/* Appearance controls share the app's existing save/cancel behavior. */
:root{color-scheme:light}
.appearance-options{margin:25px 0 8px;padding:0;border:0}
.appearance-options legend{font-size:16px;font-weight:700;margin-bottom:12px}
.theme-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.theme-choice{position:relative;display:flex;flex-direction:column;gap:9px;align-items:flex-start;border:1px solid var(--surface-edge);border-radius:12px;padding:11px;cursor:pointer;min-width:0;background:var(--surface-soft)}
.theme-choice input{position:absolute;right:9px;top:9px;width:16px;height:16px;margin:0;accent-color:var(--violet)}
.theme-choice:has(input:checked){border-color:var(--violet);box-shadow:0 0 0 1px var(--violet);background:var(--violet-light)}
.theme-choice:has(input:focus-visible){outline:3px solid var(--violet);outline-offset:4px}
.theme-choice b{font-size:14px;line-height:1.4}
.theme-swatch{display:block;width:40px;height:30px;border-radius:7px;border:1px solid #88a08e;background:#d2e2d5;box-shadow:inset 9px 0 #b3cdbb}
.theme-swatch.dark{background:#102b24;border-color:#537864;box-shadow:inset 9px 0 #294b3a}
.theme-swatch.system{background:linear-gradient(90deg,#d2e2d5 50%,#102b24 50%);box-shadow:none}
.appearance-help{font-size:14px;line-height:1.5;margin:12px 0 0}

/* A forest palette, with distinct surfaces and brighter brand accents. */
html[data-theme="dark"]{
  color-scheme:dark;
  --paper:#102b24;--ink:#e4eee5;--muted:#b1c7b8;--green:#a4d39f;--lime:#c5dd88;
  --line:#3b5d4c;--surface:#19392f;--surface-soft:#204235;--surface-inset:#2b5141;--surface-edge:#3b5d4c;
  --violet:#c4a0f1;--violet-dark:#d6bbfb;--violet-ink:#e0cbfb;--violet-light:#352b48;--violet-line:#725b90;
  --positive-bg:#244d37;--positive-ink:#b6e3b5;--positive-line:#568766;
  --retry-bg:#4a2e40;--retry-ink:#f1c2dc;--retry-line:#9a6884;
}
html[data-theme="dark"] .sidebar,html[data-theme="dark"] .mobile-nav{background:#142f27}
html[data-theme="dark"] :is(.settings-link,.settings-divider,.lesson-row:not(:last-child),.lesson-footer,.mini-crew,.growth-note,.journey-footer,.path-line,.option-key,.goal-option,.badge-status,.week-day>b,.gathering-milestones>span,.world-stepper li>span,.journey-phrases>div,.match-tile,.journey-option,.memory-seed,.gathering-card,.living-world,.world-garden){border-color:var(--line)}
html[data-theme="dark"] :is(.nav-item.active,.mobile-nav .nav-item.active){border-color:var(--line)}
html[data-theme="dark"] :is(.unit-choice:hover,.journey-option:hover:not(:disabled)){background:var(--surface-inset)}
html[data-theme="dark"] .unit-choice.selected{background:var(--violet-light);border-color:var(--violet-line)}
html[data-theme="dark"] :is(.lesson-label,.locked-label,.lesson-copy p,.lesson-copy p>span,.unit-outcome p,.week-day>span,.badge-status,.privacy-note,.companion-speech p,.tip p,.lesson-companion p,.luna-response,.lesson-breadcrumb,.lesson-step,.reply-label,.audio-transcript,.audio-status,.feedback>span,.word-meaning,.option-key,.sentence-area>span,.challenge-details){color:var(--muted)}
html[data-theme="dark"] :is(.icon-button,.accent-keys>button,.word-meaning.revealed,.top-stats .icon,.unit-outcome>.icon,.review-symbol,.growth-stats>section>.icon,.goal-detail>.icon,.goal-detail>span,.badge-symbol,.empty-state>.icon,.local-note .icon,.companion-promise>div){color:var(--green)}
html[data-theme="dark"] :is(.friend-role,.luna-line>b,.journey-dialogue b){color:var(--violet-dark)}
html[data-theme="dark"] .language-code{background:var(--surface-soft);color:var(--green)!important;border-color:var(--line)!important}
html[data-theme="dark"] .course-pill>span{border-color:var(--line)}
html[data-theme="dark"] .primary{background:var(--green);color:#112d21;box-shadow:0 3px 0 #081e15}
html[data-theme="dark"] button.primary:hover:not(:disabled){background:#b5dfb0}
html[data-theme="dark"] :is(.review-banner .primary,.companion-card.blue .companion-action,.luna-response+.primary,.conversation-finish .primary){background:#b991e5;color:#241337;box-shadow:0 3px 0 #21162f;border-color:var(--violet-line)}
html[data-theme="dark"] :is(.review-banner .primary,.companion-card.blue .companion-action,.luna-response+.primary,.conversation-finish .primary):hover:not(:disabled){background:#caa7ef}
html[data-theme="dark"] :is(.unit-header,.unit-header.blue){background:#214c3b;color:#edf6eb}
html[data-theme="dark"] .unit-header.violet{background:#45315d}
html[data-theme="dark"] .unit-header p{color:#c9ddcb}
html[data-theme="dark"] .unit-header.violet p{color:#e2d4f3}
html[data-theme="dark"] .unit-count{color:#d7e9d7;border-color:#6d927b}
html[data-theme="dark"] .unit-progress{background:#3c6550}
html[data-theme="dark"] .unit-header.violet .unit-progress{background:#70588c}
html[data-theme="dark"] .lesson-orb{background:var(--surface-inset);border-color:var(--surface-soft);color:var(--green);box-shadow:0 4px 0 #0b2119}
html[data-theme="dark"] .current .lesson-orb{background:var(--lime);color:#243d24;border-color:#35583c;box-shadow:0 5px 0 #496342}
html[data-theme="dark"] .locked .lesson-orb{color:var(--muted);background:var(--surface-inset);box-shadow:0 3px 0 #0b2119}
html[data-theme="dark"] .locked .lesson-copy{opacity:1}
html[data-theme="dark"] :is(.lesson-orb.finished,.complete-label,.earned .badge-status,.earned .badge-symbol,.match-tile.matched,.gathering-milestones>span.grown,.week-day>b.done){background:var(--positive-bg);color:var(--positive-ink);border-color:var(--positive-line)}
html[data-theme="dark"] .earned .badge-symbol{box-shadow:0 4px 0 #102b24}
html[data-theme="dark"] :is(.feedback-correct,.answer-option.correct-answer,.conversation-replies .right-reply){background:var(--positive-bg);color:var(--positive-ink);border-color:var(--positive-line)}
html[data-theme="dark"] :is(.feedback-wrong,.answer-option.wrong-answer,.conversation-replies .try-reply,.storage-status,.record-button.recording){background:var(--retry-bg);color:var(--retry-ink);border-color:var(--retry-line)}
html[data-theme="dark"] :is(.explore-feedback,.recording-status){color:var(--retry-ink)!important}
html[data-theme="dark"] .explore-feedback.positive{color:var(--positive-ink)!important}
html[data-theme="dark"] input,html[data-theme="dark"] textarea{accent-color:var(--violet)}
html[data-theme="dark"] :is(input[type=text],input:not([type]),textarea,.exercise textarea,.journey-activity textarea,.world-task textarea){background:#122f26;border-color:#688773;color:var(--ink)}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#a2b9aa}
html[data-theme="dark"] :is(.review-banner,.returning-words,.journey-tip,.record-button,.companion-card.blue,.ochre .companion-action,.luna-line .icon-button){background:var(--violet-light);color:var(--violet-ink);border-color:var(--violet-line)}
html[data-theme="dark"] .review-banner p{color:var(--violet-ink)}
html[data-theme="dark"] :is(.journey-guide,.journey-scene,.journey-can-do,.curriculum-note,.guest-name,.seed-words details){background:var(--surface-soft);border-color:var(--line)}
html[data-theme="dark"] .character-bubble{color:var(--ink)}
html[data-theme="dark"] :is(.listen-button,.phrase-row .icon-button){background:var(--surface-inset);color:var(--green);box-shadow:none}
html[data-theme="dark"] :is(.journey-progress,.explore-meter){background:var(--surface-inset)}
html[data-theme="dark"] :is(.world-stepper .current>span,.world-stepper .done>span){color:#102b24}
html[data-theme="dark"] .world-stepper .done>span{background:var(--green);border-color:var(--green)}
html[data-theme="dark"] .world-veil{background:linear-gradient(150deg,#19392f,#2b5141)}
html[data-theme="dark"] :is(.garden-stop,.story-number){background:#19392fed;color:var(--ink);border-color:#688773}
html[data-theme="dark"] .garden-stop:hover{background:var(--violet-light)}
html[data-theme="dark"] dialog{box-shadow:0 20px 90px #0008}
html[data-theme="dark"] dialog::backdrop{background:#061b14b3}
html[data-theme="dark"] .toast{background:#d2e2d5;color:#173e32;box-shadow:0 10px 35px #0005}
/* Preserve the supplied artwork on a sage stage; never invert brand images. */
html[data-theme="dark"] .brand-logo{background:#d2e2d5;padding:7px 10px;border-radius:9px;mix-blend-mode:normal;aspect-ratio:auto}
html[data-theme="dark"] .brand-logo>img{mix-blend-mode:multiply}
html[data-theme="dark"] :is(.portrait-stage,.blue .portrait-stage,.ochre .portrait-stage){background:#c5d9cb}
html[data-theme="dark"] .character-portrait.expressive-portrait{background:#d2e2d5;mix-blend-mode:normal;border-radius:50%;border-color:#789f84}
html[data-theme="dark"] .character-portrait.expressive-portrait>.portrait-frame{mix-blend-mode:multiply}
html[data-theme="dark"] .garden-card>img{background:#d2e2d5;border-radius:14px;mix-blend-mode:normal}
@media(max-width:380px){.theme-choices{gap:7px}.theme-choice{padding:9px}.theme-choice b{font-size:14px}.theme-swatch{width:30px}}
