:root{color-scheme:light}
:root[data-theme="dark"]{
  color-scheme:dark;
  --theme-page:#101112;--theme-surface:#191a1b;--theme-surface-2:#232425;
  --theme-text:#f2f2f2;--theme-muted:#b7b8ba;--theme-line:#3b3d40;
  --theme-accent:#e5e6e7;--theme-accent-soft:#2b2c2e;
  --theme-shadow:0 12px 34px #0008;
  --bg:var(--theme-page);--white:var(--theme-surface);--text:var(--theme-text);
  --muted:var(--theme-muted);--green:var(--theme-accent);--green2:#c9cacc;
  --lime:#404144;--line:var(--theme-line);
  --page:var(--theme-page);--surface:var(--theme-surface);--ink:var(--theme-text);
}
:root[data-theme="dark"] body{background:var(--theme-page);color:var(--theme-text)}
:root[data-theme="dark"] header,:root[data-theme="dark"] .site-head,:root[data-theme="dark"] .home-head,
:root[data-theme="dark"] .listening-taskbar,:root[data-theme="dark"] .learner-dashboard{
  background:var(--theme-surface)!important;color:var(--theme-text);border-color:var(--theme-line)!important
}
:root[data-theme="dark"] header a,:root[data-theme="dark"] .site-head a,:root[data-theme="dark"] .home-head a{color:inherit}
:root[data-theme="dark"] main,:root[data-theme="dark"] .summary,:root[data-theme="dark"] .card,
:root[data-theme="dark"] .exercise-card,:root[data-theme="dark"] .library,:root[data-theme="dark"] .settings,
:root[data-theme="dark"] .guide,:root[data-theme="dark"] .answer-panel,:root[data-theme="dark"] .question-paper,
:root[data-theme="dark"] .part-review,:root[data-theme="dark"] .attempt-card,:root[data-theme="dark"] .response-section,
:root[data-theme="dark"] .reading-shell,:root[data-theme="dark"] .setup-card,:root[data-theme="dark"] .setup-history,
:root[data-theme="dark"] .welcome-aside,:root[data-theme="dark"] .book-card,:root[data-theme="dark"] .feature-card,
:root[data-theme="dark"] .search-box,:root[data-theme="dark"] .home-account-menu,:root[data-theme="dark"] .home-auth-dialog,
:root[data-theme="dark"] .legal-card,:root[data-theme="dark"] .passage-card,:root[data-theme="dark"] .questions-card{
  background:var(--theme-surface)!important;color:var(--theme-text);border-color:var(--theme-line)!important;box-shadow:var(--theme-shadow)
}
:root[data-theme="dark"] .book-card.full-book,:root[data-theme="dark"] .feature-card.selected{
  background:linear-gradient(145deg,var(--theme-surface),var(--theme-surface-2))!important;border-color:#55575a!important
}
:root[data-theme="dark"] p,:root[data-theme="dark"] .muted,:root[data-theme="dark"] .intro,
:root[data-theme="dark"] .setup-intro,:root[data-theme="dark"] .attempt-meta,:root[data-theme="dark"] .side-subtitle,
:root[data-theme="dark"] .selection-note{color:var(--theme-muted)}
:root[data-theme="dark"] a,:root[data-theme="dark"] .text-button,:root[data-theme="dark"] .history-result,
:root[data-theme="dark"] .history-detail,:root[data-theme="dark"] .detail-link{color:var(--theme-accent)}
:root[data-theme="dark"] button,:root[data-theme="dark"] .test-link,:root[data-theme="dark"] input,
:root[data-theme="dark"] select,:root[data-theme="dark"] textarea{
  background-color:var(--theme-surface-2);color:var(--theme-text);border-color:var(--theme-line)
}
:root[data-theme="dark"] .home-auth .home-auth-primary,:root[data-theme="dark"] .dictation-cta,
:root[data-theme="dark"] .welcome-dictation,:root[data-theme="dark"] .primary-action,
:root[data-theme="dark"] .play-button{
  background:#303133!important;color:#fff!important;border-color:#55575a!important;box-shadow:none
}
:root[data-theme="dark"] .welcome-dictation small,:root[data-theme="dark"] .dictation-cta small{color:#d1d2d3}
:root[data-theme="dark"] .book-status,:root[data-theme="dark"] .history-type,:root[data-theme="dark"] .level,
:root[data-theme="dark"] .tip-box,:root[data-theme="dark"] .instruction,:root[data-theme="dark"] .hints,
:root[data-theme="dark"] .full-notice,:root[data-theme="dark"] .section-choice:has(input:checked){
  background:var(--theme-accent-soft)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important
}
:root[data-theme="dark"] .section-choice,:root[data-theme="dark"] .history-table,
:root[data-theme="dark"] .history-table td,:root[data-theme="dark"] .score-cards article,
:root[data-theme="dark"] .metric-grid article,:root[data-theme="dark"] .question-paper td,
:root[data-theme="dark"] .question-paper th,:root[data-theme="dark"] .explanation-content td,
:root[data-theme="dark"] .explanation-content th,:root[data-theme="dark"] .exam-sidebar,
:root[data-theme="dark"] .nav-grid button,:root[data-theme="dark"] .part-bottom button,
:root[data-theme="dark"] .actions button,:root[data-theme="dark"] .explanation-tools button,
:root[data-theme="dark"] .passage-tabs,:root[data-theme="dark"] .question-pane-head,
:root[data-theme="dark"] .inline-mc-question,:root[data-theme="dark"] .reading-answer:focus-within{
  background:var(--theme-surface-2)!important;color:var(--theme-text);border-color:var(--theme-line)!important
}
:root[data-theme="dark"] .history-table th,:root[data-theme="dark"] .setup-history .history-table th{background:#303133;color:var(--theme-text)}
:root[data-theme="dark"] .mode-tab,:root[data-theme="dark"] .skill-tab{color:var(--theme-muted)}
:root[data-theme="dark"] .mode-tab.active,:root[data-theme="dark"] .skill-tab.active,
:root[data-theme="dark"] .nav-grid button.active,:root[data-theme="dark"] .nav-grid button.answered,
:root[data-theme="dark"] .section-choice:hover,:root[data-theme="dark"] .section-choice:has(input:checked){
  background:#353638!important;border-color:#77797c!important;color:#fff!important
}
:root[data-theme="dark"] .answer-row,:root[data-theme="dark"] .part-bottom,:root[data-theme="dark"] .exercise-footer,
:root[data-theme="dark"] .reading-group{border-color:var(--theme-line)!important}
:root[data-theme="dark"] .blank{background:var(--theme-surface-2);color:var(--theme-text);border-color:#77797c}
:root[data-theme="dark"] .blank.correct{background:#292a2b;border-color:#aeb0b2}
:root[data-theme="dark"] .blank.wrong{background:#332829;border-color:#bd8a8a}
:root[data-theme="dark"] .progress-track,:root[data-theme="dark"] .audio-track{background:var(--theme-surface-2)}
:root[data-theme="dark"] .home-account-trigger{background:#292a2b!important;border-color:#55575a!important;color:var(--theme-text)!important}
:root[data-theme="dark"] .home-account-menu a,:root[data-theme="dark"] .home-account-menu button,
:root[data-theme="dark"] .home-plan,:root[data-theme="dark"] .home-auth-dialog input{color:var(--theme-text)}
:root[data-theme="dark"] .legal-page{background:var(--theme-page)}
:root[data-theme="dark"] .selection-toolbar{background:#202123;color:#f2f2f2;border-color:#55575a}
:root[data-theme="dark"] .reading-page .exam-sidebar{background:var(--theme-surface-2)!important}
:root[data-theme="dark"] .reading-title .eyebrow,:root[data-theme="dark"] .passage-content h2,
:root[data-theme="dark"] .passage-content h3,:root[data-theme="dark"] .reading-group>h3,
:root[data-theme="dark"] .reading-group>h4,:root[data-theme="dark"] .inline-mc-letter,
:root[data-theme="dark"] .reading-qnum,:root[data-theme="dark"] .question-pane-head button,
:root[data-theme="dark"] .question-pane-head button[aria-pressed="true"]{color:#f2f2f2}
:root[data-theme="dark"] .question-pane-head button,:root[data-theme="dark"] .reading-answer input[type="text"],
:root[data-theme="dark"] .reading-qnum,:root[data-theme="dark"] .recording-tabs button.active,
:root[data-theme="dark"] .inline-mc-option:hover,:root[data-theme="dark"] .exam-main{
  background:#232425!important;border-color:#3b3d40!important;color:#f2f2f2
}
:root[data-theme="dark"] .passage-content,:root[data-theme="dark"] .question-content,
:root[data-theme="dark"] .inline-mc-option,:root[data-theme="dark"] .radio-options label{color:#d1d2d3}
:root[data-theme="dark"] .reading-group th,:root[data-theme="dark"] .reading-group td{background:#232425;color:#f2f2f2;border-color:#3b3d40}
:root[data-theme="dark"] .reading-group{border-color:#3b3d40}

/* Neutralize the legacy Dictation page's hard-coded green accents in dark mode. */
:root[data-theme="dark"] h1 span,
:root[data-theme="dark"] .tiny-wave,
:root[data-theme="dark"] .progress-track span,
:root[data-theme="dark"] .audio-track span,
:root[data-theme="dark"] .wave,
:root[data-theme="dark"] .part-num,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .text-button,
:root[data-theme="dark"] .done-mark,
:root[data-theme="dark"] .offline i{color:#e5e6e7}
:root[data-theme="dark"] .part.active{border-color:#55575a}
:root[data-theme="dark"] .offline i{background-color:#e5e6e7}
:root[data-theme="dark"] .part.active{background:#292a2b}
:root[data-theme="dark"] .play-button,
:root[data-theme="dark"] .primary,
:root[data-theme="dark"] .done-mark{background:#303133!important;color:#f2f2f2;border-color:#55575a}
:root[data-theme="dark"] .blank,
:root[data-theme="dark"] .blank.correct,
:root[data-theme="dark"] .blank.wrong{background:#292a2b;color:#f2f2f2;border-color:#aeb0b2}
:root[data-theme="dark"] .blank::placeholder{color:#b7b8ba}
:root[data-theme="dark"] :focus-visible{outline-color:#c9cacc}
:root[data-theme="dark"] .hero-note{border-color:#3b3d40}
:root[data-theme="dark"] .part.active strong,:root[data-theme="dark"] .sentence-heading{color:#f2f2f2}
:root[data-theme="dark"] .status-badge,:root[data-theme="dark"] .free-badge,:root[data-theme="dark"] .plus-badge{filter:grayscale(1)}

.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:0 0 auto;margin-left:12px;padding:8px 11px;border:1px solid #dce4d8;border-radius:9px;background:#f2f6ee;color:#285943;font:650 11px/1.2 "Segoe UI",Arial,sans-serif;white-space:nowrap;cursor:pointer;transition:background .16s,border-color .16s,transform .16s}
.theme-toggle:hover{transform:translateY(-1px);border-color:#8eaa88}
.theme-toggle-icon{font-size:14px;line-height:1}
.theme-toggle-floating{position:fixed;z-index:1000;right:18px;top:14px;margin:0;box-shadow:0 12px 34px #203c3410}
.home-head .theme-toggle{margin-left:auto}.home-auth .theme-toggle{margin-left:4px}
:root[data-theme="dark"] .theme-toggle{background:#292a2b;border-color:#55575a;color:#f2f2f2;box-shadow:var(--theme-shadow)}
@media(max-width:700px){.theme-toggle{margin-left:4px;padding:8px 9px;font-size:10px}.theme-toggle-floating{right:10px;top:10px}}
