.theme-toggle{flex:none;display:grid;place-items:center;width:38px;height:38px;margin-left:auto;padding:0;border:1px solid transparent;border-radius:10px;background:transparent;color:#344054}
.theme-toggle:hover{background:#f1f4f9;color:#111827}
.theme-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .theme-sun{display:none}
html[data-theme="dark"] .theme-toggle .theme-moon{display:none}
html[data-theme="dark"] .theme-toggle .theme-sun{display:block}
.theme-toggle+.search-trigger{margin-left:0}
@media(max-width:960px){.theme-toggle{order:2;margin-left:auto}.search-trigger{order:3}.subject-switch{order:4}.topnav{order:5}}

html[data-theme="dark"]{
  --page:#0b1220;
  --surface:#121c2e;
  --raised:#1a2940;
  --soft:#17243a;
  --line:#2d3c53;
  --text:#edf3fb;
  --muted:#b1bfd1;
  --accent:#8bb3ff;
  --accent-soft:#1a3053;
  color-scheme:dark;
  background:var(--page);
  color:var(--text);
}
html[data-theme="dark"] .terver-page{
  --accent:#7addaa;
  --accent-soft:#173c2d;
  --terver-green:#72d9a2;
  --terver-dark:#238454;
  --terver-soft:#173529;
  --terver-line:#315e46;
  --rating-accent:#72d9a2;
  --rating-soft:#173529;
}
html[data-theme="dark"] body{background:var(--page);color:var(--text)}
html[data-theme="dark"] :is(.topbar,.sidebar,.search-dialog,.topic-card,.list-row,.variant-card,.problem,.problem-card,.aside-box,.course-formula-card,.course-method,.stat,.stat-card,.progress-item,.rating-card,.topic-summary,.solution-sketch){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme="dark"] :is(.topbar,.sidebar){background:#101a2b}
html[data-theme="dark"] :is(.side-divider,.tabbar,.answer-reveal,.problem details.sol,.problem .phead){border-color:var(--line)}
html[data-theme="dark"] .side-divider{background:var(--line)}
html[data-theme="dark"] :is(.subtitle,.crumbs,.group-title,.side-title,.side-link,.topic-card p,.card-foot,.row-main small,.row-meta,.stat span,.progress-row small,.muted,.rating-scale,.rating-next,.rating-factor small,.rating-note,.rating-card small,.course-count,.course-links,.course-archive-link,.problem .psrc,.problem-status,.solution-note,.course-formula-intro,.lesson-body .freq,.lesson-body .closing-note,.lesson-body figcaption,.problem figcaption){color:var(--muted)}
html[data-theme="dark"] :is(.aside-box a,.tabbar button){color:var(--muted)}
html[data-theme="dark"] :is(.topnav a,.brand,.search-trigger,.icon-button,.theme-toggle,.topic-card h3,.topic-card:hover,.list-row:hover,.row-main strong,.problem .pnum,.tabbar button.active){color:var(--text)}
html[data-theme="dark"] :is(.side-link:hover,.side-link.active,.list-row:hover,.search-result:hover){background:var(--accent-soft);color:var(--accent)}
html[data-theme="dark"] :is(.topic-card:hover,.list-row:hover){border-color:var(--accent)}
html[data-theme="dark"] :is(.crumbs a,.text-link,.course-links a,.course-archive-link a,.course-formula-card h2 a,.aside-box a:hover,.mobile-toc summary,.card-foot strong,.arrow,.eyebrow){color:var(--accent)}
html[data-theme="dark"] :is(.subject-switch,.num,.pill,.theme-toggle:hover){background:var(--soft)}
html[data-theme="dark"] .subject-switch a{color:var(--muted)}
html[data-theme="dark"] .subject-switch a:hover{background:var(--raised);color:var(--text)}
html[data-theme="dark"] .subject-switch a.active{background:var(--raised);color:var(--accent);box-shadow:0 1px 4px #0004}
html[data-theme="dark"] .terver-page .subject-switch a.active{color:var(--accent)}
html[data-theme="dark"] :is(.btn,select,input,textarea,.search-input,.course-formula-search input){background:var(--raised);color:var(--text);border-color:#42546d}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#97aac1}
html[data-theme="dark"] .btn:hover{color:var(--accent);border-color:var(--accent)}
html[data-theme="dark"] .btn.primary{background:#315ec2;border-color:#315ec2;color:#fff}
html[data-theme="dark"] .terver-page .btn.primary{background:#208251;border-color:#208251;color:#fff}
html[data-theme="dark"] .terver-page .problem .check-btn{background:#208251;border-color:#208251;color:#fff}
html[data-theme="dark"] .terver-page .problem .check-btn:hover{background:#2a9963}
html[data-theme="dark"] :is(.formula-box,.feedback,.course-formula-intro,.course-lesson .formula-block,.course-formula-card .formula-block,.course-task .answer-checker,.problem .answer-checker,.problem .dano,.problem .answer,.problem .box,.lesson-body .box,.course-method){background:var(--soft);color:var(--text);border-color:var(--line)}
html[data-theme="dark"] .reader .formula-box{background:linear-gradient(110deg,#182c4d,#17243a);border-left-color:var(--accent)}
html[data-theme="dark"] :is(.course-lesson .formula-block,.course-formula-card .formula-block){background:linear-gradient(110deg,#173529,#172b30);border-left-color:var(--accent)}
html[data-theme="dark"] :is(.course-lesson .formula-heading,.course-formula-card .formula-heading,.lesson-body h5,.problem .step .lbl){color:var(--accent)}
html[data-theme="dark"] :is(.course-lesson .formula-row,.course-formula-card .formula-row){border-color:var(--line)}
html[data-theme="dark"] :is(.course-task .course-hint,.hint){background:var(--soft);color:var(--text)}
html[data-theme="dark"] .rating-hero{background:var(--rating-soft);color:var(--text)}
html[data-theme="dark"] .rating-emblem{background:conic-gradient(var(--rating-accent) var(--rating-fill),#34445c 0)}
html[data-theme="dark"] .rating-emblem span{background:var(--surface);color:var(--text)}
html[data-theme="dark"] :is(.rating-track,.progress-track){background:#34445c}
html[data-theme="dark"] :is(.rating-card,.course-formula-card){box-shadow:0 8px 30px #0002}
html[data-theme="dark"] :is(.pill.done,.answer-input.correct,.answer-select.correct,.problem .answer-checker.correct){background:#17412f;color:#9ae8b5;border-color:#31895b}
html[data-theme="dark"] :is(.pill.review,.hint,.course-task .course-hint){background:#3b2e1b;color:#f6d38d}
html[data-theme="dark"] :is(.answer-input.wrong,.answer-select.wrong,.problem .answer-checker.wrong,.wrong-feedback){background:#45262b;color:#ffc5c5;border-color:#9f4a56}
html[data-theme="dark"] :is(.correct-feedback,.feedback:not(.wrong-feedback)){background:#173c2d;color:var(--text)}
html[data-theme="dark"] .feedback.hint{background:#3b2e1b;color:#f6d38d;border-left-color:#d9a530}
html[data-theme="dark"] :is(.problem .phead,.search-result,.lesson-body th,.problem th){background:var(--soft);color:var(--text)}
html[data-theme="dark"] :is(.lesson-body td,.lesson-body th,.problem td,.problem th){border-color:var(--line)}
html[data-theme="dark"] :is(.lesson-body .box.thm,.lesson-body .memorize){background:#3b301e;color:#ffe3a8;border-color:#665234}
html[data-theme="dark"] .lesson-body .box.thm .tag{background:#594521;color:#ffdea0}
html[data-theme="dark"] .lesson-body .box.fml{background:#29253e;border-color:#554974}
html[data-theme="dark"] .lesson-body .box.fml .tag{background:#42335f;color:#e3ccff}
html[data-theme="dark"] .lesson-body .box.err{background:#3f272c;border-color:#72414a}
html[data-theme="dark"] .lesson-body .box.err .tag{background:#5a3038;color:#ffc2c2}
html[data-theme="dark"] .lesson-body .box .tag{background:#244b38;color:#9ae7b7}
html[data-theme="dark"] .problem .box .tag{color:var(--accent)}
html[data-theme="dark"] .topic-art svg{stroke:#8093ad}
html[data-theme="dark"] .topic-art svg .blue{stroke:#6f99ff}
html[data-theme="dark"] .topic-art svg .open{fill:var(--surface);stroke:#6f99ff}
html[data-theme="dark"] .terver-page .topic-art svg{stroke:#a9dec0}
html[data-theme="dark"] .terver-page .topic-art svg text{fill:#a9dec0}
html[data-theme="dark"] .terver-page .topic-art svg .muted{stroke:#688a78}
html[data-theme="dark"] .brand svg path[stroke="#111827"]{stroke:#edf3fb}
html[data-theme="dark"] .solution-sketch svg circle[fill="#fff"]{fill:var(--surface)}
html[data-theme="dark"] .search-backdrop{background:#020612aa}
