.theme-toggle{border:1px solid var(--line);background:transparent;color:var(--ink);border-radius:6px;width:32px;min-height:32px;font-size:21px;flex-shrink:0}
.topbar-right{flex-wrap:wrap}.topbar{min-height:79px;height:auto;padding-top:12px;padding-bottom:12px;gap:12px}
@media(max-width:700px){.topbar{flex-wrap:wrap}.topbar-right{gap:9px;max-width:100%}}
@media screen {
html[data-theme=dark]{color-scheme:dark;--paper:#191919;--white:#242424;--ink:#ebebeb;--muted:#c0c0c0;--line:#4b4b4b;--green:#5e5e5e;--dark:#252525;--lime:#e1e1e1;--light:#363636;--red:#bdbdbd}
html[data-theme=dark] :is(.main,.topbar,main){background:#191919}
html[data-theme=dark] :is(.exercise-card,.solution-card,.custom-editor,.progress-dialog,.tools-dialog){background:#242424;border-color:#4b4b4b}
html[data-theme=dark] :is(.controls,.reference,.mode-switch,.step-bottom,.paste-panel,.history-card){background:#2c2c2c;border-color:#4b4b4b}
html[data-theme=dark] :is(.solution-summary,.progress-total,.focus-card,.tool-output,.formula-card-list article,.saved-matrix-panel,.tip-card,.example-math,.calculations code,.custom-chip,.completion-check,.solution-number,.pill){background:#383838;border-color:#5e5e5e;color:#e3e3e3}
html[data-theme=dark] :is(.main,.progress-dialog,.tools-dialog) :is(p,small,label,h2,h3,h4,strong,.eyebrow,.exercise-meta,.step-head,.answer-label,.format-note,.save-note,.summary-label,.tool-result-label,.focus-label,.saved-label,.matrix-caption,.step-matrix>span,.progress-row,.history-card li,.tool-output pre,.tool-number,.formula,.formula-big,.worked-math,.solution-answer,.matrix-name,.custom-status,.exam-timer){color:#d1d1d1}
html[data-theme=dark] :is(.main,.progress-dialog,.tools-dialog) :is(h1,h2,h3,h4){color:#f1f1f1}
html[data-theme=dark] :is(.quiet,.text-button,.hint-button,.progress-open,.tools-open,.exam-toggle,.reference-tabs button,.mode-switch button,.tools-tabs button,.progress-close,.tools-close){color:#d0d0d0;border-color:#5c5c5c}
html[data-theme=dark] :is(.tools-open,.exam-toggle,.problem-number){background:#303030;color:#d9d9d9;border-color:#5f5f5f}
html[data-theme=dark] :is(.mode-switch button.selected,.language .selected,.exam-toggle.on,.problem-number.current){background:#4b4b4b;color:#f0f0f0}
html[data-theme=dark] :is(input:not([type=range]),textarea,select){background:#1b1b1b!important;color:#ececec!important;border-color:#737373!important}
html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:#a0a0a0}
html[data-theme=dark] :is(.primary,.problem-number.finished){background:#5e5e5e;color:#ffffff}
html[data-theme=dark] :is(.feedback.success,.cell-result.ok,.sandbox-status.success){color:#d6d6d6}
html[data-theme=dark] :is(.feedback.error,.cell-result.bad,.custom-status.error,.sandbox-status.error){color:#bdbdbd;background:transparent}
html[data-theme=dark] :is(.tool-output.error,input.incorrect,input[aria-invalid=true]){background:#2c2c2c!important;color:#d9d9d9!important;border-color:#959595!important}
html[data-theme=dark] input.correct{background:#363636!important;border-color:#b2b2b2!important}
html[data-theme=dark] .hint-box{background:#363636;border-color:#757575;color:#dfdfdf}
html[data-theme=dark] .hint-box p{color:#dfdfdf}
html[data-theme=dark] :is(.matrix-cell.target,.matrix-cell.diagonal,.checkerboard .positive){background:#4a4a4a;color:#ededed}
html[data-theme=dark] :is(.matrix-cell.source,.checkerboard .negative){background:#3a3a3a;color:#e2e2e2}
html[data-theme=dark] .matrix-cell.deleted{background:#3a3a3a;color:#a7a7a7}
html[data-theme=dark] .matrix-cell.repeated{color:#b3b3b3}
html[data-theme=dark] .matrix-cell.repeated.diagonal{background:#4a4a4a;color:#ededed}
html[data-theme=dark] :is(.matrix-wrap:before,.matrix-wrap:after,.matrix-cell.split){border-color:#c0c0c0}
html[data-theme=dark] :is(.reference-divider,.step-dots i){background:#4b4b4b}
html[data-theme=dark] .step-dots .here{background:#dcdcdc}
html[data-theme=dark] .step-dots .complete{background:#909090}
html[data-theme=dark] .topbar-right .private-badge{color:#c9c9c9}
}
.controls{flex-wrap:wrap}
@media screen{html[data-theme=dark] #reference-content p,html[data-theme=dark] .single .answer-cell>span:first-child,html[data-theme=dark] .text-button,html[data-theme=dark] .reference-title{color:#d1d1d1}html[data-theme=dark] .reference-foot{color:#d1d1d1!important}}
/* Readable neutral surfaces and touch targets. */
:root{--paper:#f7f7f7;--white:#fff;--ink:#202020;--green:#242424;--dark:#141414;--lime:#eee}
.primary{background:#242424;color:#fff}.topic.active{background:#f3f3f3;color:#171717}
.goal,.step-instruction,.intro p,.solution-list p,.custom-intro,#reference-content p{font-size:16px;line-height:1.7;color:#525252}
.topic strong,.quiet,.primary,.hint-button,.text-button,.tools-open,.progress-open,.mode-switch button,.reference-tabs button,.controls select{font-size:14px}
.topic small,.format-note,.save-note,.answer-cell>span:first-child{font-size:12px}
button{min-height:36px}.topbar-right{gap:12px}#volume-percent{font-size:12px;min-width:34px;font-variant-numeric:tabular-nums}
.sound-control input[type=range]{width:70px}.progress-dialog{max-height:calc(100dvh - 32px);overflow-y:auto}
@media screen{html[data-theme=dark]{--paper:#111;--white:#1c1c1c;--ink:#eee;--dark:#111}html[data-theme=dark] :is(.main,.topbar,main){background:#111}html[data-theme=dark] :is(.exercise-card,.solution-card,.custom-editor,.progress-dialog,.tools-dialog){background:#1c1c1c}html[data-theme=dark] .primary{background:#ededed;color:#111}html[data-theme=dark] .topic.active{background:#ededed;color:#111}}
@media(max-width:700px){button{min-height:44px}.topbar-right{gap:8px}.topbar{padding:12px 16px}.controls{gap:14px}.new-set{font-size:12px;padding:6px}.theme-toggle{width:44px}.goal,.step-instruction{font-size:16px}.answer-cell input{font-size:18px;min-height:44px}.sound-control input[type=range]{width:60px}}
