/* One palette for every simulator surface, including nested dialogs.
   Media queries follow OS changes immediately; no stored preference overrides them. */
:root{color-scheme:light;--ui-surface:#f5f7fa;--ui-card:#ffffff;--ui-soft:#eaf0f4;--ui-text:#172c3c;--ui-muted:#526574;--ui-border:#c3cfd8;--ui-accent:#174e68;--ui-on-accent:#fff;--ui-selected:#dcebf4;--ui-focus:#1472b2;--ui-warning:#96430b;--ui-danger:#a83124;--ui-hud:#f5f7faf2;--ui-stick:#f5f7fac7;--ui-shadow:#09162233;--ui-backdrop:#07121d38}
@media(prefers-color-scheme:dark){:root{color-scheme:dark;--ui-surface:#14242e;--ui-card:#1d3341;--ui-soft:#203845;--ui-text:#edf3f6;--ui-muted:#b2c4cf;--ui-border:#4e6573;--ui-accent:#8bd5f1;--ui-on-accent:#0c2938;--ui-selected:#294c60;--ui-focus:#9fe4ff;--ui-warning:#ffd09b;--ui-danger:#ffb4aa;--ui-hud:#14242ef2;--ui-stick:#14242ebd;--ui-shadow:#0007;--ui-backdrop:#02081077}}
body.ui-theme{color:var(--ui-text);background:var(--ui-surface)}
body.ui-theme :is(button,select,textarea,input[type=text],input[type=number],input[type=password],input[type=email]){color:var(--ui-text);background:var(--ui-card);border-color:var(--ui-border);color-scheme:inherit}
body.ui-theme button:hover{background:var(--ui-selected)}
body.ui-theme :is(button,select,input,textarea,summary):focus-visible{outline:3px solid var(--ui-focus);outline-offset:2px}
body.ui-theme :is(input,meter){accent-color:var(--ui-accent)}
body.ui-theme :is(dialog,#settingsDialog.settings-drawer,.beta-dialog,.practice-dialog){background:var(--ui-surface);color:var(--ui-text);border-color:var(--ui-border);color-scheme:inherit;box-shadow:0 24px 80px var(--ui-shadow)}
body.ui-theme dialog::backdrop,body.ui-theme #settingsDialog.settings-drawer::backdrop{background:var(--ui-backdrop);backdrop-filter:none}
body.ui-theme :is(dialog,.arrival-content) :is(p,li,label,h2,h3,summary,dt,dd,.keyboard,.keyboard b){color:var(--ui-text)}
body.ui-theme :is(dialog,.arrival-content) :is(.subtle,.beta-note,.eyebrow,.arrival-intro,.arrival-note,small,.feedback-address,.keyboard small){color:var(--ui-muted)}
body.ui-theme :is(dialog,.arrival-content) :is(details,.setup-card,.tutorial-tip,.settings-panel,.aircraft-calibration,.settings-notes){border-color:var(--ui-border)}
body.ui-theme :is(.setup-card,.tutorial-tip,#calibrationPanel){background:var(--ui-card);color:var(--ui-text)}
body.ui-theme dialog :is(a,output){color:var(--ui-accent)}
body.ui-theme .tutorial-progress{color:var(--ui-accent)!important}
body.ui-theme :is(dialog,.arrival-content) .primary,body.ui-theme .primary{background:var(--ui-accent);color:var(--ui-on-accent);border-color:var(--ui-accent)}
body.ui-theme :is(#gateCodeError,#calibrationError){color:var(--ui-danger)}
body.ui-theme :is(#gateCode,.beta-dialog textarea,#feedbackPreview,#telemetryJson){background:var(--ui-card);color:var(--ui-text);border-color:var(--ui-border)}
body.ui-theme :is(.language-control #languageButton,.flight-toolbar button,#quickPause,#exitInspect,#fieldLookButton){background:var(--ui-hud);color:var(--ui-text);border-color:var(--ui-border)}
body.ui-theme #languageChoices{background:var(--ui-surface);border-color:var(--ui-border);box-shadow:0 8px 30px var(--ui-shadow)}
body.ui-theme #languageChoices button{color:var(--ui-text);background:transparent}
body.ui-theme #languageChoices button[aria-pressed=true]{background:var(--ui-selected)}
body.ui-theme :is(#banner,#hardwareCheck,#fuelGauge,.beta-label){background:var(--ui-hud);color:var(--ui-text);border-color:var(--ui-border);text-shadow:none}
body.ui-theme #fuelGauge{color:var(--ui-accent)}
body.ui-theme #fuelGauge.low,body.ui-theme #fuelNotice{color:var(--ui-warning);background:var(--ui-hud);text-shadow:none}
body.ui-theme #fuelNotice:not(:empty){padding:4px 8px;border-radius:8px}
body.ui-theme .viewport .telemetry{background:var(--ui-hud);border-color:var(--ui-border);box-shadow:0 4px 16px var(--ui-shadow)}
body.ui-theme .viewport .telemetry>div{border-color:var(--ui-border)}
body.ui-theme .viewport .telemetry b{color:var(--ui-text)}
body.ui-theme .viewport .telemetry :is(small,em,.speed-secondary){color:var(--ui-muted)}
body.ui-theme .viewport .telemetry #speed{color:var(--ui-accent)}
body.ui-theme .instrument-track,body.ui-theme .speed-track{background:var(--ui-border)}
body.ui-theme .instrument-track i{background:var(--ui-accent)}
body.ui-theme .field-label .wind-indicator{background:var(--ui-hud);color:var(--ui-text);border-color:var(--ui-border);box-shadow:0 4px 16px var(--ui-shadow)}
body.ui-theme .field-label .wind-indicator :is(small,.wind-from,#windDirection,.compass-view,.compass-you){color:var(--ui-muted)}
body.ui-theme .wind-indicator :is(.compass-rim,.compass-inner,.compass-shadow){fill:var(--ui-soft);stroke:var(--ui-border)}
body.ui-theme .wind-indicator .wind-guide{stroke:var(--ui-muted)}
body.ui-theme .wind-indicator :is(.compass-hub,.needle-source){fill:var(--ui-accent);stroke:var(--ui-accent)}
body.ui-theme .wind-indicator .needle-tail{fill:var(--ui-muted)}
body.ui-theme .stick{background:linear-gradient(90deg,transparent 49.5%,var(--ui-border) 50%,transparent 50.5%),linear-gradient(transparent 49.5%,var(--ui-border) 50%,transparent 50.5%),var(--ui-stick);border-color:var(--ui-border)}
body.ui-theme .stick i{background:var(--ui-accent);box-shadow:0 2px 5px var(--ui-shadow)}
body.ui-theme.controller-connected .touch{background:var(--ui-hud);border-color:var(--ui-border)}
body.ui-theme.controller-connected .touch :is(small,.stick span){color:var(--ui-text);text-shadow:none}
body.ui-theme .arrival-checkin .arrival-content{background:var(--ui-hud);border-color:var(--ui-border);box-shadow:0 24px 80px var(--ui-shadow)}
body.ui-theme .arrival-checklist li{border-color:var(--ui-border)}
body.ui-theme .step-number{color:var(--ui-muted);border-color:var(--ui-border)}
body.ui-theme .done .step-number{background:var(--ui-accent);color:var(--ui-on-accent)}
body.ui-theme .arrival-content .quick-entry-link{background:transparent;color:var(--ui-accent)}
body.ui-theme .arrival-privacy :is(summary,.gate-analytics){color:var(--ui-muted)}
body.ui-theme .panorama-picker{background:var(--ui-card);color:var(--ui-text);border-color:var(--ui-border)}
/* Information hierarchy; disclosures hold calibration and detailed help. */
#settingsDialog.settings-drawer .settings-category{display:block;margin:12px 0 18px}
#settingsDialog.settings-home-on>.settings-category{display:none}
#settingsDialog.settings-drawer .settings-category span{font-size:12px;color:var(--ui-muted)}
#settingsDialog.settings-drawer .settings-category select{background:var(--ui-card);border-color:var(--ui-border);color:var(--ui-text);min-height:44px;margin-top:6px;font-size:16px}
body.ui-theme dialog .simple-extra{margin-top:12px;padding:12px 0;border-color:var(--ui-border)}
body.ui-theme dialog .simple-extra>summary{min-height:32px;font-size:14px;color:var(--ui-muted);font-weight:500}
body.ui-theme dialog :is(.simple-extra,.settings-notes) p{font-size:14px;line-height:1.5}
body.ui-theme #settingsDialog .settings-head{position:static;padding-top:0}
body.ui-theme #settingsDialog .settings-head .menu-actions{display:none}
body.ui-theme #settingsDialog:not(.settings-home-on) #homeBack{margin-bottom:10px}
body.ui-theme #settingsDialog .settings-panel{padding-top:0;border-top:0}
body.ui-theme #settingsDialog .settings-panel>label{margin:14px 0}
body.ui-theme #settingsDialog .settings-panel .spec{font-size:16px}
body.ui-theme #settingsDialog .settings-panel .spec small{font-size:12px;color:var(--ui-muted)}
body.ui-theme #controlDialog .setup-card{margin:12px 0;padding:14px}
body.ui-theme #controlDialog .setup-card h3{font-size:16px}
body.ui-theme #controlDialog .eyebrow{display:none}
/* Field panning is deliberately restricted to the scene, never the sticks. */
#scene canvas{touch-action:none;cursor:grab}
#scene canvas:active{cursor:grabbing}
#scene canvas:focus-visible{outline:2px solid var(--ui-focus);outline-offset:-3px}
#fieldLookButton{position:absolute;z-index:5;top:56px;left:50%;transform:translateX(-50%);min-height:44px;padding:9px 16px;border-radius:24px;font-size:14px;box-shadow:0 2px 12px var(--ui-shadow)}
body.ui-theme #fieldLookButton[aria-pressed=true]{background:var(--ui-accent);color:var(--ui-on-accent);border-color:var(--ui-accent)}
@media(max-width:600px){#fieldLookButton{top:154px;max-width:calc(100% - 32px)}}
@media(max-height:500px) and (min-width:601px){#fieldLookButton{top:56px}}

body.ui-theme .beta-label{color:var(--ui-text)!important;background:var(--ui-hud);text-shadow:none}
body.ui-theme #readyDialog #readyStart{box-shadow:none}

/* Photo captions need stable contrast against the photograph in both modes. */
body.ui-theme .gate-heading{color:#fff;text-shadow:0 2px 10px #07121d}
body.ui-theme :is(input,textarea)::placeholder{color:var(--ui-muted);opacity:1}
