:root{color-scheme:dark;--theme-bg:#070d14;--theme-surface:#0b131c;--theme-surface-raised:#101b26;--theme-surface-soft:#0d1721;--theme-line:rgba(159,190,216,.14);--theme-text:#ecf5fb;--theme-muted:#91a1ad;--theme-soft:#b8c8d1;--theme-accent:#6cecff;--theme-accent-strong:#39cde4;--theme-accent-wash:rgba(108,236,255,.11);--theme-warm:#ffbc69;--theme-green:#76e5bf;--theme-button-ink:#07161c}
:root[data-theme="solar"]{color-scheme:light;--theme-bg:#f3f0e7;--theme-surface:#fffdf7;--theme-surface-raised:#f8f5ec;--theme-surface-soft:#eeeadf;--theme-line:rgba(24,49,59,.16);--theme-text:#172b36;--theme-muted:#617581;--theme-soft:#465e68;--theme-accent:#087d83;--theme-accent-strong:#0b9da0;--theme-accent-wash:rgba(8,125,131,.1);--theme-warm:#a95d20;--theme-green:#187b5f;--theme-button-ink:#fff}
:root[data-theme="glacier"]{color-scheme:light;--theme-bg:#edf5fa;--theme-surface:#fbfdff;--theme-surface-raised:#f3f8fc;--theme-surface-soft:#e6f0f7;--theme-line:rgba(23,61,91,.15);--theme-text:#142c40;--theme-muted:#60788b;--theme-soft:#405f76;--theme-accent:#0875b5;--theme-accent-strong:#158bd1;--theme-accent-wash:rgba(8,117,181,.1);--theme-warm:#a85d00;--theme-green:#147a68;--theme-button-ink:#fff}
:root[data-theme="verdant"]{color-scheme:light;--theme-bg:#eff4e9;--theme-surface:#fbfff7;--theme-surface-raised:#f4f8ee;--theme-surface-soft:#e8efe0;--theme-line:rgba(36,68,54,.16);--theme-text:#20392f;--theme-muted:#667b6c;--theme-soft:#506957;--theme-accent:#167567;--theme-accent-strong:#278e70;--theme-accent-wash:rgba(22,117,103,.1);--theme-warm:#9a6711;--theme-green:#2f8054;--theme-button-ink:#fff}
:root[data-theme="abyss"]{color-scheme:dark}
:root[data-theme="nebula"]{color-scheme:dark;--theme-bg:#0c0b18;--theme-surface:#131222;--theme-surface-raised:#1c1a30;--theme-surface-soft:#17162a;--theme-line:rgba(190,178,255,.17);--theme-text:#f1efff;--theme-muted:#aaa6c2;--theme-soft:#cac5e3;--theme-accent:#b7a3ff;--theme-accent-strong:#d274ed;--theme-accent-wash:rgba(183,163,255,.12);--theme-warm:#ffc879;--theme-green:#78e1c6;--theme-button-ink:#160e2a}

/* Palette switcher */
.theme-control{position:relative;display:flex;align-items:center;z-index:40}.theme-button{height:30px;display:flex;align-items:center;gap:6px;padding:0 10px;border:1px solid var(--theme-line);border-radius:3px;background:var(--theme-surface);color:var(--theme-accent);font:8px var(--mono);letter-spacing:.1em;transition:background .2s,border-color .2s,transform .2s}.theme-button:hover,.theme-button[aria-expanded="true"]{border-color:var(--theme-accent);background:var(--theme-accent-wash);transform:translateY(-1px)}.theme-button-icon{font-size:15px;line-height:1}.theme-picker{position:absolute;top:calc(100% + 11px);right:-50px;width:290px;padding:13px;border:1px solid var(--theme-line);border-radius:8px;background:var(--theme-surface);color:var(--theme-text);box-shadow:0 24px 70px #0005;z-index:50;animation:themePickerIn .18s ease-out both}.theme-picker[hidden]{display:none}.theme-picker-head{display:flex;align-items:center;justify-content:space-between;padding:3px 3px 11px;border-bottom:1px solid var(--theme-line)}.theme-picker-head b{display:block;color:var(--theme-text);font:9px var(--mono);letter-spacing:.13em}.theme-picker-head small{display:block;margin-top:5px;color:var(--theme-muted);font:8px var(--mono)}.theme-picker-head>span{color:var(--theme-accent);font-size:19px}.theme-option-list{display:grid;gap:5px;padding-top:8px}.theme-option{width:100%;display:flex;align-items:center;gap:10px;padding:8px;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--theme-text);text-align:left;transition:background .18s,border-color .18s,transform .18s}.theme-option:hover,.theme-option:focus-visible{outline:0;border-color:var(--theme-line);background:var(--theme-accent-wash);transform:translateX(2px)}.theme-option[aria-pressed="true"]{border-color:color-mix(in srgb,var(--theme-accent) 52%,transparent);background:var(--theme-accent-wash)}.theme-swatch{width:39px;height:35px;flex:0 0 39px;display:flex;align-items:flex-end;gap:3px;padding:5px;border:1px solid #0001;border-radius:4px;background:var(--swatch-bg)}.theme-swatch i{display:block;height:20px;flex:1;border-radius:2px 2px 0 0;background:var(--swatch-a)}.theme-swatch i:nth-child(2){height:14px;background:var(--swatch-b)}.theme-swatch i:nth-child(3){height:9px;background:var(--swatch-c)}.swatch-solar{--swatch-bg:#f3f0e7;--swatch-a:#087d83;--swatch-b:#ffbc69;--swatch-c:#172b36}.swatch-glacier{--swatch-bg:#edf5fa;--swatch-a:#0875b5;--swatch-b:#8dc7ec;--swatch-c:#142c40}.swatch-verdant{--swatch-bg:#eff4e9;--swatch-a:#167567;--swatch-b:#aac88c;--swatch-c:#20392f}.swatch-abyss{--swatch-bg:#070d14;--swatch-a:#6cecff;--swatch-b:#399bff;--swatch-c:#ecf5fb}.swatch-nebula{--swatch-bg:#0c0b18;--swatch-a:#b7a3ff;--swatch-b:#d274ed;--swatch-c:#f1efff}.theme-option-copy{min-width:0;flex:1}.theme-option-copy b{display:block;font-size:10px}.theme-option-copy small{display:block;margin-top:3px;color:var(--theme-muted);font:7px var(--mono);letter-spacing:.04em}.theme-check{opacity:0;color:var(--theme-accent);font-size:14px}.theme-option[aria-pressed="true"] .theme-check{opacity:1}
@keyframes themePickerIn{from{opacity:0;transform:translateY(-5px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}

/* Theme the application surface while leaving both cinematic openings untouched. */
body:not(.cinema-locked){background:var(--theme-bg);color:var(--theme-text)}
body:not(.cinema-locked) .topbar{background:var(--theme-surface);border-color:var(--theme-line);color:var(--theme-text)}
body:not(.cinema-locked) .brand,body:not(.cinema-locked) .top-center,body:not(.cinema-locked) .top-actions{color:var(--theme-text)}
body:not(.cinema-locked) .brand small,body:not(.cinema-locked) .top-center,body:not(.cinema-locked) .rail-label,body:not(.cinema-locked) .section-label,body:not(.cinema-locked) .panel-kicker,body:not(.cinema-locked) .event-time,body:not(.cinema-locked) .event-tag,body:not(.cinema-locked) .footer-note{color:var(--theme-muted)}
body:not(.cinema-locked) .app-shell{color:var(--theme-text)}
body:not(.cinema-locked) .left-rail,body:not(.cinema-locked) .right-rail{background:var(--theme-surface);border-color:var(--theme-line);color:var(--theme-text)}
body:not(.cinema-locked) .rail-divider,body:not(.cinema-locked) .divider{background:var(--theme-line)}
body:not(.cinema-locked) .rail-item,body:not(.cinema-locked) .environment-link,body:not(.cinema-locked) .side-act{color:var(--theme-muted)}
body:not(.cinema-locked) .rail-item.active,body:not(.cinema-locked) .environment-link:hover,body:not(.cinema-locked) .environment-link.active,body:not(.cinema-locked) .side-act.active{color:var(--theme-text);background:var(--theme-accent-wash);border-color:var(--theme-line)}
body:not(.cinema-locked) .environment-link i,body:not(.cinema-locked) .new-scenario span,body:not(.cinema-locked) .text-link{color:var(--theme-accent)}
body:not(.cinema-locked) .scenario-card,body:not(.cinema-locked) .panel,body:not(.cinema-locked) .model-observatory,body:not(.cinema-locked) .event-panel,body:not(.cinema-locked) .insight-card{background:var(--theme-surface);border-color:var(--theme-line);color:var(--theme-text)}
body:not(.cinema-locked) .scenario-card strong,body:not(.cinema-locked) .panel-head h2,body:not(.cinema-locked) .command-heading h2,body:not(.cinema-locked) .model-observatory h2,body:not(.cinema-locked) .insight-card b,body:not(.cinema-locked) .check-row b{color:var(--theme-text)}
body:not(.cinema-locked) .scenario-sub,body:not(.cinema-locked) .stage-description,body:not(.cinema-locked) .model-observatory p,body:not(.cinema-locked) .insight-card p,body:not(.cinema-locked) .step-text small,body:not(.cinema-locked) .check-row small{color:var(--theme-muted)}
body:not(.cinema-locked) .scenario-index,body:not(.cinema-locked) .panel-kicker,body:not(.cinema-locked) .scenario-status{color:var(--theme-accent)}
body:not(.cinema-locked) .command-overview{border-color:var(--theme-line);background:radial-gradient(ellipse at 86% -15%,var(--theme-accent-wash),transparent 44%),linear-gradient(140deg,var(--theme-surface),var(--theme-surface-raised));box-shadow:0 16px 45px #0001}
body:not(.cinema-locked) .command-heading h2 em,body:not(.cinema-locked) .command-metrics article>b i,body:not(.cinema-locked) .domain-status-top>b{color:var(--theme-accent)}
body:not(.cinema-locked) .command-metrics article,body:not(.cinema-locked) .domain-status{border-color:var(--theme-line);background:var(--theme-surface-raised);color:var(--theme-text)}
body:not(.cinema-locked) .command-metrics article>span,body:not(.cinema-locked) .command-metrics article>small,body:not(.cinema-locked) .domain-status-top>i,body:not(.cinema-locked) .domain-pressure{color:var(--theme-muted)}
body:not(.cinema-locked) .domain-status:hover,body:not(.cinema-locked) .domain-status.is-selected{border-color:var(--theme-accent);background:var(--theme-accent-wash);box-shadow:0 7px 20px #0001}
body:not(.cinema-locked) .domain-pressure-track{background:var(--theme-line)}
body:not(.cinema-locked) .model-facts span{border-color:var(--theme-line);color:var(--theme-muted)}body:not(.cinema-locked) .model-facts b{color:var(--theme-text)}
body:not(.cinema-locked) .act-choice{background:var(--theme-surface-raised);border-color:var(--theme-line);color:var(--theme-muted)}body:not(.cinema-locked) .act-choice.active{background:var(--theme-accent-wash);border-color:var(--theme-accent);color:var(--theme-text);box-shadow:inset 2px 0 var(--theme-accent)}
body:not(.cinema-locked) .stage-copy h1,body:not(.cinema-locked) .stage-copy>p,body:not(.cinema-locked) .stage-side{color:#f2fbff;text-shadow:0 2px 14px #001}
body:not(.cinema-locked) .stage-readout{background:color-mix(in srgb,var(--theme-surface) 88%,transparent);border-color:color-mix(in srgb,var(--theme-accent) 55%,transparent);backdrop-filter:blur(8px)}
body:not(.cinema-locked) .mode-tag{color:var(--theme-muted);border-color:var(--theme-line)}
body:not(.cinema-locked) .presentation-toggle{color:var(--theme-accent);border-color:var(--theme-line);background:var(--theme-accent-wash)}
body:not(.cinema-locked) .icon-button,body:not(.cinema-locked) .top-actions .avatar{color:var(--theme-accent);border-color:var(--theme-line);background:var(--theme-surface-raised)}
body:not(.cinema-locked) .top-actions .avatar{color:var(--theme-text)}
body:not(.cinema-locked) .slider-label,body:not(.cinema-locked) .metric-row,body:not(.cinema-locked) .right-heading,body:not(.cinema-locked) .resource-row,body:not(.cinema-locked) .scenario-title b{color:var(--theme-text)}
body:not(.cinema-locked) .metric-caption,body:not(.cinema-locked) .range-ends,body:not(.cinema-locked) .right-foot,body:not(.cinema-locked) .scenario-title small{color:var(--theme-muted)}
body:not(.cinema-locked) .constraint-card{background:var(--theme-surface-raised);border-color:var(--theme-line);color:var(--theme-text)}body:not(.cinema-locked) .constraint-card p{color:var(--theme-muted)}
body:not(.cinema-locked) .check-row{border-color:var(--theme-line);color:var(--theme-text)}body:not(.cinema-locked) .custom-check{border-color:var(--theme-line)}body:not(.cinema-locked) .check-row input:checked+.custom-check{background:var(--theme-accent);border-color:var(--theme-accent);color:#fff}
body:not(.cinema-locked) .resource-bar{background:var(--theme-line)}body:not(.cinema-locked) .response-button{background:linear-gradient(100deg,var(--theme-accent),var(--theme-accent-strong));color:var(--theme-button-ink)}body:not(.cinema-locked) .compare-button{background:var(--theme-surface-raised);border:1px solid var(--theme-line);color:var(--theme-accent)}
body:not(.cinema-locked) .event-row{border-color:var(--theme-line)}body:not(.cinema-locked) .event-copy b{color:var(--theme-text)}body:not(.cinema-locked) .event-copy small{color:var(--theme-muted)}
body:not(.cinema-locked) .modal{background:var(--theme-surface);border-color:var(--theme-line);color:var(--theme-text)}body:not(.cinema-locked) .modal h2,body:not(.cinema-locked) .modal h3{color:var(--theme-text)}body:not(.cinema-locked) .modal-lede,body:not(.cinema-locked) .future-metrics>div,body:not(.cinema-locked) .compare-foot{color:var(--theme-muted)}body:not(.cinema-locked) .future-card{background:var(--theme-surface-raised);border-color:var(--theme-line)}body:not(.cinema-locked) .future-metrics b{color:var(--theme-text)}
body:not(.cinema-locked) input[type="range"]{accent-color:var(--theme-accent)}
@media(max-width:680px){.theme-button{width:32px;padding:0;justify-content:center}.theme-button>span:last-child{display:none}.theme-picker{position:fixed;top:58px;right:10px;width:min(290px,calc(100vw - 20px))}.top-actions{gap:8px}.mode-tag{display:none}}
@media(max-width:520px){.top-actions .presentation-toggle{display:none}}
@media(max-width:1100px){.top-center{display:none}}
