@import url('/theme-components.css');

html[data-theme="night"] {
  --theme-bg:#101b28; --theme-surface:#203443; --theme-surface-raised:#293e4f;
  --theme-surface-soft:#192c3a; --theme-input:#132633; --theme-text:#e5f0f3;
  --theme-muted:#acc3d0; --theme-border:#405d6d; --theme-accent:#a0e0cd;
  --theme-accent-ink:#153b34; --theme-accent-soft:#2c504e; --theme-gold:#e5cc92;
  --theme-gold-soft:#303831; --theme-success:#a4e1bd; --theme-success-soft:#23483c;
  --theme-danger:#ffb9b1; --theme-danger-soft:#503139; --theme-violet:#30354b;
  --theme-glow:#294d574a; --theme-glow-alt:#52487733; --theme-shadow:#00000024;
  --theme-overlay:#06121fce;
  --chart-1:#a0e0cd;--chart-2:#e5cc92;--chart-3:#e9acc0;--chart-4:#bcb0ee;--chart-5:#9ecbe9;
}
html[data-theme="day"] {
  --theme-bg:#f3f8f7; --theme-surface:#ffffff; --theme-surface-raised:#f0f6f5;
  --theme-surface-soft:#e7f0ee; --theme-input:#ffffff; --theme-text:#243e49;
  --theme-muted:#506974; --theme-border:#c4d8d4; --theme-accent:#27675b;
  --theme-accent-ink:#ffffff; --theme-accent-soft:#d9ece5; --theme-gold:#735621;
  --theme-gold-soft:#f8f1df; --theme-success:#256744; --theme-success-soft:#e1f0e7;
  --theme-danger:#a8303b; --theme-danger-soft:#fbe8e9; --theme-violet:#f0eff9;
  --theme-glow:#92c9bb26; --theme-glow-alt:#bdb1de1f; --theme-shadow:#294a3e0d;
  --theme-overlay:#18303f70;
  --chart-1:#27675b;--chart-2:#806023;--chart-3:#a34d65;--chart-4:#6b4b97;--chart-5:#276a98;
}
html[data-theme] { --green:var(--theme-accent); --muted:var(--theme-muted); --border:var(--theme-border); --paper:var(--theme-surface); }
html[data-theme] {--control-height:46px;}

