:root {
  color-scheme: light;
  --ink: #253c37;
  --muted: #7a8079;
  --accent: #a7543d;
  --line: #e5e5dd;
  --grid-color: #bc7972;
  --guide-color: #cc9791;
  --trace-color: #c6c6c6;
  --practice-font: "KaiTi", "STKaiti", "Kaiti SC", "楷体", serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; background: transparent; }
button, select, textarea { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button { transition: background .15s, border-color .15s; }
button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid #b58260; outline-offset: 3px; }
.app { max-width: 1280px; padding: 20px 40px; margin: auto; }
.app-header, .intro, .app-footer { display: none !important; }
.app-header { height: 100px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.brand small { display: block; font-size: 10px; font-weight: 400; letter-spacing: 3px; color: var(--muted); margin-top: 4px; }
.brand-mark { position: relative; display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--accent); color: var(--accent); font: 30px var(--practice-font); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; opacity: .35; }
.brand-mark::before { top: 50%; width: 100%; border-top: 1px dashed var(--accent); }
.brand-mark::after { left: 50%; height: 100%; border-left: 1px dashed var(--accent); }
.header-note { color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.intro { padding: 39px 0 31px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: 3px; margin: 0 0 12px; }
h1 { font-size: clamp(25px, 3vw, 36px); letter-spacing: 1px; margin: 0; font-family: "STSong", "SimSun", serif; font-weight: 600; }
.intro-description { color: var(--muted); font-size: 14px; margin: 13px 0 0; }
.paper-badge { border: 1px solid #d9dcd3; border-radius: 6px; padding: 12px 16px; font-size: 12px; line-height: 1.6; white-space: nowrap; }
.paper-badge span { display: block; color: var(--muted); font-size: 10px; }
.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings { border: 1px solid var(--line); border-radius: 12px; background: #fffefa; overflow: hidden; }
.settings-section { padding: 25px 24px; border-bottom: 1px solid var(--line); }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.settings-section h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 21px; }
.settings-section h2 > span { font-size: 11px; color: var(--accent); font-weight: 500; letter-spacing: 1px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; }
.text-button { border: 0; padding: 3px 0; color: var(--muted); background: none; font-size: 12px; }
.text-button:hover { color: var(--accent); }
textarea { width: 100%; display: block; resize: vertical; min-height: 104px; max-height: 230px; border-radius: 7px; border: 1px solid #d8dbd1; background: #fff; padding: 13px 14px; font-size: 21px; line-height: 1.65; letter-spacing: 3px; color: var(--ink); }
textarea::placeholder { font-size: 16px; letter-spacing: 0; color: #9b9e97; }
textarea[aria-invalid="true"] { border-color: #b94d3e; }
.input-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; margin-top: 10px; }
#character-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.input-status { font-size: 12px; color: var(--accent); line-height: 1.6; margin: 10px 0 0; min-height: 0; }
.input-status:empty { display: none; }
.small-label { font-size: 11px; color: var(--muted); margin: 20px 0 9px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1px solid var(--line); color: #657368; background: #f7f7f1; border-radius: 5px; padding: 7px 8px; font-size: 11px; }
.presets button:hover { background: #eeeee4; border-color: #bfc6b8; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.field label { font-size: 12px; }
.field select { max-width: 174px; min-width: 160px; padding: 9px 7px; border: 1px solid var(--line); border-radius: 5px; color: #46554a; background: #fff; font-size: 12px; }
.checkbox-field { display: flex; align-items: flex-start; gap: 7px; margin-top: 20px; font-size: 12px; line-height: 1.5; cursor: pointer; }
.checkbox-field input { accent-color: var(--ink); margin: 2px 0 0; width: 15px; height: 15px; }
.field-note { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.stroke-toggle { margin-top: 0; }
.stroke-hint { margin: 9px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.7; }
select:disabled { color: #9a9e96; background: #f3f3ef; cursor: default; }
.print-section { padding: 24px 24px 10px; }
.print-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px 12px; color: white; background: #2c4a3f; border: 0; border-radius: 7px; font-size: 14px; font-weight: 600; }
.print-button:hover { background: #1e392e; }
.print-button:disabled { background: #a7aea6; cursor: not-allowed; }
.print-tip { font-size: 11px; color: var(--muted); line-height: 1.8; margin: 13px 0 0; }
.print-tip strong { font-weight: 500; color: #546357; }
.layout-note { display: flex; align-items: flex-start; gap: 12px; padding: 17px 24px 25px; }
.layout-note > span { color: var(--accent); font: 28px var(--practice-font); }
.layout-note p { font-size: 11px; color: var(--muted); line-height: 1.85; margin: 0; }
.layout-note strong { color: #596459; font-weight: 500; }
.preview { min-width: 0; }
.preview-toolbar { min-height: 43px; display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.preview-toolbar h2 { font-size: 13px; }
.preview-toolbar h2 span { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 9px; }
#preview-summary { font-size: 11px; color: var(--muted); padding-top: 1px; }
.preview-stage { background: transparent; border: 1px solid #e0e3da; border-radius: 10px; padding: 25px; overflow: hidden; }
.paper-frame { position: relative; margin: auto; }
.sheet { width: 210mm; height: 297mm; padding: 12mm; background: white; color: #333; transform-origin: top left; box-shadow: 0 4px 20px #263b3012; }
.sheet-header { height: 20mm; width: 180mm; margin: 0 auto; display: flex; align-items: flex-start; justify-content: space-between; padding-top: 1mm; }
.sheet-heading h2 { font-size: 17pt; font-weight: 500; font-family: var(--practice-font); letter-spacing: 2pt; }
.sheet-heading p { margin: 2mm 0 0; font-size: 8pt; color: #777; letter-spacing: .5pt; }
.student-info { display: flex; gap: 5mm; font-size: 9pt; margin-top: 5mm; }
.student-info span { white-space: nowrap; }
.student-info i { display: inline-block; width: 19mm; border-bottom: .2mm solid #888; }
.practice-grid { display: grid; grid-template-rows: repeat(12, 18mm); gap: 2.5mm; width: 180mm; margin: 0 auto; }
.practice-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); width: 180mm; height: 18mm; border-left: .25mm solid var(--grid-color); border-top: .25mm solid var(--grid-color); }
.cell { position: relative; min-width: 0; height: 100%; border-right: .25mm solid var(--grid-color); border-bottom: .25mm solid var(--grid-color); display: grid; place-items: center; }
.cell::before, .cell::after { content: ""; position: absolute; pointer-events: none; }
.cell::before { left: 0; right: 0; top: 50%; border-top: .18mm dashed var(--guide-color); }
.cell::after { top: 0; bottom: 0; left: 50%; border-left: .18mm dashed var(--guide-color); }
.glyph { position: relative; z-index: 1; display: block; font-family: var(--practice-font); font-size: 39pt; font-weight: 400; line-height: 1; }
.glyph.trace { color: var(--trace-color); }
.stroke-glyph { position: relative; z-index: 1; display: block; width: 14mm; height: 14mm; fill: #333; }
.stroke-glyph.trace { fill: var(--trace-color); }
.future-stroke { fill: #eeeeee; }
.previous-stroke, .current-stroke { fill: var(--current-stroke-color, #b05848); }
.stroke-number, .stroke-total { position: absolute; z-index: 2; font: 5.5pt/1 sans-serif; color: #777; }
.stroke-number { top: .8mm; left: 1mm; }
.stroke-total { bottom: .8mm; right: 1mm; }
.sheet-footer { width: 180mm; margin: 0 auto; height: 6mm; display: flex; align-items: end; justify-content: space-between; font-size: 7pt; color: #777; }
.preview-note { font-size: 11px; color: var(--muted); text-align: center; margin: 15px 0 0; }
.preview-note > span:first-child { color: #9caa95; margin-right: 5px; font-size: 8px; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; margin: 32px 0 24px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.data-credit { color: var(--muted); font-size: 10px; line-height: 1.8; padding: 0 24px 20px; margin: 0; }
.data-credit a { color: inherit; text-underline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 1100px) { .settings { position: sticky; top: 20px; } }
@media (max-width: 900px) {
  .app { padding: 20px 24px; }
  .workspace { grid-template-columns: 290px minmax(0, 1fr); gap: 18px; }
  .settings-section { padding: 22px 18px; }
  .preview-stage { padding: 15px; }
  .preview-toolbar { flex-wrap: wrap; padding-bottom: 12px; }
}
@media (max-width: 700px) {
  .app { padding: 16px 18px; }
  .app-header { height: 80px; }
  .header-note, .paper-badge { display: none; }
  .intro { padding: 28px 0 24px; }
  .workspace { grid-template-columns: 1fr; gap: 25px; }
  .settings-section { padding: 22px; }
  .field select { max-width: 65%; }
  .print-section { padding: 22px 22px 10px; }
  .layout-note { padding-left: 22px; }
  .preview-toolbar { align-items: center; min-height: 38px; }
  .app-footer { flex-direction: column; gap: 6px; }
}
@page { size: A4 portrait; margin: 12mm; }
@media print {
  html, body { width: auto; height: auto; margin: 0; padding: 0; background: white; }
  .app { max-width: none; padding: 0; margin: 0; }
  .app-header, .intro, .settings, .preview-toolbar, .preview-note, .app-footer, .data-credit { display: none !important; }
  .workspace, .preview, .preview-stage, .paper-frame { display: block; width: auto !important; height: auto !important; padding: 0; margin: 0; border: 0; border-radius: 0; background: white; overflow: visible; }
  .sheet { width: 186mm; height: 272mm; padding: 0; margin: 0; transform: none !important; box-shadow: none; break-inside: avoid; page-break-inside: avoid; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sheet-heading { display: none; }
  .sheet-header { justify-content: flex-end; }
  .practice-row { break-inside: avoid; page-break-inside: avoid; }
}
