/* Subject palettes are independent of the shared layout and personal theme. */
:root[data-subject="math"] { --blue:#3153c5; --accent-fill:#3153c5; --accent-deep:#2845a8; --hero-start:#2543a8; --hero-end:#4a60c7; --light:#edf1fc; --lightblue:#edf1fc; --bg:#f6f8fc; }
:root[data-subject="informatics"] { --blue:#4c3599; --accent-fill:#4c3599; --accent-deep:#3c277d; --hero-start:#3b287e; --hero-end:#6750ad; --light:#f0ebfa; --lightblue:#f0ebfa; --bg:#f8f7fc; --ink:#241e39; --muted:#766c8c; --line:#e8e3f0; }
:root[data-subject="board"] { --accent-fill:#3153c5; --accent-deep:#2845a8; --blue:#3153c5; --light:#edf1fc; --bg:#f6f8fc; }
:root { --panel:#fff; --white:#fff; --accent-fill:#3153c5; --accent-deep:#2845a8; }
.logo,.primary,.export { background:var(--accent-fill); }
.hero { background:linear-gradient(115deg,var(--hero-start),var(--hero-end)); box-shadow:none; }
.btn:not(.soft):not(.outline):not(.white):not(.dark) { background:var(--accent-fill); color:#fff; }
.btn.white,.btn.dark { color:var(--accent-deep); }
.btn.soft,.pill,.sidebar nav>a.active,.side-button.active,.subject-menu .subject-options a[aria-current="page"],.subject-menu .subject-options a:hover { color:var(--blue); background:var(--light); }
.btn.outline { background:var(--panel); color:var(--ink); }
.side-button:hover,.sidebar nav>a:hover { background:var(--light); }
.eyebrow,.hero-tag,.topic-num,.exam-foot,.exam-icon,.task-index,.task-category-label,.math-subject-menu summary { color:var(--blue); }
.hero .hero-tag { color:#fff; }
.btn:hover,.primary:hover,.export:hover { filter:brightness(.95); }
.theme-toggle { display:inline-grid; place-items:center; width:42px; height:42px; flex:none; padding:9px; border:1px solid var(--line,#e9ebf2); border-radius:11px; color:var(--ink,#172039); background:var(--panel); cursor:pointer; }
.theme-toggle svg { display:block; width:21px; height:21px; }
.theme-toggle:hover { background:var(--light); }
.theme-sun { display:none!important; }
:root[data-theme="dark"] .theme-moon { display:none!important; }
:root[data-theme="dark"] .theme-sun { display:block!important; }
:root[data-theme="dark"] { --bg:#121725; --panel:#1d2536; --white:#1d2536; --ink:#e8edf7; --muted:#a6b2c8; --line:#354057; --border:#354057; --light:#263451; --lightblue:#263451; --blue:#91abff; }
:root[data-theme="dark"][data-subject="informatics"] { --bg:#15121f; --panel:#221d30; --white:#221d30; --ink:#eee9f8; --muted:#b5abc9; --line:#40364f; --light:#342947; --lightblue:#342947; --blue:#beaaf2; --accent-fill:#6044b3; }
:root[data-theme="dark"] body { background:var(--bg); color:var(--ink); }
:root[data-theme="dark"] :is(.sidebar,.topbar,.mobile-nav,.panel,.exam-card,.task-card,.source-card,.topic,.exam-option,.account-auth,.card,.subject-options,dialog,.surface,.portal-panel,.auth-card,.station-work,.station-bottom,.station-sidebar,.exam-history button) { color:var(--ink); background:var(--panel); border-color:var(--line); }
:root[data-theme="dark"] :is(h1,h2,h3,h4,.task-main,.task-statement,.task-text,.solution,.breadcrumbs b,.subject-menu .subject-chip,.subject-menu .subject-options a,.document-name,.identity strong,.station-counter strong) { color:var(--ink); }
:root[data-theme="dark"] :is(.subtitle,.source-note,.task-meta,.topic-name,.top-link,.math-board-link,.math-account-link,.side-button,.save-state,.station-counter,.station-legend,.hint,.filter-label,.exam-option small) { color:var(--muted); }
:root[data-theme="dark"] :is(input:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="radio"]),select,textarea,.field,.search-wrap,.chip,.subject-menu .subject-chip,.tabs,.exam-preflight,.invite-box,.station-sync,.task-card details,.task-rich pre,.task-rich table th,.account-table th,.progress-matrix th:first-child,.results-matrix th:first-child) { background:var(--bg); color:var(--ink); border-color:var(--line); }
:root[data-theme="dark"] :is(.tabs .active,.tabs button.active,.topic.selected,.exam-option.selected,.side-button.active,.sidebar nav>a.active) { color:var(--blue); background:var(--light); }
:root[data-theme="dark"] :is(.hero h1,.hero p,.hero .hero-tag,.hero-tag) { color:#fff; }
:root[data-theme="dark"] :is(.btn.soft,.pill,.answer-state.state-blank,.task-index) { color:var(--blue); background:var(--light); }
:root[data-theme="dark"] :is(.task-statement svg,.task-rich svg,.solution svg,.task-statement img,.task-rich img,.solution img) { background:#fff; border-radius:6px; }
:root[data-theme="dark"] :is(.task-rich table,.task-rich td,.task-rich th,.account-table th,.account-table td) { border-color:var(--line); }
:root[data-theme="dark"] :is(.station-nav button,.station-button,.builder-row,.exam-answer-row,.empty,.exam-resume,.soft-panel,.answer-box,.problem-question,.lookup-formula-card,.paper-method,.paper-tape,.binary-code-tree) { color:var(--ink); background:var(--panel); border-color:var(--line); }
:root[data-theme="dark"] :is(.state-correct,.tone-good) { color:#a6e3c2; background:#203e35; }
:root[data-theme="dark"] :is(.state-wrong,.tone-bad) { color:#ffb1bc; background:#482b38; }
:root[data-theme="dark"] :is(.state-partial,.tone-mid) { color:#f0d28c; background:#453d29; }
:root[data-theme="dark"] :is(.solution,.notice,.mini-stat,.icon-btn,.stat,.stepper,.generated-summary,.variants-chips span,.source-meta,.prototype-related,.category-button,.task-category h3,.manual-replacement,.python-notice,.python-io pre,.python-run-review pre) { color:var(--ink); background:var(--panel); border-color:var(--line); }
:root[data-theme="dark"] :is(.category-button.active,.view-toggle button.active) { color:var(--blue); background:var(--light); }
:root[data-theme="dark"] :is(.sidebar nav>a,.bank-link,.task-category h3>span) { color:var(--muted); }
:root[data-theme="dark"] .sidebar nav>a.active { color:var(--blue); }
:root[data-theme="dark"] .work-table tbody tr:nth-child(even) { background:var(--bg); }
:root[data-theme="dark"] :is(.badge,.topic-num) { color:var(--blue); background:var(--light); border-color:var(--line); }
:root[data-theme="dark"] .exam-foot { border-color:var(--line); }
:root[data-theme="dark"][data-subject="board"] :is(.tools button,.stylebar button,.zoom button,.share,.account-home,.account-logout,.menu button,.coordinates,.help) { color:var(--ink); }
:root[data-theme="dark"][data-subject="board"] :is(.tools button[aria-pressed="true"],.widths button[aria-pressed="true"]) { color:var(--blue); background:var(--light); }
:root[data-theme="dark"] :is(.lookup-method,.lookup-formula-card,.problem-clue,.solution-formula,.paper-method,.paper-tape,.paper-symbol,.game-bundle-note,.legacy-note) { color:var(--ink); background:var(--panel); border-color:var(--line); }
:root[data-theme="dark"] .solution-rich :is(code,samp,.binary-number,.encoded-word,.paper-head) { color:var(--blue); }
:root[data-theme="dark"] :is(.solution-rich figcaption,.solution-scroll-note,.original-id,.topic-count) { color:var(--muted); }
:root[data-theme="dark"] .paper-cell.has-head .paper-symbol:not(.is-changed) { color:var(--ink); background:var(--light); border-color:var(--blue); }
:root[data-theme="dark"] :is(.paper-symbol.is-changed,.filled-cell) { color:#a6e3c2; background:#203e35; }
:root[data-theme="dark"] .task-card details>summary { color:var(--blue); }
/* Paper exports retain their original light appearance. Board canvas colours are document data. */
.pdf-stage { --bg:#fff; --panel:#fff; --white:#fff; --ink:#172039; --muted:#77819a; --line:#e9ebf2; --blue:#3153c5; color:#172039; color-scheme:light; }
@media(max-width:600px){.theme-toggle{width:38px;height:38px;padding:8px}}
@media print{:root[data-theme="dark"][data-subject]{--bg:#fff;--panel:#fff;--white:#fff;--ink:#172039;--muted:#657089;--line:#dce1eb;--light:#edf1fc;--blue:#3153c5;color-scheme:light!important}.theme-toggle{display:none!important}}
/* Homework feedback stays visible in both personal themes. */
:root[data-theme="dark"] .station-nav button.hw-correct { background:#163d2a; color:#bdf0ce; border-color:#548d68; }
:root[data-theme="dark"] .station-nav button.hw-wrong { background:#512532; color:#ffd3dc; border-color:#c76d86; }
:root[data-theme="dark"] .station-nav button.hw-partial { background:#493b1b; color:#ffe4a3; border-color:#b99949; }
