/* Fresh paper and quiet jade, shared in spirit with the worksheet studio. */
@font-face {
  font-family: 'KaiTi-CJK';
  src: local('STKaiti-SC-Regular'), local('STKaiti'), local('Kaiti SC'), local('BiauKai'), local('KaiTi'), local('楷体');
  unicode-range: U+2E80-2EFF, U+2F00-2FDF, U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF;
}
:root {
  --font-zh: 'KaiTi-CJK', 'LXGW WenKai Lite', serif;
  --text: #2e3732;
  --text-muted: #747c70;
  --border: #dce1d5;
  --jade: #435e50;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100vh; font-family: var(--font-zh); color: var(--text); background: #f5f5ee; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #a04736; outline-offset: 3px; }
.site-header { position: sticky; top: 0; z-index: 100; background: #fafaf4; border-bottom: 1px solid var(--border); }
.nav-inner { max-width: 1280px; height: 48px; padding: 0 24px; margin: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: #67715f; font-size: 14px; text-decoration: none; width: fit-content; }
.back-link:hover { color: #a04736; }
.circle-arrow-icon { width: 17px; height: 17px; flex-shrink: 0; }
.site-header h1 { font-size: 20px; letter-spacing: 2px; font-weight: 400; color: var(--jade); white-space: nowrap; }
.container { max-width: 1232px; width: calc(100% - 48px); margin: 20px auto 40px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-pane, .preview-pane { min-width: 0; }
.control-card { padding: 18px; border: 1px solid var(--border); border-top: 3px solid var(--jade); background: #fdfdf8; }
.section-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.section-heading h2 { font-size: 19px; letter-spacing: 2px; font-weight: 400; }
.section-number { color: #a04736; font-size: 12px; }
.section-aside { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 13px; color: #626e5f; }
input[type=text] { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #d4dccd; border-radius: 3px; background: #f6f8f0; color: var(--text); font-size: 20px; letter-spacing: 2px; }
input::placeholder { color: #879180; font-size: 15px; letter-spacing: 0; }
input[type=text]:focus { border-color: var(--jade); outline: 2px solid #435e5026; }
.toggle-field { display: grid; gap: 14px; margin: 20px 0; }
.switch { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 28px; }
.switch input { position: absolute; opacity: 0; width: 36px; height: 22px; }
.track { position: relative; width: 36px; height: 20px; border-radius: 20px; background: #cdd5c6; flex-shrink: 0; transition: background .2s; }
.thumb { position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; background: white; border-radius: 50%; transition: transform .2s; }
.switch input:checked + .track { background: var(--jade); }
.switch input:checked + .track .thumb { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid #a04736; outline-offset: 4px; }
.switch-text { font-size: 14px; }
button.primary { min-height: 44px; width: 100%; padding: 10px 16px; border: 1px solid var(--jade); border-radius: 3px; background: var(--jade); color: #fffef5; letter-spacing: 2px; }
button.primary:hover { background: #31493c; }
.status { color: var(--text-muted); font-size: 12px; line-height: 1.8; margin-top: 10px; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.err { color: #a04736; }
.note { color: var(--text-muted); font-size: 12px; line-height: 1.9; padding: 14px 3px; }
.preview-heading { margin-bottom: 12px; }
#out { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.char-card { min-width: 0; padding: 16px; background: #fdfdf9; border: 1px solid var(--border); border-radius: 4px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.char-card .box { width: 100%; max-width: 320px; aspect-ratio: 1; background: white; overflow: hidden; }
.char-card .box svg { display: block; width: 100%; height: 100%; }
.char-label { font-size: 18px; color: var(--jade); }
.char-card.missing .char-label { color: #a04736; font-size: 15px; }
.dl-btn { width: 100%; min-height: 40px; border: 1px solid #d2dacb; border-radius: 3px; color: var(--jade); background: #f0f4e9; font-size: 14px; }
.dl-btn i { margin-right: 7px; font-size: 12px; }
.dl-btn:hover { background: #e5eddd; border-color: #93a48b; }
.empty-hint { grid-column: 1 / -1; border: 1px dashed #c7d0bf; padding: 50px 16px; color: var(--text-muted); text-align: center; font-size: 14px; }
@media (max-width: 760px) {
  .nav-inner { padding: 0 14px; grid-template-columns: auto 1fr; gap: 12px; }
  .site-header h1 { font-size: 16px; letter-spacing: 0; text-align: right; }
  .back-link { font-size: 12px; gap: 5px; }
  .container { width: calc(100% - 24px); grid-template-columns: 1fr; gap: 16px; margin-top: 14px; }
  .control-card { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
  .control-card > .section-heading { display: none; }
  .control-card > .field { grid-column: 1 / -1; }
  .toggle-field { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 0; min-height: 44px; align-items: center; }
  button.primary { width: auto; }
  .status { grid-column: 1 / -1; margin: 0; }
  .note { padding: 8px 2px 0; }
  #out { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
}
@media (max-width: 380px) {
  .toggle-field { gap: 8px 12px; }
  .switch { gap: 6px; }
  .switch-text { font-size: 12px; }
  button.primary { padding: 10px; font-size: 13px; letter-spacing: 0; }
}
