/*
  DARK THEME · Pronunciation Test
  Opt-in only; the original light-theme declarations remain untouched.
  Linked after the existing stylesheet, with html[data-theme="dark"] scope.
*/
html[data-theme="dark"] {
  color-scheme: dark;
  --cream:#151f1a; --paper:#243129; --ink:#eff2ed; --soft:#b3c4b8;
  --muted:#a0b0a6; --line:#435649; --coral:#f58b76; --coral-d:#e37765;
  --pink:#40302e; --mint:#9cd4b5; --mint-p:#294236; --lav:#313443;
  --sh:0 15px 34px rgba(0,0,0,.26);
  --ed-bg:#151f1a; --ed-paper:#243129; --ed-paper2:#2b3930;
  --ed-dark:#8cc5a2; --ed-ink:#eff2ed; --ed-muted:#aabdb0;
  --ed-coral:#f58b76; --ed-edge:#465a4b; --ed-sage:#304639;
  --ed-cream:#f8f3e7; --ui-line:#465a4b;
  scrollbar-color:#556b5a #151f1a;
}
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] body:has(#home.home-concept:not([hidden])) {
  background:var(--ed-bg)!important;
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .footer,
html[data-theme="dark"] body:has(#home.home-concept:not([hidden])) .site-shell>.footer {
  border-color:var(--ed-edge)!important;
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] .site-header #brandHome.brand {color:var(--ed-ink)!important}
html[data-theme="dark"] .site-header .tiny-control {
  background:#223028!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] .site-header .tiny-control:hover,
html[data-theme="dark"] .site-header .tiny-control[aria-pressed="true"] {
  background:#314639!important;border-color:#92b9a0!important;
}
html[data-theme="dark"] :is(.btn-main,.btn-dark) {
  background:#356049!important;border-color:#477b5e!important;
  color:#fbf7eb!important;box-shadow:none!important;
}
html[data-theme="dark"] :is(.btn-main,.btn-dark):hover:not(:disabled) {
  background:#43745a!important;border-color:#5c9875!important;
}
html[data-theme="dark"] :is(.btn-light,.back-link) {
  color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
  background:#27372e!important;
}
html[data-theme="dark"] :is(.btn-light,.back-link):hover:not(:disabled) {
  background:#33483a!important;border-color:#84ad91!important;
}
html[data-theme="dark"] .kbd {
  background:#28382e!important;color:#d6e5da!important;border-color:#506254!important;
}
/* Home: preserve the dark-green quote poster and its original emphasis colors. */
html[data-theme="dark"] #home.home-concept :is(.hero-question-headline,.section-heading h2,.podium-intro h2,.my-rank-heading strong,.home-best-title) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] #home.home-concept :is(.hero-desc,.hero-sub,.home-mic-note,.section-aside,.my-rank-status,.podium-disclaimer,.home-record-details>summary) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #home.home-concept .home-live-stats {
  border-color:var(--ed-edge)!important;color:var(--ed-muted)!important;
}
html[data-theme="dark"] #home.home-concept .home-live-stats :is(.live-stat strong,.live-stat.today strong) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] #home.home-concept .home-live-stats .live-divider{background:#54675a!important}
html[data-theme="dark"] #home.home-concept .home-live-stats .live-demo-chip{color:var(--ed-muted)!important}
html[data-theme="dark"] #home.home-concept :is(.podium-toggle,.podium-periods) {
  background:#27382e!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #home.home-concept :is(.podium-toggle button,.podium-periods button) {
  color:#b8cabe!important;background:transparent!important;
}
html[data-theme="dark"] #home.home-concept :is(.podium-toggle button.active,.podium-periods button.active) {
  background:#41634e!important;color:#fff9ef!important;
}
html[data-theme="dark"] #home.home-concept :is(.podium-card,.podium-card.podium-1,.podium-card.podium-2,.podium-card.podium-3,.my-rank-card,.home-record-content,#homePodiumEmpty) {
  background:var(--ed-paper)!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #home.home-concept .podium-card.podium-1{border-left-color:#cbaa64!important}
