:root{color-scheme:light}.header-controls{display:flex;align-items:center;gap:22px}.theme-control{white-space:nowrap}#theme-icon{font-size:18px;color:#b53206;width:18px;text-align:center}header{gap:16px}.theme-ready body,.theme-ready aside,.theme-ready header,.theme-ready .panel,.theme-ready .card,.theme-ready .metric,.theme-ready .question,.theme-ready select,.theme-ready .btn{transition:background-color .25s ease,color .25s ease,border-color .25s ease}
:root[data-theme="dark"]{color-scheme:dark;--bg:#141417;--ink:#f0edeb;--muted:#bab4b0;--line:#3b3535;--blue:#ff938a;--mint:#ff9569;--gpol-orange:#ff9569;--gpol-dark-orange:#ffab86}
[data-theme="dark"] aside,[data-theme="dark"] header{background:#19191d}[data-theme="dark"] aside{border-top-color:#d2232a}[data-theme="dark"] .brand,[data-theme="dark"] .lab-identity{color:#f1edeb}[data-theme="dark"] .brand small,[data-theme="dark"] .lab-identity span,[data-theme="dark"] .nav-label,[data-theme="dark"] nav .group,[data-theme="dark"] .sidebar-bottom,[data-theme="dark"] .sidebar-bottom small{color:#b8aeaa}[data-theme="dark"] .official-logo{background:white;border-radius:5px;padding:3px}[data-theme="dark"] nav a{color:#d9d0cd}[data-theme="dark"] nav a:hover{background:#2b2224}[data-theme="dark"] nav a.active{background:#402327;color:#ffc2bd;border-left-color:#ee6268}[data-theme="dark"] .sidebar-bottom a{color:#ffaaa0}
[data-theme="dark"] .panel,[data-theme="dark"] .card{background:#202024}[data-theme="dark"] select,[data-theme="dark"] input[type="number"],[data-theme="dark"] .btn{background:#29272c;border-color:#494146;color:#f0edeb}[data-theme="dark"] .btn.primary{background:#d2232a;border-color:#d2232a;color:white}[data-theme="dark"] .hero{background:#222225}[data-theme="dark"] .hero .btn:not(.primary){background:#f5eeea;color:#292929}[data-theme="dark"] .card .icon{background:#382721;color:#ffad86}[data-theme="dark"] .tag{background:#3a2921;color:#ffc19d}[data-theme="dark"] .metric{background:#2a272c}[data-theme="dark"] .note{background:#312620;border-left-color:#f1450c}[data-theme="dark"] .equation{background:#302326;color:#f5e9e6}[data-theme="dark"] .question{background:#29262a}[data-theme="dark"] .question textarea{background:#1b1a1e;color:#f1edeb;border-color:#615152}[data-theme="dark"] .question textarea::placeholder{color:#b7abaa}[data-theme="dark"] .check{background:#1d352c;color:#a5e4ca}[data-theme="dark"] footer a{color:#c9bcb6}[data-theme="dark"] #theme-icon{color:#ffaf87}
/* Keep numerical graphics on their calibrated light surfaces in both themes. */
[data-theme="dark"] .plot-wrap,[data-theme="dark"] .wire-scroll,[data-theme="dark"] .model-diagram,[data-theme="dark"] .circuit{background:#f9fbfe;border-color:#d8e0eb}[data-theme="dark"] .model-diagram h4,[data-theme="dark"] .model-diagram .hint,[data-theme="dark"] .circuit .hint{color:#526680}[data-theme="dark"] .gate-chip{background:#edf3ff;border-color:#bdcff8;color:#245ce5}[data-theme="dark"] .gate-chip button{color:#526680}[data-theme="dark"] .comparison-plot{border-radius:8px}
@media(max-width:1100px){header{height:auto;min-height:76px;padding-top:14px;padding-bottom:14px;flex-wrap:wrap}.header-controls{gap:14px}header label{gap:7px}}
@media(max-width:760px){.header-controls{width:100%;justify-content:space-between;gap:8px}header label{font-size:11px}header #level{max-width:140px}header #theme-select{max-width:96px}.theme-control{gap:5px}#theme-icon{font-size:16px;width:14px}}
@media(prefers-reduced-motion:reduce){.theme-ready body,.theme-ready aside,.theme-ready header,.theme-ready .panel,.theme-ready .card,.theme-ready .metric,.theme-ready .question,.theme-ready select,.theme-ready .btn{transition:none}.card{transition:none}}
.check.approx-warning{background:#fff1df;color:#88450e}[data-theme="dark"] .check.approx-warning{background:#422e1c;color:#ffd0a0}
