/* Two native palettes. Scientific raster data and spectral colors are never inverted. */
.theme-toggle{display:inline-flex!important;align-items:center;justify-content:center;gap:6px;flex-shrink:0;background:#142437;border:1px solid #3a526a;border-radius:6px;color:#b9d0e4;white-space:nowrap;padding:7px 10px;font:10px/1.3 -apple-system,BlinkMacSystemFont,'PingFang SC','Microsoft YaHei',sans-serif;cursor:pointer;min-height:30px;touch-action:manipulation}.theme-toggle:hover{background:#21394b;border-color:#66bda9;color:#c8ffed}.theme-toggle:focus-visible{outline:2px solid #4ec5a4;outline-offset:3px}.theme-icon{font-size:15px;line-height:1}.theme-guide-actions{display:flex;align-items:center;gap:18px}.theme-toggle[aria-pressed=true]{background:#fff;border-color:#a5bac9;color:#28475c}.theme-toggle[aria-pressed=true]:hover{background:#e6f1f2;border-color:#2f8e7e;color:#075e50}
html[data-theme=light]{color-scheme:light;--bg:#f1f5f8;--panel:#ffffff;--panel-alt:#f7f9fc;--panel2:#edf3f8;--line:#ccd8e2;--text:#20374c;--muted:#526b80;--teal:#087e66;--mint:#087e66;--cyan:#08758b;--blue:#4c61bc;--purple:#715db0;--gold:#906517;--amber:#946820;--red:#bc3f59}
html[data-theme=light] body{background:var(--bg);color:var(--text)}
html[data-theme=light] :is(.topbar,.nav-inner){background:#fff;color:#20374c;border-color:#ccd8e2}
html[data-theme=light] :is(.brand em,.brand small,.quiet,.version,.nav-item,.nav-button,h1 span,.hero p,.page-heading p,.side-heading>span,.panel-heading .muted,.muted,.section-label,.control-title label,.range-labels,.control-note,.scientific-control label,.gas-select-label,.device-inspector label,.device-inspector small,.speed-label,.save-state,.camera-metrics span,.camera-metrics small,.micro-note,.scope-footer,.journal-entry time,.journal-entry p,.journal-note,footer,footer .text-button,.task-card p,.task-notes p,.task-card .task-target,.dialog-heading p,.dialog-footer,.inventory-item p,.fault-card span,.field-label,.field-label>span,.field-note,.range-heading,.library-label,.placement-note,.circuit-explanation,.step-label,.chart-legend,.plot-foot,.empty-result,.factor-label,.outcome-message,.outcome-note,.mini-values span,.mini-values small,.reason-step p,.task-tip p,.resource-estimate small,.algorithm-detail p,.gate-description-list p,.mission-card p,.mission-note p){color:#526b80}
html[data-theme=light] :is(.brandmark,.brand-mark){background:#f3f8f8;color:#087d66;border-color:#a8c0c8}
html[data-theme=light] :is(.brandmark span,.brand-mark>span){color:#3c5d70}
html[data-theme=light] :is(.nav-item.active,.nav-button.active,.text-button:hover,.task-number,.task-completed,.eyebrow,.accent,.model-content a,.model-content h3,.model-content b){color:#08775f}
html[data-theme=light] :is(.panel,.task-card,.mission-card,.mission-note,.task-notes){background:#fff;border-color:#ccd8e2;box-shadow:0 3px 13px #20364a05}
html[data-theme=light] :is(.telemetry,.metrics-strip){background:linear-gradient(105deg,#ffffff,#ecf3f8);border-color:#cad8e3;color:#20374c}
html[data-theme=light] :is(.telemetry article,.metrics-strip article){border-color:#ccd8e2}
html[data-theme=light] :is(.telemetry article>span,.telemetry small,.telemetry i,.metrics-strip span,.metrics-strip em,.metrics-strip small){color:#526b80}
html[data-theme=light] .telemetry .system-state b{color:#087c64}
html[data-theme=light] :is(.button,.outline-button,.secondary-full,.step-button,.example-row button,.print-btn){background:#f6f9fc;border-color:#afc3d3;color:#36546b}
html[data-theme=light] :is(.button:hover,.outline-button:hover,.secondary-full:hover,.step-button:hover,.example-row button:hover){background:#e8f3f1;border-color:#6aa999;color:#086b58}
html[data-theme=light] :is(.button.primary,.primary-button,.run-button){background:#087d67;border-color:#087d67;color:#fff}
html[data-theme=light] :is(.button.primary:hover,.primary-button:hover){background:#096c59;color:#fff}
html[data-theme=light] .run-button.running{background:#e5f3ed;color:#086d55;border-color:#8ab6a6}
html[data-theme=light] :is(input:not([type=range]):not([type=checkbox]),select,.control-select,.scientific-control input,.sidebar input:not([type=range]),.sidebar select,.inventory-item select,#deviceSelect,.state-panel select){background:#f8fafc;border-color:#b6c9d8;color:#25465d;accent-color:#087d67}
html[data-theme=light] input[type=range]{accent-color:#087d67}
html[data-theme=light] :is(.number-wrap,.readout,.small-callout,.hero-tag,.chip,.mini-tabs,.mini-values,.reason-step code){background:#f1f6fa;border-color:#c0d0dc;color:#3a5b73}
html[data-theme=light] .number-wrap input{background:transparent;color:#274b63}
html[data-theme=light] .readout b{color:#0b725d}
html[data-theme=light] :is(.control-tabs button,.scope-tabs button){color:#536f88}
html[data-theme=light] :is(.control-tabs button.active,.scope-tabs button.active,.mini-tabs button.active){background:#e2f1ed;color:#08775f}
html[data-theme=light] .control-body{scrollbar-color:#adc0cf #f1f5f8}
html[data-theme=light] .section-label:after{background:#d4dfe7}
html[data-theme=light] :is(.switch,.check-icon,.reason-step>i){background:#d5e0e8;color:#536e83}
html[data-theme=light] .switch:after{background:#6a8297}
html[data-theme=light] .switch[aria-checked=true]{background:#b6ddd0}
html[data-theme=light] .switch[aria-checked=true]:after{background:#087b61}
html[data-theme=light] :is(.diagnosis-row.good .check-icon,.reason-step.good>i,.chip.good){background:#dff1e8;color:#0a7456;border-color:#afd0bf}
html[data-theme=light] :is(.chip.warn,.chip.pr-bad){background:#fff2d9;color:#886018;border-color:#ddc391}
html[data-theme=light] :is(.panel-heading,.panel-foot,.device-inspector,.runbar,.diagnosis-row,.camera-wrap,.journal-entry,.scope-footer,.journal-note,.dialog-heading,.dialog-footer,.parameters .side-heading,.circuit-explanation,.placement-note,.plot-foot,.event-row,.side-heading,.shared-parameters){border-color:#d3dfe8}
html[data-theme=light] .journal-entry b{color:#29485e}
html[data-theme=light] .diagnosis-row .check-detail{color:#5a748c}
html[data-theme=light] .diagnosis-row.good .check-detail{color:#0b785b}
html[data-theme=light] :is(.inventory-item,.fault-card,.algorithm-detail,.resource-estimate>div){background:#f7f9fc;border-color:#c3d3df;color:#2b485e}
html[data-theme=light] .fault-card:hover{background:#fff8ec;border-color:#c89a4e}
html[data-theme=light] dialog{background:#fff;border-color:#b8cad8;color:#20374c;box-shadow:0 25px 90px #1d3b5b33}
html[data-theme=light] dialog::backdrop{background:#233c546e}
html[data-theme=light] .model-content{color:#4a657b}
html[data-theme=light] .formula{background:#edf5f6;color:#24586b;border-color:#2b907e}
html[data-theme=light] .toast{background:#eefaf5f7;border-color:#88bba6;color:#165e47;box-shadow:0 7px 25px #1d3b5b20}
/* Optical and detector canvases deliberately retain dark scientific plotting surfaces. */
html[data-theme=light] .bench-panel{background:#f9fbfd}
html[data-theme=light] :is(.bench-stage,.camera-wrap){background:#081321}
html[data-theme=light] :is(.camera-label,.camera-scale,#cameraOverlay,.bench-legend,.bench-instruction,.scale-tag){color:#9db5cd}
html[data-theme=light] .view-switch{background:#102233eb;border-color:#3b536e}
html[data-theme=light] .view-switch button{color:#91aec8}
html[data-theme=light] .view-switch button.active{color:#e0edf9;background:#2b435a}
/* Quantum-workbench controls and distributions. */
html[data-theme=light] .experiment-button b{color:#27485f}
html[data-theme=light] :is(.experiment-button small,.experiment-button i,.experiment-icon){color:#5e7b92}
html[data-theme=light] .experiment-button.active{background:linear-gradient(90deg,#e4f3ed,#f1f8f7);border-color:#9fc9bd}
html[data-theme=light] :is(.experiment-button.active .experiment-icon,.experiment-button.active small,.range-heading b){color:#087a60}
html[data-theme=light] .gate-library{background:#f4f7fb;border-color:#ccd8e3}
html[data-theme=light] .gate-button{background:#f0edf9;color:#614f9d;border-color:#c0b7df}
html[data-theme=light] .gate-button.pauli{background:#eaf2fc;color:#375f9c;border-color:#b0c5e1}
html[data-theme=light] .gate-button.control{background:#e1f1e9;color:#0c755d;border-color:#9fcdb9}
html[data-theme=light] .gate-button.measure{background:#fff2d9;color:#8d651e;border-color:#d9c18b}
html[data-theme=light] .gate-button.active{box-shadow:0 0 0 1px #157b60;border-color:#157b60}
html[data-theme=light] :is(.help-button,.segment-toggle,.input-bits button){background:#eff4f8;border-color:#bccdda;color:#41617b}
html[data-theme=light] :is(.segment-toggle.active,.input-bits button.active){background:#e3f2ea;color:#0b7157;border-color:#90bfa9}
html[data-theme=light] :is(#circuitEditor,.distribution,.state-content){background:#fafcfe}
html[data-theme=light] .distribution-row{border-color:#e2eaf0}
html[data-theme=light] .distribution-row .binary{color:#355975}
html[data-theme=light] .prob-track{background:#e7edf3}
html[data-theme=light] .prob-ideal{background:#168c77}
html[data-theme=light] .prob-measured{background:#7b72c7}
html[data-theme=light] .bloch-item b{color:#35536b}
html[data-theme=light] .bloch-item small{color:#59758c}
html[data-theme=light] .bloch-item svg circle{fill:#087e66}
html[data-theme=light] .bloch-item svg path[stroke="#a99aff"]{stroke:#7664b8}
html[data-theme=light] :is(.amplitude-row,.phase-bar){background:#edf2f7;border-color:#d5e1e9}
html[data-theme=light] :is(.event-row b,.reason-step b,.algorithm-detail b,.task-tip h3,.gate-description-list b){color:#2e4d65}
html[data-theme=light] .factor-answer{color:#087a60}
html[data-theme=light] .factor-answer em{color:#668297}
html[data-theme=light] .mini-values b{color:#315069}
html[data-theme=light] .task-tip{background:linear-gradient(135deg,#f1f7f5,#eff3fb);border-color:#c1d8d2}
html[data-theme=light] :is(.led-bit b,.led-measure-button){background:#edf3f7;color:#59758c;border-color:#bdcfdc}
html[data-theme=light] .led-bit.on b{background:#e1f3e9;color:#0a795b;border-color:#93c3ab}
html[data-theme=light] .check-table th{background:#edf3f8;color:#496780}
html[data-theme=light] .check-table .pass{color:#087a5a}
html[data-theme=light] .check-table .fail{color:#b73853}
/* Editable SVG circuit uses its own semantic gate palette in both schemes. */
html[data-theme=light] .qce{--qce-bg:#fbfcfe;--qce-panel:#fff;--qce-border:#c8d7e3;--qce-muted:#56738b;--qce-text:#234158;--qce-mint:#087d65;--qce-purple:#715daf;box-shadow:0 5px 20px #28435d0a}
html[data-theme=light] :is(.qce-toolbar,.qce-inspector){background:#f5f8fb;border-color:#ccd9e4}
html[data-theme=light] .qce-stage{background:radial-gradient(ellipse at 38% 10%,#dfebf533,transparent 65%),#fbfcfe;scrollbar-color:#a4bacd #edf3f8}
html[data-theme=light] :is(.qce-hint,.qce-footer){background:#edf3f8;color:#526e85;border-color:#cddae5}
html[data-theme=light] .qce button{background:#f4f8fb;color:#43637d;border-color:#b4cadb}
html[data-theme=light] .qce button:hover:not(:disabled){background:#e6f1ee;color:#076b55;border-color:#7eac9c}
html[data-theme=light] .qce button.is-active{background:#dcefe6;color:#087256;border-color:#7dac98}
html[data-theme=light] :is(.qce-title-icon,.qce-pending){background:#e2f1e9;color:#216d56;border-color:#a6ccba}
html[data-theme=light] :is(.qce-count,.qce-tools button.qce-zoom,.qce-inspector-summary small,.qce-inspector-summary p,.qce-inspector-fields label,.qce-inspector-empty,.qce-key-tip,.qce-inspector-register,.qce-mode,.qce-pending-label){color:#55738c}
html[data-theme=light] .qce-inspector-summary strong{color:#294a63}
html[data-theme=light] .qce-inspector-fields select,html[data-theme=light] .qce-inspector-fields input[type=number]{background:#fff;color:#2c4e68;border-color:#b3cadc}
html[data-theme=light] :is(.qce-inspector-gate,.qce-badge-pauli){background:#e6f0fb;border-color:#a9c1df;color:#385f9c}
html[data-theme=light] .qce-badge-control{background:#e0f1e8;border-color:#9bc6b1;color:#0c7458}
html[data-theme=light] .qce-badge-measure{background:#fff0d5;border-color:#d4bc88;color:#88621c}
html[data-theme=light] .qce-hint.qce-hint-alert{background:#fff5df;color:#865f1a}
html[data-theme=light] .qce-inspector-fields .qce-delete{background:#fff0f2;color:#ac3b51;border-color:#ddb0ba}
html[data-theme=light] :is(.qce-column-label,.qce-register-label,.qce-initial-state,.qce-output-text){fill:#5b7890}
html[data-theme=light] .qce-qubit-label{fill:#31546e}
html[data-theme=light] .qce-wire{stroke:#a4bacd}
html[data-theme=light] .qce-output{fill:#eef4f9;stroke:#bdcfde}
html[data-theme=light] .qce-output.measured{fill:#fff3dc;stroke:#d2bc8f}
html[data-theme=light] .qce-gate{--gate-fill:#efebfa;--gate-stroke:#9b8bc9;--gate-ink:#64509d}
html[data-theme=light] .qce-gate-pauli{--gate-fill:#e9f2fd;--gate-stroke:#8faed5;--gate-ink:#3f659c}
html[data-theme=light] .qce-gate-control{--gate-fill:#e2f2e9;--gate-stroke:#70a990;--gate-ink:#087a5b}
html[data-theme=light] .qce-gate-measure{--gate-fill:#fff1d7;--gate-stroke:#c2a164;--gate-ink:#89611b}
html[data-theme=light] .qce-step-highlight{fill:#087d6509;stroke:#087d6533}
/* Physics diagnostics: numerical canvases retain their calibrated colormaps. */
html[data-theme=light] #precisionWorkspace{color:#203c52}
html[data-theme=light] .pr-card{background:linear-gradient(145deg,#fff,#f8fbfd);border-color:#c5d5e1}
html[data-theme=light] :is(.pr-cardhead,.pr-tabs){border-color:#c9d8e3}
html[data-theme=light] :is(.pr-header p,.pr-tabs button,.pr-controls label,.pr-caption,.pr-small,.pr-legend,.pr-eventnote,.pr-footer,.pr-source,.pr-boundary p,.pr-readout span,.pr-readout small,.pr-canvas-label){color:#526e85}
html[data-theme=light] :is(.pr-kicker,.pr-tabs button[aria-selected=true],.pr-source a,.pr-footer a){color:#087c65}
html[data-theme=light] .pr-tabs button[aria-selected=true]{background:linear-gradient(0deg,#e5f3ed,transparent);border-color:#16886b}
html[data-theme=light] :is(.pr-live,.pr-tag,.pr-chip){background:#ecf4f8;border-color:#b6cedc;color:#436c82}
html[data-theme=light] .pr-controls select,html[data-theme=light] .pr-controls input[type=number]{background:#fff;color:#2c4d66;border-color:#b3cadb}
html[data-theme=light] .pr-button{background:#087b64;color:#fff;border-color:#087b64}
html[data-theme=light] .pr-button:hover{background:#076650}
html[data-theme=light] .pr-button.pr-secondary{background:#f3f8fb;color:#3c5d76;border-color:#b5cadb}
html[data-theme=light] :is(.pr-readout>div,.pr-boundary){background:#f0f6fa;border-color:#c4d6e2}
html[data-theme=light] :is(.pr-readout b,.pr-boundary h3,.pr-inline-value){color:#254d67}
html[data-theme=light] .pr-table th{background:#eaf2f7;color:#456a82}
html[data-theme=light] .pr-table td{border-color:#d7e2ea;color:#31536c}
html[data-theme=light] .pr-table tr[data-mode]:hover td{background:#eaf3f7}
html[data-theme=light] .pr-table tr.pr-selected td{background:#ddf0e7;color:#0b6c52}
html[data-theme=light] .pr-message{background:#e9f5ef;border-color:#a8cdbb;color:#2d6b54}
html[data-theme=light] .pr-message.pr-warn{background:#fff5e1;border-color:#dcc18b;color:#805d1c}
html[data-theme=light] .pr-message.pr-error{background:#fff0f3;border-color:#d5a1ae;color:#a1364e}
html[data-theme=light] .pr-formula{background:#edf5f7;color:#2c6175;border-color:#32917c}
html[data-theme=light] .pr-status{background:#e0f2e7;color:#0c7255;border-color:#aad0bb}
html[data-theme=light] .pr-status.pr-bad{background:#fff1dc;color:#8b641e;border-color:#d8bd88}
html[data-theme=light] .pr-hover{color:#3d6d82}
/* Both teaching guides use the same remembered theme. */
html[data-theme=light] body>nav{background:#fff;border-color:#c6d6e2}
html[data-theme=light] .nav-links a{color:#28677a}
html[data-theme=light] body>header:not(.topbar){background:#fffffff2;border-color:#c5d6e2;color:#29485f}
html[data-theme=light] :is(.card,.goal,.flow,.flow-node,.task,.step,.mini,.hero-side,.stats article){background:#fff;border-color:#c7d7e3;color:#23485e}
html[data-theme=light] :is(.card p,.card li,.goal p,.flow-node span,.task p,.step p,.compact ul,.hero-side p,.stats span,.intro,.footnote,.memory-scale,.task-head p){color:#516d84}
html[data-theme=light] :is(.card strong,.task b,.card .name,.flow-node strong,.callout h2,.stats strong){color:#234b62}
html[data-theme=light] :is(.label,.section-num,.section-intro,.task-title small,.step .n,.task-number,.task .evidence,.toc strong,.toc a,.badge){color:#247386}
html[data-theme=light] .flow-node.fixed{background:#e9f5f5;border-color:#86b4bd}
html[data-theme=light] :is(.note,.boundary){background:#fff5df;border-color:#c9a764;color:#775b24}
html[data-theme=light] :is(.evidence,.pill,.workflow span,.chip,.memory-control){background:#eff5f9;border-color:#c4d6e2;color:#416c83}
html[data-theme=light] .evidence b{color:#28566c}
html[data-theme=light] .boundary b{color:#785514}
html[data-theme=light] th{background:#e9f1f7;color:#34596f}
html[data-theme=light] td{color:#4a687d;border-color:#ccdae5}
html[data-theme=light] :is(td:first-child,.total td){color:#2d5269}
html[data-theme=light] td.points{color:#087a60}
html[data-theme=light] .toc a:hover{background:#e4f1ee;color:#08765c}
html[data-theme=light] :is(.start,.callout){background:linear-gradient(115deg,#e3f3ef,#e9f1fb);border-color:#accbc9}
html[data-theme=light] :is(.start p,.callout p){color:#466c7c}
html[data-theme=light] code{background:#e7eef5;color:#2c5a74}
html[data-theme=light] .mark{background:#087d65;color:#fff}
html[data-theme=light] :is(.small-link,.back){color:#08765f}
@media(max-width:1250px){.topbar .theme-toggle{font-size:9px;padding:6px 8px;gap:4px}.topbar .top-actions,.topbar .header-actions{gap:10px}}
@media(max-width:700px){.topbar .theme-toggle{font-size:9px;padding:6px;gap:4px;min-height:28px}.theme-toggle .theme-icon{font-size:13px}.topbar .top-actions,.topbar .header-actions{gap:6px}.theme-guide-actions{gap:10px}.nav-links{flex-wrap:wrap}.nav-links .theme-toggle{margin-left:auto}}
@media(max-width:420px){.topbar .theme-toggle>span:last-child{font-size:0}.topbar .theme-toggle>span:last-child:after{content:'主题';font-size:9px}.theme-guide-actions .back{font-size:10px}}
@media print{.theme-toggle{display:none!important}}
html[data-theme=light] :is(.gate-description-list div,.bloch-item){background:#f5f9fc;border-color:#c6d7e4}
html[data-theme=light] :is(.text-button,.mini-tabs button){color:#4d6c84}
html[data-theme=light] :is(.text-button:hover,.mini-tabs button.active){color:#087b60}
html[data-theme=light] .icon-button{background:#edf4f9;border-color:#bed1e0;color:#456982}
html[data-theme=light] .icon-button:hover{background:#e0eeef;color:#0e705f}
html[data-theme=light] .pr-caption b{color:#355b71}