html[data-theme="dark"] #home.home-concept .podium-card.podium-2{border-left-color:#b4c1c8!important}
html[data-theme="dark"] #home.home-concept .podium-card.podium-3{border-left-color:#c99675!important}
html[data-theme="dark"] #home.home-concept :is(.podium-card .podium-nick,.podium-card .podium-score,.my-rank-score,#homePodiumEmpty span) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] #home.home-concept :is(.podium-card .podium-score small,.my-rank-score small,.home-record-info) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #home.home-concept .home-contact-link{color:#b4ddc2!important}
/* Main game screens, panels and charts */
html[data-theme="dark"] :is(#modes .mode-card,#micSetup .mic-compact-panel,#leaderboard .board-card,#practiceLevels .practice-level-card,#practiceList .practice-sentence-card,#play .challenge-panel,#play .side-panel,#results .report-panel,#results .result-break-panel,#results .result-detail-card,#results #resultFinishSlide,#results .result-story-detail-host .result-slide) {
  background:var(--ed-paper)!important;color:var(--ed-ink)!important;
  border-color:var(--ed-edge)!important;
  box-shadow:6px 7px 0 #0e1712!important;
}
html[data-theme="dark"] :is(#modes .mode-card:hover,#practiceLevels .practice-level-card:hover,#practiceList .practice-sentence-card:hover) {
  background:#2d3e33!important;border-color:#79aa89!important;
}
html[data-theme="dark"] :is(#modes .mode-card h3,#practiceLevels .practice-level-content strong,#practiceList .practice-sentence-text,#leaderboard .board-score,#leaderboard .board-status-panel strong,#play .question-text,#results .result-story-chapter strong) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] :is(#modes .mode-card p,#modes .mode-meta,#practiceLevels .practice-level-content small,#practiceList .practice-breadcrumb,#practiceList .practice-list-total,#play .difficulty-label,#play .manual-detail,#play .mode-sub,#results .result-disclaimer) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #modes .mode-tag{background:#34473a!important;color:#c4d9c9!important}
html[data-theme="dark"] #modes .mode-features>span{color:#c3d3c8!important;border-color:var(--ed-edge)!important}
html[data-theme="dark"] #modes .mode-symbol-quick{background:#45332e!important;color:#f5b099!important}
html[data-theme="dark"] #modes .mode-symbol-deep{background:#38344b!important;color:#c8baf6!important}
html[data-theme="dark"] #modes .mode-symbol-practice{background:#2c4937!important;color:#a4dab9!important}
html[data-theme="dark"] #practiceLevels .practice-level-number {background:#3b4c40!important;color:#d1e4d3!important}
html[data-theme="dark"] #practiceList .practice-sentence-index {background:#35473a!important;color:#dfebdd!important}
html[data-theme="dark"] #practiceList .practice-sentence-action{color:#b6dac4!important}
html[data-theme="dark"] #micSetup :is(.mic-compact-description,.mic-compact-meter-label,.mic-setup-privacy,.mic-compact-status) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #micSetup .mic-setup-privacy a{color:#a5d8b7!important}
html[data-theme="dark"] #micSetup :is(#micSetupBars,.mic-setup-bars){background:#24372a!important}
html[data-theme="dark"] #play :is(.level-progress .progress-unit,.mic-box,#micBox,.phase-guide,.round-feedback,.manual-detail .manual-row textarea) {
  background:#2c3c31!important;border-color:var(--ed-edge)!important;color:var(--ed-ink)!important;
}
html[data-theme="dark"] #play :is(.mic-box.live,#micBox.live) {
  background:#3a3b2e!important;border-color:#ab9475!important;
}
html[data-theme="dark"] #play :is(.mic-clock,.phase-guide,.phase-guide-icon,.heard-text,.play-auto-note) {
  color:#b8cbbf!important;
}
html[data-theme="dark"] #play #countdownCover:not([hidden]) {
  background:var(--ed-paper)!important;color:var(--ed-ink)!important;
}
html[data-theme="dark"] #play #countdownCover #countdownNumber{color:#f59b80!important}
html[data-theme="dark"] #play :is(.game-error,.recovery-notice){background:#3f302d!important;border-color:#805b50!important;color:#f7c0b1!important}
html[data-theme="dark"] #leaderboard .board-summary,
html[data-theme="dark"] #leaderboard .board-filters {color:var(--ed-muted)!important}
html[data-theme="dark"] #leaderboard :is(.board-table thead,.board-table th) {
  background:#34483a!important;color:#dcece1!important;
}
html[data-theme="dark"] #leaderboard :is(.board-table,.board-table td,.board-table th,.board-table tbody tr) {
  border-color:var(--ed-edge)!important;color:var(--ed-ink)!important;
}
html[data-theme="dark"] #leaderboard .board-table tbody tr:hover td{background:#34483a!important}
html[data-theme="dark"] #leaderboard #boardRows tr.is-my-rank td{background:#294735!important}
html[data-theme="dark"] :is(#home,#leaderboard) :is(.podium-toggle,.podium-periods) {
  background:#28372d!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] :is(#home,#leaderboard) :is(.podium-toggle,.podium-periods)>button {
  color:#b4c7b9!important;
}
html[data-theme="dark"] :is(#home,#leaderboard) :is(.podium-toggle,.podium-periods)>button.active {
  color:#f8f7ef!important;background:#41604d!important;
}
html[data-theme="dark"] :is(#leaderboard .board-status-panel,#leaderboard #boardStatusPanel) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] #leaderboard :is(#boardStatusTitle,#boardStatusDetail) {color:var(--ed-ink)!important}
/* Result slides and the finishing form */
html[data-theme="dark"] #results :is(.result-head,.result-story-toolbar,.result-story-footer,.result-story-actions,.result-detail-foot,.story-detail-foot) {
  color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #results :is(.result-story-eyebrow,.story-detail-kicker,.result-story-chapter small,.story-detail-note,.story-text-block>span,.story-detail-metrics span,.rank-consent-caption,.online-rank-guide,.online-rank-eligibility) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #results :is(.story-detail-metrics>div,.story-text-block,.result-stats>div,.result-story-metric,.result-chart,.level-chart,.result-chart-row,.result-story-panel) {
  background:#2b3a30!important;border-color:var(--ed-edge)!important;color:var(--ed-ink)!important;
}
html[data-theme="dark"] #results :is(.story-detail-metrics strong,.story-text-block p,.result-story-chapter strong,.result-share-heading,#resultFinishSlide .online-rank-title,.rank-consent-caption strong,.result-grade) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] #results :is(.result-story-detail-host .result-slide,.result-detail-card,#resultFinishSlide,.report-panel) {
  background:var(--ed-paper)!important;color:var(--ed-ink)!important;
  border-color:var(--ed-edge)!important;box-shadow:6px 7px 0 #0d1712!important;
}
html[data-theme="dark"] #results #resultFinishSlide :is(#resultRecordPanel,#onlineProfilePanel,#onlineRecordDetails,.online-rank-form,.rank-consent-steps,.result-story-actions,.result-finish-action-group) {
  background:transparent!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #results :is(#onlineNickname,.online-record-body input,.online-rank-form input[type="text"]) {
  background:#19271f!important;color:var(--ed-ink)!important;border-color:#596e5e!important;
}
html[data-theme="dark"] #results :is(.online-record-summary,.online-record-status,#onlineSaveStatus) {
  color:#b8d5bf!important;
}
html[data-theme="dark"] #results :is(.rank-consent-caption a,.online-rank-guide a) {color:#b4dec2!important}
html[data-theme="dark"] #results :is(.result-story-dot,.result-group-navigation button) {
  border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #results :is(.result-story-dot.active,.result-group-navigation button.active) {
  background:#8cb79b!important;
}
html[data-theme="dark"] #results .story-text-block .ok{color:#a8e0b4!important}
/* Popups share the same surfaces, without touching ranking badge artwork. */
html[data-theme="dark"] :is(#settingsDialog,#helpDialog,#preTestDialog,#historyDialog,#weakReviewDialog,#gradeGuideDialog,#historyDetailDialog,#historyClearDialog,#contactDialog) {
  background:var(--ed-paper)!important;color:var(--ed-ink)!important;
  border-color:var(--ed-edge)!important;box-shadow:0 28px 75px rgba(0,0,0,.48)!important;
}
html[data-theme="dark"] :is(#settingsDialog,#helpDialog,#preTestDialog,#historyDialog,#weakReviewDialog,#gradeGuideDialog,#historyDetailDialog,#historyClearDialog,#contactDialog) :is(h2,h3,strong) {
  color:var(--ed-ink);
}
html[data-theme="dark"] :is(#settingsDialog,#helpDialog,#preTestDialog,#historyDialog,#weakReviewDialog,#gradeGuideDialog,#historyDetailDialog,#historyClearDialog,#contactDialog) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea,select) {
  background:#1a2920!important;color:var(--ed-ink)!important;border-color:#506452!important;
}
html[data-theme="dark"] :is(#settingsDialog,#helpDialog,#preTestDialog,#historyDialog,#weakReviewDialog,#gradeGuideDialog,#historyDetailDialog,#historyClearDialog,#contactDialog) :is(.settings-close,.help-close,.history-close,.weak-review-close,.grade-guide-close,.history-detail-close,.contact-close) {
  background:#304337!important;color:#eef3ed!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #settingsDialog .settings-section{border-color:var(--ed-edge)!important}
html[data-theme="dark"] #settingsDialog .settings-heading strong{color:var(--ed-ink)!important}
html[data-theme="dark"] #settingsDialog :is(.settings-heading small,.settings-slider-row output,.settings-volume-icon) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #settingsDialog .settings-switch input+span{background:#506156!important}
html[data-theme="dark"] #settingsDialog .settings-switch input:checked+span{background:#4d9674!important}
html[data-theme="dark"] #helpDialog :is(.help-note,.help-step,.help-steps li) {
  background:#2b3b31!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #historyDialog :is(.history-stat,.history-list,.history-empty-card,.history-record-row,.history-data,.history-empty) {
  background:#2b3b30!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] #historyDialog :is(.history-stat span,.history-record-date,.history-rank-help,.history-record-bottom small,.history-section-header span,.history-empty-desc) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] #historyDialog :is(.history-stat strong,.history-record-bottom strong,.history-empty-title) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] #historyDialog .history-record-row:hover{background:#34513e!important}
html[data-theme="dark"] #historyDialog .history-tabs button{background:#2b3b30!important;color:#bcd1c1!important}
html[data-theme="dark"] #historyDialog .history-tabs button.active{background:#45684f!important;color:#fff!important}
html[data-theme="dark"] :is(#gradeGuideDialog .grade-guide-list li,#historyDetailDialog .history-detail-section,#historyClearDialog .history-clear-content,#contactDialog .contact-card,#weakReviewDialog .weak-review-list) {
  background:#2b3b30!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] :is(#gradeGuideDialog .grade-guide-note,#gradeGuideDialog .grade-guide-description,#contactDialog .contact-note,#weakReviewDialog .weak-review-foot) {
  color:var(--ed-muted)!important;
}
/* New opt-in theme control in Settings */
.settings-theme-section .settings-heading {margin-bottom:13px}
.settings-theme-options {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.settings-theme-option {display:block;position:relative;cursor:pointer;min-width:0}
.settings-theme-option input {
  position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;
}
.settings-theme-option span {
  display:flex;align-items:center;justify-content:center;gap:7px;min-height:43px;
  border:1px solid #d8dcd1;background:#f8f8f2;color:#4d6253;
  border-radius:7px;font-size:13px;font-weight:750;
  transition:background .16s,border-color .16s,color .16s;
}
.settings-theme-option input:checked+span {
  background:#e6efe7;border-color:#557b62;color:#244b37;box-shadow:inset 0 0 0 1px #557b62;
}
.settings-theme-option input:focus-visible+span {
  outline:3px solid #e38b79;outline-offset:3px;
}
html[data-theme="dark"] .settings-theme-option span {
  background:#1d2d23;border-color:var(--ed-edge);color:#bcd5c2;
}
html[data-theme="dark"] .settings-theme-option input:checked+span {
  background:#3e614b;border-color:#a1d1ac;color:#fff9ef;
  box-shadow:inset 0 0 0 1px #a1d1ac;
}
@media(max-width:440px) {
  .settings-theme-section .settings-heading{margin-bottom:10px}
  .settings-theme-option span{min-height:42px}
}
/* Privacy page: inherits the same stored choice, with no separate toggle. */
html[data-theme="dark"] body:has(#main .page-hero) :is(h1,.content h2,.content h3,.summary strong,.toc-title,.provider strong,.table-wrap td:first-child,.header-back) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(.intro,.hero-meta,.summary-heading small,.summary p,.toc a,.footer,.content p,.content li) {
  color:var(--ed-muted)!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(.hero-meta span,.summary article,.toc,.content,.provider,.table-wrap) {
  background:var(--ed-paper)!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(.toc a:hover,.toc a:focus-visible,.header-back:hover) {
  background:#36503e!important;color:#fff!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(.toc a,.toc-title,th,td,.content section) {
  border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(th,.note,.contact) {
  background:#30483a!important;color:#dcebdd!important;border-color:var(--ed-edge)!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(td:first-child,td:before,.section-index,.summary-index) {
  color:#f4ab8c!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(.note strong,.contact strong,.table-wrap td) {
  color:var(--ed-ink)!important;
}
html[data-theme="dark"] body:has(#main .page-hero) :is(.contact a,.content a,.footer a) {
  color:#b0dbbd!important;
}
@media(max-width:740px) {
  html[data-theme="dark"] body:has(#main .page-hero) :is(.toc a,.table-wrap tr) {
    background:#2b3b30!important;color:var(--ed-ink)!important;border-color:var(--ed-edge)!important;
  }
  html[data-theme="dark"] body:has(#main .page-hero) .table-wrap td{
    border-color:var(--ed-edge)!important;
  }
}
/* Respect reduced motion without changing the current default. */
@media(prefers-reduced-motion:reduce) {
  .settings-theme-option span{transition:none}
}

/* ================================================================
   DARK THEME QA · 2026-11-09
   Visual-only refinements from the 21-screen desktop review.
   Keep all declarations scoped to the dark theme so light mode and
   scoring / microphone / leaderboard / sharing logic stay unchanged.
   ================================================================ */

/* Shared back buttons: do not leave white light-mode buttons scattered
   across mic setup, modes, practice, tests and result navigation. */
html[data-theme="dark"] :is(
  #micSetup>.back-link,
  #modes .modes-nav>.back-link,
  #leaderboard>.back-link,
  #practiceLevels>.back-link,
  #practiceList>.back-link,
  #play .play-nav>.back-link,
  #results .result-story-toolbar>.back-link,
  #results>.back-link
) {
  background:#2c3d32!important;
  color:#eef3ec!important;
  border-color:#627768!important;
  box-shadow:none!important;
}
html[data-theme="dark"] :is(
  #micSetup>.back-link,
  #modes .modes-nav>.back-link,
  #leaderboard>.back-link,
  #practiceLevels>.back-link,
  #practiceList>.back-link,
  #play .play-nav>.back-link,
  #results .result-story-toolbar>.back-link,
  #results>.back-link
):hover:not(:disabled) {
  background:#3a5543!important;
  color:#fff!important;
  border-color:#94b69c!important;
}
html[data-theme="dark"] :is(#results .result-edge-arrow,#results .result-edge-arrow:not(:disabled):hover) {
  background:#2c4033!important;
  color:#ecf5ed!important;
  border-color:#62836a!important;
  box-shadow:2px 3px 0 #101a13!important;
}
html[data-theme="dark"] #results .result-edge-arrow:not(:disabled):hover {
  background:#41614b!important;
}
html[data-theme="dark"] #results .result-edge-arrow:disabled {
  opacity:.26!important;
}

/* The home secondary action had an explicit dark-ink color even
   on the dark background, making the leaderboard link look disabled. */
html[data-theme="dark"] #home.home-concept .hero-actions .hero-rank-button {
  background:#273a2f!important;
  color:#e8f1e9!important;
  border-color:#789981!important;
}
html[data-theme="dark"] #home.home-concept .hero-actions .hero-rank-button:hover:not(:disabled) {
  background:#385440!important;
  color:#fffaf1!important;
  border-color:#a5c9ab!important;
}

/* Mode tags and small captions: use one dark chip instead of pale
   chips with near-invisible light-on-light text. */
html[data-theme="dark"] #modes .mode-card .mode-features>span {
  background:#354a3c!important;
  color:#e1eee2!important;
  border-color:#57745f!important;
}
html[data-theme="dark"] #modes .mode-card .mode-tag {
  color:#c4d8c8!important;
}
html[data-theme="dark"] #modes .mode-card .mode-meta>strong,
html[data-theme="dark"] #practiceLevels .practice-level-content small,
html[data-theme="dark"] #practiceList .practice-list-total,
html[data-theme="dark"] #practiceList .practice-breadcrumb {
  color:#bed0c2!important;
}
html[data-theme="dark"] #practiceList :is(.practice-sentence-card,.practice-sentence-index,.practice-sentence-action) {
  border-color:#52705b!important;
}
html[data-theme="dark"] #practiceList .practice-sentence-action {
  color:#c0e4ca!important;
}

