/* Merkaz Tirgul V47: reference palette with preserved V46 menu fixes.
   --ink is foreground text; --brand-surface is background paint.
   Theme-specific rules are isolated. Light study images and QR artwork
   keep their original pixels. Layout, content and application logic are unchanged. */

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  --shadow: 0 18px 52px rgba(0,0,0,.42);
  --drawer-bg: #101b17;
  --drawer-line: #30443b;
  --drawer-ink: #f2eee6;
  --drawer-muted: #a9b7b0;
  --drawer-accent: #79b39a;
  --drawer-accent-2: #e58b56;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #101715 !important;
  color: #f5efe7;
}

html[data-theme="dark"] body:not(.auth-locked),
html[data-theme="dark"] .site-shell,
html[data-theme="dark"] .results-shell,
html[data-theme="dark"] .games-page {
  background-color: #101715;
}

html[data-theme="dark"] .site-hamburger,
html[data-theme="dark"] .site-menu-close,
html[data-theme="dark"] .merkaz-launcher-close {
  background: #19221f !important;
  color: #f7efe7 !important;
  border-color: #3a4943 !important;
}

html[data-theme="dark"] .site-menu-drawer {
  background: #121a18 !important;
  color: #f5efe7 !important;
  border-color: #34433d !important;
  box-shadow: -18px 0 48px rgba(0,0,0,.42) !important;
}

html[data-theme="dark"] .site-menu-section,
html[data-theme="dark"] .site-menu-link,
html[data-theme="dark"] .site-menu-action,
html[data-theme="dark"] .site-menu-sound,
html[data-theme="dark"] .drawer-xp-card,
html[data-theme="dark"] .google-signin-menu,
html[data-theme="dark"] .drawer-sound-panel-v23,
html[data-theme="dark"] .sound-settings-note-v23 {
  background: #18211e !important;
  color: #f5efe7 !important;
  border-color: #35443f !important;
}

html[data-theme="dark"] .site-menu-section h3,
html[data-theme="dark"] .site-menu-link .menu-main,
html[data-theme="dark"] .site-menu-action .menu-main,
html[data-theme="dark"] .site-menu-sound strong,
html[data-theme="dark"] .drawer-sound-panel-v23 h2 {
  color: #f5efe7 !important;
}

html[data-theme="dark"] :is(.site-menu-link,.site-menu-action) .menu-kicker,
html[data-theme="dark"] .site-menu-sound small,
html[data-theme="dark"] .drawer-xp-next,
html[data-theme="dark"] .drawer-sound-panel-v23 p,
html[data-theme="dark"] .drawer-sound-panel-v23 small {
  color: #aab5af !important;
}

