/* Site-wide color preference. Game canvases and authored raster art retain their own palette. */
.site-theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 3px 12px #13253616;
  white-space: nowrap;
}
.site-theme-switch button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.site-theme-switch button[aria-pressed="true"] { background: #ffe8b9; box-shadow: inset 0 0 0 1px #e7c887; }
.site-theme-switch button[data-site-theme="dark"][aria-pressed="true"] { background: #3b5974; box-shadow: inset 0 0 0 1px #88a5c2; }
.site-theme-switch img { display: block; width: 19px; height: 19px; }
.site-theme-switch button:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.site-header { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: clamp(10px, 1.3vw, 22px); }
.site-header > .brand { grid-column: 1; }
.site-header > .primary-nav { grid-column: 2; }
.site-header > .site-theme-switch { grid-column: 3; }
.site-header > .header-cta { grid-column: 4; }
.site-header:not(:has(> .header-cta)) { grid-template-columns: auto minmax(0, 1fr) auto; }
.site-header:not(:has(> .header-cta)) > .site-theme-switch { grid-column: 3; }
.arena-lobby-header > .site-theme-switch { grid-column: auto; justify-self: end; margin-left: auto; }
.arena-lobby-header > .game-lobby__menu { margin-left: 0 !important; }

@media (max-width: 1020px) {
  .site-header, .site-header:not(:has(> .header-cta)) { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .site-header > .brand { grid-column: 1; grid-row: 1; }
  .site-header > .site-theme-switch { grid-column: 2; grid-row: 1; }
  .site-header > .nav-toggle { grid-column: 3; grid-row: 1; }
  .site-header > .nav-toggle { position: static; top: auto; right: auto; left: auto; justify-self: end; }
  .site-header.is-open > .primary-nav,
  .site-header.is-open > .header-cta { grid-column: 1 / -1; }
  .site-header.is-open > .primary-nav { grid-row: 2; }
  .site-header.is-open > .header-cta { grid-row: 3; }
}
@media (max-width: 370px) {
  .site-header { padding-inline: 10px; }
  .site-theme-switch button { width: 30px; height: 30px; }
}
@media (max-width: 700px) {
  .arena-lobby-header > .game-lobby__menu { display: none !important; }
}

:root[data-theme="dark"] {
  --ink: #edf3f5;
  --muted: #b6c5ce;
  --line: #3a5360;
  --paper: #192a36;
  --soft: #213542;
  --brand: #f19c91;
  --brand-strong: #ec8275;
  --mint: #71d2be;
  --sky: #8cbde5;
  --plum: #c3a9e9;
  --footer: #101b25;
  --shadow: 0 18px 45px #020b13a8;
  color-scheme: dark;
}
html[data-theme="dark"] body { color: var(--ink); background: #15232f; }
html[data-theme="dark"] :is(.home-page, .knowledge-page, .exercise-page, .study-sets-page, .monster-arena-page) { background: #15232f; }
html[data-theme="dark"] .site-header {
  background: linear-gradient(135deg, #223947ef, #192d3bef);
  border-color: #435765;
  box-shadow: 0 10px 28px #07121c75;
}
html[data-theme="dark"] .primary-nav a { color: var(--ink); }
html[data-theme="dark"] .glass-surface {
  background: linear-gradient(135deg, #233c4aee, #1a303eee);
  border-color: #476575;
  box-shadow: 0 12px 30px #07121c75;
}
html[data-theme="dark"] :is(.section--light, .section--online, .knowledge-browser, .exercise-workspace, .exercise-app-main, .study-sets-main) { background: #15232f; }
html[data-theme="dark"] .home-subject-nav__item { background: #263b48; border-color: #547080; }
html[data-theme="dark"] .knowledge-hero {
  background: linear-gradient(90deg, #15232ff2, #223b48dd), url('../images/background.webp') center / cover;
}
html[data-theme="dark"] .grammar-hero {
  background: linear-gradient(90deg, #15232ff2, #223b48dd), url('../images/background.webp') center / cover;
}
html[data-theme="dark"] :is(.formula-card, .rule-tile, .usage-card, .grammar-note, .next-card,
  .mistake-list article, .keyword-grid span, .formula) {
  color: var(--ink);
  background: #263e4b;
  border-color: #547080;
  box-shadow: 0 8px 22px #08162175;
}
html[data-theme="dark"] .formula { background: #1d303c; }
html[data-theme="dark"] .hl-person { color: #a7eddb; background: #244b48; }
html[data-theme="dark"] .hl-verb { color: #bddcff; background: #29445e; }
html[data-theme="dark"] .hl-aux { color: #e0ccff; background: #443856; }
html[data-theme="dark"] .hl-note { color: #ffc5b8; background: #513d42; }
/* Tense tables have their own nested surfaces and interactive filters. */
html[data-theme="dark"] .tense-filter {
  color: var(--ink);
  background: #304956;
  border-color: #65808c;
}
html[data-theme="dark"] .tense-filter:hover { background: #3b5967; }
html[data-theme="dark"] .tense-filter[aria-pressed="true"] {
  color: #182a30;
  background: #f3a49a;
  border-color: #f3a49a;
  box-shadow: 0 4px 15px #07121c75;
}
html[data-theme="dark"] .tense-card {
  color: var(--ink);
  background: #203441;
  border-color: #a77476;
  box-shadow: 0 12px 30px #07121c75;
}
html[data-theme="dark"] .tense-card__title { background: #293f4b; border-color: #a77476; }
html[data-theme="dark"] .tense-card__title h3 { color: var(--ink); }
html[data-theme="dark"] .tense-structure { background: #1b2d39; border-color: #547080; }
html[data-theme="dark"] :is(.tense-structure__row + .tense-structure__row, .tense-structure__row strong) { border-color: #547080; }
html[data-theme="dark"] .tense-structure__row strong { background: #263e4b; }
html[data-theme="dark"] .tense-structure__row .hl-person { color: #a7eddb; }
html[data-theme="dark"] .tense-structure__row .hl-verb { color: #bddcff; }
html[data-theme="dark"] .tense-structure__row .hl-aux { color: #e0ccff; }
html[data-theme="dark"] .tense-structure__row .hl-note { color: #ffc5b8; }
html[data-theme="dark"] .tense-usage { border-color: #a77476; }
html[data-theme="dark"] .tense-usage h4 { color: #ffb7ab; }
/* Math library pages share these surfaces with the embedded tool pages. */
html[data-theme="dark"] .math-page {
  --math-teal: #91e0d0;
  --math-teal-soft: #244b48;
  --math-blue: #bddcff;
  --math-blue-soft: #29445e;
  --math-violet: #e0ccff;
  --math-violet-soft: #443856;
  --math-gold: #ffda95;
  --math-gold-soft: #50462e;
}
html[data-theme="dark"] :is(.math-hub-hero, .math-subpage-hero) {
  background: linear-gradient(135deg, #203d46, #1c303e 64%, #243743);
  border-color: #476575;
}
html[data-theme="dark"] :is(.math-library, .math-tool-section, .math-related) { background: #15232f; }
html[data-theme="dark"] :is(.math-resource-card, .math-frame-shell, .math-related__links a) {
  color: var(--ink);
  background: #203441;
  border-color: #547080;
  box-shadow: 0 12px 30px #07121c75;
}
html[data-theme="dark"] .math-related .math-library__inner { border-color: #547080; }
html[data-theme="dark"] .math-breadcrumb :is(a, span::before) { color: #ffb7ab; }
html[data-theme="dark"] .math-workspace-bar button { color: var(--ink); background: #304956; }
html[data-theme="dark"] .math-help-dialog { color: var(--ink); background: #203441; }
html[data-theme="dark"] .grammar-hero__exercise-link { color: var(--ink); background: #304956; }
html[data-theme="dark"] :is(.knowledge-toolbar, .knowledge-hero__copy, .knowledge-hero__stats > div,
  .knowledge-group, .knowledge-card, .knowledge-feature-card, .exercise-card, .exercise-shell,
  .exercise-setup, .exercise-control-group, .study-sets-panel, .study-set-card,
  .study-sets-howto__steps li, .study-vocabulary-editor, .cookie-banner) {
  color: var(--ink);
  background: #203441;
  border-color: #47606e;
}
html[data-theme="dark"] :is(.knowledge-hero p, .knowledge-toolbar p, .knowledge-card p,
  .study-sets-header p, .study-set-card p, .study-set-card small, .exercise-shell p) { color: var(--muted); }
html[data-theme="dark"] .knowledge-group--past {
  --group-accent: #d0b7ec;
  --group-border: #7a6593;
}
html[data-theme="dark"] .knowledge-group--future {
  --group-accent: #9bc7ff;
  --group-border: #5278a4;
}
html[data-theme="dark"] .knowledge-group--future-past {
  --group-accent: #cbb5ff;
  --group-border: #7d69ad;
}
html[data-theme="dark"] :is(.future-story-card, .comparison-story-card) {
  color: var(--ink);
  background: #263e4b;
  border-color: #547080;
  box-shadow: 0 12px 30px #07121c75;
}
html[data-theme="dark"] :is(.future-story-card, .comparison-story-card) h3 { color: var(--ink); }
html[data-theme="dark"] :is(.future-story-card, .comparison-story-card) p { color: var(--muted); }
/* Shared comparison panels and both desktop/mobile lesson tables. */
html[data-theme="dark"] :is(.comparison-panel, .grammar-table-wrap, .adjective-table-wrap,
  .grammar-mobile-data__card) {
  color: var(--ink);
  background: #203441;
  border-color: #547080;
  box-shadow: 0 12px 30px #07121c75;
}
html[data-theme="dark"] .comparison-panel--blue { background: #233b50; border-color: #6088a7; }
html[data-theme="dark"] .comparison-panel--green { background: #21413f; border-color: #5c9589; }
html[data-theme="dark"] :is(.comparison-panel h3, .grammar-mobile-data__value,
  .grammar-table td, .adjective-table td) { color: var(--ink); }
html[data-theme="dark"] .comparison-panel p { color: var(--muted); }
html[data-theme="dark"] :is(.grammar-table th, .adjective-table th,
  .grammar-mobile-data__field:first-child) { background: #304956; }
html[data-theme="dark"] :is(.grammar-table th, .adjective-table th,
  .grammar-mobile-data__label) { color: #ffc5b8; }
html[data-theme="dark"] :is(.grammar-table th, .grammar-table td, .adjective-table th,
  .adjective-table td, .grammar-mobile-data__field, .tense-rules-table tr) { border-color: #547080; }
html[data-theme="dark"] :is(.grammar-table, .adjective-table) tbody tr:nth-child(even) { background: #263e4b; }
html[data-theme="dark"] :is(.grammar-table, .adjective-table) tbody tr:hover { background: #314d5b; }
html[data-theme="dark"] :is(.pronouns-path, .pronouns-figure, .pronouns-story p,
  .pronouns-table-wrap, .pronouns-examples article, .pronouns-pair, .pronouns-mistakes article) {
  background: #203441;
  border-color: #547080;
  box-shadow: 0 12px 30px #07121c75;
}
html[data-theme="dark"] .pronouns-table :is(th, td) { color: var(--ink); border-color: #547080; }
html[data-theme="dark"] .pronouns-table thead th { color: #ffc5b8; background: #304956; }
html[data-theme="dark"] .pronouns-table tbody tr:nth-child(even) { background: #263e4b; }
html[data-theme="dark"] .pronouns-table tbody td:nth-child(5) { color: #e0ccff; }
html[data-theme="dark"] .pronouns-table tbody td:nth-child(6) { color: #a7eddb; }
html[data-theme="dark"] :is(.pronouns-path span, .pronouns-examples span, .pronouns-pair span,
  .pronouns-bad, .pronouns-mistakes del) { color: #ffc5b8; }
html[data-theme="dark"] :is(.pronouns-story em, .pronouns-good, .pronouns-mistakes strong) { color: #a7eddb; }
@media (max-width: 700px) {
  html[data-theme="dark"] .pronouns-table-wrap { background: transparent; box-shadow: none; }
  html[data-theme="dark"] .pronouns-table tbody tr { background: #203441; border-color: #547080; }
  html[data-theme="dark"] .pronouns-table tbody th { background: #304956; }
  html[data-theme="dark"] .pronouns-table tbody td::before { color: var(--muted); }
  html[data-theme="dark"] .pronouns-lesson .grammar-toc a { background: #304956; border-color: #547080; }
}
html[data-theme="dark"] .about-values {
  background: linear-gradient(135deg, #203d46, #1c303e 64%, #243743);
}
html[data-theme="dark"] .edu-context > :is(p, summary) {
  color: var(--ink);
  background: #293f4b;
  border-color: #f19c91;
}
html[data-theme="dark"] .edu-context > summary:hover { background: #354f5c; }
/* Elfsight's public es-* hooks also apply when it loads after a theme switch. */
html[data-theme="dark"] .reviews-embed :is(.es-review-background-container, .es-header-container) {
  color: var(--ink) !important;
  background: #263e4b !important;
  border-color: #547080 !important;
}
html[data-theme="dark"] .reviews-embed .es-header-container::before { background: #263e4b !important; }
html[data-theme="dark"] .reviews-embed :is(.es-widget-title, .es-header-title,
  .es-header-rating-value, .es-header-rating-title, .es-review-author-name,
  .es-review-content-text, .es-tabs-container, .es-tabs-item) { color: var(--ink) !important; }
html[data-theme="dark"] .reviews-embed :is(.es-review-info-date, .es-header-rating-count) { color: var(--muted) !important; }
html[data-theme="dark"] .reviews-embed .es-review-content-control { color: #9bc7ff !important; }
html[data-theme="dark"] :is(.study-sets-paste-panel, .study-sets-import-panel, .study-vocabulary-card,
  .study-vocabulary-card:nth-child(even), .study-set-row, .study-set-card--local) {
  color: var(--ink);
  background: #263d49;
  border-color: #547381;
}
html[data-theme="dark"] :is(.study-vocabulary-card__tools button, .study-sets-page .button--secondary,
  .study-sets-pagination button, .study-sets-howto__browser, .study-sets-howto__menu-popover,
  .study-sets-howto__pair, .study-sets-howto__fallback-code) {
  color: var(--ink);
  background: #314d5b;
  border-color: #65808c;
}
html[data-theme="dark"] body:not(.exam-reader-page) :is(input, textarea, select) { color: var(--ink); background-color: #1b2d39; border-color: #597281; }
html[data-theme="dark"] body:not(.exam-reader-page) :is(input, textarea)::placeholder { color: #a8bbc6; opacity: 1; }
html[data-theme="dark"] :is(.study-sets-toolbar input, .study-sets-toolbar select, .study-set-row input[type="text"],
  .study-vocabulary-search input, .study-sets-howto__mock-field) { color: var(--ink); background: #1b2d39; border-color: #597281; }
html[data-theme="dark"] .study-sets-howto__visual { color: var(--ink); background: #203441; border-color: #547381; }
html[data-theme="dark"] .study-sets-howto__fallback { background: #23463f; border-color: #5a9c8d; }
html[data-theme="dark"] .study-vocabulary-card__pair p + p { border-color: #71918f; }
html[data-theme="dark"] .cookie-banner__actions { background: #203441; }
html[data-theme="dark"] .cookie-option { background: #2a414e; border-color: #547080; }
html[data-theme="dark"] :is(.cookie-banner .button--secondary, .nav-toggle, .cookie-floating-button) {
  color: var(--ink);
  background: #324c59;
  border-color: #617988;
}
html[data-theme="dark"] :is(.issue-report-trigger--floating, .issue-report-trigger--inline) {
  color: #ffaaa0;
  background: #304956;
  border-color: #a77476;
}
html[data-theme="dark"] .filter-chip:not([aria-pressed="true"]) { color: var(--ink); background: #304956; border-color: #65808c; }
html[data-theme="dark"] :is(.button--secondary, .header-cta) { border-color: #617988; }
html[data-theme="dark"] .button--secondary { color: var(--ink); background: #304956; }
html[data-theme="dark"] .button--secondary:hover { background: #3b5967; }
html[data-theme="dark"] :is(.exercise-mode-option, .exercise-activity-option, .exercise-setup-mode,
  .exercise-setup-activity, .exercise-control-option) { color: var(--ink); background: #263e4b; border-color: #547080; }
html[data-theme="dark"] .exercise-app-bar { color: var(--ink); background: #203441; border-color: #547080; }
html[data-theme="dark"] .exercise-app-bar h1 { color: var(--ink); }
html[data-theme="dark"] .exercise-panel--setup { background: #203441; border-color: #547080; }
html[data-theme="dark"] .exercise-setup-tabs { background: #314d5b; border-color: #65808c; }
html[data-theme="dark"] .exercise-setup-tabs button { color: var(--ink); background: transparent; }
html[data-theme="dark"] .exercise-setup-tabs button[aria-pressed="true"] { color: #18323a; background: #d7eae7; }
html[data-theme="dark"] .exercise-page[data-exercise-page] .exercise-setup-tabs {
  background: #1c3442;
  border-color: #617d8b;
}
html[data-theme="dark"] .exercise-page[data-exercise-page] .exercise-setup-tabs button[aria-pressed="true"] {
  color: var(--ink);
  background: #496677;
  box-shadow: inset 0 0 0 1px #8aa8b5;
}
html[data-theme="dark"] .exercise-panel--setup .exercise-activity-section .exercise-activity__art {
  background: #263e4b;
}
html[data-theme="dark"] :is(.exercise-activity, .exercise-mode, .exercise-count,
  .exercise-control-group button:not(.button), .exercise-panel--setup button:not(.button):not([aria-pressed="true"])) {
  color: var(--ink);
  background: #304956;
  border-color: #65808c;
}
html[data-theme="dark"] :is(.exercise-activity[aria-pressed="true"], .exercise-mode[aria-pressed="true"],
  .exercise-count[aria-pressed="true"], .exercise-activity.is-selected, .exercise-mode.is-selected,
  .exercise-count.is-selected) { color: var(--ink); background: #4a4554; border-color: var(--brand); }
html[data-theme="dark"] .exercise-panel--setup :is(.exercise-setup-actions button, .exercise-control-actions button) { color: var(--ink); background: #304956; }
html[data-theme="dark"] .exercise-panel--setup .exercise-start { color: #192a32; background: #f3a49a; }
html[data-theme="dark"] :is(.exercise-question, .exercise-sentence__line, .exercise-session-back,
  .exercise-feedback, .exercise-result-card, .exercise-control-bar) {
  color: var(--ink);
  background: #263e4b;
  border-color: #597281;
}
html[data-theme="dark"] :is(.exercise-sentence__line, .exercise-session-back) { background: #314d5b; }
html[data-theme="dark"] .exercise-choice-gap { color: #322548; background: #d4b5e6; border-color: #ac82c5; }
html[data-theme="dark"] .exercise-hint { color: #d5e3e9; }
html[data-theme="dark"] .exercise-choice { color: #24363d; }
html[data-theme="dark"] :is(.study-sets-status, .study-sets-help summary) { color: #87dbce; }
html[data-theme="dark"] :is(.exercise-mode-option[aria-pressed="true"], .exercise-activity-option[aria-pressed="true"],
  .exercise-setup-mode[aria-pressed="true"], .exercise-setup-activity[aria-pressed="true"]) { background: #394d5c; border-color: var(--brand); }
html[data-theme="dark"] .arena-lobby-header { background: #203441e8; }
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby {
  --lobby-ink: #edf3f5;
  --lobby-muted: #b6c5ce;
  --lobby-paper: #203441;
  --lobby-line: #4c6876;
  background: #142735;
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-setup__grid { background: #142735; }
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-setup__options {
  background: #203441;
  border-color: #4c6876;
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-intro {
  isolation: isolate;
  background: #11243b;
  border-color: #547080;
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-intro::before,
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-intro::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-intro::before {
  background: url('/assets/images/monster-arena/maps/mystery-pastures-night.webp') center / cover;
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-intro::after {
  background: linear-gradient(180deg, #071322ba, #0b223b70 55%, #10284742);
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-intro > * { position: relative; z-index: 1; }
html[data-theme="dark"] .monster-arena-page :is(.arena-set-summary, .arena-room-panel) {
  color: var(--ink);
  background: #263e4b;
  border-color: #608080;
}
html[data-theme="dark"] .monster-arena-page :is(.arena-set-summary span:last-child, .arena-room-panel > p,
  .arena-panel__description, .arena-panel__note, .arena-map-card__copy small,
  .arena-setup__launch p:first-child) { color: var(--muted); }
html[data-theme="dark"] .monster-arena-page .arena-set-summary__icon { color: #9be3d5; background: #285550; }
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby :is(.arena-character-card, .arena-map-card) {
  color: var(--ink);
  background: #293f4c;
  border-color: #5b7480;
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby :is(.arena-character-card, .arena-map-card)[aria-pressed="true"] {
  background: #315850;
  border-color: #96d6c8;
  box-shadow: 0 0 0 2px #517c73;
}
html[data-theme="dark"] .monster-arena-page .arena-setup.game-lobby .arena-character-pager button,
html[data-theme="dark"] .monster-arena-page .arena-setup__launch kbd,
html[data-theme="dark"] .monster-arena-page #arena-room-players li {
  color: var(--ink);
  background: #304956;
  border-color: #65808c;
}
html:not([data-theme="dark"]) .monster-arena-page .arena-map-art__night,
html[data-theme="dark"] .monster-arena-page .arena-map-art__day { display: none; }
html[data-theme="dark"] .monster-arena-page .arena-map-art { background: #1a3047; }
html[data-theme="dark"] .monster-arena-page .arena-setup__launch { border-color: #547080; }
html[data-theme="dark"] .monster-arena-page .arena-dialog:not(.arena-dialog--upgrades) {
  color: var(--ink);
  background: #203441;
  border-color: #74948f;
}
html[data-theme="dark"] .monster-arena-page .arena-dialog:not(.arena-dialog--upgrades) > p:not(.eyebrow) { color: var(--muted); }
html[data-theme="dark"] .monster-arena-page .arena-question-text {
  color: var(--ink) !important;
  background: #294b49;
  border-color: #618a82;
}
html[data-theme="dark"] .monster-arena-page :is(.arena-hud__top > div:not(.arena-hud__buttons), .arena-hud__bottom,
  .arena-hud__buttons button, .arena-room-standings) {
  color: var(--ink);
  background: #203441e8;
  border-color: #71909b;
  text-shadow: none;
}
html[data-theme="dark"] .monster-arena-page .arena-hud__label { color: var(--muted); }

/* The home journey keeps its landmarks in place while changing from day to night. */
html[data-theme="dark"] .home-page .quick-paths--under-subjects {
  background: #203441;
  border-color: #547080;
}
html[data-theme="dark"] .home-page .quick-paths--under-subjects .quick-path + .quick-path { border-color: #547080; }
html[data-theme="dark"] .home-page .quick-paths--under-subjects .quick-path:hover { background: #2d4856; }
html[data-theme="dark"] .home-page .home-launchpad__intro h2 { color: var(--ink); }
html[data-theme="dark"] .home-page .home-launchpad__intro p:not(.eyebrow) { color: var(--muted); }
html[data-theme="dark"] .home-page .home-launchpad__props {
  background: #14263a;
  border-color: #537084;
  box-shadow: 0 24px 54px #06121e9c;
}
html:not([data-theme="dark"]) .home-page .theme-art--night,
html[data-theme="dark"] .home-page .theme-art--day { display: none !important; }
/* The map overlaps the launchpad: its background must fade with the sticky art. */
html[data-theme="dark"] .home-page .home-map-story { background: transparent !important; }
html[data-theme="dark"] .home-page .home-map-story__picture { background: #102745; }
html[data-theme="dark"] .home-page .home-map-story__shade { display: none; }
html[data-theme="dark"] .home-page .home-map-story__intro {
  background: #203441f5;
  border-color: #65808c;
  box-shadow: 0 18px 45px #020b13a8;
  color: var(--ink);
  text-shadow: none;
}
html[data-theme="dark"] .home-page .home-map-story__intro h2 { color: var(--ink); }
html[data-theme="dark"] .home-page .home-map-story__intro p:not(.eyebrow) { color: var(--muted); }
html[data-theme="dark"] .home-page .journey-stop {
  color: var(--ink);
  background: #203746;
  border-color: #557084;
  box-shadow: 0 12px 30px #06121e99;
}
html[data-theme="dark"] .home-page .journey-stop > span { color: #ffaaa0; }
html[data-theme="dark"] .home-page .journey-stop p { color: var(--muted); }
html[data-theme="dark"] .home-page .journey-stop a { color: #91dfd2; }
html[data-theme="dark"] .home-page .home-course-expeditions .course-card > div:not(.course-card__media) {
  background: linear-gradient(180deg, #203744, #192d3a);
}
html[data-theme="dark"] .home-page .home-course-expeditions .course-card__media { background: #1a303e; }
html[data-theme="dark"] .home-page .home-course-expeditions .course-card > a {
  color: var(--ink);
  background: #304956;
  border-color: #617988;
}
html[data-theme="dark"] .home-page .about-teaser { background: #1b2d39; }
html[data-theme="dark"] .home-page .hero__actions .button--secondary {
  color: var(--ink);
  background: #223847e8;
  border-color: #8ca3ad;
}

html[data-theme="dark"] .exam-browser {
  --exam-browser-border: #4c6572;
  --exam-browser-soft: #1b303c;
  color: var(--ink);
  background: #203441;
  border-color: var(--exam-browser-border);
}
html[data-theme="dark"] :is(.exam-browser__topbar, .exam-browser__content) { background: #203441; }
html[data-theme="dark"] :is(.exam-browser__nav, .exam-directory__filters) { background: #1b303c; }
html[data-theme="dark"] :is(.exam-browser__nav button, .exam-directory__filters button) {
  color: var(--ink);
  background: #29414f;
  border-color: #54707d;
}
html[data-theme="dark"] .exam-browser__nav button > span { color: #ffaaa0; background: #314b59; }
html[data-theme="dark"] :is(.exam-browser__nav button:hover, .exam-directory__filters button:hover) {
  color: var(--ink);
  background: #304956;
  border-color: #65808c;
}
html[data-theme="dark"] :is(.exam-browser__nav button.is-active, .exam-directory__filters button.is-active) {
  color: #ffaaa0;
  background: #3b4552;
  border-color: #af797c;
}
html[data-theme="dark"] :is(.exam-category-card, .exam-session-item) {
  color: var(--ink);
  background: #263e4b;
  border-color: #57717f;
  box-shadow: 0 8px 18px #0716206b;
}
html[data-theme="dark"] .exam-category-card__icon { color: #ffaaa0; background: #493f4c; }
html[data-theme="dark"] :is(.exam-directory__summary strong, .exam-group__count, .exam-session-item__status) {
  color: #a6e5d8 !important;
  background: #2b4a50;
}
html[data-theme="dark"] :is(.exam-detail__close, [data-exam-detail-close], .exam-session-action,
  .exam-audio-dialog__head button) {
  color: var(--ink);
  background: #304956;
  border-color: #65808c;
}
html[data-theme="dark"] .exam-session-action--primary { color: #182a30; background: #f3a49a; border-color: #f3a49a; }
html[data-theme="dark"] .exam-session-action--audio { color: #9be3d5; background: #24453f; border-color: #5c9589; }
html[data-theme="dark"] :is(.exam-browser > .exam-directory__source-note, .exam-audio-dialog) {
  color: var(--ink);
  background: #1b303c;
}
/* The PDF itself stays white; only the reader chrome follows the site theme. */
.reader-header__actions > .site-theme-switch { flex: 0 0 auto; }
@media (max-width: 900px) {
  .reader-header__actions .site-theme-switch button:first-child { display: grid; }
}
@media (max-width: 650px) {
  .reader-header__actions { align-items: center; }
  .reader-header__actions .site-theme-switch { padding: 2px; }
  .reader-header__actions .site-theme-switch button { width: 27px; height: 27px; }
  .reader-header__actions .site-theme-switch img { width: 17px; height: 17px; }
  .reader-header__actions > .reader-header__primary { min-width: 65px; font-size: 0; }
  .reader-header__actions > .reader-header__primary::after { content: 'Pobierz'; font-size: 0.72rem; }
  .reader-mobile-tools { align-self: end; }
}
html[data-theme="dark"] .exam-reader-page {
  --ink: #edf3f5;
  --muted: #b6c5ce;
  --surface: #15232f;
  --line: #47606e;
  background: var(--surface);
}
html[data-theme="dark"] :is(.reader-header, .reader-toolbar, .reader-mobile-tools) { background: #203441; border-color: #47606e; }
html[data-theme="dark"] :is(.reader-header__back, .reader-header__actions > button:not(.reader-header__primary),
  .reader-toolbar button:not([data-color-preset]), .reader-toolbar input, .reader-mobile-tools button) {
  color: var(--ink);
  background: #304956;
  border-color: #597281;
}
html[data-theme="dark"] .reader-header__actions > .reader-header__primary { color: #172b2f; }
html[data-theme="dark"] .reader-audio { background: #233f43; }
html[data-theme="dark"] :is(.reader-audio__tabs button, .reader-audio__action) { color: var(--ink); background: #304956; }
html[data-theme="dark"] .reader-audio__copy small { color: #9be3d5; }
html[data-theme="dark"] .reader-error :is(button, a) { color: var(--ink); background: #304956; border-color: #597281; }

@media (prefers-reduced-motion: reduce) {
  .site-theme-switch button { transition: none; }
}

.game-loading {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #152733;
  color: #fff;
  isolation: isolate;
}
.game-loading__scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #091d29b3, #0d263955, #091d29b3), var(--game-loading-art) center / cover no-repeat;
}
.game-loading__card {
  width: min(490px, calc(100vw - 36px));
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: clamp(20px, 5vw, 36px);
  border: 1px solid #d2e1db70;
  border-radius: 22px;
  background: #102330c9;
  box-shadow: 0 20px 65px #07151db8;
  text-align: center;
  backdrop-filter: blur(12px);
}
.game-loading__brand { width: 116px; height: 60px; object-fit: contain; filter: drop-shadow(0 2px 7px #0008); }
.game-loading__logo { width: min(330px, 100%); height: 135px; object-fit: contain; filter: drop-shadow(0 7px 15px #0008); }
.game-loading__byline { color: #d3ece3; font-size: .78rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.game-loading__label { min-height: 1.4em; font-size: 1rem; }
.game-loading__track { width: 100%; height: 12px; overflow: hidden; border: 1px solid #cce4d48c; border-radius: 99px; background: #071925d9; }
.game-loading__track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #72d7bd, #f5b28d); transition: width .18s linear; }
.game-loading__percent { color: #e4f0e9; font-variant-numeric: tabular-nums; }
@media (max-height: 550px) {
  .game-loading__card { gap: 6px; padding: 10px 20px; }
  .game-loading__brand { height: 35px; }
  .game-loading__logo { height: 80px; }
}
@media (prefers-reduced-motion: reduce) { .game-loading__track > span { transition: none; } }