/* Mic setup: status bar must not remain light with dull grey text. */
html[data-theme="dark"] #micSetup .mic-compact-status {
  background:#304437!important;
  color:#e2eee5!important;
  border-color:#647f69!important;
}
html[data-theme="dark"] #micSetup #micSetupStatus {
  color:#dce9df!important;
}
html[data-theme="dark"] #micSetup #micSetupStatus.ready {
  color:#98e1b5!important;
}
html[data-theme="dark"] #micSetup :is(.mic-compact-description,.mic-compact-meter-label,.mic-setup-privacy) {
  color:#b9cabe!important;
}

/* Sound status and toast: both states must be legible. */
html[data-theme="dark"] .toast {
  background:#36624a!important;
  color:#fff9ed!important;
  border:1px solid #a4d2b0!important;
  box-shadow:0 8px 22px rgba(0,0,0,.35)!important;
}
html[data-theme="dark"] #play .heard-text {
  color:#c1d2c5!important;
}
html[data-theme="dark"] #play .play-auto-note,
html[data-theme="dark"] #play .attempt-prompt,
html[data-theme="dark"] #play .manual-detail {
  color:#bdcec0!important;
}

/* Per-question score summary: two dark statistics chips with readable
   labels and numbers, without changing measurements or flow. */
html[data-theme="dark"] #play.result-mode .feedback-numbers span {
  background:#354a3d!important;
  color:#c5d8c9!important;
  border:1px solid #607a65!important;
}
html[data-theme="dark"] #play.result-mode .feedback-numbers strong {
  color:#fff9ef!important;
}
html[data-theme="dark"] #play.result-mode .feedback-desc {
  color:#d3dfd4!important;
}