@media screen {
  html[data-theme] body, html[data-theme] .startup-app,
  html[data-theme] .startup-app.home-lobby,
  html[data-theme] :is(.public-student,.student-discovery,.character-design-preview,.certificate-route,.premium-route) {
    background:radial-gradient(ellipse at 13% 12%,var(--theme-glow),transparent 45%),radial-gradient(ellipse at 91% 42%,var(--theme-glow-alt),transparent 45%),var(--theme-bg)!important;
    color:var(--theme-text)!important;
  }
  html[data-theme] :is(.page,.main-shell,.practice-reader,.quiz-page,.adventure-page) { background:transparent!important;color:var(--theme-text)!important; }
  html[data-theme] .adventure-page {--gold:var(--theme-gold);--violet:var(--theme-accent);}
  html[data-theme] :is(h1,h2,h3,h4,legend) {color:var(--theme-text)!important;}
  html[data-theme] :is(.muted,.fine,.eyebrow,.game-demo-note,.registration-status,.course-meta,.chapter-description,.media-credits,.quest-reset,.quest-note,.lobby-footnote,.lobby-empty,.lobby-loading,.date) {color:var(--theme-muted)!important;}
  html[data-theme] a {color:var(--theme-accent);}
  html[data-theme] :is(.brand,.tru-brand strong,.discovery-brand,.premium-brand,.chapter-award-brand) {color:var(--theme-accent)!important;}
  html[data-theme] :is(.tru-brand small,.brand small) {color:var(--theme-muted)!important;}
  html[data-theme] :is(.panel,.stat,.course-card,.child-card,.plan,.chapter-choice,.subject-choice,.category-choice,.question-card,.editor-question,.review-item,.modal,.parent-registration,.pwa-dialog,.purchase-dialog,.avatar-controls,.shop-card,.profile-form,.profile-preview,.constellation-chart-card,.discovery-search,.discovery-card,.public-award-card) {
    background:var(--theme-surface)!important;border-color:var(--theme-border)!important;color:var(--theme-text)!important;box-shadow:0 8px 26px var(--theme-shadow)!important;
  }
  html[data-theme] :is(.menu-spark,.demo-note,.config-note,.registration-context,.chapter-intro,.reward-intro,.shop-banner,.hero,.onboarding,.draft-resume,.audio-box,.practice-explanation,.explanation,.chapter-benefit-note,.hijab-outfit-note) {background:var(--theme-surface-soft)!important;border-color:var(--theme-border)!important;color:var(--theme-text)!important;}
  html[data-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea,.json-editor) {background:var(--theme-input)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;caret-color:var(--theme-accent);}
  html[data-theme] input::placeholder,html[data-theme] textarea::placeholder {color:var(--theme-muted)!important;opacity:1;}
  html[data-theme] input:is([type="checkbox"],[type="radio"]) {accent-color:var(--theme-accent);}
  html[data-theme] :is(label,.field,.consent,.legal-consent,.answer-radio) {color:var(--theme-text)!important;}
  html[data-theme] :is(.primary,.game-primary,.lobby-primary,.course-button,.discovery-search form>button) {background:var(--theme-accent)!important;color:var(--theme-accent-ink)!important;border-color:var(--theme-accent)!important;box-shadow:none!important;}
  html[data-theme] :is(.primary,.game-primary,.lobby-primary,.course-button) :is(strong,span,small) {color:inherit!important;}
  html[data-theme] :is(.secondary,.lobby-secondary,.header-account-button,.pwa-install-button,.icon-button,.chart-mode button,.atelier-category-tabs button,.shop-tabs button) {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;box-shadow:none!important;}
  html[data-theme] :is(.text-button,.lobby-text,.lobby-back) {color:var(--theme-accent)!important;}
  html[data-theme] :is(.top-navigation,.shop-tabs,.quiz-dock) {background:var(--theme-bg)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .app-header {background:var(--theme-bg)!important;border-color:var(--theme-border)!important;box-shadow:0 2px 15px var(--theme-shadow)!important;}
  html[data-theme] .top-navigation button {color:var(--theme-muted)!important;background:transparent!important;}
  html[data-theme] .top-navigation button>svg {color:var(--theme-accent)!important;background:var(--theme-surface)!important;}
  html[data-theme] :is(.top-navigation button.active,.grade-tabs button.active,.category-tabs button.active,.atelier-category-tabs button.selected,.shop-tabs button.selected,.chart-mode button.active,.lobby-subjects button[aria-pressed="true"]) {background:var(--theme-accent-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-accent)!important;}
  html[data-theme] :is(.student-companion,.companion-character,.daily-quests,.companion-wallet,.companion-performance,.companion-certificate-count) {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] :is(.avatar-stage,.avatar-display,.shop-try-on,.character-preview-hero,.character-preview-options,.avatar-studio-asset) {background:radial-gradient(ellipse at 50% 30%,var(--theme-surface-raised),var(--theme-surface-soft))!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .home-avatar .avatar-stage {background:none!important;border:0!important;}
  html[data-theme] .avatar-nameplate {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;}
  html[data-theme] .atelier-portrait-grid button:not(.color-swatch) {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .atelier-portrait-grid button.selected:not(.color-swatch) {background:var(--theme-gold-soft)!important;border-color:var(--theme-gold)!important;}
  html[data-theme] :is(.answer-option,.practice-options li,.editor-options,.option-letter) {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] :is(.answer-option.chosen,.answer-option:has(input:checked)) {background:var(--theme-accent-soft)!important;border-color:var(--theme-accent)!important;}
  html[data-theme] :is(.practice-options li.correct,.review-item.correct,.result-card:not(.failed),.score.good,.done-badge) {background:var(--theme-success-soft)!important;color:var(--theme-success)!important;border-color:var(--theme-success)!important;}
  html[data-theme] :is(.error,.audio-error,.danger,.review-item.wrong,.result-card.failed) {color:var(--theme-danger)!important;}
  html[data-theme] :is(.toast,.constellation-tooltip,.lobby-tooltip,.recharts-default-tooltip) {background:var(--theme-surface-raised)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] :is(table,th,td,.ledger-row,.activity-row,.exercise-row,.skill-row,.link-list) {color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] :is(th,thead) {background:var(--theme-surface-soft)!important;color:var(--theme-muted)!important;}
  html[data-theme] .recharts-text,html[data-theme] .recharts-text tspan {fill:var(--theme-muted)!important;}
  html[data-theme] .recharts-wrapper text {fill:var(--theme-muted)!important;}
  html[data-theme] .recharts-label {fill:var(--theme-text)!important;}
  html[data-theme] .recharts-cartesian-grid line,html[data-theme] .recharts-polar-grid path {stroke:var(--theme-border)!important;}
  html[data-theme] .recharts-radar-polygon {stroke:var(--theme-accent)!important;fill:var(--theme-accent)!important;}
  html[data-theme] .recharts-radar-polygon path {stroke:var(--theme-accent)!important;fill:var(--theme-accent)!important;}
  html[data-theme] .recharts-bar-rectangle path {fill:var(--theme-accent)!important;}
  html[data-theme] .recharts-tooltip-wrapper :is(span,p,strong,small) {color:var(--theme-text)!important;}
  html[data-theme] .progress-track,html[data-theme] .lobby-progress-track,html[data-theme] .companion-score-track {background:var(--theme-border)!important;}
  html[data-theme] .progress-track>span,html[data-theme] .lobby-progress-track>span,html[data-theme] .companion-score-track>span {background:var(--theme-accent)!important;}
  html[data-theme] .game-home {--lobby-border:var(--theme-border);--lobby-muted:var(--theme-muted);--lobby-mint:var(--theme-accent);color:var(--theme-text);}
  html[data-theme] .family-player,html[data-theme] :is(.lobby-character,.lobby-inventory,.lobby-player-grid>.lobby-performance,.lobby-chapter) {background:linear-gradient(145deg,var(--theme-surface-raised),var(--theme-surface))!important;border-color:var(--theme-border)!important;}
  html[data-theme] .family-player:nth-child(even) {background:linear-gradient(145deg,var(--theme-violet),var(--theme-surface))!important;}
  html[data-theme] .family-player-portrait {background:radial-gradient(ellipse at 50% 38%,var(--theme-glow),transparent 70%)!important;}
  html[data-theme] .game-home .lobby-heading h1 em,html[data-theme] .lobby-eyebrow {color:var(--theme-accent)!important;}
  html[data-theme] :is(.lobby-skill,.lobby-small-stats>div,.lobby-shortcuts>button,.lobby-shortcuts>button>span,.player-class) {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .lobby-performance-row>div {background:var(--theme-border)!important;}
  html[data-theme] .lobby-performance-row i {background:var(--theme-accent)!important;}
  html[data-theme] .lobby-performance-row.untrained strong {color:var(--theme-muted)!important;}
  html[data-theme] .mission-route button {background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .mission-route button.done {background:var(--theme-success-soft)!important;color:var(--theme-success)!important;border-color:var(--theme-success)!important;}
  html[data-theme] .mission-route button.next {background:var(--theme-accent)!important;color:var(--theme-accent-ink)!important;border-color:var(--theme-accent)!important;}
  html[data-theme] .mission-route button.attempted {background:var(--theme-gold-soft)!important;color:var(--theme-gold)!important;border-color:var(--theme-gold)!important;}
  html[data-theme] .game-home :is(small,.lobby-heading p,.lobby-performance-row>span,.lobby-progress>div>span,.lobby-parent-mode) {color:var(--theme-muted)!important;}
  html[data-theme] .home-lobby .top-navigation {display:flex!important;min-width:0;flex:1;}
  html[data-theme] .home-lobby .topbar {padding-inline:22px;gap:16px;}
  html[data-theme] .home-lobby .topbar>div:first-child>strong {display:none;}
  html[data-theme] .home-lobby .top-navigation button {font-size:12px;padding:10px 9px;}
  html[data-theme] :is(.certificate,.premium-document,.chapter-premium-masterpiece,.chapter-masterpiece) {background:var(--theme-surface)!important;color:var(--theme-text)!important;}
  html[data-theme] .premium-document h2 {background:none!important;color:var(--theme-gold)!important;-webkit-text-fill-color:var(--theme-gold)!important;}
  html[data-theme] :is(.premium-frame,.chapter-award-frame,.chapter-award-rule,.cert-line) {border-color:var(--theme-gold)!important;}
  html[data-theme] :is(.chapter-signature-vector,.chapter-signature-image,.premium-signature svg) {color:var(--theme-gold)!important;}
  html[data-theme] :is(.premium-qr,.cert-qr,.chapter-award-qr) {background:#fff!important;}
  html[data-theme] :is(.certificate-appearance-control,.premium-verification-details,.premium-record-title,.chapter-exercise-results) {background:var(--theme-surface-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] :is(.page-footer,.login-panel-footer,.public-student-footer,.discovery-footer) {color:var(--theme-muted)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .page-footer .service-links,html[data-theme] .page-footer .course-image-credits {font-size:11px!important;line-height:1.6!important;}
  html[data-theme] .page-footer .service-links {gap:6px 16px;margin:0;}
  html[data-theme] .page-footer .service-links a,html[data-theme] .page-footer .course-image-credits {color:var(--theme-muted)!important;padding-block:8px;}
  html[data-theme] :is(.google-registration-button,.popup-google-button) {background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .google-registration-button :is(strong,span) {color:inherit!important;}
  html[data-theme] .login .editorial-story {background:var(--theme-surface-soft)!important;--story-accent:var(--theme-accent);--story-soft:var(--theme-surface);}
  html[data-theme] .login :is(.story-copy h1 em,.story-photo-mark,.story-note>svg) {color:var(--theme-accent)!important;}
  html[data-theme] .login :is(.story-note,.story-detail) {background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;}
  html[data-theme] .modal-backdrop {background:var(--theme-overlay)!important;}
  html[data-theme] .legal-page a,html[data-theme] .image-credits-page a {color:var(--theme-accent)!important;}
  html[data-theme] .legal-page :is(header,section,footer),html[data-theme] .image-credits-page article {border-color:var(--theme-border)!important;}
  html[data-theme] .legal-page .date,html[data-theme] .image-credits-page :is(p,small) {color:var(--theme-muted)!important;}
  html[data-theme] .image-credits-page article {background:var(--theme-surface)!important;color:var(--theme-text)!important;}
  html[data-theme] .offline-page :is(p,small) {color:var(--theme-muted)!important;}
  html[data-theme] .offline-page main>button {background:var(--theme-accent)!important;color:var(--theme-accent-ink)!important;}
  html[data-theme] :is(.primary,.secondary,.game-primary,.lobby-primary,.lobby-secondary,.course-button,.header-account-button) {
    display:inline-flex!important;align-items:center!important;justify-content:center!important;
    text-align:center!important;line-height:1.4!important;gap:8px;min-height:var(--control-height)!important;
    padding-block:9px!important;box-sizing:border-box;vertical-align:middle;white-space:normal;
  }
  html[data-theme] :is(.text-button,.lobby-text,.lobby-back,.chart-mode button,.atelier-category-tabs button,.shop-tabs button,.category-tabs button) {
    display:inline-flex;align-items:center;justify-content:center;text-align:center;line-height:1.4;
  }
  html[data-theme] :is(.chart-mode button,.shop-tabs button,.category-tabs button) {min-height:var(--control-height);}
  html[data-theme] :is(.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),.field select,.inline-select select,.adventure-filters input,.adventure-filters select) {min-height:var(--control-height);line-height:1.4;padding-block:9px;}
  html[data-theme] .app-header .child-select {height:var(--control-height);padding:0 8px!important;align-items:center;}
  html[data-theme] .app-header .child-select select {height:44px;min-height:44px;padding-block:0!important;}
  html[data-theme] .app-header .theme-switch {height:var(--control-height);align-items:center;}
  html[data-theme] .app-header .theme-switch button {height:36px;min-height:36px;}
  html[data-theme] .search-input {height:var(--control-height);padding:0 12px;align-items:center;}
  html[data-theme] .search-input input {height:44px;min-height:44px;padding-block:0;}
  html[data-theme] .grade-tabs {height:var(--control-height);align-items:center;}
  html[data-theme] .grade-tabs button {display:inline-flex;align-items:center;justify-content:center;gap:6px;height:38px;min-height:38px;padding-block:5px;line-height:1.4;text-align:center;}
  html[data-theme] .discovery-search form>button {display:inline-flex;align-items:center;justify-content:center;text-align:center;min-height:52px;line-height:1.4;padding-block:12px!important;}
  html[data-theme] .discovery-input {min-height:52px;align-items:center;}
  html[data-theme] .discovery-input input {height:50px;min-height:50px;padding-block:9px!important;line-height:1.4;}
  html[data-theme] .demo-choices button {justify-content:center;text-align:center;min-height:var(--control-height);}
  html[data-theme] .certificate-appearance-control button {display:inline-flex;align-items:center;justify-content:center;min-height:42px;line-height:1.4;text-align:center;}
  html[data-theme] .demo-gallery-access {padding-bottom:24px;margin-bottom:24px;border-bottom:1px solid var(--theme-border);}
  html[data-theme] .demo-gallery-access>div {display:flex;flex-wrap:wrap;gap:10px;margin-top:15px;}
  html[data-theme] .profile-settings>:is(.profile-preview,.profile-form) {min-width:0;}
}
.theme-switch {display:inline-flex;gap:3px;border:1px solid var(--theme-border);background:var(--theme-surface-soft);padding:4px;border-radius:24px;flex:none;}
.theme-switch button {display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:32px;padding:6px 10px;border:0;border-radius:20px;background:transparent;color:var(--theme-muted);font:500 11px/1.4 system-ui,sans-serif;cursor:pointer;}
.theme-switch button[aria-pressed="true"] {background:var(--theme-accent)!important;color:var(--theme-accent-ink)!important;}
.theme-switch button:focus-visible {outline:3px solid var(--theme-accent);outline-offset:3px;}
.theme-switch-floating {position:fixed;top:16px;right:20px;z-index:70;box-shadow:0 4px 18px var(--theme-shadow);}
.theme-static-toolbar {display:flex;align-items:center;justify-content:flex-end;gap:15px;margin-bottom:20px;}
@media(max-width:850px){
  html[data-theme] .adventure-app {--app-header-height:124px;}
  html[data-theme] .adventure-app .topbar {height:124px;position:relative;align-items:flex-start;padding-top:12px;}
  html[data-theme] .adventure-app .top-navigation {position:absolute;left:12px;right:12px;bottom:5px;min-height:45px;padding:3px 0;scroll-padding-inline:8px;}
  html[data-theme] .adventure-app .topbar-right {margin-left:auto;}
  .theme-switch button {padding:6px 8px;min-height:32px;}
  .app-header .theme-switch button span {display:none;}
  .theme-switch-floating {right:14px;top:12px;}
  .theme-switch-floating button span {display:none;}
  .discovery-header,.public-student-header,.character-design-preview header {flex-wrap:wrap;gap:15px;}
  .discovery-header nav,.public-gallery-actions {flex-wrap:wrap;align-items:center;}
  .legal-page header {flex-wrap:wrap;}
}
@media print {html,body{color-scheme:light!important;background:#fff!important;color:#243e49!important}.theme-switch,.theme-static-toolbar{display:none!important}}
@media(max-width:600px){.app-header .child-select{padding:4px!important}.app-header .child-select select{width:80px!important;max-width:80px!important;padding:6px;font-size:11px!important}.discovery-header nav{display:flex;gap:12px;flex-wrap:wrap}}
/* Keep content sized to its column when forms and cards reflow on phones. */
html[data-theme] .form-row {grid-template-columns:repeat(2,minmax(0,1fr));}
html[data-theme] :is(.form-row>.field,.children-grid>.child-card,.course-editor-form input) {min-width:0;}
@media(max-width:720px){html[data-theme] .editor-question .form-row {grid-template-columns:minmax(0,1fr);}}
@media(max-width:600px){
  html[data-theme] .children-grid {grid-template-columns:minmax(0,1fr);}
  html[data-theme] .course-editor-form>.form-row,html[data-theme] .editor>.form-row {grid-template-columns:minmax(0,1fr);}
}
@media(max-width:700px){html[data-theme] .profile-settings {grid-template-columns:minmax(0,1fr);}}
@media screen {
  html[data-theme] .certificate {--document-bg:var(--theme-surface);--document-ink:var(--theme-text);--document-muted:var(--theme-muted);--document-gold:var(--theme-gold);}
  html[data-theme="night"] :is(.certificate.premium-gold,.certificate.chapter-premium-gold) {--document-bg:#302b25;--document-ink:#f0ead8;--document-muted:#c9bea5;--document-gold:#e5c785;}
  html[data-theme="day"] :is(.certificate.premium-gold,.certificate.chapter-premium-gold) {--document-bg:#fffaf0;--document-ink:#634b2c;--document-muted:#745f43;--document-gold:#856221;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate {background:var(--document-bg)!important;color:var(--document-ink)!important;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate :is(h1,h2,h3,h4,p,em,strong,small,span,a) {color:var(--document-ink)!important;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate :is(p,em,small) {color:var(--document-muted)!important;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate.premium-document h2 {background:none!important;color:var(--document-gold)!important;-webkit-text-fill-color:var(--document-gold)!important;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate :is(.premium-brand,.chapter-award-brand,.cert-overline,.premium-kicker,.chapter-award-kicker,.chapter-signature-vector) {color:var(--document-gold)!important;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate :is(.premium-qr,.cert-qr) {background:#fff!important;color:#244536!important;}
  html[data-theme] :is(.certificate-route,.modal,.premium-certificate-stage) .certificate :is(.premium-qr,.cert-qr) :is(span,p,small,a) {color:#244536!important;}
}

