.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:6px 12px;border:1px solid #ccdce5;border-radius:999px;background:#f3f8fa;color:#25495f;font-size:.78rem;font-weight:800;white-space:nowrap}
.theme-toggle:hover{background:#e2f2f5;border-color:#9acbd4}
.theme-toggle-icon{font-size:1.05rem;line-height:1}
.topbar-title{flex:1;min-width:0}
.topbar-badge{margin-left:0}
.progress-track span{background:var(--grade,#2a97ad)}
@media(max-width:600px){.topbar-badge{display:none}.topbar-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
@media(max-width:360px){.theme-toggle-label{display:none}.theme-toggle{width:39px;padding:5px}}

html[data-theme="dark"]{
  --night-bg:#0d1726;
  --night-panel:#17263a;
  --night-raised:#1e3148;
  --night-border:#324960;
  --night-text:#e9f2fa;
  --night-muted:#b2c5d4;
  --night-accent:#76d2e6;
  color-scheme:dark;
  color:var(--night-text);
  background:var(--night-bg);
}
html[data-theme="dark"] body{background:var(--night-bg)}
html[data-theme="dark"] :focus-visible{outline-color:#8bdff0}
html[data-theme="dark"] .skip-link{background:var(--night-panel);color:var(--night-text)}
html[data-theme="dark"] .sidebar{background:#0b1b30;color:#f0f7fc}
html[data-theme="dark"] .nav-list a{color:#c0d3e1}
html[data-theme="dark"] .nav-list a:hover,
html[data-theme="dark"] .nav-list a.active{background:#24435e;color:#fff}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .footer{background:#142237;border-color:var(--night-border)}
html[data-theme="dark"] .topbar-title,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .menu-button{color:var(--night-muted)}
html[data-theme="dark"] .topbar-badge{background:#263f55;color:#c7dbe9}
html[data-theme="dark"] .theme-toggle{background:#294258;border-color:#46657a;color:#edf7fb}
html[data-theme="dark"] .theme-toggle:hover{background:#35546c;border-color:#77b8cc}

html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .metric-value,
html[data-theme="dark"] .feature-link,
html[data-theme="dark"] .question-title{color:var(--night-text)}
html[data-theme="dark"] .page-head p:last-child,
html[data-theme="dark"] .hero p:last-of-type,
html[data-theme="dark"] .grade-card p,
html[data-theme="dark"] .question-item p,
html[data-theme="dark"] .history-card p,
html[data-theme="dark"] .about-copy p,
html[data-theme="dark"] .about-copy li,
html[data-theme="dark"] .result-center p,
html[data-theme="dark"] .empty{color:var(--night-muted)}
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .text-link,
html[data-theme="dark"] .feature-icon{color:var(--night-accent)}
html[data-theme="dark"] .hero{background:#173447;border-color:#315d6c}
html[data-theme="dark"] .hero:before{border-color:#4dc7d51f}

html[data-theme="dark"] :where(.grade-card,.panel,.notice,.question-item,.side-panel,.metric,.history-card,.feature-link,.color-card,.review-item){background:var(--night-panel);border-color:var(--night-border);box-shadow:0 8px 24px #050c1a38}
html[data-theme="dark"] :where(.grade-count,.status-pill,.reference-tag){background:#273a50;color:#bfd1de}
html[data-theme="dark"] :where(.grade-card p,.progress-label,.metric-label,.question-item p,.history-card p,.feature-link small,.color-count,.color-card p,.color-card h2 span,.color-card code,.color-family,.color-card-body small){color:var(--night-muted)}
html[data-theme="dark"] .notice,
html[data-theme="dark"] .notice strong{color:#c5d6e2}
html[data-theme="dark"] .progress-track{background:#2a4055}
html[data-theme="dark"] .grade-tag{background:#244d61;color:#b6e7f0}
html[data-theme="dark"] .status-pill.good{background:#173d35;color:#9be8c8}
html[data-theme="dark"] .status-pill.bad{background:#4a3032;color:#ffb6a9}
html[data-theme="dark"] .result-breakdown .breakdown-row{border-color:var(--night-border);color:#c5d5e1}
html[data-theme="dark"] .score-circle{border-color:#315e68;color:#a8e5ef}
html[data-theme="dark"] .set-summary{background:#1d3b49}
html[data-theme="dark"] .set-summary p,
html[data-theme="dark"] .answer-box p,
html[data-theme="dark"] .review-item p{color:var(--night-muted)}
html[data-theme="dark"] .answer-box{background:#21394b;color:var(--night-text)}
html[data-theme="dark"] .answer-box.correct{background:#173c36}
html[data-theme="dark"] .answer-box.wrong{background:#493332}
html[data-theme="dark"] .answer-box .answer-value{color:#d1edf2}

html[data-theme="dark"] :where(.field label,.quiz-number,.quiz-category,.back-link,.side-panel p,.side-panel .mini-note){color:var(--night-muted)}
html[data-theme="dark"] :where(.field select,.short-answer){background:#102033;border-color:#49617a;color:var(--night-text)}
html[data-theme="dark"] input::placeholder{color:#93aabb}
html[data-theme="dark"] .chip{background:#1d3047;border-color:#426077;color:#d5e4ee}
html[data-theme="dark"] .chip.active{background:#2a6b83;border-color:#66bace;color:#fff}
html[data-theme="dark"] .secondary-button{background:#2a4359;color:#e1eef5}
html[data-theme="dark"] .secondary-button:hover{background:#385974}
html[data-theme="dark"] .primary-button{background:#277e9a;color:#fff}
html[data-theme="dark"] .primary-button:hover{background:#359bb7}
html[data-theme="dark"] .danger-button{background:#493237;color:#ffc7bb}
html[data-theme="dark"] .danger-button:hover{background:#5c3b40}
html[data-theme="dark"] .quiz-category{background:#244459;color:#a9e7f1}
html[data-theme="dark"] .choice,
html[data-theme="dark"] .exam2-option{background:#1b2d43;border-color:#3d566b;color:var(--night-text)}
html[data-theme="dark"] .choice:hover:not(:disabled),
html[data-theme="dark"] .exam2-option:hover{background:#263f55;border-color:#6ab9cc}
html[data-theme="dark"] .choice.selected,
html[data-theme="dark"] .exam2-option.selected{background:#16475a;border-color:#75d4e6}
html[data-theme="dark"] .choice.correct{background:#194a3e;border-color:#74d3ae}
html[data-theme="dark"] .choice.wrong{background:#593a3a;border-color:#f0a194}
html[data-theme="dark"] .choice-key{background:#30485e;color:#d1e1eb}
html[data-theme="dark"] .choice.correct .choice-key{background:#2c6d54;color:#e3fff2}
html[data-theme="dark"] .choice.wrong .choice-key{background:#784942;color:#ffe0d5}
html[data-theme="dark"] .mock-jump button,
html[data-theme="dark"] .exam2-jump button{background:#24394f;border-color:#405b70;color:#d8e7f0}
html[data-theme="dark"] .mock-jump button.answered,
html[data-theme="dark"] .exam2-jump button.answered{background:#1a5048;border-color:#5cb5a5}
html[data-theme="dark"] .mock-bar strong{background:#1d4557;color:#b7e9f3}
html[data-theme="dark"] .mock-facts div{background:#203449}
html[data-theme="dark"] .mock-facts span{color:var(--night-muted)}
html[data-theme="dark"] .side-panel .mini-note{border-color:var(--night-border)}

html[data-theme="dark"] .color-card .color-swatch,
html[data-theme="dark"] .quiz-swatch{border-color:#49617a}
html[data-theme="dark"] .color-hint{background:#214151;border-color:#68b9cb;color:#d5e9f2}
html[data-theme="dark"] .exam2-lead,
html[data-theme="dark"] .exam2-figure figcaption,
html[data-theme="dark"] .exam2-figure p,
html[data-theme="dark"] .exam2-written-label,
html[data-theme="dark"] .exam2-review p{color:var(--night-muted)}
html[data-theme="dark"] .exam2-figure{background:#1d2e42;border-color:var(--night-border)}
html[data-theme="dark"] .exam2-part{border-color:var(--night-border)}
html[data-theme="dark"] .exam2-part legend{color:var(--night-text)}
html[data-theme="dark"] .exam2-part legend strong,
html[data-theme="dark"] .exam2-review summary strong{background:#276b86;color:#fff}
html[data-theme="dark"] .exam2-option span{color:#9bdceb}
html[data-theme="dark"] .exam2-review{border-color:var(--night-border)}
html[data-theme="dark"] :where(.exam2-scheme-grid>div,.exam2-digital>div,.exam2-formula strong,.exam-data-cards span,.exam-flow span,.exam-route-map>div,.exam-menu,.exam-form,.exam-emergency){background:#263a50;border-color:#476178;color:var(--night-text)}
html[data-theme="dark"] :where(.exam2-formula span,.exam-data-cards span,.exam-route-map strong,.exam-route-map small,.exam-menu,.exam-form,.exam-emergency small){color:var(--night-muted)}
html[data-theme="dark"] :where(.exam2-formula strong,.exam-data-cards strong,.exam2-digital div span){color:#d9f1f8}
html[data-theme="dark"] .exam2-digital small{color:#a9c7d6}
html[data-theme="dark"] .exam-flow b{color:#8dc9d7}
html[data-theme="dark"] .exam2-figure svg text{fill:#c0d1dd}
html[data-theme="dark"] .exam-form label span{border-color:#688098;color:#a9c3d3}
html[data-theme="dark"] .exam-form p{color:#ffc0b4}
html[data-theme="dark"] .exam-emergency p{border-color:var(--night-border)}
html[data-theme="dark"] .exam2-question-swatch{border-color:#738a9e}
html[data-theme="dark"] .toast{background:#28485f;color:#f3fbff}