/* Result three-tab navigation: remove the old light strip and make the
   currently selected section unmistakable. */
html[data-theme="dark"] #results .result-group-navigation {
  background:#27372d!important;
  border-color:#66806c!important;
}
html[data-theme="dark"] #results .result-group-navigation .result-group-tab {
  background:#2c3c31!important;
  color:#c8d9cb!important;
  border-color:#506a56!important;
  box-shadow:none!important;
}
html[data-theme="dark"] #results .result-group-navigation .result-group-tab:not(.is-active):hover {
  background:#385543!important;
  color:#fff9ed!important;
  border-color:#8aaf92!important;
}
html[data-theme="dark"] #results .result-group-navigation .result-group-tab.is-active {
  background:#41654e!important;
  color:#fffef5!important;
  border-color:#9fc6a5!important;
  box-shadow:inset 0 0 0 1px #80ad8b!important;
}
html[data-theme="dark"] #results .result-group-navigation .result-group-tab :is(.result-group-full,.result-group-compact) {
  color:inherit!important;
}

/* Detail comparison legend and secondary information: keep the colored
   error marking, but ensure its explanation can actually be read. */
html[data-theme="dark"] #results .story-detail-foot small {
  color:#c7d7c9!important;
}
html[data-theme="dark"] #results :is(.story-detail-foot,.story-detail-note,.story-text-block>span,.story-detail-metrics span,.story-detail-kicker,.result-story-eyebrow) {
  color:#b9cdbc!important;
}
html[data-theme="dark"] #results .story-text-block.story-text-merged {
  background:#304338!important;
  border-color:#5a7562!important;
}
html[data-theme="dark"] #results .story-text-block.story-text-merged p {
  color:#f3f6ef!important;
}

