:root{color-scheme:dark}
html[data-theme="light"]{color-scheme:light;--bg:#e8ede8;--surface:#f5f4ee;--surface-light:#dee8e3;--text:#253d40;--muted:#52696b;--cyan:#277c7f;--orange:#a86527;--magenta:#ac4065;--line:rgba(66,102,101,.22)}
.theme-changing body,.theme-changing body *,.theme-changing body *::before,.theme-changing body *::after{transition:background-color .28s ease,color .28s ease,border-color .28s ease,box-shadow .28s ease!important}
.theme-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;flex:none}
.site-theme-dialog{position:fixed;inset:0;margin:auto;width:min(520px,calc(100% - 28px));max-height:calc(100dvh - 28px);box-sizing:border-box;padding:28px;background:var(--surface,#0e131c);color:var(--text,#edf2f7);border:1px solid var(--line);border-radius:8px;box-shadow:0 24px 90px #0005;overflow:auto}
.site-theme-dialog[open]{animation:site-theme-enter .2s ease-out}
.site-theme-dialog.is-closing{animation:site-theme-exit .18s ease-in both}
.site-theme-dialog::backdrop{background:#030914a8;backdrop-filter:blur(7px)}
.site-theme-top{display:flex;align-items:center;justify-content:space-between;gap:16px}.site-theme-top p{margin:0;color:var(--orange);font:.7rem "DM Mono",monospace;letter-spacing:.08em}
.site-theme-close{width:36px;height:36px;border:1px solid var(--line);border-radius:4px;background:transparent;color:var(--text);font:1.5rem/1 Arial;cursor:pointer;flex:none}
.site-theme-dialog h2{font-size:1.9rem;line-height:1.2;margin:16px 0}.site-theme-dialog>p{color:var(--muted);font-size:.9375rem;line-height:1.75}
.site-theme-options{display:grid;gap:10px;border:0;padding:0;margin:24px 0}.site-theme-options legend{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.site-theme-options label{display:flex;align-items:center;gap:14px;padding:14px;border:1px solid var(--line);border-radius:6px;cursor:pointer;background:var(--bg)}
.site-theme-options label:has(input:checked){border-color:var(--cyan);box-shadow:0 0 0 1px var(--cyan)}
.site-theme-options input{accent-color:var(--cyan);width:17px;height:17px;flex:none}.site-theme-options strong{display:block;font-size:1rem}.site-theme-options small{display:block;color:var(--muted);font-size:.8125rem;line-height:1.6;margin-top:4px}
.theme-preview{display:grid;place-items:center;width:42px;height:42px;border-radius:5px;flex:none;font-size:1.5rem;border:1px solid #8da5b866}.preview-dark{background:#101b29;color:#c6f4ff}.preview-light{background:#ede9d9;color:#286477}.preview-device{background:linear-gradient(90deg,#101b29 50%,#f4f7fa 50%);color:#64919d}
.site-theme-dialog .site-theme-note,.site-theme-dialog .site-theme-status{font-size:.8125rem}.site-theme-status:empty{display:none}
.site-theme-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:24px}.site-theme-actions button{padding:12px 15px;border:1px solid var(--line);background:transparent;color:var(--text);font:700 .875rem/1.6 Manrope,sans-serif;border-radius:4px;cursor:pointer}.site-theme-actions .theme-change{background:var(--cyan);color:#fff;border-color:var(--cyan)}
.site-theme-dialog :focus-visible{outline:2px solid var(--cyan);outline-offset:4px}
@keyframes site-theme-enter{from{opacity:0;translate:0 8px;scale:.99}to{opacity:1;translate:0 0;scale:1}}
@keyframes site-theme-exit{from{opacity:1;translate:0 0}to{opacity:0;translate:0 6px}}
html[data-theme="light"] body{color:var(--text);background-color:var(--bg)}
html[data-theme="light"] :is(.guide-card,.category-panel,.modality-overview,.outcome-grid article,.project-list,.project-card,.episode-group,.math-definition,.matrix-card,.python-reading,.ptp-resource,.ptp-start,.ptp-flow li,.vlsm-workspace,.vlsm-results,.vlsm-how,.home-faq details,.home-contact,.home-terms>p,.backup-dialog,.race-console,.race-garage,.race-planner,.race-telemetry,.planner-task,.planner-project,.helmet-picker){background:var(--surface);border-color:var(--line);color:var(--text);box-shadow:none}
html[data-theme="light"] :is(.guide-menu,.guide-sidebar){background:linear-gradient(145deg,#e5ede6,#dce6e3);color:var(--text);border-color:var(--line)}
html[data-theme="light"] :is(.hero-copy,.lesson-content p,.lesson-content ul,.lesson-content ol,.guide-content>p,.category-name,.guide-menu-item strong,.project-description,.project-copy,.home-faq summary,.home-faq .home-answer,.home-help-heading>p,.home-contact-actions>a,.home-terms summary,.sidebar-back,.topology-node small,.outcome-grid p,.episode-heading p,.episode-heading strong,.network-inputs label,.request-row label,.ptp-resource-meta,.pomo-how p,.pomo-local,.pomo-intro>p,.race-status,.planner-description,.planner-empty,.planner-storage,.planner-task-copy,.planner-project-name,.planner-form label,.helmet-help,.tire-help,.circuit-note){color:var(--muted)}
html[data-theme="light"] :is(h1,h2,h3,.brand,.guide-content h3,.lesson-content strong,.home-faq summary,.home-contact h3,.planner-heading h2,.race-time,.race-telemetry strong){color:var(--text)}
html[data-theme="light"] h1 em{color:var(--cyan);text-shadow:none}
html[data-theme="light"] :is(.button-outline,.home-contact-actions>a,.home-terms summary,.category-button,.circuit,.session-tabs button,.race-reset,.pomo-small,.team-options button,.race-stage .team-options button,.tire-options button,.planner-project-select,.backup-close,.planner-delete,.helmet-colors button){background:#e5ece7;color:var(--text);border-color:var(--line)}
html[data-theme="light"] :is(input:not([type=radio]):not([type=checkbox]),select,textarea){background:#f7f6f0;color:var(--text);border-color:#aabcca}
html[data-theme="light"] :is(.pomo-label,.driver-number,.console-heading,.timing-heading,.track-heading,.planner-tag,.circuit small,.car-caption,.race-telemetry small,.planner-task-copy small,.planner-project-select small,.track-legend,.tire-options small){color:var(--muted)}
html[data-theme="light"] .pomo-page{--race:#007f91;background-image:radial-gradient(ellipse at 80% 12%,#d3ecf166,transparent 45%)}
html[data-theme="light"] :is(.race-start,.button:not(.button-outline)){color:#fff;background:var(--cyan)}
html[data-theme="light"] :is(.circuit.active,.session-tabs button.active,.planner-filters button[aria-pressed=true],.helmet-colors button[aria-pressed=true]){color:var(--cyan);border-color:var(--cyan);background:#d3e8e2}
html[data-theme="light"] :is(.backup-dropzone,.backup-summary){background:#e0ece6;color:var(--text);border-color:#8caebb}
html[data-theme="light"] :is(.backup-dropzone span,.backup-dropzone small,.backup-dialog p,.backup-upload-status,.backup-status,.backup-file-name){color:var(--muted)}
html[data-theme="light"] .backup-upload-error{color:#982f40;background:#fff0f1}
html[data-theme="light"] :is(.math-table,.matrix-grid,.ptp-table,.vlsm-results table){background:#f7f6f0;color:var(--text)}
html[data-theme="light"] :is(th,td){border-color:var(--line);color:var(--text)}
html[data-theme="light"] :is(.cli-block,.code-block,.code-output){background:#e0e8e3;color:#203a50;border-color:#a8bdcc}
html[data-theme="light"] :is(.cli-block code,.code-block code,.code-output code,.py-variable){color:#203a50}
html[data-theme="light"] :is(.py-comment,.py-guide-comment,.cli-comment){color:#347146}
html[data-theme="light"] :is(.py-string,.py-function,.py-builtin){color:#087064}
html[data-theme="light"] .terminal-preview{background:#f2f3e9eb;border-color:#7eafb9;box-shadow:0 20px 50px #28445c16;color:#203a50}
html[data-theme="light"] .terminal-preview :is(span,i){color:#24475e}
html[data-theme="light"] :is(.sidebar-brand strong,.sidebar-category,.lesson-nav a,.lesson-nav-label,.sidebar-back,.project-name strong,.project-name small,.project-empty p,.admin-field,.network-inputs p,.requirements-head p,.results-heading>p,.planner-filters button,.race-settings summary,.race-settings label,.tire-help,.helmet-trigger-hint){color:var(--muted)}
html[data-theme="light"] :is(.lesson-nav a.active,.sidebar-category.active){color:var(--cyan);background:#007f910c}
html[data-theme="light"] :is(.sidebar-brand small,.card-label,.py-keyword,.py-operator){color:#965000}
html[data-theme="light"] :is(.py-number,.py-boolean){color:#8b3274}
html[data-theme="light"] .code-block::before,html[data-theme="light"] .cli-block::before{background:#d1dfda;color:#405e74;border-color:var(--line)}
html[data-theme="light"] .cli-block::after,html[data-theme="light"] :is(.cli-comment,.py-guide-comment){color:#247042}
html[data-theme="light"] :is(.admin-login,.admin-summary,.project-button,.project-story article,.esp32-capabilities article,.project-next,.l2-output){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme="light"] :is(.esp32-capabilities strong,.project-empty strong){color:var(--text)}
html[data-theme="light"] footer :is(p,small,a){color:var(--muted)}
@media(max-width:430px){.site-theme-dialog{padding:20px}.site-theme-actions{flex-direction:column}.site-theme-options label{gap:10px;padding:12px}.site-theme-dialog h2{font-size:1.6rem}}
@media(prefers-reduced-motion:reduce){.theme-changing body *{transition:none!important}.site-theme-dialog[open],.site-theme-dialog.is-closing{animation:none}}

/* Soft daylight: warm paper, sage panels and restrained teal/amber accents. */
html[data-theme="light"] body{background-image:radial-gradient(ellipse at 8% 0%,#d9ba8c22,transparent 38%),radial-gradient(ellipse at 95% 18%,#7eaaa526,transparent 45%);background-repeat:no-repeat}
html[data-theme="light"] .ambient-one{background:#79aaa6;opacity:.14}
html[data-theme="light"] .ambient-two{background:#cfaa7c;opacity:.1}
html[data-theme="light"] .guide-card{background:linear-gradient(120deg,#f5f2e8,#e6eeea);border-color:#7a9c9640;box-shadow:0 6px 20px #3b60510b}
html[data-theme="light"] .guide-section:nth-of-type(3n) .guide-card{background:linear-gradient(120deg,#e5eee8,#f2f1e7)}
html[data-theme="light"] .guide-section:nth-of-type(3n + 1) .guide-card{background:linear-gradient(120deg,#e5eded,#e9eee3)}
html[data-theme="light"] .home-faq details{background:#f0f1e8;box-shadow:0 3px 12px #324e4107}
html[data-theme="light"] .home-faq details[open]{background:#e3ece5;border-color:#4c8b7c55}
html[data-theme="light"] .home-contact{background:linear-gradient(110deg,#dbe8e1,#eee9dc)}
html[data-theme="light"] :is(.lesson-note,.math-definition,.modality-overview){background:#e2ece4;border-color:#739c9055}
html[data-theme="light"] .race-console{background:#edf1e9;box-shadow:0 18px 60px #314b3b14}
html[data-theme="light"] .race-garage{background:#e1e9e1}
html[data-theme="light"] .race-planner{background:#e6ece3}
html[data-theme="light"] :is(.race-telemetry,.console-heading){background:#dce6df}
html[data-theme="light"] :is(.planner-task,.planner-project){background:#f0f1e9}
html[data-theme="light"] :is(th,.site-theme-options label){background:#e3eae2}
html[data-theme="light"] .site-theme-options label:has(input:checked){background:#d5e8df}
.site-theme-suggestion{inset:auto auto max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));margin:0;width:min(380px,calc(100% - 40px));padding:20px;z-index:40;box-shadow:0 12px 40px #0003}
.site-theme-suggestion h2{font-size:1.2rem;margin:12px 0}
.site-theme-suggestion>p{font-size:.875rem;line-height:1.75;margin-bottom:0}
.site-theme-suggestion .site-theme-actions{gap:8px;margin-top:18px;flex-direction:row}
.site-theme-suggestion .site-theme-actions button{font-size:.8125rem;padding:10px 11px;flex:1}
.site-theme-suggestion .site-theme-close{width:30px;height:30px;font-size:1.25rem}
@media(max-width:430px){.site-theme-suggestion{left:16px;bottom:max(16px,env(safe-area-inset-bottom));width:calc(100% - 32px);padding:18px}.site-theme-suggestion .site-theme-actions{flex-direction:column}}

/* Daylight surfaces shared by the lessons and their interactive panels. */
html[data-theme="light"] :is(.category-panel,.modality-overview,.math-definition,.ptp-resource,.ptp-start){background:linear-gradient(135deg,#f3f3e9,#e5eee8)}
html[data-theme="light"] :is(.category-button,.episode-group,.sequence-solution,.concept-pairs>div,.reference-directory,.request-row,.ptp-flow li){background:#edf1e9;color:var(--text);border-color:var(--line)}
html[data-theme="light"] :is(.episode-group.is-locked,.category-button[disabled]){background:#e5e9e2}
html[data-theme="light"] :is(.lesson-content ul,.lesson-content ol,.lesson-content li,.math-formula,.math-table td,.ptp-table td,.fc-table td,.foa-reader .foa-prose p,.foa-reader .foa-prose li){color:var(--muted)}
html[data-theme="light"] :is(.math-formula,.sequence-strip>div,.fiber-warning,.lesson-note,.vlsm-note){background:#e4ebe3;color:var(--text)}
html[data-theme="light"] :is(.fiber-warning strong,.vlsm-note strong,.episode-group.is-locked .episode-heading strong){color:var(--text)}
html[data-theme="light"] :is(.assumed-topic-links a,.reference-help,.assumed-topic-links a::after){background:#f3f3e9;color:var(--text);border-color:var(--line);box-shadow:0 8px 24px #405b491a}
html[data-theme="light"] :is(.reference-terminal-bar,.code-title,.output-window .code-title){background:#d4e1da;color:#405a59;border-color:var(--line)}
html[data-theme="light"] :is(.code-window,.output-window,.sequence-code.code-window,.l2-output){background:#e0e8e3;color:#203a50;border-color:#a8bdcc}
html[data-theme="light"] :is(.code-window pre,.output-window pre,.code-window code,.output-window code,.l2-output code){color:#203a50}
html[data-theme="light"] :is(.function-plot-card,.topology-card,.lab-topology,.vfl-lab,.fc-lab,.fiber-spectrum-card,.em-spectrum){background:#e6eee7;color:var(--text);border-color:#7ba49b88;box-shadow:0 12px 32px #48645712}
html[data-theme="light"] :is(.topology-card,.lab-topology,.vfl-lab,.fc-lab,.em-spectrum) :is(h2,h3,strong,b){color:var(--text)}
html[data-theme="light"] :is(.topology-card,.lab-topology,.vfl-lab,.fc-lab,.em-spectrum) :is(p,small){color:var(--muted)}

/* Fiber: light workbench around the original connector, cable and VFL drawings. */
html[data-theme="light"] .fc-lab{background:radial-gradient(ellipse at 55% 35%,#d7e9e1,#f1f2e9 76%)}
html[data-theme="light"] .fc-lab button,html[data-theme="light"] .fc-check{background:#f5f5ed;color:var(--text);border-color:#789c9966}
html[data-theme="light"] .fc-lab button[aria-pressed="true"]{background:#cce8df;color:#156d74;border-color:#277c7f}
html[data-theme="light"] .fc-scene{background-color:#e5eee9;background-image:linear-gradient(#648a8315 1px,transparent 1px),linear-gradient(90deg,#648a8315 1px,transparent 1px)}
html[data-theme="light"] .fc-scene svg text{fill:#37545c}
html[data-theme="light"] .fc-scene .fc-svg-title{fill:#203f4a}
html[data-theme="light"] .fc-detail{background:#d9ebe4}
html[data-theme="light"] .fc-color-card,html[data-theme="light"] .fc-quiz fieldset{background:#eef2e9;border-color:var(--line)}
html[data-theme="light"] :is(.fc-color-card strong,.fc-quiz legend){color:var(--text)}
html[data-theme="light"] .fc-quiz label{color:var(--muted)}
html[data-theme="light"] .fc-table{color:var(--text)}
html[data-theme="light"] .fc-table th{background:#dce9e1}
html[data-theme="light"] .vfl-lab{background:radial-gradient(ellipse at 65% 35%,#d6e8e2,#edf1e8 72%)}
html[data-theme="light"] :is(.vfl-diagram-label,.vfl-diagram-small){fill:#355562}
html[data-theme="light"] .vfl-controls button,html[data-theme="light"] .vfl-assessment button{background:#d6e9e1;color:#176b70;border-color:#75a29b}
html[data-theme="light"] .vfl-switch label,html[data-theme="light"] .vfl-switch-labels,html[data-theme="light"] .vfl-status{color:var(--muted)}
html[data-theme="light"] :is(.fiber-flow,.spectrum-observations article,.wavelength-units,.em-visibility-compare article){background:#edf1e9;color:var(--text);border-color:var(--line)}
html[data-theme="light"] .fiber-flow span{color:var(--text);border-color:var(--line)}
html[data-theme="light"] .em-spectrum{background:radial-gradient(ellipse at 50% 20%,#dcefe5,#eef1e9 75%)}
html[data-theme="light"] .em-spectrum .em-region strong{color:var(--text)}
html[data-theme="light"] .em-spectrum .em-region{border-color:#76999055}
html[data-theme="light"] .em-spectrum .em-region{--region-color:#158295}
html[data-theme="light"] .em-spectrum .em-micro{--region-color:#286b9f}
html[data-theme="light"] .em-spectrum .em-infra{--region-color:#b4630b}
html[data-theme="light"] .em-spectrum .em-visible{--region-color:#13897f}
html[data-theme="light"] .em-spectrum .em-uv{--region-color:#734da6}
html[data-theme="light"] .em-spectrum .em-xray{--region-color:#a22f85}
html[data-theme="light"] .em-spectrum .em-gamma{--region-color:#bd185b}
html[data-theme="light"] .em-spectrum .em-directions span:last-child{color:#a33269}
html[data-theme="light"] .em-spectrum .em-region-number{color:var(--muted)}
html[data-theme="light"] .em-spectrum .em-infra{background:#f2dfc5}
html[data-theme="light"] .em-spectrum .em-visibility-compare strong{color:var(--text)}

/* Packet Tracer: keep the equipment drawings, use daylight for their canvas and labels. */
html[data-theme="light"] .topology-card{background:radial-gradient(circle at 50% 45%,#d6e9e2,#eff2e9 72%)}
html[data-theme="light"] :is(.topology-node b,.topology-link span,.topology-legend span,.workshop-group,.workshop-group small){color:#344f58}
html[data-theme="light"] :is(.topology-legend,.workshop-group){background:#e5ede5;border-color:var(--line)}
html[data-theme="light"] :is(.l2-map-copy,.hsrp-copy,.hsrp-virtual-card text){fill:#405c63}
html[data-theme="light"] :is(.l2-map-copy .l2-map-name,.hsrp-copy .hsrp-name){fill:#25414a}
html[data-theme="light"] .lab-topology{background:linear-gradient(135deg,#eff2e9,#e1ece6)}
html[data-theme="light"] .lab-topology-stage{background:#dde9e4}
html[data-theme="light"] .lab-topology-svg text{stroke:#dde9e4}
html[data-theme="light"] :is(.lab-topology-svg .lab-device-name,.lab-topology-svg .lab-network){fill:#263e49}
html[data-theme="light"] :is(.lab-topology-svg .lab-device-meta,.lab-topology-svg .lab-label,.lab-topology-svg .lab-port,.lab-topology-svg .lab-channel-mode,.lab-topology-svg .lab-note-line){fill:#3e5960}
html[data-theme="light"] :is(.lab-topology-svg .lab-small,.lab-topology-svg .lab-zone-title){fill:#58727a}
html[data-theme="light"] .lab-map-note rect{fill:#e9f0e7;stroke:#8ca9a4}
html[data-theme="light"] .lab-topology.is-expanded{background:transparent;box-shadow:none}
html[data-theme="light"] .lab-topology.is-expanded .lab-topology-stage{background:transparent}
html[data-theme="light"] .lab-topology.is-expanded .lab-topology-svg text{stroke:#e6eee8}

/* Math, Python, VLSM and point-to-point lessons. */
html[data-theme="light"] .function-plot-card{background:radial-gradient(circle at 65% 45%,#d5e8e0,#f1f2e9 74%)}
html[data-theme="light"] .function-plot-card text,html[data-theme="light"] .function-plot-card .plot-label{fill:#435e66}
html[data-theme="light"] .plot-axis{stroke:#587078}
html[data-theme="light"] .plot-grid{stroke:#6d90804d}
html[data-theme="light"] .ptp-capture{background:#e1eae2;border-color:var(--line)}
html[data-theme="light"] .ptp-action:disabled{background:#e2e7df}
html[data-theme="light"] .vlsm-workspace .request-row{background:#edf1e9}
html[data-theme="light"] .vlsm-results th{background:#d7e5de;color:#3c5b60}

/* The FOA reader uses its own stylesheet and needs its own daylight palette. */
html[data-theme="light"] .foa-reader{--foa-line:var(--line)}
html[data-theme="light"] :is(.foa-toc,.foa-figure,.foa-table-wrap table,.foa-table-wrap caption,.foa-chapter-card){background:#edf1e9;color:var(--text);border-color:var(--line)}
html[data-theme="light"] .foa-chapter-card{background:linear-gradient(135deg,#f5f2e9,#e4eee6)}
html[data-theme="light"] .foa-chapter-card:hover{background:#dfebe3}
html[data-theme="light"] :is(.foa-reader .foa-prose h3,.foa-reader .foa-prose strong,.foa-reader .foa-question,.foa-search-label,.foa-table-wrap th){color:var(--text)!important}
html[data-theme="light"] :is(.foa-toc a,.foa-figure figcaption,.foa-table-wrap td,.foa-chapter-card small){color:var(--muted)}
html[data-theme="light"] .foa-table-wrap th{background:#dce9e1}
html[data-theme="light"] .foa-table-wrap tr:nth-child(even) td{background:#e5ece4}
html[data-theme="light"] .foa-search{background:#f7f6f0;color:var(--text);border-color:#aabcca}
html[data-theme="light"] .foa-lightbox{background:#e7efe7;color:var(--text);border-color:var(--line)}
html[data-theme="light"] .foa-lightbox button{background:#d4e7df;color:var(--cyan);border-color:#8eb2aa}