html[data-theme="dark"] :is(.site-menu-link,.site-menu-action,.site-menu-sound) .menu-icon {
  background: #22322d !important;
  color: #efad7e !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .quiz-header,
html[data-theme="dark"] .results-topbar {
  border-color: #35443f !important;
}

html[data-theme="dark"] :is(.topic-card,.exam-card,.question-panel,.review-list button,.search-box,.performance-search,.reference-information-v25,.note-editor-v25,.note-editor-head-v25,.note-editor-actions-v25,.activity-confirm-v25,.guest-warning-card,.transition-loader-panel) {
  background: #18211e !important;
  color: #f5efe7 !important;
  border-color: #35443f !important;
}

html[data-theme="dark"] :is(.topic-card,.exam-card,.question-panel,.review-list button,.note-editor-v25,.activity-confirm-v25) :is(p,small,label) {
  color: #aab5af;
}

html[data-theme="dark"] .transition-loader {
  background: rgba(10,15,14,.92) !important;
}

html[data-theme="dark"] .mascot-loading-screen,
html[data-theme="dark"] .transition-loader-panel {
  color: #f5efe7 !important;
}

html[data-theme="dark"] :is(.hf-shell,.hf-content,.hf-card,.hf-section,.hf-toc-drawer,.hf-toc-panel,.hf-toc-item,.hf-search,.material-card,.material-section) {
  border-color: #35443f !important;
}

html[data-theme="dark"] :is(.hf-card,.hf-section,.hf-toc-drawer,.hf-toc-panel,.hf-toc-item,.hf-search,.material-card,.material-section) {
  background-color: #18211e !important;
  color: #f5efe7 !important;
}

html[data-theme="dark"] body.games-page {
  --card: #18211e;
  --paper: #101715;
}

html[data-theme="dark"] .games-page .games-site-header,
html[data-theme="dark"] .games-page .games-account-bar,
html[data-theme="dark"] .games-page .games-footer {
  background: #121a18 !important;
  color: #f5efe7 !important;
  border-color: #35443f !important;
}

html[data-theme="dark"] .games-page :is(.game-card,.games-note,.level-article,.stats-strip article,.result-screen,.rank-dialog,.rank-row,.scenario-card,.answer-card,.game-answer,.stage-card) {
  background-color: #18211e !important;
  color: #f5efe7 !important;
  border-color: #35443f !important;
}

html[data-theme="dark"] .games-page :is(.game-card,.games-note,.level-article,.stats-strip article,.result-screen,.rank-dialog,.rank-row,.scenario-card,.answer-card,.game-answer,.stage-card) :is(p,small,.card-meta,.stat-label) {
  color: #aab5af !important;
}

html[data-theme="light"] .auth-gate {
  color: #17362c;
  background: linear-gradient(135deg, rgba(246,241,231,.82), rgba(244,236,224,.72)),
    url("/assets/login-aircraft-bg.jpg") center center / cover no-repeat;
}

html[data-theme="light"] .auth-gate__noise {
  background: radial-gradient(circle at 15% 20%, rgba(205,116,65,.22), transparent 28%),
    radial-gradient(circle at 85% 35%, rgba(230,160,101,.13), transparent 30%),
    radial-gradient(circle at 75% 82%, rgba(205,116,65,.16), transparent 32%);
  mix-blend-mode: multiply;
}

html[data-theme="light"] .auth-gate__brand,
html[data-theme="light"] .auth-gate__card,
html[data-theme="light"] .auth-gate__info-panel {
  background: linear-gradient(180deg, rgba(255,253,248,.94), rgba(245,239,229,.92)) !important;
  color: #17362c !important;
  border-color: rgba(155,91,55,.30) !important;
  box-shadow: 0 28px 75px rgba(54,45,37,.18) !important;
}

html[data-theme="light"] .auth-gate__brand--minimal h1,
html[data-theme="light"] .auth-gate__section-kicker,
html[data-theme="light"] .auth-gate__link,
html[data-theme="light"] .auth-gate__ghost,
html[data-theme="light"] .auth-gate__switch button,
html[data-theme="light"] .auth-gate__detail-back {
  color: #a85f39 !important;
}

html[data-theme="light"] .auth-gate__card h2,
html[data-theme="light"] .auth-gate__menu-view h3,
html[data-theme="light"] .auth-gate__info-panel h3,
html[data-theme="light"] .auth-gate__menu-item-copy strong,
html[data-theme="light"] .auth-gate__field span {
  color: #17362c !important;
}

html[data-theme="light"] .auth-gate__card p.auth-gate__sub,
html[data-theme="light"] .auth-gate__info-panel p,
html[data-theme="light"] .auth-gate__info-panel li,
html[data-theme="light"] .auth-gate__menu-item-copy small,
html[data-theme="light"] .auth-gate__switch,
html[data-theme="light"] .auth-gate__or {
  color: #68756f !important;
}

html[data-theme="light"] .auth-gate__tabs,
html[data-theme="light"] .auth-gate__field input,
html[data-theme="light"] .auth-gate__menu-item,
html[data-theme="light"] .auth-gate__about-grid article,
html[data-theme="light"] .auth-gate__donation-card {
  background: rgba(255,255,255,.72) !important;
  color: #17362c !important;
  border-color: rgba(111,94,78,.22) !important;
}

html[data-theme="light"] .auth-gate__field input {
  color: #17362c !important;
}

html[data-theme="light"] .auth-gate__field input::placeholder {
  color: rgba(23,54,44,.44) !important;
}

html[data-theme="light"] .auth-gate__tabs button {
  color: #65736c;
}

html[data-theme="light"] .auth-gate__menu-button,
html[data-theme="light"] .auth-gate__info-close {
  background: rgba(255,253,248,.86) !important;
  color: #17362c !important;
  border-color: rgba(111,94,78,.24) !important;
}

html[data-theme="light"] .auth-gate__menu-backdrop {
  background: rgba(38,42,39,.28);
}

html[data-theme="light"] .auth-gate__oauth {
  border-color: rgba(111,94,78,.22);
}

[data-theme-cycle] [data-theme-icon] {
  font-size: 1.15rem;
  line-height: 1;
}

html[data-theme="dark"] body:not(.auth-locked) {
  background: var(--dark-canvas) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(
  .hero h1,.topic-heading h2,.section-heading h2,.topic-copy strong,
  .topic-count strong,.exam-card h3,.progress-block strong,.empty-exams strong,
  .quiz-title>span,.nav-heading>div,.results-hero h1,.review-list strong
) {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(
  .hero-copy>p,.topic-heading>p,.section-heading>p,.topic-copy>span,
  .topic-count small,.exam-card>p,.quiz-title small,.nav-heading small,
  .nav-legend,.results-hero>p,.review-list small
) {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] :is(
  .meter-card,.stats-strip,.results-summary,footer,.topic-card.active,
  .question-grid button.current
) {
  background: var(--dark-brand) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .meter-card,
html[data-theme="dark"] .topic-card.active {
  box-shadow: 12px 14px 0 #101c18, var(--shadow) !important;
}

html[data-theme="dark"] .stats-strip {
  box-shadow: 0 16px 46px rgba(0,0,0,.32) !important;
}

html[data-theme="dark"] .stat-item {
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .stat-item>span {
  background: #24362f !important;
  color: #f2a17b !important;
}

html[data-theme="dark"] .stat-item strong {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .stat-item small {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .available-exams-row {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .available-exams-heading span,
html[data-theme="dark"] .available-exams-kicker,
html[data-theme="dark"] .available-exams-note {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] :is(.topic-card,.exam-card,.search-box,.performance-search) {
  background: var(--dark-surface) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .topic-card:not(.active):hover,
html[data-theme="dark"] .exam-card:hover {
  background: var(--dark-surface-2) !important;
  border-color: #466055 !important;
}

html[data-theme="dark"] .topic-card.active {
  background: linear-gradient(145deg,#13261f,#193229) !important;
  border-color: #365e4d !important;
}

html[data-theme="dark"] .topic-card.active .topic-copy small {
  color: #f1a47b !important;
}

html[data-theme="dark"] .topic-card.active .topic-copy>span,
html[data-theme="dark"] .topic-card.active .topic-count small {
  color: #b7c8c0 !important;
}

html[data-theme="dark"] .search-box input,
html[data-theme="dark"] .performance-search input {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] :is(.search-box input,.performance-search input)::placeholder {
  color: #73867d !important;
}

html[data-theme="dark"] .card-button,
html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .navigator-button {
  background: var(--dark-surface-2) !important;
  color: var(--dark-text) !important;
  border: 1px solid var(--dark-border) !important;
}

html[data-theme="dark"] :is(.card-button,.secondary-button,.navigator-button):hover:not(:disabled) {
  background: var(--dark-surface-3) !important;
  border-color: #50675d !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .mode-intro-shell {
  background: var(--dark-canvas) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .mode-intro-card {
  box-shadow: 0 20px 64px rgba(0,0,0,.36) !important;
}

html[data-theme="dark"] .mode-intro-card :is(h1,h2) {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .mode-intro-card p {
  color: #b7c2bd !important;
}

html[data-theme="dark"] .mode-intro-card .intro-subtitle {
  color: #8fa099 !important;
}

html[data-theme="dark"] .intro-facts {
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .intro-practice {
  background: #18372d !important;
  color: #91cfb3 !important;
}

html[data-theme="dark"] .intro-exam {
  background: #3a271f !important;
  color: #f0a078 !important;
}

html[data-theme="dark"] .quiz-mode-label,
html[data-theme="dark"] .practice-mode-note {
  color: #8fc3ad !important;
}

html[data-theme="dark"] .quiz-shell {
  background: var(--dark-canvas) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .quiz-header {
  background: #111f1a !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .quiz-header .quiz-exit-button {
  background: #1b2924 !important;
  color: #e8eee9 !important;
  border-color: #3a4e45 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .quiz-header .quiz-exit-button:hover {
  background: #24352e !important;
  border-color: #53695f !important;
}

html[data-theme="dark"] .question-nav,
html[data-theme="dark"] .question-panel {
  background: var(--dark-surface) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .question-nav {
  box-shadow: -22px 0 55px rgba(0,0,0,.34) !important;
}

html[data-theme="dark"] .question-content,
html[data-theme="dark"] .question-content :is(p,div,span,strong,b,em,i,li,td,th) {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .question-content [style*="color"] {
  color: inherit !important;
}

html[data-theme="dark"] .question-content :is(td,th) {
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .official-subtopic-badge {
  background: #18332a !important;
  border-color: #315246 !important;
  color: #a6d2bd !important;
}

html[data-theme="dark"] .answer-option .answer-copy,
html[data-theme="dark"] .answer-option .answer-copy :is(p,span,strong,b,em) {
  color: #edf1ed !important;
}

html[data-theme="dark"] .answer-option .answer-copy [style*="color"] {
  color: inherit !important;
}

html[data-theme="dark"] .answer-option.selected:not(.correct):not(.wrong) {
  box-shadow: 0 0 0 2px rgba(108,169,143,.14) !important;
}

html[data-theme="dark"] .answer-option.selected:not(.correct):not(.wrong) .answer-letter {
  background: #396a57 !important;
  color: #fff !important;
  border-color: #79b39a !important;
}

html[data-theme="dark"] .answer-option.correct .answer-letter {
  border-color: #4f8f72 !important;
}

html[data-theme="dark"] .answer-option.wrong .answer-letter {
  background: #a45f4d !important;
  border-color: #a45f4d !important;
  color: #fff !important;
}

html[data-theme="dark"] .feedback-box p,
html[data-theme="dark"] .explanation-copy p {
  color: #b7c2bd !important;
}

html[data-theme="dark"] .correct-answer-text,
html[data-theme="dark"] .explanation-copy strong {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .question-grid button:hover {
  background: #22342d !important;
  border-color: #587267 !important;
}

html[data-theme="dark"] .nav-legend i.current {
  background: #e58b56 !important;
}

html[data-theme="dark"] .results-topbar {
  background: #111f1a !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] :is(.donation-dialog,.support-dialog,.donation-modal,.support-modal) :is(input,textarea,select) {
  background: #1c2a25 !important;
  color: var(--dark-text) !important;
  border-color: #3b5047 !important;
}

html[data-theme="dark"] :is(.admin-header,.admin-tabs,.admin-main,.updates-footer) {
  background: #17251f !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] :is(.admin-card,.admin-kpi,.admin-table-wrap,.updates-item,.admin-user-result) {
  background: #1b2a24 !important;
  color: var(--dark-text) !important;
  border-color: #344a40 !important;
}

html[data-theme="dark"] :is(.admin-field input,.admin-field textarea) {
  background: #101b17 !important;
  color: var(--dark-text) !important;
  border-color: #3a5046 !important;
}

html[data-theme="dark"] :is(.admin-sub,.admin-note-row p,.admin-note-meta,.admin-empty,.updates-item p,.updates-date,.updates-dismiss-help,.updates-dismiss-status) {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] :is(.admin-close,.updates-close,.admin-secondary,.updates-admin-manage) {
  background: #22322c !important;
  color: var(--dark-text) !important;
  border-color: #40564c !important;
}

html[data-theme="dark"] .games-page :is(.stats-strip,.game-card,.game-panel,.topic-card,.mission-node,.game-answer,.name-field input) {
  background: var(--dark-surface) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .games-page .game-panel-header {
  background: linear-gradient(180deg,#1b2924,#17231f) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .games-page :is(.game-panel-header p,.topic-card-copy small,.stat-label,.stats-strip small,.card-meta) {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .games-page :is(.brand-mark,.topic-icon) {
  background: #274138 !important;
  color: #f2a078 !important;
}

html[data-theme="dark"] .games-page .game-card:before {
  opacity: .24;
  filter: saturate(.7) brightness(.65);
}

html[data-theme="dark"] .games-page :is(.topic-card,.mission-node,.game-answer):hover:not(:disabled) {
  background: #20312a !important;
  border-color: #516b60 !important;
}

html[data-theme="dark"] .games-page .topic-card:disabled {
  background: #151f1b !important;
}

html[data-theme="dark"] .games-page .game-answer .answer-letter {
  background: #263832 !important;
  color: #e8eee9 !important;
  border-color: #465c52 !important;
}

html[data-theme="dark"] .games-page :is(.ghost-button,.secondary-button) {
  background: #1d2c26 !important;
  color: var(--dark-text) !important;
  border-color: #3a5046 !important;
}

html[data-theme="dark"] .games-page :is(.ghost-button,.secondary-button):hover {
  background: #26372f !important;
}

html[data-theme="dark"] .games-page .games-footer {
  background: #101c18 !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .games-page :is(.footer-brand-v25 p,.footer-brand-v25>small,.footer-copy-v25 p,.footer-links-v25 button,.footer-bottom-v25) {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .games-page .footer-copy-v25 {
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .games-page .footer-actions-v25 :is(a,button) {
  background: #1c2a25 !important;
  color: var(--dark-text) !important;
  border-color: #3a5046 !important;
}

html[data-theme="dark"] .games-page .footer-actions-v25 .footer-study-v25 {
  background: #285142 !important;
  color: #fff !important;
}

html[data-theme="dark"] ::selection {
  background: #714328;
  color: #fff8f1;
}

html[data-theme="dark"] :is(input,textarea,select) {
  caret-color: #f0a078;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0d1714;
  --paper-deep: #101d18;
  --card: #17231f;
  --muted: #c1cdc7;
  --line: #40544a;
  --rust: #e58b56;
  --rust-dark: #f2a371;
  --blue: #8fbcc6;
  --blue-soft: #183238;
  --green: #8fc2a9;
  --green-soft: #17352b;
  --red: #e4937f;
  --red-soft: #3b2621;
  --dark-canvas: #0d1714;
  --dark-surface: #17231f;
  --dark-surface-2: #1d2c26;
  --dark-surface-3: #24362f;
  --dark-brand: #12251f;
  --dark-border: #40544a;
  --dark-border-soft: #31443b;
  --dark-text: #f7f2ea;
  --dark-muted: #c1cdc7;
  --dark-faint: #9eafa6;
  --dark-copper: #f0a06c;
  --dark-copper-soft: #3b291f;
  --dark-sage: #8fc2a9;
  --dark-sage-soft: #17352b;
}

html[data-theme="dark"] body:not(.auth-locked),
html[data-theme="dark"] :is(.site-shell,.mode-intro-shell,.quiz-shell,.results-shell,.games-page) {
  background-color: var(--dark-canvas) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(
  .hero-copy>p,.topic-heading>p,.section-heading>p,.topic-copy>span,
  .topic-count small,.exam-card>p,.card-meta,.progress-block>div:first-child,
  .quiz-title small,.nav-heading small,.nav-legend,.results-hero>p,
  .review-list small,.available-exams-note,.available-exams-heading span,
  .mode-intro-card p,.intro-subtitle,.footer-brand-v25 p,
  .footer-brand-v25>small,.footer-copy-v25 p,.footer-bottom-v25,
  .drawer-xp-next,.site-menu-sound small,.drawer-sound-panel-v23 p,
  .drawer-sound-panel-v23 small,.rank-dialog small,.rank-rules p,
  .admin-sub,.admin-note-meta,.admin-empty,.updates-date,
  .updates-dismiss-help,.updates-dismiss-status,.hf-study-meta,
  .hf-study-toolbar small,.hf-toc-item small
) {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(
  .section-kicker,.results-kicker,.question-tag,.exam-number,
  .available-exams-kicker,.footer-kicker-v25,.note-editor-head-v25 small
) {
  color: var(--dark-copper) !important;
}

html[data-theme="dark"] :is(
  .meter-card,.stats-strip,.results-summary,footer,.topic-card.active,
  .quiz-header,.results-topbar,.games-topbar,.games-site-header
) {
  background: var(--dark-brand) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] :is(.meter-card,.stats-strip,.results-summary,footer) :where(*) {
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] :is(.meter-label,.meter-note,.stats-strip small,.results-summary span,footer p) {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] :is(
  .topic-card:not(.active),.exam-card,.search-box,.performance-search,
  .empty-exams,.performance-tabs,.development-native-v21,
  .available-exams-row
) {
  background: var(--dark-surface) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .empty-exams {
  border-style: dashed !important;
}

html[data-theme="dark"] .progress-track {
  background: #2a3c34 !important;
}

html[data-theme="dark"] .status-pill.new {
  background: #26362f !important;
  color: #c5d1cb !important;
}

html[data-theme="dark"] .status-pill.complete {
  background: #18382d !important;
  color: #9dd4b7 !important;
}

html[data-theme="dark"] .status-pill:not(.new):not(.complete) {
  background: #18343a !important;
  color: #9bc8d0 !important;
}

html[data-theme="dark"] .development-topic-tag {
  background: #3a321f !important;
  color: #f3cf89 !important;
  border-color: #665633 !important;
}

html[data-theme="dark"] .mode-intro-card {
  background: linear-gradient(180deg,#192720,#15211d) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .intro-facts span {
  background: #203129 !important;
  color: #e8efe9 !important;
  border: 1px solid #3a5147 !important;
}

html[data-theme="dark"] .mode-intro-card .intro-resume {
  background: #3a2a21 !important;
  color: #f0bd9b !important;
  border: 1px solid #654936 !important;
}

html[data-theme="dark"] .exam-mode-buttons .practice-entry {
  background: #1d2c26 !important;
  color: #f4f0e9 !important;
  border-color: #43584e !important;
}

html[data-theme="dark"] .exam-mode-buttons .exam-entry {
  background: #285443 !important;
  color: #ffffff !important;
  border-color: #3e705d !important;
}

html[data-theme="dark"] .exam-timer {
  background: #3b2a21 !important;
  color: #f2c0a0 !important;
  border-color: #704c36 !important;
}

html[data-theme="dark"] .exam-timer strong {
  color: #ffad7d !important;
}

html[data-theme="dark"] .practice-mode-note,
html[data-theme="dark"] .quiz-mode-label {
  color: #9ed0b9 !important;
}

html[data-theme="dark"] .question-panel,
html[data-theme="dark"] .question-nav {
  background: var(--dark-surface) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .question-content,
html[data-theme="dark"] .question-content :is(p,div,span,strong,b,em,i,li,td,th),
html[data-theme="dark"] .answer-copy,
html[data-theme="dark"] .answer-copy :is(p,div,span,strong,b,em,i,li) {
  color: #f8f3ec !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] :is(.question-content,.answer-copy,.explanation-copy,.feedback-copy) [style*="color"] {
  color: inherit !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .question-content :is(table,tbody,thead,tr,td,th) {
  background: transparent !important;
  border-color: #485d53 !important;
}

html[data-theme="dark"] .question-content mark,
html[data-theme="dark"] .answer-copy mark {
  background: #5c4028 !important;
  color: #fff3e8 !important;
}

html[data-theme="dark"] .question-toolbar button {
  color: #becbc4 !important;
}

html[data-theme="dark"] .question-toolbar button.flag-active {
  color: #f0a06c !important;
}

html[data-theme="dark"] .answer-option {
  background: #1d2d27 !important;
  color: #f8f3ec !important;
  border-color: #43584e !important;
}

html[data-theme="dark"] .answer-option:hover:not(:disabled) {
  background: #253830 !important;
  border-color: #658074 !important;
}

html[data-theme="dark"] .answer-option .answer-letter {
  background: #2a3d35 !important;
  color: #f8f3ec !important;
  border-color: #53695f !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .answer-option.selected:not(.correct):not(.wrong) {
  background: #234438 !important;
  border-color: #79ad95 !important;
}

html[data-theme="dark"] .answer-option.correct {
  background: #17382c !important;
  color: #ecf8f1 !important;
  border-color: #639a7f !important;
}

html[data-theme="dark"] .answer-option.wrong {
  background: #402722 !important;
  color: #f8e8e3 !important;
  border-color: #a56554 !important;
}

html[data-theme="dark"] .feedback-box.success {
  border: 1px solid #426f5b !important;
}

html[data-theme="dark"] .feedback-box.error {
  background: #402722 !important;
  color: #f9e8e3 !important;
  border: 1px solid #8e5547 !important;
}

html[data-theme="dark"] .feedback-box :is(strong,.correct-answer-text) {
  color: #fff5ee !important;
}

html[data-theme="dark"] .feedback-box :is(p,.explanation-copy p) {
  color: #d2dcd7 !important;
}

html[data-theme="dark"] .explanation-copy {
  border-color: #5c4035 !important;
}

html[data-theme="dark"] .question-grid button {
  background: #1c2b25 !important;
  color: #d9e2dd !important;
  border-color: #40554b !important;
}

html[data-theme="dark"] .question-grid button.answered {
  background: #19382d !important;
  color: #a5d7bd !important;
  border-color: #4b7864 !important;
}

html[data-theme="dark"] .question-grid button.current {
  background: #e58b56 !important;
  color: #17231f !important;
  border-color: #f0a06c !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .primary-button.rust {
  background: #e58b56 !important;
  color: #18211d !important;
  border-color: #e58b56 !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .primary-button:hover {
  background: #f2a371 !important;
}

html[data-theme="dark"] :is(.secondary-button,.card-button,.navigator-button) {
  background: #1d2c26 !important;
  color: #f5f1ea !important;
  border: 1px solid #40564c !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] :is(.secondary-button,.card-button,.navigator-button):hover:not(:disabled) {
  background: #273a32 !important;
  color: #ffffff !important;
  border-color: #60786c !important;
}

html[data-theme="dark"] .score-ring-track {
  stroke: #293a33 !important;
}

html[data-theme="dark"] .review-list button {
  background: #18261f !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .review-number {
  background: #3d2a21 !important;
  color: #f2aa7e !important;
}

html[data-theme="dark"] :is(.reference-information-v25,.answer-sources,.sound-settings-note-v23) {
  background: #182720 !important;
  color: var(--dark-text) !important;
  border-color: #40564c !important;
}

html[data-theme="dark"] :is(.reference-information-v25,.answer-sources) :where(p,span,strong,summary,a,small) {
  color: #d8e1dc !important;
}

html[data-theme="dark"] :is(.reference-information-v25,.answer-sources) :is(strong,summary,a) {
  color: #9ed0b9 !important;
}

html[data-theme="dark"] .note-editor-v25,
html[data-theme="dark"] .note-editor-head-v25,
html[data-theme="dark"] .note-editor-actions-v25 {
  background: #17241f !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .note-editor-x-v25 {
  background: #22332c !important;
  color: #f5f0e9 !important;
  border-color: #4b6157 !important;
}

html[data-theme="dark"] .note-editor-body-v25 .admin-field,
html[data-theme="dark"] .note-content-label-v25 {
  color: #dce6e0 !important;
}

html[data-theme="dark"] .note-content-label-v25 bdi {
  color: #a9b9b0 !important;
}

html[data-theme="dark"] :is(.activity-confirm-v25,.guest-warning-card) {
  background: #17241f !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .confirm-content-v25 p {
  color: #c4d0ca !important;
}

html[data-theme="dark"] .confirm-symbol-v25 {
  background: #3b2a22 !important;
  color: #f0a06c !important;
}

html[data-theme="dark"] .confirm-stay-v25 {
  background: #285443 !important;
  color: #fff !important;
}

html[data-theme="dark"] .confirm-leave-v25 {
  background: #31241f !important;
  color: #f1b08a !important;
  border-color: #624534 !important;
}

html[data-theme="dark"] .site-menu-drawer .site-menu-header,
html[data-theme="dark"] .site-menu-drawer #siteMenuXpSection,
html[data-theme="dark"] :is(.site-menu-section,.site-menu-link,.site-menu-action,.site-menu-sound,.drawer-xp-card) {
  background: #17241f !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .sound-setting-switch-v23 {
  background: #1d382e !important;
  color: #eef7f2 !important;
  border-color: #507765 !important;
}

html[data-theme="dark"] .sound-setting-switch-v23.is-muted {
  background: #252f2b !important;
  color: #c6d0cb !important;
  border-color: #4b5d55 !important;
}

html[data-theme="dark"] .sound-switch-track-v23 {
  background: #4e8b71 !important;
}

html[data-theme="dark"] .rank-dialog {
  background: #14221c !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .rank-dialog-head button {
  background: #21322b !important;
  color: #f5f0e9 !important;
  border-color: #43594f !important;
}

html[data-theme="dark"] :is(.rank-summary,.rank-row,.rank-dialog .rank-inactivity,#siteMenuRanksView .updates-item) {
  background: #1b2a24 !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .rank-number {
  background: #28463a !important;
  color: #f5f0e9 !important;
}

html[data-theme="dark"] #siteMenuRanksView .donation-qr-wrap {
  background: #f7f7f4 !important;
  border-color: #cfd4cf !important;
  color: #17362c !important;
}

html[data-theme="dark"] #siteMenuRanksView .donation-qr-wrap :where(*) {
  color: #17362c !important;
}

html[data-theme="dark"] .mascot-loading-screen {
  background: #0d1714 !important;
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .mascot-loading-scene-v23 {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .mascot-monologue-v23 {
  background: #24342d !important;
  color: #f6f1e9 !important;
  border-color: #725d39 !important;
}

html[data-theme="dark"] .mascot-monologue-v23:after {
  background: #24342d !important;
  border-color: #725d39 !important;
}

html[data-theme="dark"] .mascot-loading-label-v23 {
  color: #bac7c0 !important;
}

html[data-theme="dark"] :is(
  .hf-study-panel,.hf-page,.hf-study-toolbar,.hf-toc-drawer,.hf-toc-header,
  .hf-toc-item,.hf-study-count,.el-study-panel,.aero-study-panel
) {
  background: #17241f !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] :is(.hf-fullscreen-button,.hf-toc-button,.hf-toc-close) {
  background: #21322b !important;
  color: #f4f0e9 !important;
  border-color: #4b6157 !important;
}

html[data-theme="dark"] :is(.hf-page,.el-study-panel,.aero-study-panel) [style*="color"] {
  color: inherit !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] :is(.hf-page,.el-study-panel,.aero-study-panel) :is(table,td,th) {
  background-color: transparent !important;
  color: #eef3ef !important;
  border-color: #465c52 !important;
}

html[data-theme="dark"] :is(.donation-trigger,.support-trigger,.donation-close,.support-close) {
  background: #21322b !important;
  color: #f4f0e9 !important;
  border-color: #4a6056 !important;
}

html[data-theme="dark"] :is(.donation-dialog,.support-dialog,.donation-modal,.support-modal) {
  background: #17241f !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] :is(.donation-qr-wrap) {
  background: #f7f7f4 !important;
  color: #17362c !important;
}

html[data-theme="dark"] :is(.admin-shell,.updates-shell) {
  background: #101b17 !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] :is(.admin-header,.admin-card,.admin-kpi,.admin-table-wrap,.updates-item,.admin-user-result,.updates-footer) {
  background: #182720 !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .admin-table th {
  background: #21332b !important;
  color: #e7eee9 !important;
}

html[data-theme="dark"] .admin-table td {
  color: #e1e9e4 !important;
  border-color: #384d43 !important;
}

html[data-theme="dark"] :is(.admin-nav-button,.updates-nav-button,.admin-secondary,.updates-admin-manage) {
  background: #22332c !important;
  color: #f5f0e9 !important;
  border-color: #4b6157 !important;
}

html[data-theme="dark"] .admin-danger {
  background: #3a2421 !important;
  color: #f1b3a4 !important;
}

html[data-theme="dark"] .admin-notice {
  background: #3b321f !important;
  color: #f2d18f !important;
}

html[data-theme="dark"] .admin-chip.weak {
  background: #3b2d22 !important;
  color: #efbb91 !important;
}

html[data-theme="dark"] body:not(.auth-locked) .cloud-auth-bar,
html[data-theme="dark"] body:not(.auth-locked) .cloud-modal {
  background: #14221c !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] body:not(.auth-locked) .cloud-account-button {
  background: #21322b !important;
  color: #f5f0e9 !important;
  border-color: #4b6157 !important;
}

html[data-theme="dark"] body:not(.auth-locked) .cloud-notice {
  background: #3a311f !important;
  color: #f0d29a !important;
  border-color: #665632 !important;
}

html[data-theme="dark"] body.games-page {
  background: linear-gradient(180deg,#0d1714 0 18%,#102019 58%,#14261f 100%) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .games-page :is(
  .game-card,.game-panel,.game-answer,.weekly-card,.mission-node,.topic-picker-intro,
  .topic-card,.scenario-card,.stage-card,.result-screen,.rank-row,.stats-strip article,
  .name-field input,.result-tips-v26,.answer-sources
) {
  background: #182720 !important;
  color: var(--dark-text) !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .games-page :is(.game-answer,.mission-node,.topic-card):hover:not(:disabled) {
  background: #22352d !important;
  border-color: #607a6e !important;
}

html[data-theme="dark"] .games-page .answer-letter {
  background: #293b33 !important;
  color: #f6f1ea !important;
  border-color: #53695f !important;
}

html[data-theme="dark"] .games-page .visual-frame {
  background: #e9ece8 !important;
  border-color: #607067 !important;
}

html[data-theme="dark"] .games-page .result-tips-v26 :is(.tips-heading,ol,li) {
  color: #d7e2dc !important;
}

html[data-theme="dark"] .games-page .result-tips-v26 li::marker {
  color: #8fc2a9 !important;
}

html[data-theme="dark"] .games-page #speedTimePill.final-five {
  background: #402722 !important;
  color: #ffb49c !important;
  border-color: #a25f4d !important;
}

html[data-theme="dark"] .games-page .back-link {
  color: #f6f1ea !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(input,textarea,select) {
  background: #13211b !important;
  color: #f5f1ea !important;
  -webkit-text-fill-color: currentColor;
  border-color: #43594f !important;
  caret-color: #f0a06c !important;
  opacity: 1 !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(input,textarea)::placeholder {
  color: #9eafa6 !important;
  -webkit-text-fill-color: currentColor;
  opacity: 1 !important;
}

html[data-theme="dark"] body:not(.auth-locked) select option {
  background: #17241f !important;
  color: #f5f1ea !important;
}

html[data-theme="dark"] body:not(.auth-locked) :is(.site-shell,.quiz-shell,.results-shell,.games-page,.site-menu-drawer) a {
  color: #9ed0b9;
}

html[data-theme="dark"] :is(.question-content,.answer-copy,.hf-page) [style*="color: rgb(0"],
html[data-theme="dark"] :is(.question-content,.answer-copy,.hf-page) [style*="color:#0"],
html[data-theme="dark"] :is(.question-content,.answer-copy,.hf-page) [style*="color: #0"] {
  color: #f8f3ec !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .topic-icon {
  background: #22312c !important;
  color: #efc0a4 !important;
  border: 1px solid #43584e !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .topic-aerodynamics .topic-icon {
  background: #213740 !important;
  color: #9fc5ce !important;
  border-color: #44646e !important;
}

html[data-theme="dark"] .topic-constitution .topic-icon {
  background: #3a2a22 !important;
  color: #e6c4b0 !important;
  border-color: #6a4a3a !important;
}

html[data-theme="dark"] .topic-card.active .topic-icon {
  background: #274239 !important;
  color: #f7efe7 !important;
  border-color: #5f8573 !important;
}

html[data-theme="dark"] .topic-card .topic-copy > span,
html[data-theme="dark"] .topic-card .topic-count > span,
html[data-theme="dark"] .topic-card .topic-count small {
  color: #bdcac4 !important;
}

html[data-theme="dark"] .stat-item > span,
html[data-theme="dark"] .score-pill,
html[data-theme="dark"] .official-subtopic-badge,
html[data-theme="dark"] .answer-letter,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .performance-search {
  background: #1f2e28 !important;
  color: #f3eee6 !important;
  border-color: #43584e !important;
}

html[data-theme="dark"] .official-subtopic-badge span {
  color: #b7c5bf !important;
}

html[data-theme="dark"] .official-subtopic-badge strong {
  color: #9fd2bb !important;
}

html[data-theme="dark"] .score-pill span,
html[data-theme="dark"] .search-box input::placeholder,
html[data-theme="dark"] .performance-search input::placeholder {
  color: #aebbb5 !important;
}

html[data-theme="dark"] :is(.hf-study-tabs,.el-study-tabs,.aero-study-tabs) {
  background: #182620 !important;
  border-color: #3f554b !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(.hf-study-tab,.el-study-tab,.aero-study-tab) {
  background: transparent !important;
  color: #c7d4ce !important;
}

html[data-theme="dark"] :is(.hf-study-tab,.el-study-tab,.aero-study-tab):hover {
  background: #22332c !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .hf-study-tab.is-active {
  background: #285443 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .el-study-tab.is-active {
  background: #315f6d !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .aero-study-tab.is-active {
  background: #264d57 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(.hf-study-hero,.el-study-panel .el-reader-hero,.aero-study-panel .el-reader-hero,.hf-study-toolbar,.hf-study-viewer-shell,.hf-study-viewer) {
  background: #13201b !important;
  border-color: #3f554b !important;
}

html[data-theme="dark"] .hf-viewer-note {
  background: #1d2b25 !important;
  color: #d7e2dc !important;
  border-color: #41574d !important;
}

html[data-theme="dark"] :is(.hf-study-copy p,.el-study-panel .hf-study-copy p,.aero-study-panel .hf-study-copy p,.hf-page figcaption) {
  color: #bfcac5 !important;
}

html[data-theme="dark"] .hf-study-count span {
  color: #b4c3bc !important;
}

html[data-theme="dark"] .pwa-install-panel-v29,
html[data-theme="dark"] .pwa-install-panel-v29 :is(h2,strong) {
  color: #f3eee6 !important;
}

html[data-theme="dark"] .pwa-app-card-v29 {
  background: #1a2822 !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .pwa-app-card-v29 span,
html[data-theme="dark"] .pwa-install-panel-v29 p,
html[data-theme="dark"] .pwa-steps-v29 li,
html[data-theme="dark"] .pwa-install-panel-v29 .pwa-status-v29 {
  color: #c3cdc8 !important;
}

html[data-theme="dark"] .pwa-step-v29 {
  background: #22332c !important;
  color: #f5efe7 !important;
}

html[data-theme="dark"] .pwa-online-note-v29 {
  background: #2b241d !important;
  border-color: #876a45 !important;
}

html[data-theme="dark"] .pwa-online-note-v29 strong {
  color: #f0cb95 !important;
}

html[data-theme="dark"] .pwa-back-v29 {
  background: #1d2c26 !important;
  color: #f5efe7 !important;
  border-color: #40564c !important;
}

html[data-theme="dark"] .site-menu-drawer #siteMenuXpSection {
  background: #17241f !important;
  border-color: #5a4a2f !important;
}

html[data-theme="dark"] .site-menu-drawer .drawer-rank-button {
  background: #2d251d !important;
  color: #f6ead8 !important;
  border-color: #7a5d34 !important;
}

html[data-theme="dark"] .site-menu-drawer .drawer-rank-button:hover {
  background: #392e22 !important;
}

html[data-theme="dark"] .site-menu-drawer .drawer-rank-button .xp-nav-icon {
  background: #c4953b !important;
  color: #2c2112 !important;
}

html[data-theme="dark"] .site-menu-drawer .drawer-rank-button .xp-nav-caption {
  color: #e5c888 !important;
  border-color: #7a5d34 !important;
}

html[data-theme="dark"] .site-menu-drawer .drawer-xp-progress {
  background: #25312b !important;
  border-color: #41574d !important;
}

html[data-theme="dark"] .site-menu-drawer .drawer-xp-progress span {
  background: linear-gradient(90deg,#4e8b71,#79b39a) !important;
}

html[data-theme="dark"] .site-menu-drawer .cloud-account-button {
  background: #17241f !important;
  color: #f5efe7 !important;
  border-color: #40544a !important;
}

html[data-theme="dark"] .menu-header-v20>:is(.header-link,.games-return,.donation-trigger,.support-trigger) {
  background: #19221f !important;
  color: #f7efe7 !important;
  border: 1px solid #3a4943 !important;
  border-radius: 12px !important;
}

html[data-theme="dark"] .menu-header-v20>:is(.header-link,.games-return,.donation-trigger,.support-trigger):hover {
  background: #22312c !important;
  border-color: #546760 !important;
}

html[data-theme="dark"] :is(.site-menu-link,.site-menu-action,.site-menu-sound,.cloud-primary,.cloud-secondary) .menu-icon,
html[data-theme="dark"] .cloud-links button,
html[data-theme="dark"] .cloud-notice {
  color: inherit !important;
}

html[data-theme="dark"] .site-menu-drawer .menu-icon,
html[data-theme="dark"] .cloud-modal .menu-icon {
  background: #22322d !important;
  color: #efb08a !important;
}

html[data-theme="dark"] .feedback-box.wrong,
html[data-theme="dark"] .feedback-box.error,
html[data-theme="dark"] .feedback-box.explanation-feedback {
  background: #402722 !important;
  color: #faece7 !important;
  border-color: #8f5748 !important;
}

html[data-theme="dark"] .feedback-box.success {
  background: #18362b !important;
  color: #eef8f2 !important;
  border-color: #456f5c !important;
}

html[data-theme="dark"] .feedback-box :is(p,strong,.correct-answer-text,.explanation-copy strong,.explanation-copy p) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .next-row .primary-button,
html[data-theme="dark"] .quiz-actions .navigator-button,
html[data-theme="dark"] .quiz-actions .secondary-button {
  box-shadow: none !important;
}

html[data-theme="light"] .menu-header-v20>:is(.header-link,.games-return,.donation-trigger,.support-trigger) {
  background: transparent;
}

html[data-theme="light"] .site-menu-drawer .drawer-rank-button {
  background: #fff5d3;
  color: #484b22;
  border-color: #e5c361;
}

html[data-theme="light"] .site-menu-drawer .drawer-rank-button .xp-nav-icon {
  background: #f2c74f;
}

html[data-theme="dark"] .updates-footer {
  background: #16231e !important;
  border-top-color: #3d5248 !important;
}

html[data-theme="dark"] .updates-dismiss-area {
  background: #182620 !important;
  color: #eef5f1 !important;
  border: 1px solid #43584e !important;
  border-radius: 18px !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .updates-dismiss-area label,
html[data-theme="dark"] .updates-dismiss-area strong,
html[data-theme="dark"] .updates-dismiss-status {
  color: #eef5f1 !important;
}

html[data-theme="dark"] .updates-dismiss-area .updates-dismiss-help {
  color: #b9c7c1 !important;
}

html[data-theme="dark"] .updates-dismiss-area input[type="checkbox"] {
  accent-color: #6fb0c1 !important;
  filter: none !important;
}

























html[data-theme="dark"] .games-page .world-hero .eyebrow,
html[data-theme="dark"] .games-page .world-hint,
html[data-theme="dark"] .games-page .radar-label,
html[data-theme="dark"] .games-page .world-stats small,
html[data-theme="dark"] .games-page .world-stats .stat-label {
  color: #b9d0c6 !important;
}

html[data-theme="dark"] .games-page .world-hero .hero-copy p,
html[data-theme="dark"] .games-page .world-hero .hero-tags span,
html[data-theme="dark"] .games-page .mission-stations .card-copy small,
html[data-theme="dark"] .games-page .world-stats article small {
  color: #d7e4de !important;
}

html[data-theme="dark"] .games-page .world-hint {
  background: #20322a !important;
  border: 1px solid #4a655a !important;
}

html[data-theme="dark"] .games-page #feedback .feedback-box:not(.wrong):not(.error):not(.explanation-feedback):not(.success) {
  background: #18362b !important;
  color: #eef8f2 !important;
  border: 1px solid #456f5c !important;
  border-right-color: #6ba084 !important;
}

html[data-theme="dark"] .games-page #feedback .feedback-box:not(.wrong):not(.error):not(.explanation-feedback):not(.success) :is(p,strong,.correct-answer-text,.study-citations-v26,.study-citations-v26 *,a) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] #drawerRanksBack,
html[data-theme="dark"] .site-menu-close {
  background: #192823 !important;
  color: #f4efe8 !important;
  border: 1px solid #40544a !important;
  box-shadow: none !important;
  background-image: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

html[data-theme="dark"] #drawerRanksBack:hover,
html[data-theme="dark"] #drawerRanksBack:focus-visible,
html[data-theme="dark"] .site-menu-close:hover,
html[data-theme="dark"] .site-menu-close:focus-visible {
  background: #22342d !important;
  color: #ffffff !important;
  border-color: #597066 !important;
}

html[data-theme="dark"] #drawerRanksBack::before,
html[data-theme="dark"] #drawerRanksBack::after,
html[data-theme="dark"] .site-menu-close::before,
html[data-theme="dark"] .site-menu-close::after {
  display: none !important;
}

html[data-theme="dark"] #drawerRanksBack svg,
html[data-theme="dark"] .site-menu-close svg {
  color: currentColor !important;
  stroke: currentColor !important;
}

:root {
  --brand-surface: #12241f;
  --surface-raised: #fffdf7;
  --surface-hover: #f3eee4;
  --on-brand: #ffffff;
  --action-blue: #2b6475;
  --action-green: #285f50;
  --focus-ring: #2b6475;
}

html[data-theme="dark"] {
  --ink: #f7f2ea;
  --brand-surface: #12251f;
  --surface-raised: #1d2c26;
  --surface-hover: #24362f;
  --on-brand: #f7f2ea;
  --action-blue: #315f6d;
  --action-green: #285443;
  --focus-ring: #91c9d7;
}

html[data-theme="light"] .auth-gate :is(.auth-gate__hero h1,.auth-gate__about-copy h3,.auth-gate__donation-card h3) {
  color: #17362c !important;
}

html[data-theme="light"] .auth-gate :is(.auth-gate__lead,.auth-gate__demo-note,.auth-gate__about-grid span,.auth-gate__info-tabs button) {
  color: #4f635a !important;
}

html[data-theme="light"] .auth-gate :is(.auth-gate__eyebrow,.auth-gate__info-brand strong,.auth-gate__about-grid strong,.auth-gate__menu-item-icon,.auth-gate__menu-item-arrow) {
  color: #97522e !important;
}

html[data-theme="light"] .auth-gate :is(.auth-gate__chips span,.auth-gate__info-tabs) {
  background: #e8e4d9 !important;
  color: #244d40 !important;
  border-color: #c8c8ba !important;
}

html[data-theme="light"] .auth-gate .auth-gate__menu-item-icon {
  background: #f2e4d6 !important;
}

html[data-theme="light"] .auth-gate :is(.auth-gate__tabs button,.auth-gate__info-tabs button).is-active {
  color: #19251f !important;
}

html[data-theme="light"] .auth-gate .auth-gate__message {
  color: #7c4a24 !important;
}

html[data-theme="light"] .auth-gate .auth-gate__message.is-error {
  color: #a23530 !important;
}

html[data-theme="light"] .auth-gate .auth-gate__message.is-success {
  color: #216344 !important;
}

html[data-theme="light"] .auth-gate .auth-gate__or::before,
html[data-theme="light"] .auth-gate .auth-gate__or::after {
  background: #c3c8bf !important;
}

html[data-theme="light"] .auth-gate .auth-gate__field input::placeholder {
  color: #67786e !important;
}

html[data-theme="dark"] .auth-gate :is(.auth-gate__oauth,.auth-gate__field input) {
  background: #1d2c26 !important;
  color: #f7f2ea !important;
  border-color: #4c6157 !important;
}

html[data-theme="dark"] .auth-gate :is(.auth-gate__demo-note,.auth-gate__or,.auth-gate__menu-item-copy small) {
  color: #b8c6bf !important;
}

html[data-theme="dark"] .auth-gate .auth-gate__field input::placeholder {
  color: #a8bab0 !important;
}

html[data-theme="dark"] .updates-shell,
html[data-theme] body.auth-locked .updates-shell {
  --updates-bg: #14221c;
  --updates-card: #1d2e25;
  --updates-text: #f7f2ea;
  --updates-muted: #c1cdc7;
  color-scheme: dark;
  background: var(--updates-bg) !important;
  color: var(--updates-text) !important;
  border-color: #435a4e !important;
}

html[data-theme="dark"] .updates-shell .updates-item,
html[data-theme] body.auth-locked .updates-shell .updates-item,
html[data-theme="dark"] .updates-shell .updates-dismiss-area,
html[data-theme] body.auth-locked .updates-shell .updates-dismiss-area {
  background: var(--updates-card) !important;
  color: var(--updates-text) !important;
  border-color: #435a4e !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .updates-shell .updates-footer,
html[data-theme] body.auth-locked .updates-shell .updates-footer {
  background: var(--updates-bg) !important;
  border-color: #435a4e !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .updates-shell :is(h2,h3,strong,label,label span),
html[data-theme] body.auth-locked .updates-shell :is(h2,h3,strong,label,label span) {
  color: var(--updates-text) !important;
}

html[data-theme="dark"] .updates-shell :is(p,small,.updates-date,.updates-dismiss-help,.updates-dismiss-status),
html[data-theme] body.auth-locked .updates-shell :is(p,small,.updates-date,.updates-dismiss-help,.updates-dismiss-status) {
  color: var(--updates-muted) !important;
}

html[data-theme="dark"] .updates-shell :is(.updates-close,.updates-admin-manage),
html[data-theme] body.auth-locked .updates-shell :is(.updates-close,.updates-admin-manage) {
  background: #263a30 !important;
  color: var(--updates-text) !important;
  border-color: #536c5f !important;
}

html[data-theme="dark"] .updates-shell .updates-new-badge,
html[data-theme] body.auth-locked .updates-shell .updates-new-badge {
  background: #254d3d !important;
  color: #b9e3cc !important;
}

html[data-theme="dark"] .updates-shell input[type="checkbox"],
html[data-theme] body.auth-locked .updates-shell input[type="checkbox"] {
  color-scheme: dark;
  accent-color: #91c9d7 !important;
}

html[data-theme="dark"] .updates-shell .updates-dismiss-status.error,
html[data-theme] body.auth-locked .updates-shell .updates-dismiss-status.error {
  color: #ffb5a6 !important;
}

html[data-theme="dark"] .updates-shell .updates-dismiss-status.saved,
html[data-theme] body.auth-locked .updates-shell .updates-dismiss-status.saved {
  color: #a8dcbf !important;
}











html[data-theme="dark"] .topic-section .topic-aerodynamics:not(.active) .topic-copy small {
  color: #a8d1dc !important;
}

html[data-theme="dark"] .topic-section .topic-constitution:not(.active) .topic-copy small {
  color: #e6b18e !important;
}





html[data-theme="dark"] .hero-status {
  background: #22342b !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .development-native-v21 .development-tabs-v21 {
  background: #182620 !important;
  border-color: #43594e !important;
}

html[data-theme="dark"] .development-tabs-v21>button {
  background: transparent !important;
  color: #cfdbd4 !important;
}

html[data-theme="dark"] .development-tabs-v21>button[aria-selected="true"] {
  background: #285443 !important;
  color: #fff !important;
}

html[data-theme="dark"] .games-page .world-hero {
  background: radial-gradient(ellipse at 20% 100%,#2c4635 0 28%,transparent 29%),radial-gradient(ellipse at 55% 110%,#29483d 0 42%,transparent 43%),linear-gradient(130deg,#183b36,#1b4049 48%,#213a2e) !important;
  color: #f7f2ea !important;
  border-color: #496b60 !important;
}

html[data-theme="dark"] .games-page .world-hero::before {
  opacity: .16;
}

html[data-theme="dark"] .games-page .world-hero h1 {
  color: #f7f2ea !important;
}

html[data-theme="dark"] .games-page .world-hero h1 em {
  color: #acdcd4 !important;
}

html[data-theme="dark"] .games-page .world-hero .hero-tags span {
  background: #ffffff0d !important;
  color: #e1eee8 !important;
  border-color: #557669 !important;
}

html[data-theme="dark"] .games-page .world-primary {
  background: #284c3b !important;
  color: #f4f4e7 !important;
  border-color: #6c8868 !important;
  box-shadow: 0 5px 0 #10261b !important;
}

html[data-theme="dark"] .games-page .world-primary:hover {
  background: #346047 !important;
}

html[data-theme="dark"] .games-page :is(.mascot-reply,.companion-bubble) {
  background: #263b30 !important;
  color: #f7f2ea !important;
  border-color: #758357 !important;
}

html[data-theme="dark"] .games-page .mission-stations .game-card {
  background: linear-gradient(180deg,var(--station-light),#182720 60%) !important;
  border-color: var(--station-line) !important;
}

html[data-theme="dark"] .games-page .mission-stations .card-troubleshoot {
  --accent: #efb88f;
  --station-light: #3b2e20;
  --station-line: #745437;
  --station-base: #8a491f;
}

html[data-theme="dark"] .games-page .mission-stations .card-speed {
  --accent: #a7d5eb;
  --station-light: #203641;
  --station-line: #436a7d;
  --station-base: #286784;
}

html[data-theme="dark"] .games-page .mission-stations .card-weekly {
  --accent: #c5dba5;
  --station-light: #2c3923;
  --station-line: #59763d;
  --station-base: #44612d;
}

html[data-theme="dark"] .games-page .mission-stations .card-mission {
  --accent: #dbc0ed;
  --station-light: #332a41;
  --station-line: #705981;
  --station-base: #6b4787;
}

html[data-theme="dark"] .games-page .mission-stations .card-examiner {
  --accent: #c8d4c6;
  --station-light: #2b382e;
  --station-line: #596e5c;
  --station-base: #455e49;
}

html[data-theme="dark"] .games-page .mission-stations :is(.card-kicker,.station-kicker,.card-number,.card-meta) {
  color: var(--accent) !important;
}

html[data-theme="dark"] .games-page .mission-stations .station-cta {
  color: #ffffff !important;
  background: var(--station-base) !important;
}

html[data-theme="dark"] .games-page .level-article {
  background: #263023 !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .games-page :is(.xp-track,.result-gauge) {
  background-color: #2a3b32 !important;
}

html[data-theme="dark"] .games-page .result-gauge {
  background: conic-gradient(#8fc2a9 var(--gauge,0%),#2a3b32 0) !important;
}

html[data-theme="dark"] .games-page :is(.mission-index,.mission-topic-banner,.result-xp,.rank-toast,.sound-toggle,.speed-flash) {
  background: #23392e !important;
  color: #d6e7dc !important;
  border-color: #4c6758 !important;
  text-shadow: none !important;
}

html[data-theme="dark"] .games-page .speed-flash--bad {
  color: #ffb5a6 !important;
}

html[data-theme="dark"] .games-page .speed-flash--time {
  color: #b8e6f3 !important;
}

html[data-theme="dark"] .games-page .mission-node.passed .mission-index {
  background: #35634b !important;
  color: #fff !important;
}

html[data-theme="dark"] .games-page .game-answer.correct {
  background: #17382c !important;
  color: #eef8f3 !important;
  border-color: #639a7f !important;
}

html[data-theme="dark"] .games-page .game-answer.wrong {
  background: #402722 !important;
  color: #f9e8e3 !important;
  border-color: #a56554 !important;
}

html[data-theme="dark"] .games-page .game-answer.correct .answer-letter {
  background: #35634b !important;
  color: #fff !important;
}

html[data-theme="dark"] .games-page .game-answer.wrong .answer-letter {
  background: #884939 !important;
  color: #fff !important;
}

html[data-theme="dark"] .games-page .feedback-box {
  background: #18362b !important;
  color: #eef8f2 !important;
  border-color: #6ba084 !important;
}

html[data-theme="dark"] .games-page .feedback-box.wrong {
  background: #402722 !important;
  color: #faece7 !important;
  border-color: #a56554 !important;
}

html[data-theme="dark"] .games-page .feedback-box :is(p,strong,a,summary,.source-disclaimer) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

html[data-theme="dark"] .games-page .primary-button:not(.rust) {
  background: #285443 !important;
  color: #ffffff !important;
  border-color: #6a9481 !important;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .games-page .primary-button:not(.rust):hover {
  background: #346650 !important;
}

html[data-theme="dark"] .games-page .rank-dialog-head {
  background: #14221c !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(.hf-study-copy h3,.hf-toc-header strong,.google-signin-copy strong) {
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(.hf-study-copy small,.hf-study-count strong,.hf-toc-page,.hf-toc-page-button) {
  color: #a8d8c3 !important;
}

html[data-theme="dark"] :is(.hf-toc-page,.hf-toc-page-button,.support-icon,.guest-warning-actions button,.guest-warning-actions a,.stage-navigation .back-step-button) {
  background: #233b30 !important;
  color: #d9ece0 !important;
  border-color: #486757 !important;
}

html[data-theme="dark"] :is(.hf-toc-item:hover,.hf-fullscreen-button:hover) {
  background: #284438 !important;
  color: #fff !important;
}

html[data-theme="dark"] :is(.hf-study-viewer-shell.is-fullscreen,.hf-study-viewer-shell:fullscreen) {
  background: #13201b !important;
}

html[data-theme="dark"] :is(.rank-rules,.rank-step,.rank-row,.google-signin-copy small,.cloud-help,.cloud-history p,.guest-warning-card p,.site-menu-drawer .exam-services-note) {
  color: #bacbc1 !important;
}

html[data-theme="dark"] .rank-row.current {
  background: #263f30 !important;
  color: #f3f7ef !important;
  border-color: #7ca68a !important;
}

html[data-theme="dark"] .rank-row.unlocked {
  color: #b9e0c3 !important;
}

html[data-theme="dark"] .rank-toast {
  background: #3c321e !important;
  color: #f9e1a5 !important;
}

html[data-theme="dark"] .cloud-modal .cloud-close {
  color: #d8e6de !important;
}

html[data-theme="dark"] .cloud-modal .cloud-status {
  color: #a8dcbf !important;
}

html[data-theme="dark"] .cloud-modal :is(.cloud-header small,.cloud-secondary) {
  color: #f0ad89 !important;
}

html[data-theme="dark"] :is(.admin-tab,.admin-kpi span,.admin-user-result small) {
  color: #c1cdc7 !important;
}

html[data-theme="dark"] .admin-tab.active {
  background: #285443 !important;
  color: #fff !important;
}

html[data-theme="dark"] .admin-kpi strong {
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(.admin-chip,.admin-success,.admin-chip.muted) {
  background: #233b30 !important;
  color: #d3e8dd !important;
}

html[data-theme="dark"] :is(.auth-message.success) {
  background: #17382c !important;
  color: #c5ebd6 !important;
}

html[data-theme="dark"] :is(.auth-message.error) {
  background: #402722 !important;
  color: #f9d4c9 !important;
}

html[data-theme="dark"] .support-mail-button {
  background: #285f50 !important;
  color: #fff !important;
}

html[data-theme="dark"] .donation-qr-wrap :is(span,p,strong,small) {
  color: #244339 !important;
}

html[data-theme="dark"] :is(.reference-information-v25,.answer-sources) .source-disclaimer {
  color: #b7c8be !important;
}

html[data-theme="dark"] .reference-information-v25>strong {
  color: #a8d8c3 !important;
}

html[data-theme="dark"] .site-menu-drawer .exam-service-link svg {
  color: #a8d8c3 !important;
}

html[data-theme] :is(button,input,textarea,select) {
  -webkit-text-fill-color: currentColor;
}

html[data-theme] :is(button,a,input,textarea,select):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

html[data-theme="dark"] :is(.question-content,.answer-copy,.explanation-copy,.feedback-copy) mark {
  background: #624729 !important;
  color: #fff5e7 !important;
}

html[data-theme="light"] {
  --muted: #59665f;
}

html[data-theme="light"] :is(.status-pill.new,.feedback-box p) {
  color: #526159 !important;
}

html[data-theme="light"] :is(.site-menu-link,.site-menu-action) .menu-kicker,
html[data-theme="light"] :is(.google-signin-copy small,.rank-step,.rank-row,.updates-date,.hf-study-count span) {
  color: #52665a !important;
}

html[data-theme="light"] .games-page .rank-row small.rank-step {
  color: #52665a !important;
}

html[data-theme="light"] .site-menu-drawer .drawer-rank-button .xp-nav-icon {
  color: #604511 !important;
}

html[data-theme="light"] .hf-study-copy small {
  color: #216b57 !important;
}

html[data-theme="light"] .development-eyebrow {
  color: #6c5a30 !important;
}

html[data-theme="light"] .development-dossier p {
  color: #526159 !important;
}

html[data-theme="light"] .auth-gate :is(p.auth-gate__sub,.auth-gate__switch,.auth-gate__or,.auth-gate__menu-item-copy small) {
  color: #4f635a !important;
}

html[data-theme="light"] .games-page .world-hero .eyebrow {
  color: #285b48 !important;
}

html[data-theme="light"] .games-page .world-hero .hero-copy p {
  color: #304f42 !important;
}

html[data-theme="light"] .games-page .world-hero h1 em {
  color: #205a57 !important;
}

html[data-theme="light"] .games-page .section-heading .eyebrow {
  color: #a5422b !important;
}

html[data-theme="light"] .games-page .level-open>span {
  color: #795b18 !important;
}

html[data-theme="light"] .games-page .mission-stations .card-copy small {
  color: #4a6054 !important;
}

html[data-theme="light"] .games-page .mission-stations .card-examiner {
  --accent: #52634f;
}

html[data-theme="light"] .games-page .card-troubleshoot .station-cta {
  background: #995021 !important;
}

html[data-theme="light"] .games-page .card-speed .station-cta {
  background: #286b8d !important;
}

html[data-theme="light"] .games-page .card-weekly .station-cta {
  background: #466b2f !important;
}

html[data-theme="light"] .games-page .card-mission .station-cta {
  background: #765191 !important;
}

html[data-theme="light"] .games-page .card-examiner .station-cta {
  background: #536b50 !important;
}

html[data-theme="light"] .games-page .station-emblem {
  color: #0d201a !important;
}

html[data-theme="dark"] .games-page .station-emblem {
  background: linear-gradient(145deg,var(--station-base),#172b22) !important;
  color: #fff !important;
}

html[data-theme="dark"] .games-page .level-open>span {
  color: #efce87 !important;
}

html[data-theme="dark"] .development-dossier {
  background: #1d2c26 !important;
  border-color: #4e6152 !important;
}

html[data-theme="dark"] .development-dossier .development-eyebrow {
  color: #dbc88f !important;
}

html[data-theme="dark"] .development-dossier .development-stamp {
  color: #efb091 !important;
}

html[data-theme="dark"] .development-dossier p {
  color: #c1cdc7 !important;
}

html[data-theme="dark"] .answer-option.correct .answer-letter {
  background: #35634b !important;
  color: #fff !important;
}

html[data-theme="dark"] .cloud-modal {
  background: #14221c !important;
  color: var(--ink) !important;
}

/* V46: one selection language and a permanent progress palette.
   Light-mode brown matches the published Constitution card (#70452f).
   Progress colors depend only on the theme, never the selected topic. */
html[data-theme="light"] {
  --topic-selected-bg: #70452f;
  --topic-selected-border: #70452f;
  --topic-selected-text: #fffaf5;
  --topic-selected-muted: #f1ded1;
  --topic-selected-accent: #ffc4a9;
  --topic-selected-icon: #ffffff1a;
  --topic-selected-line: #ffffff38;
  --topic-selected-shadow: 0 9px 0 #ddd3c2, 0 18px 44px #472d181c;
  --progress-surface: #70452f;
  --progress-text: #fffaf5;
  --progress-muted: #f1ded1;
  --progress-accent: #ffd0af;
  --progress-line: #a17d65;
  --progress-icon: #5e3827;
}
html[data-theme="dark"] {
  --topic-selected-bg: #533c2e;
  --topic-selected-border: #d6a277;
  --topic-selected-text: #fff5e8;
  --topic-selected-muted: #efdbc7;
  --topic-selected-accent: #ffd3a7;
  --topic-selected-icon: #77543c;
  --topic-selected-line: #a7815e;
  --topic-selected-shadow: 0 0 0 2px #d6a27730, 0 8px 0 #101b16, 0 16px 38px #00000030;
  --progress-surface: #29312c;
  --progress-text: #f7f2e9;
  --progress-muted: #c9cec5;
  --progress-accent: #efb58d;
  --progress-line: #596459;
  --progress-icon: #39473b;
}
html[data-theme] #root .topic-section .topic-card.active {
  background: var(--topic-selected-bg) !important;
  color: var(--topic-selected-text) !important;
  border-color: var(--topic-selected-border) !important;
  box-shadow: var(--topic-selected-shadow) !important;
}
html[data-theme="dark"] #root .topic-section .topic-card.active {
  outline: 1px solid var(--topic-selected-border);
  outline-offset: 0;
}
html[data-theme] #root .topic-section .topic-card.active :is(.topic-copy strong,.topic-count strong,.topic-count>span) {
  color: var(--topic-selected-text) !important;
}
html[data-theme] #root .topic-section .topic-card.active :is(.topic-copy>span,.topic-count small) {
  color: var(--topic-selected-muted) !important;
}
html[data-theme] #root .topic-section .topic-card.active .topic-copy small {
  color: var(--topic-selected-accent) !important;
}
html[data-theme] #root .topic-section .topic-card.active .topic-icon {
  background: var(--topic-selected-icon) !important;
  color: #ffe1cd !important;
  border-color: var(--topic-selected-line) !important;
  box-shadow: none !important;
}
html[data-theme] #root .topic-section .topic-card.active .topic-count {
  border-color: var(--topic-selected-line) !important;
}
html[data-theme] #root .topic-section .topic-card:focus-visible {
  outline: 3px solid var(--focus-ring) !important;
  outline-offset: 5px !important;
}
html[data-theme] #root :is(.hero .meter-card.available-exams-card,.stats-strip) {
  background: var(--progress-surface) !important;
  color: var(--progress-text) !important;
  border-color: var(--progress-line) !important;
}
html[data-theme] #root :is(.available-exams-heading strong,.stat-item strong) {
  color: var(--progress-text) !important;
}
html[data-theme] #root :is(.available-exams-kicker,.available-exams-heading span,.available-exams-note,.stat-item small) {
  color: var(--progress-muted) !important;
}
html[data-theme] #root .available-exams-row {
  background: transparent !important;
  color: var(--progress-text) !important;
  border: 0 !important;
}
html[data-theme] #root .available-exams-row>span { color: var(--progress-text) !important; }
html[data-theme] #root .available-exams-row>b { color: var(--progress-accent) !important; }
html[data-theme] #root :is(.available-exams-list,.stat-item) {
  border-color: var(--progress-line) !important;
}
html[data-theme] #root .stat-item>span {
  background: var(--progress-icon) !important;
  color: var(--progress-accent) !important;
  border-color: var(--progress-line) !important;
}
html[data-theme="dark"] #root .hero .meter-card.available-exams-card {
  box-shadow: 8px 10px 0 #111c17, 0 20px 42px #00000038 !important;
}
html[data-theme] #root .topic-section .topic-card.active .topic-count>.development-topic-tag {
  background: var(--topic-selected-icon) !important;
  color: var(--topic-selected-text) !important;
  border-color: var(--topic-selected-line) !important;
}

/* V47 — the authoritative color layer. Layered important declarations replace
   legacy color overrides without changing layout, interaction or animation.
   Foregrounds, surfaces and feedback states have separate semantic tokens. */
@layer merkaz-palette-v47 {
  html[data-theme="light"] {
    --canvas-base: #fff0dc !important;
    --canvas-gradient: radial-gradient(ellipse at 8% 0%,#ffe2be 0%,transparent 56%),linear-gradient(135deg,#ffe8cd 0%,#fff0dd 52%,#fff7eb 100%) !important;
    --surface: #fff9ef !important;
    --surface-2: #f8ead8 !important;
    --surface-3: #f0ddc6 !important;
    --surface-line: #d9bfa2 !important;
    --text: #44362d !important;
    --text-muted: #6a5545 !important;
    --accent: #805019 !important;
    --accent-soft: #f6dfbf !important;
    --hero-coral: #cd603e !important;
    --success-bg: #e3eddf !important;
    --success-ink: #31543a !important;
    --success-line: #6e9770 !important;
    --error-bg: #f8e1d7 !important;
    --error-ink: #893f32 !important;
    --error-line: #b66a54 !important;
    --warning-bg: #f6e6c9 !important;
    --warning-ink: #735019 !important;
    --footer-bg: #542c17 !important;
    --footer-ink: #fff0dc !important;
    --gold-shadow: 12px 14px 0 #f4c79e,0 20px 46px #82431626 !important;
    --selection-shadow: 0 8px 0 #e8c7a8,0 14px 32px #7c471126 !important;
    --panel-shadow: 0 12px 34px #68401c14 !important;
  }
  html[data-theme="dark"] {
    --canvas-base: #242933 !important;
    --canvas-gradient: radial-gradient(ellipse at 12% 0%,#2c313e 0%,transparent 60%),linear-gradient(150deg,#222731 0%,#262b35 58%,#20242e 100%) !important;
    --surface: #2b303b !important;
    --surface-2: #323744 !important;
    --surface-3: #3b404c !important;
    --surface-line: #56555a !important;
    --text: #f6efe5 !important;
    --text-muted: #d0c6b9 !important;
    --accent: #dfb47c !important;
    --accent-soft: #483b2e !important;
    --hero-coral: #e97f57 !important;
    --success-bg: #293f36 !important;
    --success-ink: #cce5cf !important;
    --success-line: #759c7b !important;
    --error-bg: #493039 !important;
    --error-ink: #ffd1c3 !important;
    --error-line: #b87870 !important;
    --warning-bg: #493b28 !important;
    --warning-ink: #f3d49a !important;
    --footer-bg: #1d212b !important;
    --footer-ink: #e2d5c4 !important;
    --gold-shadow: 12px 14px 0 #554339,0 24px 48px #10131b60 !important;
    --selection-shadow: 0 0 0 2px #e2a46636,0 8px 0 #191d26,0 16px 38px #11131c50 !important;
    --panel-shadow: 0 14px 36px #11131b32 !important;
    --dark-canvas: var(--canvas-base) !important;
    --dark-surface: var(--surface) !important;
    --dark-surface-2: var(--surface-2) !important;
    --dark-surface-3: var(--surface-3) !important;
    --dark-brand: var(--surface-2) !important;
    --dark-border: var(--surface-line) !important;
    --dark-border-soft: var(--surface-line) !important;
    --dark-text: var(--text) !important;
    --dark-muted: var(--text-muted) !important;
    --dark-faint: var(--text-muted) !important;
    --dark-copper: var(--accent) !important;
    --dark-copper-soft: var(--accent-soft) !important;
    --dark-sage: var(--success-ink) !important;
    --dark-sage-soft: var(--success-bg) !important;
  }
  html[data-theme] {
    --amber-base: #763000 !important;
    --amber-gradient: radial-gradient(ellipse at 94% 100%,#a55712 0%,#94460699 24%,transparent 53%),linear-gradient(135deg,#803700 0%,#692600 48%,#7d3300 100%) !important;
    --amber-button: linear-gradient(110deg,#893b00 0%,#a14a00 62%,#af560d 100%) !important;
    --amber-button-hover: linear-gradient(110deg,#773000 0%,#944000 58%,#a9530c 100%) !important;
    --amber-text: #fff9ee !important;
    --amber-muted: #fff0dd !important;
    --amber-line: #c6945a80 !important;
    --selection-gradient: linear-gradient(130deg,#743005 0%,#813805 52%,#9c4d12 100%) !important;
    --paper: var(--canvas-base) !important;
    --paper-deep: var(--surface-3) !important;
    --ink: var(--text) !important;
    --muted: var(--text-muted) !important;
    --line: var(--surface-line) !important;
    --card: var(--surface) !important;
    --rust: var(--accent) !important;
    --rust-dark: var(--accent) !important;
    --blue: var(--accent) !important;
    --blue-soft: var(--accent-soft) !important;
    --green: var(--success-ink) !important;
    --green-soft: var(--success-bg) !important;
    --red: var(--error-ink) !important;
    --red-soft: var(--error-bg) !important;
    --brand-surface: var(--amber-base) !important;
    --on-brand: var(--amber-text) !important;
    --drawer-bg: var(--surface) !important;
    --drawer-line: var(--surface-line) !important;
    --drawer-ink: var(--text) !important;
    --drawer-muted: var(--text-muted) !important;
    --drawer-accent: var(--accent) !important;
    --drawer-accent-2: var(--hero-coral) !important;
    --focus-ring: var(--accent) !important;
    --shadow: var(--panel-shadow) !important;
    --topic-selected-bg: var(--selection-gradient) !important;
    --topic-selected-border: #d29354 !important;
    --topic-selected-text: var(--amber-text) !important;
    --topic-selected-muted: var(--amber-muted) !important;
    --topic-selected-accent: var(--amber-text) !important;
    --topic-selected-icon: #ffffff0d !important;
    --topic-selected-line: var(--amber-line) !important;
    --topic-selected-shadow: var(--selection-shadow) !important;
    --progress-surface: var(--amber-gradient) !important;
    --progress-text: var(--amber-text) !important;
    --progress-muted: var(--amber-muted) !important;
    --progress-accent: var(--amber-text) !important;
    --progress-line: var(--amber-line) !important;
    --progress-icon: #552600 !important;
    background: var(--canvas-base) !important;
    color: var(--text) !important;
  }
  html[data-theme] body,
  html[data-theme] body.games-page {
    --paper: var(--canvas-base) !important;
    --card: var(--surface) !important;
    --ink: var(--text) !important;
    background: var(--canvas-gradient) !important;
    color: var(--text) !important;
  }
  html[data-theme] :is(.site-shell,.mode-intro-shell,.quiz-shell,.results-shell,.games-shell,.games-site-header,.games-account-bar,.cloud-auth-bar) {
    background: transparent !important;
    color: var(--text) !important;
    border-color: var(--surface-line) !important;
  }
  html[data-theme] :is(.hero h1,.hero h1 em,.world-hero h1,.world-hero h1 em) { color:var(--hero-coral) !important; }
  html[data-theme] :is(.hero-copy>p,.topic-heading>p,.section-heading>p,.results-hero>p,.card-meta,.exam-card>p,.score-ring small,.account-email) { color:var(--text-muted) !important; }
  html[data-theme] :is(.eyebrow,.section-kicker,.results-kicker,.exam-number,.question-tag,.topic-copy small,.footer-kicker-v25) { color:var(--accent) !important; }
  html[data-theme] :is(.brand,.brand-link,.topic-heading h2,.section-heading h2,.topic-copy strong,.topic-count strong,.exam-card h3,.progress-block strong,.quiz-title>span,.nav-heading>div,.results-hero h1,.review-list strong,.mode-intro-card h1,.mode-intro-card h2) { color:var(--text) !important; }
  html[data-theme] .topbar>.brand { color:var(--accent) !important; }
  html[data-theme] :is(.topbar,.quiz-header,.results-topbar) { border-color:var(--surface-line) !important; }
  html[data-theme] :is(.quiz-header,.results-topbar) { background:var(--surface) !important; color:var(--text) !important; }
  html[data-theme] .hero-visual::after { background:#dca36824 !important; }
  html[data-theme] .orbit { border-color:#db9a54 !important; }
  html[data-theme] .orbit-two { background:#db9a54 !important; }

  /* Neutral surfaces and controls in every screen. */
  html[data-theme] :is(.topic-card,.exam-card,.search-box,.performance-search,.empty-exams,.question-panel,.question-nav,.review-list button,.mode-intro-card,.game-panel,.game-card,.weekly-card,.topic-picker-intro,.mission-node,.scenario-card,.stage-card,.result-screen,.level-article,.games-note,.result-tips-v26,.development-dossier,.hf-study-panel,.el-study-panel,.aero-study-panel,.hf-card,.hf-section,.material-card,.material-section) {
    background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; box-shadow:var(--panel-shadow) !important;
  }
  html[data-theme] :is(.topic-card:not(.active),.exam-card,.mission-node,.game-answer):hover:not(:disabled):not(.correct):not(.wrong) { background:var(--surface-2) !important; border-color:var(--accent) !important; }
  html[data-theme] :is(.topic-copy>span,.topic-count small,.card-copy small,.topic-card-copy small,.game-panel-header p,.games-note p,.weekly-card p,.result-screen p,.stat-label,.game-card .card-meta,.mode-intro-card p,.intro-subtitle,.review-list small,.nav-heading small,.nav-legend,.rank-rules,.rank-rules p,.rank-step,.rank-dialog small,.cloud-help,.cloud-history p) { color:var(--text-muted) !important; }
  html[data-theme] :is(.primary-button,.primary-button.rust,.exam-entry,.cloud-primary,.admin-primary,.updates-confirm,.confirm-stay-v25,.guest-primary,.support-mail-button,.footer-study-v25,.world-primary,.station-cta,.pwa-native-install-v29,.auth-gate__primary,.auth-gate__donation-button,.merkaz-games-launcher) {
    background:var(--amber-button) !important; color:var(--amber-text) !important; border-color:#c4813c !important; -webkit-text-fill-color:currentColor !important;
    box-shadow:0 9px 24px #8a3a0026 !important;
  }
  html[data-theme] :is(.primary-button,.cloud-primary,.admin-primary,.updates-confirm,.world-primary,.auth-gate__primary,.merkaz-games-launcher):hover { background:var(--amber-button-hover) !important; }
  html[data-theme] :is(.primary-button,.world-primary,.station-cta,.merkaz-games-launcher) :is(span,strong,b,small) { color:inherit !important; }
  html[data-theme] :is(.secondary-button,.card-button,.navigator-button,.ghost-button,.practice-entry,.site-hamburger,.site-menu-close,#drawerRanksBack,.merkaz-launcher-close,.quiz-exit-button,.donation-trigger,.support-trigger,.header-link,.games-return,.donation-close,.support-close,.cloud-account-button,.cloud-close,.admin-close,.admin-secondary,.updates-close,.updates-admin-manage,.hf-fullscreen-button,.hf-toc-button,.hf-toc-close,.hf-toc-page-button,.pwa-back-v29,.sound-toggle,.google-signin-menu) {
    background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; box-shadow:none !important;
  }
  html[data-theme] :is(.secondary-button,.card-button,.navigator-button,.ghost-button,.site-menu-action,.site-menu-link,.site-hamburger,.site-menu-close,.google-signin-menu):hover { background:var(--surface-2) !important; border-color:var(--accent) !important; }
  html[data-theme] :is(.topic-icon,.brand-bolt,.brand-mark,.review-number,.official-subtopic-badge,.stage-badge,.score-pill,.intro-facts span,.intro-icon,.hf-study-count,.hf-toc-page,.support-icon,.confirm-symbol-v25,.development-topic-tag,.world-hint,.hero-tags span,.mission-topic-banner,.mission-index,.result-xp,.rank-number,.xp-nav-icon) {
    background:var(--accent-soft) !important; color:var(--accent) !important; border-color:var(--surface-line) !important;
  }
  html[data-theme] :is(.score-pill span,.official-subtopic-badge span,.hf-study-count span,.mission-topic-banner span) { color:var(--text-muted) !important; }
  html[data-theme] :is(.official-subtopic-badge strong,.hf-study-count strong,.level-open>span,.topic-arrow) { color:var(--accent) !important; }
  html[data-theme] :is(.status-pill.new,.status-pill:not(.complete),.performance-tabs,.hf-study-tabs,.el-study-tabs,.aero-study-tabs,.development-tabs-v21) { background:var(--surface-2) !important; color:var(--text-muted) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.hf-study-tab,.el-study-tab,.aero-study-tab,.performance-tabs button,.development-tabs-v21>button,.admin-tab) { background:transparent !important; color:var(--text-muted) !important; }
  html[data-theme] :is(.hf-study-tab,.el-study-tab,.aero-study-tab).is-active,
  html[data-theme] :is(.performance-tabs,.development-tabs-v21)>button[aria-selected="true"],
  html[data-theme] .admin-tab.active { background:var(--amber-button) !important; color:var(--amber-text) !important; box-shadow:none !important; }
  html[data-theme] :is(.progress-track,.xp-track,.top-progress) { background:var(--surface-3) !important; }
  html[data-theme] :is(.progress-track span,.progress-fill,.top-progress span,.xp-track span,.drawer-xp-progress span) { background:linear-gradient(90deg,#a44c10,#d49953) !important; }
  html[data-theme] .score-ring-track { stroke:var(--surface-3) !important; }
  html[data-theme] .score-ring-value { stroke:#d28b4b !important; }
  html[data-theme] .score-ring span { color:var(--accent) !important; }

  /* Selected topics use the amber family in both themes. */
  html[data-theme] #root .topic-section .topic-card.active {
    background:var(--selection-gradient) !important; color:var(--amber-text) !important; border-color:#d6a269 !important; box-shadow:var(--selection-shadow) !important;
  }
  html[data-theme] #root .topic-section .topic-card.active :is(.topic-copy strong,.topic-copy small,.topic-copy>span,.topic-count strong,.topic-count>span,.topic-count small) { color:var(--amber-text) !important; }
  html[data-theme] #root .topic-section .topic-card.active :is(.topic-icon,.development-topic-tag) { background:#ffffff0d !important; color:#fff6e6 !important; border-color:var(--amber-line) !important; }
  html[data-theme] #root .topic-section .topic-card.active .topic-count { border-color:var(--amber-line) !important; }

  /* Reference gradient: dark upper-left, warm amber glow at lower-right. */
  html[data-theme] #root :is(.hero .meter-card.available-exams-card,.stats-strip),
  html[data-theme] .results-summary {
    background:var(--amber-gradient) !important; color:var(--amber-text) !important; border-color:var(--amber-line) !important;
  }
  html[data-theme] #root .hero .meter-card.available-exams-card { box-shadow:var(--gold-shadow) !important; isolation:isolate; }
  html[data-theme] #root .hero .meter-card.available-exams-card::before {
    content:""; position:absolute; inset:0; border-radius:inherit; background:url('/assets/amber-dust-v47.svg') center / 100% 100% no-repeat; pointer-events:none; z-index:-1;
  }
  html[data-theme] #root :is(.available-exams-heading strong,.available-exams-row,.available-exams-row>span,.available-exams-row>b,.stat-item strong),
  html[data-theme] .results-summary strong { color:var(--amber-text) !important; }
  html[data-theme] #root :is(.available-exams-kicker,.available-exams-heading span,.available-exams-note,.stat-item small),
  html[data-theme] .results-summary span { color:var(--amber-muted) !important; }
  html[data-theme] #root .available-exams-row { background:transparent !important; border:0 !important; }
  html[data-theme] #root :is(.available-exams-list,.stat-item) { border-color:var(--amber-line) !important; }
  html[data-theme] #root .stat-item>span { background:#542800 !important; color:var(--amber-text) !important; border-color:var(--amber-line) !important; }
  html[data-theme] .stats-strip.world-stats { background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .world-stats article { background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .world-stats .level-article { background:var(--surface-2) !important; }
  html[data-theme] .world-stats :is(.stat-label,small) { color:var(--text-muted) !important; }

  /* Menus, dialogs and shared forms. */
  html[data-theme] :is(.site-menu-drawer,.site-menu-header,.site-menu-section,.site-menu-link,.site-menu-action,.site-menu-sound,.drawer-xp-card,#siteMenuXpSection,.drawer-sound-panel-v23,.sound-settings-note-v23,.rank-dialog,.rank-dialog-head,.rank-row,.cloud-modal,.donation-dialog,.support-dialog,.activity-confirm-v25,.guest-warning-card,.note-editor-v25,.note-editor-head-v25,.note-editor-actions-v25,.admin-shell,.admin-header,.admin-tabs,.admin-card,.admin-kpi,.admin-table-wrap,.admin-user-result,.pwa-app-card-v29) {
    background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important;
  }
  html[data-theme] :is(.site-menu-section h3,.site-menu-link .menu-main,.site-menu-action .menu-main,.google-signin-copy strong,.drawer-sound-panel-v23 h2,.pwa-install-panel-v29 h2,.pwa-install-panel-v29 strong,.rank-dialog h2,.cloud-header h2,.admin-kpi strong,.note-content-label-v25) { color:var(--text) !important; }
  html[data-theme] :is(.menu-kicker,.site-menu-sound small,.drawer-xp-next,.drawer-sound-panel-v23 p,.drawer-sound-panel-v23 small,.google-signin-copy small,.pwa-install-panel-v29 p,.pwa-steps-v29 li,.pwa-app-card-v29 span,.admin-sub,.admin-note-meta,.admin-note-row p,.admin-user-result small,.admin-kpi span,.admin-empty,.guest-warning-card p,.confirm-content-v25 p,.donation-copy p,.support-content p,.exam-services-note,.rank-step) { color:var(--text-muted) !important; }
  html[data-theme] :is(.site-menu-drawer .menu-icon,.cloud-modal .menu-icon,.rank-summary,.drawer-rank-button,.xp-nav-button,.rank-row.current,.rank-inactivity,.sound-setting-switch-v23,.pwa-step-v29,.rank-toast,.intro-resume,.exam-timer) { background:var(--accent-soft) !important; color:var(--accent) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.xp-nav-caption,.drawer-rank-button .xp-nav-icon,.rank-summary small,.rank-summary>span,.rank-row.current,.rank-row.current .rank-step,.exam-timer strong,.cloud-secondary,.cloud-header small,.cloud-links button,.support-email,.donation-thanks,.note-editor-head-v25 small) { color:var(--accent) !important; }
  html[data-theme] :is(.drawer-xp-progress,.sound-switch-track-v23) { background:var(--surface-3) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .sound-setting-switch-v23:not(.is-muted) .sound-switch-track-v23 { background:#a46121 !important; }
  html[data-theme] :is(.sound-setting-switch-v23.is-muted,.sound-toggle.is-muted) { background:var(--surface-2) !important; color:var(--text-muted) !important; }
  html[data-theme] :is(.cloud-notice,.admin-notice,.pwa-online-note-v29) { background:var(--warning-bg) !important; color:var(--warning-ink) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .pwa-online-note-v29 :is(p,strong) { color:var(--warning-ink) !important; }
  html[data-theme] :is(input,textarea,select) { background:var(--surface-2) !important; color:var(--text) !important; -webkit-text-fill-color:currentColor !important; border-color:var(--surface-line) !important; caret-color:var(--accent) !important; }
  html[data-theme] :is(input,textarea)::placeholder { color:var(--text-muted) !important; -webkit-text-fill-color:currentColor !important; opacity:1 !important; }
  html[data-theme] :is(.search-box,.performance-search) input { background:transparent !important; }
  html[data-theme] input[type="checkbox"] { accent-color:#b26622 !important; }
  html[data-theme] .admin-table th { background:var(--surface-2) !important; color:var(--text) !important; }
  html[data-theme] .admin-table td { color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.admin-chip,.admin-chip.muted) { background:var(--surface-2) !important; color:var(--text-muted) !important; }
  html[data-theme] .admin-chip.weak { background:var(--warning-bg) !important; color:var(--warning-ink) !important; }
  html[data-theme] :is(.admin-field,.note-editor-body-v25 .admin-field) { color:var(--text) !important; }
  html[data-theme] .updates-new-badge { background:var(--accent-soft) !important; color:var(--accent) !important; }
  html[data-theme] :is(.site-menu-drawer .exam-service-link svg,.hf-study-copy small,.hf-study-count strong,.hf-toc-page,.hf-toc-page-button,.quiz-mode-label,.practice-mode-note) { color:var(--accent) !important; }

  /* Welcome screen retains the aircraft photo under matching glass panels. */
  html[data-theme="light"] .auth-gate { background:linear-gradient(135deg,#ffe5c8e8,#fff7edd6),url('/assets/login-aircraft-bg.jpg') center / cover no-repeat !important; color:var(--text) !important; }
  html[data-theme="dark"] .auth-gate { background:linear-gradient(135deg,#20242eef,#292e39e0),url('/assets/login-aircraft-bg.jpg') center / cover no-repeat !important; color:var(--text) !important; }
  html[data-theme] .auth-gate__noise { background:radial-gradient(circle at 20% 10%,#db8a4020,transparent 40%) !important; mix-blend-mode:normal !important; }
  html[data-theme] :is(.auth-gate__brand,.auth-gate__card,.auth-gate__info-panel,.auth-gate__menu-item,.auth-gate__about-grid article,.auth-gate__donation-card) { background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; box-shadow:var(--panel-shadow) !important; }
  html[data-theme] :is(.auth-gate__brand--minimal h1,.auth-gate__section-kicker,.auth-gate__info-brand strong,.auth-gate__about-grid strong,.auth-gate__menu-item-icon,.auth-gate__menu-item-arrow,.auth-gate__detail-back,.auth-gate__link,.auth-gate__ghost,.auth-gate__switch button) { color:var(--accent) !important; }
  html[data-theme] :is(.auth-gate__card h2,.auth-gate__hero h1,.auth-gate__menu-view h3,.auth-gate__about-copy h3,.auth-gate__donation-card h3,.auth-gate__menu-item-copy strong,.auth-gate__field span) { color:var(--text) !important; }
  html[data-theme] :is(.auth-gate__sub,.auth-gate__lead,.auth-gate__demo-note,.auth-gate__about-copy p,.auth-gate__about-grid span,.auth-gate__donation-card p,.auth-gate__menu-item-copy small,.auth-gate__switch,.auth-gate__or,.auth-gate__info-panel li) { color:var(--text-muted) !important; }
  html[data-theme] :is(.auth-gate__menu-button,.auth-gate__info-close,.auth-gate__oauth) { background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.auth-gate__tabs,.auth-gate__info-tabs,.auth-gate__chips span,.auth-gate__menu-item-icon) { background:var(--surface-2) !important; color:var(--accent) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.auth-gate__tabs button,.auth-gate__info-tabs button) { color:var(--text-muted) !important; }
  html[data-theme] :is(.auth-gate__tabs button,.auth-gate__info-tabs button).is-active { background:var(--amber-button) !important; color:var(--amber-text) !important; }
  html[data-theme] .auth-gate__message { color:var(--accent) !important; }
  html[data-theme] .auth-gate__message.is-success { color:var(--success-ink) !important; }
  html[data-theme] .auth-gate__message.is-error { color:var(--error-ink) !important; }
  html[data-theme] .auth-gate__or::before,
  html[data-theme] .auth-gate__or::after { background:var(--surface-line) !important; }
  html[data-theme] :is(.auth-gate__menu-backdrop,.site-menu-backdrop,.cloud-modal-wrap,.admin-overlay,.updates-overlay,.guest-warning-modal) { background:#141820b8 !important; }

  /* Landing updates remain a dark, readable card in both modes. */
  html[data-theme] .updates-shell { background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .updates-shell :is(.updates-item,.updates-dismiss-area,.updates-footer) { background:var(--surface-2) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .updates-shell :is(h2,h3,strong,label,label span) { color:var(--text) !important; }
  html[data-theme] .updates-shell :is(p,small,.updates-date,.updates-dismiss-help,.updates-dismiss-status) { color:var(--text-muted) !important; }
  html[data-theme] body.auth-locked .updates-shell {
    --surface:#292e39 !important; --surface-2:#343946 !important; --text:#f6efe5 !important; --text-muted:#d0c6b9 !important; --surface-line:#60574e !important;
    --success-ink:#cce5cf !important; --error-ink:#ffd1c3 !important; --accent:#dfb47c !important; --accent-soft:#483b2e !important;
    background:var(--surface) !important; color:var(--text) !important;
  }

  /* Study/exam content and semantic answer colors. */
  html[data-theme] :is(.hf-study-hero,.el-reader-hero,.hf-study-toolbar,.hf-toc-drawer,.hf-toc-header,.hf-toc-item,.hf-study-viewer,.hf-study-viewer-shell,.reference-information-v25,.answer-sources,.note-editor-x-v25) { background:var(--surface-2) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.hf-study-copy h3,.hf-toc-header strong,.hf-toc-item,.hf-study-toolbar small) { color:var(--text) !important; }
  html[data-theme] :is(.hf-study-copy p,.hf-toc-header small,.hf-toc-item small,.hf-page figcaption,.reference-item-v25 p,.source-disclaimer) { color:var(--text-muted) !important; }
  html[data-theme] .hf-viewer-note { background:var(--surface) !important; color:var(--text-muted) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.reference-information-v25>strong,.answer-sources summary,.answer-sources a) { color:var(--accent) !important; }
  html[data-theme] :is(.question-content,.answer-copy,.question-content p,.question-content span,.answer-copy p,.answer-copy span,.game-question) { color:var(--text) !important; -webkit-text-fill-color:currentColor !important; }
  html[data-theme] :is(.answer-option,.game-answer,.question-grid button) { background:var(--surface-2) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(.answer-letter,.answer-option .answer-letter,.game-answer .answer-letter) { background:var(--surface-3) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .answer-option.selected:not(.correct):not(.wrong) { background:var(--accent-soft) !important; border-color:var(--accent) !important; box-shadow:inset -4px 0 0 var(--accent) !important; }
  html[data-theme] .answer-option.selected:not(.correct):not(.wrong) .answer-letter,
  html[data-theme] .question-grid button.current { background:var(--amber-button) !important; color:var(--amber-text) !important; border-color:#c58b50 !important; -webkit-text-fill-color:currentColor !important; }
  html[data-theme] :is(.answer-option.correct,.game-answer.correct,.feedback-box,.feedback-box.success,.question-grid button.answered,.status-pill.complete,.admin-success,.auth-message.success) { background:var(--success-bg) !important; color:var(--success-ink) !important; border-color:var(--success-line) !important; }
  html[data-theme] :is(.answer-option.wrong,.game-answer.wrong,.feedback-box.wrong,.feedback-box.error,.feedback-box.explanation-feedback,.auth-message.error,.admin-danger) { background:var(--error-bg) !important; color:var(--error-ink) !important; border-color:var(--error-line) !important; }
  html[data-theme] :is(.answer-option.correct,.game-answer.correct) .answer-letter { background:#45684a !important; color:#fffaf0 !important; border-color:var(--success-line) !important; }
  html[data-theme] :is(.answer-option.wrong,.game-answer.wrong) .answer-letter { background:#854637 !important; color:#fffaf0 !important; border-color:var(--error-line) !important; }
  html[data-theme] .feedback-box :is(p,strong,span,.correct-answer-text,.explanation-copy,.explanation-copy p,.explanation-copy strong) { color:inherit !important; -webkit-text-fill-color:currentColor !important; }
  html[data-theme] :is(.cloud-status,.rank-row.unlocked,.mission-node.passed .mission-status,.updates-dismiss-status.saved) { color:var(--success-ink) !important; }
  html[data-theme] :is(.updates-dismiss-status.error,.speed-flash--bad) { color:var(--error-ink) !important; }
  html[data-theme] .confirm-leave-v25 { background:var(--error-bg) !important; color:var(--error-ink) !important; border-color:var(--error-line) !important; }

  /* Games share the palette; only correctness feedback uses sage or rose. */
  html[data-theme] .games-page .world-hero { background:radial-gradient(ellipse at 85% 90%,#b7753320,transparent 64%),var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; box-shadow:var(--panel-shadow) !important; }
  html[data-theme] .games-page .world-hero .eyebrow { color:var(--accent) !important; }
  html[data-theme] .games-page .world-hero .hero-copy p { color:var(--text-muted) !important; }
  html[data-theme] .games-page .hero-tags span { background:var(--accent-soft) !important; color:var(--accent) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .games-page :is(.mascot-reply,.companion-bubble) { background:var(--surface-2) !important; color:var(--text) !important; border-color:var(--accent) !important; }
  html[data-theme] .games-page .radar-label { color:var(--text-muted) !important; }
  html[data-theme] .games-page .world-companion .hero-instrument { background:radial-gradient(circle,#292d37 0 67%,#6f4d2f 68%) !important; border-color:#c69661 !important; }
  html[data-theme] .games-page .radar-sweep { background:conic-gradient(from 0deg,transparent 0 280deg,#f0b87730 327deg,#ffd29880 358deg,transparent) !important; }
  html[data-theme] .games-page .mission-stations .game-card { --station-base:#9d5b26 !important; --station-line:var(--surface-line) !important; --accent:var(--text-muted) !important; background:linear-gradient(160deg,var(--surface-2),var(--surface) 68%) !important; }
  html[data-theme] .games-page .mission-stations :is(.station-kicker,.card-number,.card-meta,.card-copy small) { color:var(--text-muted) !important; }
  html[data-theme] .games-page .station-emblem { background:var(--amber-button) !important; color:var(--amber-text) !important; border-color:#bd854c !important; }
  html[data-theme] .games-page .station-cta { background:var(--amber-button) !important; color:var(--amber-text) !important; }
  html[data-theme] .games-page .game-panel-header { background:var(--surface-2) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .games-page .scenario-banner { background:var(--amber-gradient) !important; color:var(--amber-text) !important; }
  html[data-theme] .games-page .scenario-banner p { color:var(--amber-muted) !important; }
  html[data-theme] .games-page .system-meter span.active { background:#edbc7e !important; }
  html[data-theme] .games-page .result-gauge { background:conic-gradient(#d09355 var(--gauge,0%),var(--surface-3) 0) !important; }
  html[data-theme] .games-page .result-gauge::after { background:var(--surface) !important; }
  html[data-theme] :is(.result-tips-v26 .tips-heading,.result-tips-v26 ol,.result-tips-v26 li,.development-dossier p) { color:var(--text-muted) !important; }
  html[data-theme] :is(.development-eyebrow,.development-lock,.development-stamp,.tips-heading,.score-unit-v26) { color:var(--accent) !important; }
  html[data-theme] .games-page :is(.speed-flash,.speed-flash--time) { background:var(--surface) !important; color:var(--accent) !important; text-shadow:none !important; }
  html[data-theme] .games-page .speed-flash--bad { color:var(--error-ink) !important; }
  html[data-theme] .games-page #speedTimePill.final-five { background:var(--error-bg) !important; color:var(--error-ink) !important; border-color:var(--error-line) !important; }
  html[data-theme] :is(footer,.games-footer) { background:var(--footer-bg) !important; color:var(--footer-ink) !important; border-color:var(--surface-line) !important; }
  html[data-theme] :is(footer,.games-footer) :is(p,small,.footer-bottom-v25,.footer-links-v25 button) { color:var(--footer-ink) !important; }
  html[data-theme] .games-footer .games-shell { color:var(--footer-ink) !important; }
  html[data-theme] .footer-actions-v25 :is(a,button) { background:var(--amber-button) !important; color:var(--amber-text) !important; border-color:#ad774c !important; }
  html[data-theme] :is(.mascot-loading-screen,.transition-loader) { background:var(--canvas-gradient) !important; color:var(--text-muted) !important; }
  html[data-theme] :is(.transition-loader-panel,.mascot-monologue-v23,.mascot-monologue-v23::after) { background:var(--surface) !important; color:var(--text) !important; border-color:var(--surface-line) !important; }
  html[data-theme] .mascot-loading-label-v23 { color:var(--text-muted) !important; }
  /* Keep scannable codes and technical source artwork accurate. */
  html[data-theme] .donation-qr-wrap { background:#fff9ef !important; color:#543e29 !important; }
  html[data-theme] .donation-qr-wrap :is(span,p,strong,small) { color:#543e29 !important; }
  html[data-theme] .games-page .visual-frame { background:#fff9ef !important; }
  html[data-theme] :is(button,a,input,textarea,select):focus-visible { outline:2px solid var(--accent) !important; outline-offset:3px !important; }
}