/* Optional online ranking: the user must be able to read consent copy
   even when this particular result cannot be submitted to the ranking.
   Do not alter disabled controls, eligibility or data/checkbox behavior. */
html[data-theme="dark"] #results #resultFinishSlide .online-rank-entry {
  background:#283a2f!important;
  border-color:#576f5e!important;
}
html[data-theme="dark"] #results #resultFinishSlide .online-profile-panel {
  border-color:#536c5a!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-steps {
  border-top-color:#596e5e!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-check,
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-check span {
  color:#e3eee2!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-check strong {
  color:#f4f8ed!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-check input {
  accent-color:#86caa0!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-caption,
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-caption span {
  color:#b8cbbb!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-caption strong {
  color:#eff5e8!important;
}
html[data-theme="dark"] #results #resultFinishSlide .rank-consent-caption a {
  color:#addfba!important;
}
html[data-theme="dark"] #results.is-finish-page #onlineEligibilityNote[data-state="blocked"] {
  color:#f59e8c!important;
}
html[data-theme="dark"] #results.is-finish-page #onlineEligibilityNote[data-state="ready"] {
  color:#a5e5b8!important;
}
html[data-theme="dark"] #results #resultFinishSlide :is(.online-rank-title,.online-record-body>label:not(.online-profile-consent)) {
  color:#eff5e9!important;
}
html[data-theme="dark"] #results #resultFinishSlide #onlineNickname::placeholder {
  color:#a8bbad!important;
  opacity:1;
}
/* Keep disabled action genuinely disabled, yet readable. */
html[data-theme="dark"] #results #onlineProfileSave:disabled {
  color:#c5d9cb!important;
  background:#3a5644!important;
  border-color:#57715d!important;
  opacity:.55!important;
}

