/* One shared choice for every public page. High-contrast accessibility stays independent. */
:root{--surface:#fff;--surface-soft:#eaf0e5;--page:#f7f8f5;--ink:#163d3b;--muted:#506563;--edge:#b0c3b8;--focus:#8955c5}
:root[data-theme=dark]{--surface:#192f3d;--surface-soft:#213d4b;--page:#101f2c;--ink:#eef6ef;--muted:#bed0d6;--edge:#68868e;--focus:#f8d876}
.theme-toggle{white-space:nowrap;flex-shrink:0;min-height:44px!important;background:var(--surface)!important;color:var(--ink)!important;border:1px solid var(--edge)!important;font-size:.9rem!important;box-shadow:none!important}
.theme-toggle:focus-visible{outline:3px solid var(--focus)!important;outline-offset:3px}
:root[data-theme=light]{--q-bg:#f7f8f5;--q-panel:#fff;--q-surface:#eaf0e5;--q-text:#163d3b;--q-muted:#49645c;--q-accent:#755418;--q-link:#215a48;--q-border:#8fa99b;--q-primary:#1f5b50;--q-primary-text:#fff;--q-pill:#e2eedc;--q-pill-text:#254d38;--q-wrong:#9b3023;--q-result:#e2eedc;--q-focus:#8955c5}
html[data-theme=light] .q-score b{color:#215a48}
html[data-theme=light] .quest-body .site-nav a:hover,html[data-theme=light] .quest-body .site-nav a[aria-current=page]{background:#e5eddf;color:#143e35}
html[data-theme=dark] body:not(.high-contrast){background:var(--page);color:var(--ink)}
html[data-theme=dark] body:not(.high-contrast) :is(p,.header-note,.eyebrow,.age-note small,.feature-meta,.level-hint,.card-meta,.card .hebrew,.page-top,.line-number,footer){color:var(--muted)}
html[data-theme=dark] body:not(.high-contrast) :is(.topbar,footer,.reading-line,#server-reading,.site-nav){border-color:var(--edge)}
html[data-theme=dark] body:not(.high-contrast) :is(.card,.book,.book-page,.audio-panel,dialog,.empty,.game-board,.game-hub article,.abc-panel,.abc-songs a,.flag-panel,.flag-card,.legal-toc,.analytics-choice,#server-reading>details>summary){background:var(--surface);color:var(--ink);border-color:var(--edge)}
html[data-theme=dark] body:not(.high-contrast) :is(.featured,.finish,.teacher-panel,.game-settings,.segmented,.line-hebrew,#translation-text,.vocab-word,#words span){background:var(--surface-soft);color:var(--ink);border-color:var(--edge)}
html[data-theme=dark] body:not(.high-contrast) :is(.outline,.card-link,.card button,.abc-tabs button,.voice-choice,.speed select,.teacher-panel select,.game-settings select,.flag-settings select,#flag-search,dialog select,dialog input,.voice-dialog input,#quiz button){background:var(--surface);color:var(--ink);border-color:var(--edge)}
html[data-theme=dark] body:not(.high-contrast) :is(.primary,.level-row button[aria-pressed=true],.abc-tabs button[aria-pressed=true],#quiz button[aria-pressed=true],.game-tabs [aria-current=page]){background:#b5eccd;color:#123c31;border-color:#b5eccd;box-shadow:none}
html[data-theme=dark] body:not(.high-contrast) :is(.primary:hover,.primary:active){background:#d3f7e2;color:#123c31}
html[data-theme=dark] body:not(.high-contrast) :is(.level-row button,.segmented button){color:var(--muted);border-color:var(--edge)}
html[data-theme=dark] body:not(.high-contrast) :is(.segmented button[aria-pressed=true],.voice-choice[aria-pressed=true],.site-nav a:hover,.site-nav a[aria-current=page]){background:#31594c;color:#fff;border-color:#b5eccd}
html[data-theme=dark] body:not(.high-contrast) :is(#story-text,#words b,.abc-sequence){color:var(--ink)}
html[data-theme=dark] body:not(.high-contrast) :is(.badge,.card[data-level='2'] .badge,.card[data-level='3'] .badge){background:#31594c;color:#e5ffeb}
html[data-theme=dark] body:not(.high-contrast) :is(.pill,.audio-symbol,.reward-badges li,#reader-secret){background:#514523;color:#fff0bc;border-color:#bea66d}
html[data-theme=dark] body:not(.high-contrast) :is(.memory-card,.abc-board button,#flag-answers button){background:var(--surface-soft);color:var(--ink);border-color:var(--edge)}
html[data-theme=dark] body:not(.high-contrast) :is(.memory-card[aria-pressed=true],.abc-board button[aria-pressed=true]){background:#514523;color:#fff0bc;border-color:#f8d876}
html[data-theme=dark] body:not(.high-contrast) :is(.memory-card.matched,.abc-board button.matched,#flag-answers button.correct,#game-options .correct){background:#31594c;color:#fff;border-color:#b5eccd}
html[data-theme=dark] body:not(.high-contrast) :is(.word.active,#story-text .word:hover){background:#ffdf79;color:#142b27}
html[data-theme=dark] body:not(.high-contrast) :is(.little-stars,.finish>span){color:#f6d887}
html[data-theme=dark] body:not(.high-contrast) :is(button,a,input,select,summary):focus-visible{outline-color:var(--focus)}
html[data-theme=dark] #page-dots i{background:#68868e}html[data-theme=dark] #page-dots i.current{background:#b5eccd}
html[data-theme=dark] body:not(.high-contrast) .art-caption{color:white}html[data-theme=dark] body:not(.high-contrast) .art-caption p{color:#e4f4ef}
@media(max-width:760px){.theme-toggle{padding:8px 12px!important}.topbar,.q-header{gap:12px}}
@media(forced-colors:active){.theme-toggle{background:Canvas!important;color:CanvasText!important;border-color:ButtonText!important}}
