* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --paper: #f6f5ee;
  --sheet: #fffefa;
  --ink: #182e27;
  --muted: #53665d;
  --forest: #174b3a;
  --forest-deep: #16392e;
  --line: #dedfd3;
  --field: #f8f8f2;
  --yellow: #e7ba6a;
  --soft-green: #edf3e9;
  --error: #8f382a;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ae6c17; outline-offset: 3px; }
.shell { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.topbar { background: var(--sheet); border-bottom: 1px solid var(--line); }
.topbar-inner { height: 74px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; line-height: 1.18; }
.brand strong { display: block; font-size: 16px; letter-spacing: .035em; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 6px; letter-spacing: .1em; }
.brand-mark { width: 39px; height: 39px; display: flex; align-items: center; justify-content: center; gap: 2px; background: var(--forest-deep); border-radius: 11px; }
.brand-mark i { display: block; width: 9px; height: 14px; border: 1.5px solid #f7e6bc; }
.brand-mark i:first-child { border-radius: 2px 5px 3px 1px; transform: skewY(9deg); }
.brand-mark i:last-child { border-radius: 5px 2px 1px 3px; transform: skewY(-9deg); }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 16px; padding: 49px 0 33px; }
.course-meta { font-size: 12px; color: #335a49; font-weight: 750; display: flex; align-items: center; gap: 8px; margin: 0 0 12px; letter-spacing: .055em; }
.course-meta::before { content: ""; width: 7px; height: 7px; display: block; border-radius: 100%; background: #bb8233; flex: 0 0 7px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(37px, 5vw, 62px); font-weight: 800; letter-spacing: -.06em; line-height: 1.16; margin-bottom: 14px; }
.intro-copy { color: var(--muted); font-size: 15px; line-height: 1.7; margin: 0; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: end; flex: 0 0 auto; }
.quiet, .outline, .primary, .link-button {
  font-size: 13px; font-weight: 680; line-height: 1.35; min-height: 40px;
  padding: 9px 13px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.outline { border-color: #c9d1c7; background: var(--sheet); }
.outline:hover, .quiet:hover { background: var(--soft-green); }
.link-button { color: var(--forest); text-decoration: underline; text-underline-offset: 4px; }
.primary { background: var(--forest); color: white; border-color: var(--forest); }
.primary:hover:not(:disabled) { background: #103c2d; }
.primary:disabled { opacity: .5; }
.steps { display: flex; align-items: center; gap: 14px; padding: 0 0 16px; margin-bottom: 24px; border-bottom: 1px solid #d4d8cb; }
.step { background: none; border: none; display: flex; align-items: center; gap: 8px; border-radius: 5px; padding: 2px 0; font-size: 13px; font-weight: 700; color: #52685b; white-space: nowrap; }
.step span { width: 23px; height: 23px; border: 1px solid #bac8bb; border-radius: 50%; display: grid; place-content: center; font-size: 11px; }
.step.is-current { color: var(--forest); }
.step.is-current span { color: white; background: var(--forest); border-color: var(--forest); }
.step:disabled { color: #65736c; opacity: .76; }
.step-divider { width: 29px; height: 1px; background: #cbd3c8; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 302px; gap: 24px; align-items: start; }
.entry, .lesson-fields { display: grid; gap: 15px; }
.sheet { border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); padding: 23px; min-width: 0; }
.section-heading { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.section-heading h2 { font-size: 19px; letter-spacing: -.025em; margin: 0; }
.section-heading p { font-size: 12px; line-height: 1.65; color: var(--muted); margin: 6px 0 0; }
.status-tag { color: #335846; background: #eaf0e6; border-radius: 6px; padding: 5px 8px; font-size: 11px; line-height: 1.4; white-space: nowrap; }
.attributes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; gap: 8px; }
.attribute { min-width: 0; background: var(--field); border: 1px solid #e5e7db; border-radius: 8px; padding: 10px 12px; }
.attribute dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.attribute dd { margin: 0; font-size: 15px; font-weight: 750; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, legend { font-size: 13px; font-weight: 690; line-height: 1.5; }
.field small, legend small, .check small { margin-left: 3px; color: var(--muted); font-size: 10.5px; font-weight: 450; }
.field small.required, legend small.required { color: #7e431b; }
.field input, .field textarea, .field select {
  font-size: 14px; color: #182e27; background: var(--field); border: 1px solid #d6dacc; border-radius: 8px;
  width: 100%; padding: 10px 11px; min-height: 41px; min-width: 0;
}
.field textarea { resize: vertical; line-height: 1.65; min-height: 77px; }
.field input::placeholder, .field textarea::placeholder { color: #63736a; font-size: 12px; }
.field.wide-field { grid-column: 1 / -1; }
.lesson-card .section-heading > div { display: flex; align-items: flex-start; gap: 10px; }
.section-number { background: #f6ead2; color: #754b19; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 30px; font-size: 11px; font-weight: 750; }
.lesson-form { display: grid; gap: 15px; }
fieldset.field { padding: 0; border: 0; margin: 0; }
fieldset.field legend { margin: 0 0 7px; padding: 0; }
.options { display: flex; flex-wrap: wrap; gap: 7px; }
.option { display: inline-flex; align-items: center; min-height: 38px; gap: 8px; padding: 7px 11px; font-size: 13px; border: 1px solid #d6ded1; border-radius: 8px; background: var(--field); cursor: pointer; }
.option:hover, .option:has(input:checked) { border-color: #619272; background: var(--soft-green); }
.option input, .check input { accent-color: var(--forest); width: 15px; height: 15px; margin: 0; }
.choice-rule { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.confirm-sheet { padding-block: 17px; }
.check { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: 13px; cursor: pointer; line-height: 1.4; }
.check input { flex: 0 0 15px; margin-top: 2px; }
.check small { display: block; margin: 4px 0 0; }
.side-pane { position: sticky; top: 20px; min-width: 0; }
.summary { overflow: hidden; border-radius: 14px; border: 1px solid #d7ddd0; background: var(--sheet); }
.summary-top { background: var(--forest-deep); color: #fffdf2; padding: 21px 19px 18px; }
.summary-kicker { font-size: 10px; letter-spacing: .13em; color: #f0cb88; font-weight: 750; margin-bottom: 9px; }
.summary-top p { margin: 0; font-size: 17px; font-weight: 710; line-height: 1.45; overflow-wrap: anywhere; }
.summary-top > span { display: block; color: #dbe6d9; font-size: 11px; margin-top: 5px; line-height: 1.45; overflow-wrap: anywhere; }
.summary-body { padding: 17px 17px 16px; }
.summary-progress { display: flex; justify-content: space-between; align-items: center; gap: 7px; font-size: 13px; margin-bottom: 10px; }
.summary-progress span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-track { height: 5px; background: #e9ece1; border-radius: 20px; overflow: hidden; }
.progress-track > div { width: 0; height: 100%; background: #4b855c; transition: width .18s ease; }
.checklist { margin: 13px 0 16px; padding: 0; list-style: none; display: grid; gap: 6px; color: #4e6557; font-size: 12px; line-height: 1.5; }
.checklist li { display: flex; gap: 7px; align-items: baseline; overflow-wrap: anywhere; }
.checklist li::before { content: ""; width: 6px; height: 6px; border: 1px solid #7d8b80; flex: 0 0 6px; border-radius: 50%; }
.checklist li.is-ready::before { background: #4b855c; border-color: #4b855c; }
.checklist a { color: inherit; text-underline-offset: 2px; }
.summary-note { margin: 11px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.wide { width: 100%; justify-content: space-between; }
.access-field { margin: 0 0 13px; }
.feedback { border: 1px solid #d9decf; border-radius: 8px; background: var(--soft-green); padding: 10px 11px; font-size: 12px; line-height: 1.6; margin: 10px 0 0; }
.feedback.error, .form-error { color: var(--error); }
.feedback.error { background: #fcf0e8; border-color: #e8cfc3; }
.form-error { font-size: 12px; margin: 8px 0; }
.story-sheet { padding: 24px; }
.story-toolbar, .button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.story-toolbar { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.story-preview { padding: 24px clamp(0px, 4vw - 12px, 35px) 12px; overflow-wrap: anywhere; }
.story-preview h3 { text-align: center; font-size: clamp(23px, 3vw, 32px); margin: 0 0 21px; }
.story-preview p { font: 16px/1.95 "Songti SC", SimSun, "Noto Serif CJK SC", serif; color: #283832; margin: 0 0 15px; white-space: pre-wrap; }
.story-editor { display: grid; gap: 13px; margin-top: 16px; }
.story-editor textarea { min-height: 210px; }
.candidate { padding: 13px; margin-top: 14px; border-radius: 8px; border: 1px solid #e8d9b7; background: #f9f1df; }
.candidate p { margin-bottom: 8px; font-size: 13px; }
.metadata-check { margin-bottom: 13px; }
.footer { display: flex; gap: 12px; justify-content: space-between; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); margin: 27px 0 0; padding: 16px 0 23px; }
dialog { width: min(600px, calc(100% - 32px)); max-height: min(700px, 90dvh); background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-radius: 15px; padding: 0; box-shadow: 0 22px 55px #16392e37; }
dialog::backdrop { background: #142c2570; }
.dialog-inner { padding: 22px; }
.close-dialog { min-height: 36px; font-size: 21px; line-height: 1; }
.dialog-course { padding: 13px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 15px; font-size: 13px; line-height: 1.8; }
.dialog-course ul { padding-inline-start: 20px; }
.dialog-course summary { cursor: pointer; color: var(--forest); font-weight: 650; }
@media (max-width: 920px) {
  .shell { width: calc(100% - 42px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 252px; gap: 14px; }
  .sheet { padding: 17px; }
}
@media (max-width: 690px) {
  .shell { width: calc(100% - 28px); }
  .topbar-inner { height: 60px; }
  .intro { padding: 27px 0 23px; align-items: start; flex-direction: column; }
  .intro-actions { justify-content: start; }
  .intro-copy { font-size: 13px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .side-pane { position: static; }
  .steps { gap: 7px; padding-bottom: 12px; margin-bottom: 14px; }
  .step { font-size: 11.5px; gap: 4px; }
  .step span { width: 20px; height: 20px; }
  .step-divider { width: 13px; }
  .attributes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.account-shell { max-width: 440px; margin: clamp(40px, 11vh, 112px) auto; }
.account-sheet { padding: clamp(20px, 5vw, 34px); }
.account-sheet h1 { font-size: clamp(25px, 5vw, 35px); margin-bottom: 20px; }
.account-modes, .account-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.account-modes { margin-bottom: 21px; }
.account-modes [aria-pressed="true"] { color: var(--forest); background: var(--soft-green); border-color: var(--forest); }
.account-form { display: grid; gap: 14px; }
.account-form p { margin: 0; }
.account-form p:empty { display: none; }
.account-actions { justify-content: flex-end; }
#current-username { font-size: 12px; color: var(--forest); overflow-wrap: anywhere; max-width: 120px; }
@media (max-width: 440px) {
  #current-username { display: none; }
  .account-actions .quiet { padding-inline: 5px; }
}