/* Share controls: consistent dark-mode secondary/tertiary buttons
   while still differentiating image save, share and copy. */
html[data-theme="dark"] #results #resultFinishSlide .result-share-actions #copyButton {
  background:#31483a!important;
  color:#f0f5ec!important;
  border-color:#698a72!important;
}
html[data-theme="dark"] #results #resultFinishSlide .result-share-actions #copyButton:hover:not(:disabled) {
  background:#41604b!important;
  border-color:#96b99c!important;
}
html[data-theme="dark"] #results #resultFinishSlide .result-share-actions #snsShareButton {
  background:#583d36!important;
  color:#ffe3d6!important;
  border-color:#bd8e7f!important;
}
html[data-theme="dark"] #results #resultFinishSlide .result-share-actions #snsShareButton:hover:not(:disabled) {
  background:#734d40!important;
  border-color:#e0aa93!important;
}
html[data-theme="dark"] #results #resultFinishNextActions #goHomeButton {
  background:#314738!important;
  color:#f3f7ec!important;
  border-color:#6b8c72!important;
}
html[data-theme="dark"] #results #resultFinishNextActions #goHomeButton:hover:not(:disabled) {
  background:#41604a!important;
  border-color:#a0bd9e!important;
}

/* Contact popup: matching dark choice cards, explanatory text and email
   address so none of the original light surfaces remain. */
