/* These button styles are the only addition applied to the existing light UI. */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:8px 11px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--ink);font:600 12px var(--sans,system-ui);white-space:nowrap;cursor:pointer;flex-shrink:0}
.theme-toggle>span:first-child{font-size:19px;line-height:1}.theme-toggle:hover{border-color:var(--ink-soft)}.theme-toggle:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
@media(max-width:600px){.theme-toggle{padding:7px 8px;gap:5px;font-size:11px;min-height:36px}.chat-head{flex-wrap:wrap}.chat-head .who{order:3;flex-basis:100%}.nav-inner{gap:8px}.nav-links{gap:2px}}
html[data-theme="dark"]{color-scheme:dark;--paper:#12151d;--paper-2:#191e29;--card:#202633;--ink:#f1f3f9;--ink-soft:#c1c8d8;--ink-faint:#a6afc2;--line:#3c4659;--line-2:#343e50;--brand:#b5adff;--brand-deep:#d5d0ff;--brand-tint:#302b50;--amber:#ffd18a;--amber-tint:#3b2c1b;--ok:#8ee3b0;--ok-tint:#193b2c;--ok-bg:#193b2c;--ok-br:#437757;--err:#ffb2b2;--err-tint:#43272d;--err-bg:#43272d;--err-br:#89505d;--warn:#ffd18a;--warn-bg:#3b2c1b;--shadow-sm:0 1px 4px #0004;--shadow-md:0 8px 24px #0004;--shadow-lg:0 24px 60px #0007}
html[data-theme="dark"] header.nav{background:#12151ded}
html[data-theme="dark"] :is(input,textarea,select){color:var(--ink);background-color:var(--paper)}
html[data-theme="dark"] ::placeholder{color:var(--ink-faint);opacity:1}
html[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.chat-fb):not(.attach-btn){--bg:#5546d7;background:var(--bg);color:#fff}
html[data-theme="dark"] :is(.brand .glyph,.msg-row.user .msg-bubble,.auto-step h5 .auto-no,.pyq-sort button[aria-pressed="true"],.pyq-tabs button[aria-pressed="true"]){background:#5546d7;color:#fff}
html[data-theme="dark"] :is(.subject-coverage.is-complete,.subjects li .cov.full,.auto-exam,.auto-res,.calculus-final,.fb-done .check){background:#193b2c;color:#b3f3ce;border-color:#437757}
html[data-theme="dark"] :is(.auto-tip,.pyq-pill.times.hot){background:var(--amber-tint);color:var(--amber)}
html[data-theme="dark"] .toast{background:#323b50;color:var(--ink)}
html[data-theme="dark"] :is(.modal-msg.err,.msg-bubble.error,.pyq-answer-panel.error){background:var(--err-bg);color:var(--err);border-color:var(--err-br)}
html[data-theme="dark"] .modal-msg.ok{background:var(--ok-bg);color:var(--ok);border-color:var(--ok-br)}
html[data-theme="dark"] :is(.chat-course-icon,.chat-course-change){background:#233e33;color:#b3f3ce;border-color:#537863}
html[data-theme="dark"] .chat-course-change:hover{background:#2f5142}
html[data-theme="dark"] :is(.chat-picker-step,.chat-picker-back,.chat-course-scheme,.chat-course-group small,.chat-course-code,.chat-course-coverage){color:#ade0c1}
html[data-theme="dark"] :is(.chat-course-group:hover,.chat-course-subject:hover,.chat-course-subject.is-selected){background:#283e35;border-color:#7da98d}
html[data-theme="dark"] .chat-picker-error{background:var(--err-bg);color:var(--err)}
html[data-theme="dark"] :is(.pyq-answer-panel,.pyq-version){background:var(--card);border-color:var(--line)}
html[data-theme="dark"] :is(.pyq-answer-head,.pyq-pick-opts button){background:var(--err-bg);color:var(--err);border-color:var(--err-br)}
html[data-theme="dark"] .pyq-answer-hide{color:var(--err)}
html[data-theme="dark"] .pyq-card.hot{box-shadow:0 0 0 2px #725432;border-color:#b48c55}
html[data-theme="dark"] .pyq-pill.marks{background:#193b2c;color:#b3f3ce}
html[data-theme="dark"] .auto-calculus{color:var(--ink)}
html[data-theme="dark"] :is(.calculus-course,.calculus-step h4>span){color:#8ad8e0;border-color:var(--line)}
html[data-theme="dark"] .calculus-table th{background:var(--paper-2)}
html[data-theme="dark"] .calculus-final>strong{color:#b3f3ce}
/* Original diagrams retain a white drawing surface so their ink and labels stay intact. */
html[data-theme="dark"] :is(.dfa-diagram svg,.auto-fig svg,.solve-diagram svg,.scan-machine-svg svg){background:#fff;color:#1b1b23;border-radius:6px}
html[data-theme="dark"] :is(.dfa-table th,.dfa-table td,.calculus-table th,.calculus-table td){border-color:var(--line)}
html[data-theme="dark"] .sandbox{background:var(--paper-2)}
@media print{[data-theme-toggle]{display:none!important}}

html[data-theme="dark"] :is(.pledge,.friend .avatar,.btn-chat-hero){background:linear-gradient(135deg,#423789,#302861);color:#fff}
html[data-theme="dark"] :is(.try-q:hover,.chat-fb:hover,.attach-btn:hover,.attach-btn[aria-expanded="true"]){background:#5546d7;color:#fff;--bg:#5546d7;--fg:#fff}
html[data-theme="dark"] ::selection{background:#5546d7;color:#fff}
html[data-theme="dark"] .fb-tab{background:#5546d7;color:#fff}
html[data-theme="dark"] :is(.chat-picker-foot,.chat-course-loading,.chat-picker-step>span){color:var(--ink-faint)}
html[data-theme="dark"] :is(.seg,.iconbtn,.course-card,.prow,.prow.full,.prow.half,.bq.on,.cie-note button){background:var(--card);border-color:var(--line)}
html[data-theme="dark"] :is(.steps button[aria-current="true"],.seg button[aria-pressed="true"],.chip[aria-pressed="true"],.mtabs button[aria-pressed="true"],.meter.total,.pill.marks){background:#5546d7;color:#fff}
@media(max-width:600px){.nav-inner:has([data-theme-toggle]){height:auto;min-height:68px;flex-wrap:wrap;padding-top:10px;padding-bottom:10px}.nav-inner:has([data-theme-toggle]) .nav-links{max-width:100%;flex-wrap:wrap;justify-content:flex-end}.top:has([data-theme-toggle]) .crumb{display:none}}
