/* Shared appearance tokens and controls, after the page and reading styles. */
:root{color-scheme:light;--blue:#365f78;--surface:#fffef9;--surface-soft:#eff4e9;--surface-deep:#e5eddd;--button-ink:#f8fbe9;--warm:#faf1e8;--warm-ink:#805033;--header-height:92px}
[hidden]{display:none!important}
html{scroll-padding-top:calc(var(--header-height) + 20px)}
.lesson-section,.home-method,.home-lessons,[id^="stage-"]{scroll-margin-top:calc(var(--header-height) + 20px)}
.site-header{display:grid;grid-template-columns:auto 1fr auto;gap:26px}
.header-nav{justify-content:flex-end;gap:26px}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:8px 13px;border:1px solid var(--line);border-radius:100px;background:var(--surface);color:var(--ink);font-size:14px;white-space:nowrap}
.theme-toggle:hover{border-color:var(--green);background:var(--surface-soft)}
.theme-toggle .ui-icon{width:19px;height:19px}.theme-sun{display:none}
[data-theme=dark] .theme-sun{display:inline-block}[data-theme=dark] .theme-moon{display:none}
.reading-progress{top:calc(var(--header-height) - 1px)}.lesson-sidebar{top:calc(var(--header-height) + 32px)}
.method-number{color:var(--muted)}
.remember-separator{color:var(--muted)}
.home-roadmap{display:flex;align-items:center;justify-content:space-between;gap:25px;margin:40px 0 0;padding:26px 28px;border:1px solid var(--line);border-radius:18px;background:var(--surface-soft)}
.home-roadmap h2{font-size:24px}.home-roadmap p{margin-top:8px;color:var(--muted);font-size:16px}.home-roadmap a{flex:none}
[data-theme=dark]{color-scheme:dark;--paper:#111e18;--ink:#eef4ed;--muted:#b8c9bc;--green:#a7d8b8;--mint:#486b54;--lime:#d8eb9f;--line:#3b5243;--blue:#a6cde4;--surface:#1b2b22;--surface-soft:#23372a;--surface-deep:#2e4534;--button-ink:#13251a;--warm:#3b2d23;--warm-ink:#f0be99}
[data-theme=dark] .site-header{background:rgba(17,30,24,.97)}
[data-theme=dark] .brand-icon{background:#345742}[data-theme=dark] .brand-icon svg{stroke:var(--lime)}
[data-theme=dark] .header-nav>a:hover{color:var(--lime)}[data-theme=dark] .header-quiz:hover{background:var(--surface-soft)}
[data-theme=dark] :is(.hero-copy h1>span,.home-hero h1>span,.home-equals){color:#a7c99f}
[data-theme=dark] :is(.hero-description,.lesson-section>p,.home-description,.lesson-entry-copy>p,.sidebar-note,.scene-caption>span,.demo-instruction,.fraction-labels small,.paper-top,.art-note,.lesson-category,.thumbnail-mark,.entry-details,.section-number,.method-number){color:var(--muted)}
[data-theme=dark] :is(.subject-symbol,.lesson-toc a.is-current,.lesson-toc a:hover,.learning-goal,.step-tabs,.fraction-explainer,.lab-top,.comparison-item,.result-score,.home-visual:before,.hero-art,.lesson-thumbnail,.method-number){background:var(--surface-soft);border-color:var(--line)}
[data-theme=dark] :is(.step-demo,.interactive-lab,.quiz-card,.home-paper,.lesson-entry,.hero-tile,.lab-top select,.parts-grid){background:var(--surface);border-color:var(--line);color:var(--ink)}
[data-theme=dark] :is(.home-paper,.hero-tile){box-shadow:10px 12px 0 #0b1710}
[data-theme=dark] .lesson-entry:hover{background:var(--surface-soft);border-color:var(--green)}
[data-theme=dark] :is(.step-tabs button,.step-tabs button>span){color:var(--muted);border-color:var(--line)}
[data-theme=dark] .step-tabs button:hover{background:var(--surface-deep)}
[data-theme=dark] .step-tabs button.is-active{background:var(--surface);color:var(--green)}
[data-theme=dark] .step-tabs button.is-active>span{background:var(--green);color:var(--button-ink)}
[data-theme=dark] :is(.snack-strip,.question-visual>span,.comparison-bar i,.part-button,.hero-tile i.empty,.home-four-parts i:last-child,.thumbnail-parts,.thumbnail-parts i:last-child){background:var(--surface-deep);border-color:#78927a;color:var(--ink)}
[data-theme=dark] .snack-strip[data-stage="0"]{background:#90bf9e}
[data-theme=dark] .snack-strip[data-stage="2"]>span:last-child{background:var(--surface-deep);border-color:#78927a}
[data-theme=dark] .question-visual>span.is-filled{background:var(--green);border-color:var(--green)}
[data-theme=dark] .comparison-bar i:first-child{background:#a7d8b8}
[data-theme=dark] :is(.comparison-item.incorrect,.feedback.wrong,.quiz-option.is-wrong){background:var(--warm);border-color:#9c7152}
[data-theme=dark] .comparison-bar.unequal i{background:#584332;border-color:#b28c70}
[data-theme=dark] .comparison-bar.unequal i:first-child{background:#e5ad83}
[data-theme=dark] :is(.incorrect .comparison-title>span,.quiz-option.is-wrong .answer-marker,.review-item.was-wrong>span){color:var(--warm-ink)}
[data-theme=dark] .lab-canvas{background-image:radial-gradient(#39513f .8px,transparent .8px)}
[data-theme=dark] .part-button[aria-pressed=true]{background:var(--green);color:var(--button-ink);border-color:var(--green)}
[data-theme=dark] :is(.fraction-sticker,.home-sticker,.live-fraction,.pill){color:#25351d;border-color:#d8eb9f;box-shadow:none}
[data-theme=dark] .fraction-sticker svg{stroke:#25351d}
[data-theme=dark] .fraction-labels strong{background:#34533e;color:#d4eed5}
[data-theme=dark] .fraction-labels>div:last-child strong{background:#314754;color:#d0e8f7}
[data-theme=dark] .lesson-summary{background:#294833;color:var(--ink);border:1px solid var(--line)}
[data-theme=dark] :is(.primary-button,.lesson-entry-action,.skip-link,.thumbnail-fraction){background:var(--green);color:var(--button-ink)}
[data-theme=dark] .primary-button:hover{background:#c1e5cc}
[data-theme=dark] .primary-button:disabled{background:#34483a;color:#b6c5b9;border-color:#536b59}
[data-theme=dark] .secondary-button:hover{background:var(--surface-soft)}
[data-theme=dark] .quiz-option{border-color:var(--line)}
[data-theme=dark] .quiz-option:hover{background:var(--surface-soft);border-color:var(--green)}
[data-theme=dark] .quiz-option:has(input:checked){background:#2d4835;border-color:#a7d8b8;box-shadow:inset 0 0 0 1px #a7d8b8}
[data-theme=dark] :is(.quiz-option.is-correct,.feedback){background:#2b4432;border-color:#789a71}
[data-theme=dark] .quiz-option.is-wrong{background:var(--warm);border-color:#d4a27c;box-shadow:none}
[data-theme=dark] .review-item>span{color:var(--green)}
[data-theme=dark] .quiz-dots>span{background:#4c6252}[data-theme=dark] .quiz-dots>span.is-current{background:var(--green)}
[data-theme=dark] .quiz-dots>span.is-done{background:#8eaf82}
[data-theme=dark] .no-script{background:var(--warm);border-color:#9c7152}
[data-theme=dark] :is(button,a,select,input):focus-visible{outline-color:#d8eb9f}
@media(max-width:900px){.site-header{gap:16px}.header-nav{gap:18px}.brand{font-size:18px}}
@media(max-width:720px){
 .site-header,.home-header{height:auto;min-height:116px;grid-template-columns:1fr auto;gap:8px 10px;padding:12px 20px 10px}
 .brand{font-size:18px}.brand-icon{width:36px;height:36px}.brand small{font-size:11px}
 .theme-toggle{grid-column:2;grid-row:1;font-size:13px;padding:8px 10px;gap:6px}
 .header-nav{grid-column:1/-1;grid-row:2;justify-content:space-between;gap:12px;font-size:14px}
 .site-header .header-nav>a:not([data-mobile-hide]){display:inline-flex;font-size:14px}
 .site-header .header-nav>[data-mobile-hide]{display:none}
 .site-header .header-nav .header-quiz{padding:6px 14px;min-height:40px;gap:12px;font-size:14px}
 .home-roadmap{align-items:flex-start;flex-direction:column;padding:22px;gap:18px}.home-roadmap h2{font-size:22px}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,*:before,*:after{transition:none!important}}