html[data-theme="dark"] #contactDialog .contact-description {
  color:#bbccbf!important;
}
html[data-theme="dark"] #contactDialog :is(.contact-type,.contact-type:visited) {
  background:#304538!important;
  color:#f1f6ed!important;
  border-color:#5c7964!important;
}
html[data-theme="dark"] #contactDialog .contact-type:hover {
  background:#41624b!important;
  color:#fff!important;
  border-color:#9cc1a3!important;
}
html[data-theme="dark"] #contactDialog .contact-type :is(.contact-type-name,.contact-chevron) {
  color:inherit!important;
}
html[data-theme="dark"] #contactDialog .contact-footer {
  border-color:#5d7462!important;
}
html[data-theme="dark"] #contactDialog .contact-footer span {
  color:#c4e4ce!important;
}
html[data-theme="dark"] #contactDialog .contact-footer button {
  background:#31483a!important;
  color:#f3f7ee!important;
  border-color:#688b72!important;
}
html[data-theme="dark"] #contactDialog .contact-footer button:hover {
  background:#42644e!important;
}

/* Other small text in local records and ranking: muted, not invisible. */
html[data-theme="dark"] #historyDialog :is(.history-record-date,.history-section-header span,.history-rank-help,.history-record-bottom small) {
  color:#bdcfc1!important;
}
html[data-theme="dark"] #leaderboard :is(.board-summary,.board-filters,.board-status-panel) {
  color:#c0d3c4!important;
}


/* DARK THEME QA · follow-up: leaderboard rank contrast and history detail.
   Presentation-only overrides; no light-mode or game logic changes. */

/* The global leaderboard badge used a pale background with white text
   in dark mode, which made rank 2 particularly difficult to read. */
html[data-theme="dark"] #leaderboard .board-rank {
  background:#36483b!important;
  color:#eef4ed!important;
  border:1px solid #667e6c!important;
}
html[data-theme="dark"] #leaderboard .board-rank.top1 {
  background:#e9ce90!important;
  color:#4e391c!important;
  border-color:#b89650!important;
}
html[data-theme="dark"] #leaderboard .board-rank.top2 {
  background:#dae4e9!important;
  color:#263d4a!important;
  border-color:#a5b8c4!important;
}
html[data-theme="dark"] #leaderboard .board-rank.top3 {
  background:#e1b398!important;
  color:#573523!important;
  border-color:#bd886d!important;
}

/* Past-result dialog: the outer shell was dark, but inner result, level
   bars and two insight cards still used the old light-theme backgrounds.
   Match these panels to the same contrast system as the result screens. */
