/* Navigation and chapter identity, shared by every lesson and test. */
:root{color-scheme:light;--surface:#fff;--surface-soft:#efe6d5;--surface-raised:#fffaf0;--accent:#405840;--accent-ink:#fffaf0}
.theme-toggle{margin-left:auto;align-self:center;flex:0 0 44px;display:grid;place-items:center;width:44px;height:44px;padding:10px;border:1px solid var(--line);border-radius:50%;color:var(--forest);background:var(--surface-raised)}
.theme-toggle:hover{background:var(--surface-soft);border-color:var(--gold)}
.theme-toggle svg{grid-area:1/1;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .theme-sun{display:none}
.book-menu.is-current-book>summary,.book-menu.is-current-book[open]>summary{background:var(--accent);color:var(--accent-ink);box-shadow:inset 0 -3px 0 #d7b578}
.chapter-heading>div{display:flex;gap:25px;align-items:center;min-width:0}
.chapter-heading h1{margin:0;max-width:780px;font-size:clamp(28px,3.2vw,42px)}
.chapter-stamp{flex:0 0 110px;display:flex;flex-direction:column;align-items:center;justify-content:center;align-self:stretch;min-height:125px;margin:0;padding:12px 8px 8px;background:linear-gradient(150deg,#f3e8d1,#e5d2ac);border:1px solid #cfb58b;border-radius:24px 5px 24px 5px;box-shadow:3px 3px 0 #bf9d5c25;color:#735023}
.chapter-stamp span{font-size:10px;font-weight:800;letter-spacing:.17em;text-transform:uppercase;line-height:1.5}
.chapter-stamp strong{font-family:Georgia,serif;font-size:72px;font-weight:400;letter-spacing:-.055em;line-height:1.05;padding-right:4px;font-variant-numeric:lining-nums}
.chapter-heading .audio{font-size:14px;flex-shrink:0}
.chapter-heading+.intro{margin-top:22px}
@media(max-width:700px){.chapter-heading{display:block}.chapter-heading .audio{display:inline-block;margin:18px 0 0}.chapter-stamp{flex-basis:85px;min-height:108px;padding:10px 6px}.chapter-stamp strong{font-size:60px}.chapter-stamp span{font-size:9px;letter-spacing:.12em}.chapter-heading>div{gap:17px}.chapter-heading h1{font-size:28px}.chapter-heading+.intro{margin-top:14px}}
@media(max-width:400px){.nav-home,.book-menu>summary{padding:10px 9px;gap:7px;font-size:13px}.theme-toggle{flex-basis:42px;width:42px;height:42px}}

/* Dark mode uses warm paper tones and green surfaces; artwork keeps its own colors. */
:root[data-theme=dark]{color-scheme:dark;--ink:#f2e8d8;--muted:#bfb6a6;--paper:#17211d;--line:#435045;--gold:#d8b574;--forest:#b2cd9e;--surface:#222e27;--surface-soft:#2d392f;--surface-raised:#26342a;--accent:#9cbb87;--accent-ink:#17251a}
[data-theme=dark] .theme-toggle .theme-sun{display:block}
[data-theme=dark] .theme-toggle .theme-moon{display:none}
[data-theme=dark] .chapter-stamp{background:linear-gradient(145deg,#354331,#263029);color:#ead09b;border-color:#7e7653;box-shadow:3px 3px 0 #0003}
[data-theme=dark] .story,[data-theme=dark] .exercise-group,[data-theme=dark] details,[data-theme=dark] .character-card-front{background:var(--surface);border-color:var(--line)}
[data-theme=dark] .book-menu{background:transparent}
[data-theme=dark] .book-submenu,[data-theme=dark] .recap-popover{background:var(--surface-raised);border-color:var(--line);box-shadow:0 18px 40px #0006}
[data-theme=dark] .book-menu[open]>summary,[data-theme=dark] .book-menu>summary:hover,[data-theme=dark] .nav-home:hover,[data-theme=dark] .nav-home[aria-current]{background:var(--surface-soft);color:var(--ink)}
[data-theme=dark] .book-menu.is-current-book>summary{background:var(--accent);color:var(--accent-ink)}
[data-theme=dark] .chapter-grid>a,[data-theme=dark] .chapter-links a,[data-theme=dark] .chapter-links select{background:var(--surface);color:var(--ink);border-color:var(--line)}
[data-theme=dark] .chapter-grid>a:hover{background:#3b5038}
[data-theme=dark] .chapter-grid>a[aria-current]{background:var(--accent);color:var(--accent-ink)}
[data-theme=dark] .chapter-grid>span{background:#202b24;color:#9eaa98}
[data-theme=dark] .book-submenu h2,[data-theme=dark] .eyebrow,[data-theme=dark] .crossword-clues h3{color:#dbc28e}
[data-theme=dark] .nav-recaps a{color:#c0d6ab}
[data-theme=dark] .places,[data-theme=dark] .remember-panel,[data-theme=dark] .context-panel,[data-theme=dark] .next,[data-theme=dark] .test-result,[data-theme=dark] #result{background:var(--surface-soft);border-color:var(--line)}
[data-theme=dark] .quote{background:#304831}
[data-theme=dark] .reference,[data-theme=dark] .card-hint,[data-theme=dark] .match-remove{color:#c4bba8}
[data-theme=dark] .audio{color:#e8c993;border-color:#88754e}
[data-theme=dark] .character-card-back{background:linear-gradient(140deg,#354431,#26372d);border-color:#738362}
[data-theme=dark] .character-button.flip-card{background:transparent}
[data-theme=dark] .character-card-front,[data-theme=dark] .character-card-back{box-shadow:0 5px 15px #0003}
[data-theme=dark] .vocab details[open]{background:#30422f;border-color:#72845e}
[data-theme=dark] .question input[type=text],[data-theme=dark] .inline-answer input,[data-theme=dark] textarea,[data-theme=dark] .question select,[data-theme=dark] #test-form .question select,[data-theme=dark] .crossword-cell{background:#19231d;color:var(--ink);border-color:#73806a}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:#a5ae9e;opacity:1}
[data-theme=dark] .crossword-cell.unused{background:transparent;border:0}
[data-theme=dark] .crossword-cell.highlight{background:#465a38}
[data-theme=dark] .crossword-cell input{color:var(--ink)}
[data-theme=dark] .inline-answer input[aria-invalid=true]{background:#452d27;border-color:#d19a76}
[data-theme=dark] .inline-answer input:disabled{background:#30442b;color:#d5edbd;border-color:#8da977}
[data-theme=dark] .option:hover,[data-theme=dark] .option:has(input:checked){background:#354630;border-color:#9bb287}
[data-theme=dark] .option input{accent-color:#a9c392}
[data-theme=dark] .primary{background:#a6c18d;color:#182719}
[data-theme=dark] .secondary{background:transparent;color:var(--ink);border-color:#89927a}
[data-theme=dark] .check-one{background:#35472f;color:#daebc7;border-color:#8b9b74}
[data-theme=dark] .scene-nav button{background:var(--surface-soft);color:var(--ink)}
[data-theme=dark] .scene-nav button.selected,[data-theme=dark] .intruder-words button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink)}
[data-theme=dark] .word-answer,[data-theme=dark] .word-token{background:var(--surface-soft);color:var(--ink);border-color:#829070}
[data-theme=dark] .feedback{background:#493626;color:#f1d3ae}
[data-theme=dark] .feedback.good,[data-theme=dark] .instant-feedback.good{background:#2d452b;color:#d4edc4}
[data-theme=dark] .test-breakdown p{border-color:var(--line)}
[data-theme=dark] .match-game h3,[data-theme=dark] .match-status{color:#c7d5b6}
[data-theme=dark] .match-card,[data-theme=dark] .test-match-game .match-card-wrap.has-assignment .match-card{background:linear-gradient(135deg,#394832,#2d3c2b);border-color:#81936a;color:var(--ink)}
[data-theme=dark] .match-slot{background:#202b23;border-color:#697759}
[data-theme=dark] .match-slot.drop-ready{background:#3d5135;border-color:#afc593}
[data-theme=dark] .match-card-wrap.matched .match-card{background:#3a5231;border-color:#a6c78b}
[data-theme=dark] .match-card-wrap.not-matched .match-card{border-color:#d0a079}
[data-theme=dark] .match-drag-ghost,[data-theme=dark] .recap-drag-ghost{background:#394b30;color:var(--ink);border-color:#bfd5a0}
[data-theme=dark] .recap-hero{background:linear-gradient(120deg,#2f412e,#333728);border-color:#59654c}
[data-theme=dark] .recap-subtitle,[data-theme=dark] .recap-progress{color:#c2d7ae}
[data-theme=dark] .recap-help,[data-theme=dark] .recap-turn,[data-theme=dark] .recap-ref,[data-theme=dark] .recap-card-index,[data-theme=dark] .recap-bank-return{color:#c6bea8}
[data-theme=dark] .recap-tabs button,[data-theme=dark] .recap-filter,[data-theme=dark] .recap-round,[data-theme=dark] .recap-map-stop{background:var(--surface-soft);border-color:#69765b;color:var(--ink)}
[data-theme=dark] .recap-tabs button[aria-pressed=true],[data-theme=dark] .recap-filter[aria-pressed=true],[data-theme=dark] .recap-round[aria-current=step]{background:var(--accent);color:var(--accent-ink)}
[data-theme=dark] .recap-face{background:linear-gradient(140deg,#303b2b,#253127);border-color:#697458}
[data-theme=dark] .recap-back,[data-theme=dark] .recap-note,[data-theme=dark] .recap-map-detail,[data-theme=dark] .recap-map-challenge{background:var(--surface-soft);border-color:#697458}
[data-theme=dark] .recap-event-mark{background:#4b5135;color:#f1d49c}
[data-theme=dark] .recap-bank,[data-theme=dark] .recap-slot{background:#202c24;border-color:#738061}
[data-theme=dark] .recap-game-card,[data-theme=dark] .recap-destination{background:#34432e;color:var(--ink);border-color:#879974}
[data-theme=dark] .recap-game-card[aria-pressed=true],[data-theme=dark] .recap-slot.drop-ready{background:#435c34;border-color:#bed59d}
[data-theme=dark] .recap-slot.is-right{border-color:#a5c489}
[data-theme=dark] .recap-slot.is-wrong{border-color:#d2a072}
[data-theme=dark] .recap-feedback.is-right{color:#c1e6a6}
[data-theme=dark] .recap-feedback.is-wrong{color:#efc091}
[data-theme=dark] :is(button,a,input,summary,textarea):focus-visible{outline-color:#dfc180}
