:root{color-scheme:light;--page:#f7f8fc;--surface:#fff;--soft:#f3efff;--ink:#20233c;--muted:#64617a;--line:#e7e4ef;--accent:#ae392f}
:root[data-theme=dark]{color-scheme:dark;--page:#17151f;--surface:#25222f;--soft:#352b4d;--ink:#f1eff8;--muted:#b7b3c8;--line:#474153;--accent:#b49bff;background:var(--page);color:var(--ink)}
.theme-picker{display:flex;gap:7px;align-items:center;font-size:12px;color:var(--muted)}
.theme-picker select{max-width:130px;padding:8px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink);font:inherit}
[data-theme=dark] body,[data-theme=dark] .main-wrap,[data-theme=dark] .app-shell{background:var(--page);color:var(--ink)}
[data-theme=dark] :is(.sidebar,.side-profile,.bottom-nav,.panel,.summary-box,.profile-dialog,.profile-option,.offline-pill,.history-item,.tool-button){background:var(--surface);color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(.field input,.field select,.field textarea,.add-profile-form input){background:#1d1a26;color:var(--ink);border-color:var(--line);accent-color:var(--accent)}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:var(--muted);opacity:1}
[data-theme=dark] :is(.page-heading p,.eyebrow,.side-label,.profile-text small,.side-tip p,.dialog-note,.task-card p,.history-item small,.summary-box small,.source,.section-head p,.chevron,.nav-link,.bottom-link){color:var(--muted)}
[data-theme=dark] :is(.task-statement,.task-statement strong,.solution ol,.solution h2,.profile-text strong){color:var(--ink)}
[data-theme=dark] :is(.tag,.notice,.side-tip,.avatar,.ghost-button,.icon-button,.nav-link.active,.nav-link:hover,.bottom-link.active,.profile-option.active,.selected-row,.tool-button.active){background:var(--soft);color:#d3c2ff;border-color:var(--line)}
[data-theme=dark] .side-tip:after{color:#574574}
[data-theme=dark] :is(.task-card small,.text-link,.brand-dot,.mini-mark){color:var(--accent)}
[data-theme=dark] :is(.primary-button,.white-button){background:var(--accent);color:#21182e;box-shadow:none}
[data-theme=dark] .primary-button:hover,[data-theme=dark] .white-button:hover{background:#c8b4ff}
[data-theme=dark] .hero{background:#493578;box-shadow:none}
[data-theme=dark] :is(pre,.solution,th){background:#211d2d;color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(td,th,.add-profile-form){border-color:var(--line)}
[data-theme=dark] .profile-dialog::backdrop{background:#090711b3}
[data-theme=dark] .task-card:hover,[data-theme=dark] .history-item:hover{border-color:var(--accent)}
/* Recolour diagrams, leaving geometry and stored drawing pixels unchanged. */
[data-theme=dark] :is(#experiment,.task-media) text{fill:var(--ink)}
[data-theme=dark] :is(#experiment,.task-media) [stroke="#ae392f"]{stroke:var(--accent)}
[data-theme=dark] :is(#experiment,.task-media) :is([stroke="#bbb"],[stroke="#aaa"]){stroke:#777086}
[data-theme=dark] :is(#experiment,.task-media) [fill="#e7efdf"]{fill:var(--soft)}
[data-theme=dark] #experiment [fill="#fff1e5"]{fill:#4b342a}
[data-theme=dark] #drawing,[data-theme=dark] .conflict-drawings img{filter:invert(.9) hue-rotate(180deg)}
@media(max-width:650px){.theme-picker{gap:4px}.theme-picker span{display:none}.theme-picker select{max-width:115px}.topbar{gap:9px}.offline-pill{display:none}}