html[data-theme="dark"] #historyDetailDialog .history-detail-header {
  border-bottom-color:#556d5a!important;
}
html[data-theme="dark"] #historyDetailDialog :is(.history-detail-eyebrow,.history-detail-side,.history-detail-side span) {
  color:#bccfc0!important;
}
html[data-theme="dark"] #historyDetailDialog :is(.history-detail-header h2,.history-detail-section h3) {
  color:#f0f5ef!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-hero {
  background:#304639!important;
  color:#eff6ed!important;
  border-left-color:#f18e79!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-grade {
  color:#f0f5ed!important;
}
html[data-theme="dark"] #historyDetailDialog #historyDetailScore {
  color:#ffad93!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-side strong {
  color:#f3f7ec!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-levels {
  background:#293b30!important;
  border-color:#536c58!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-level {
  color:#c0d2c5!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-level strong {
  color:#f2f7ee!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-track {
  background:#43594a!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-track>span {
  background:#86c4a4!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-insights>div {
  background:#30483a!important;
  border-color:#5b7963!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-insights>div:last-child {
  background:#403d35!important;
  border-color:#786958!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-insights span {
  color:#bdd0c1!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-insights strong {
  color:#f3f7ed!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-done {
  background:#366049!important;
  color:#fff9ef!important;
  border:1px solid #648b6d!important;
}
html[data-theme="dark"] #historyDetailDialog .history-detail-done:hover {
  background:#46785a!important;
}
/* The optional online-publication form may also appear in past results. */
html[data-theme="dark"] #historyDetailDialog .history-online-section {
  background:#2b4134!important;
  color:#e9f2e9!important;
  border-color:#577260!important;
}
html[data-theme="dark"] #historyDetailDialog :is(.history-online-heading,.history-online-consent label,#historyDetailPublishStatus) {
  color:#d1e1d3!important;
}
html[data-theme="dark"] #historyDetailDialog .history-online-form input[type="text"] {
  background:#1d2c23!important;
  color:#f0f6ee!important;
  border-color:#6c8770!important;
}
html[data-theme="dark"] #historyDetailDialog .history-online-consent a {
  color:#a9e1bd!important;
}
html[data-theme="dark"] #historyDetailDialog #historyDetailPublishSave {
  background:#3c6c51!important;
  color:#fff!important;
}


/* DARK MODE QA · quiet secondary controls (2026-11-09).
   Both grade-guide entry buttons share .grade-guide-open:
   leaderboard heading and the local-history dialog header.
   Existing light-theme rules, layout and behavior are untouched. */
html[data-theme="dark"] .grade-guide-open {
  background:#304438!important;
  color:#edf4ed!important;
  border:1px solid #667f6b!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .grade-guide-open:hover {
  background:#3d5845!important;
  color:#ffffff!important;
  border-color:#93b69a!important;
}
html[data-theme="dark"] .grade-guide-open:focus-visible {
  outline:2px solid #f58b76!important;
  outline-offset:2px!important;
}

/* History mode tabs: the inherited light-colored 4px padding was
   reading like a thick white border in dark mode. Keep a quiet 1px
   frame and let only the selected tab carry the visual emphasis. */
html[data-theme="dark"] #historyDialog .history-tabs {
  background:#273a2f!important;
  border:1px solid #536a59!important;
  border-radius:5px!important;
  padding:3px!important;
  gap:4px!important;
  box-shadow:none!important;
}
html[data-theme="dark"] #historyDialog .history-tabs button,
html[data-theme="dark"] #historyDialog .history-tabs button[aria-pressed="false"] {
  background:transparent!important;
  color:#c3d4c6!important;
  border:1px solid transparent!important;
  box-shadow:none!important;
}
html[data-theme="dark"] #historyDialog .history-tabs button.active,
html[data-theme="dark"] #historyDialog .history-tabs button[aria-pressed="true"] {
  background:#41664f!important;
  color:#fffaf2!important;
  border:1px solid #769b7f!important;
  box-shadow:none!important;
}
html[data-theme="dark"] #historyDialog .history-tabs button:not(.active):hover {
  background:#354e3e!important;
  color:#f4f7f0!important;
}
html[data-theme="dark"] #historyDialog .history-tabs button:focus-visible {
  outline:2px solid #f58b76!important;
  outline-offset:1px!important;
}


/* Dark-mode history best badge: inherit original tier colors instead of
   the generic muted stat-label color. Match recent-record tier badges. */
html[data-theme="dark"] #historyDialog .history-stat #historyBestGrade.history-record-grade {
  color:#465e50!important;
}
html[data-theme="dark"] #historyDialog .history-stat #historyBestGrade[data-grade="다이아몬드"],
html[data-theme="dark"] #historyDialog .history-stat #historyBestGrade[data-grade="플래티넘"] {
  color:#476581!important;
}
html[data-theme="dark"] #historyDialog .history-stat #historyBestGrade[data-grade="골드"] {
  color:#8c6a20!important;
}
html[data-theme="dark"] #historyDialog .history-stat #historyBestGrade[data-grade="실버"] {
  color:#526775!important;
}
html[data-theme="dark"] #historyDialog .history-stat #historyBestGrade[data-grade="브론즈"] {
  color:#956046!important;
}
