:root {
  color-scheme: dark;
  --bg: #050d18;
  --panel: #0a1522;
  --panel-2: #0d1b2a;
  --line: rgba(127, 172, 204, .16);
  --line-strong: rgba(127, 172, 204, .26);
  --text: #e9f2f8;
  --muted: #8ba0b2;
  --dim: #5d7284;
  --cyan: #69e4e2;
  --cyan-2: #2eaabf;
  --blue: #4d8dc5;
  --amber: #f1b96c;
  --green: #74e0b7;
  --danger: #ff9a81;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow: hidden; background: radial-gradient(ellipse at 35% -10%, #10243a 0, #07111e 38%, #040a12 100%); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { height: 100vh; min-height: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid rgba(123, 169, 199, .13); background: rgba(5, 13, 24, .82); backdrop-filter: blur(18px); z-index: 4; }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 230px; }
.brand-mark { width: 27px; height: 27px; border: 1px solid rgba(105, 228, 226, .55); border-radius: 8px; position: relative; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-12deg); }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--cyan); box-shadow: 0 0 9px rgba(105, 228, 226, .55); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .8; }
.eyebrow, .panel-kicker, .scene-kicker, .micro-label { color: #7891a5; font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.2; }
.brand-title { margin-top: 2px; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.brand-title span { color: var(--cyan); margin-left: 4px; }
.topbar-center { display: flex; align-items: center; gap: 10px; color: #bfd0dd; font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(116, 224, 183, .85); }
.topbar-divider { color: #45596b; }
.muted { color: #62788b; }
.topbar-right { display: flex; gap: 8px; align-items: center; min-width: 230px; justify-content: flex-end; }
.seed-label, .version-label { border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; color: #8297a8; font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.version-label { color: var(--cyan); border-color: rgba(105, 228, 226, .22); }
.workspace { width: 100%; max-width: 1680px; flex: 1; min-height: 0; margin: 0 auto; padding: 18px 22px 12px; display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(350px, .92fr); gap: 16px; }
.visual-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.scene-header { min-height: 68px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 0 3px 12px; }
.scene-kicker { color: var(--cyan-2); }
h1 { margin: 4px 0 3px; font-size: clamp(22px, 2.25vw, 31px); letter-spacing: -.045em; line-height: 1.06; font-weight: 680; }
.scene-subtitle { margin: 0; color: #8498a9; font-size: 11px; letter-spacing: .01em; }
.scene-header-meta { text-align: right; padding-top: 5px; }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid rgba(105, 228, 226, .22); border-radius: 5px; color: #9de5e1; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.chip-dot { width: 5px; height: 5px; border-radius: 50%; }
.chip-dot.cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.meta-caption { margin-top: 7px; color: #607588; font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.scene-frame { flex: 1; min-height: 320px; position: relative; overflow: hidden; border: 1px solid rgba(101, 163, 195, .23); border-radius: 13px; background: radial-gradient(ellipse at 55% 46%, #0c2032 0, #071321 54%, #030a13 100%); box-shadow: 0 16px 50px rgba(0,0,0,.22), inset 0 0 55px rgba(24, 100, 137, .08); }
#world { display: block; width: 100%; height: 100%; min-height: 320px; touch-action: none; }
.scene-vignette { pointer-events: none; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(2,8,15,.28), transparent 20%, transparent 78%, rgba(2,8,15,.22)), linear-gradient(0deg, rgba(2,8,15,.36), transparent 30%, transparent 75%, rgba(2,8,15,.18)); }
.scene-annotation { position: absolute; display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; border: 1px solid rgba(123, 187, 212, .18); border-radius: 6px; background: rgba(5, 16, 28, .64); backdrop-filter: blur(8px); pointer-events: none; }
.annotation-top-left { top: 14px; left: 14px; }
.annotation-top-right { top: 14px; right: 14px; }
.annotation-bottom-left { bottom: 42px; left: 14px; }
.annotation-index { color: var(--cyan); font: 800 9px/1.5 ui-monospace, monospace; }
.scene-annotation strong { display: block; color: #cfe2ed; font-size: 8px; letter-spacing: .12em; }
.scene-annotation small { display: block; margin-top: 3px; color: #8098a9; font: 9px/1.2 ui-monospace, monospace; }
.scene-legend { position: absolute; right: 14px; bottom: 14px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; max-width: 75%; color: #91a6b6; font-size: 8px; letter-spacing: .02em; pointer-events: none; }
.scene-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.legend-swatch.plasma { background: #3de2c3; box-shadow: 0 0 7px #3de2c3; }
.legend-swatch.signal { background: #8af9ff; box-shadow: 0 0 7px #8af9ff; }
.legend-swatch.intensity { background: linear-gradient(90deg,#164c9b,#39d4c2,#f3b967); }
.context-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(3, 10, 18, .82); backdrop-filter: blur(8px); }
.context-overlay[hidden], .fatal-error[hidden] { display: none; }
.context-card { display: grid; justify-items: center; gap: 8px; padding: 22px; border: 1px solid var(--line-strong); border-radius: 12px; background: #0b1b2a; text-align: center; }
.context-symbol { color: var(--cyan); font-size: 25px; }
.context-card small { color: var(--muted); }
.fatal-error { position: absolute; inset: auto 18px 18px; padding: 12px; background: #3a1a1b; color: #ffd4ca; border: 1px solid #a74b48; border-radius: 8px; font-size: 12px; }
.transport-bar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px 4px; }
.transport-controls, .transport-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.primary-control, .icon-control, .utility-control { border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(11, 26, 41, .84); cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.primary-control { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; background: rgba(31, 110, 124, .28); border-color: rgba(105, 228, 226, .32); color: #b9f3ed; font-size: 10px; font-weight: 750; }
.button-icon { font-size: 12px; }
.icon-control { width: 34px; height: 34px; color: #a8bdcb; font-size: 16px; }
.primary-control:hover, .icon-control:hover, .utility-control:hover { background: rgba(37, 94, 117, .34); border-color: rgba(105, 228, 226, .44); }
.transport-divider { height: 24px; width: 1px; margin: 0 5px; background: var(--line-strong); }
.time-readout { display: grid; gap: 3px; }
.time-readout strong { font: 700 12px/1 ui-monospace, monospace; color: #d6e5ec; }
.transport-right { justify-content: flex-end; }
.speed-control { display: flex; align-items: center; gap: 7px; margin-right: 3px; }
.speed-control input { width: 62px; }
.speed-control strong { min-width: 35px; color: #b5c9d7; font: 700 10px ui-monospace, monospace; }
.utility-control { height: 31px; padding: 0 9px; display: inline-flex; align-items: center; gap: 6px; color: #9eb1bf; font-size: 10px; white-space: nowrap; }
.export-control { color: var(--cyan); border-color: rgba(105, 228, 226, .22); }
.keyboard-hint { padding: 0 2px; color: #536a7e; font: 8px/1.2 ui-monospace, monospace; letter-spacing: .06em; }
kbd { display: inline-block; margin: 0 3px 0 7px; padding: 2px 4px; border: 1px solid rgba(126, 160, 185, .24); border-radius: 3px; color: #91a7b8; font: 8px ui-monospace, monospace; }
.control-column { min-width: 0; min-height: 0; overflow-y: auto; padding-right: 2px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: #244257 transparent; }
.panel { border: 1px solid rgba(118, 166, 197, .16); border-radius: var(--radius); background: linear-gradient(145deg, rgba(13, 29, 45, .96), rgba(8, 19, 31, .98)); box-shadow: 0 8px 24px rgba(0,0,0,.11); }
.controls-panel { padding: 14px 15px 12px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-heading h2, .validation-title h2 { margin: 4px 0 0; font-size: 14px; line-height: 1.1; letter-spacing: -.02em; font-weight: 650; }
.panel-icon { color: #6ddedc; font-size: 23px; opacity: .78; }
.preset-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 5px; margin: 13px 0 14px; }
.preset-button { min-width: 0; height: 29px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 5px; border: 1px solid rgba(121, 161, 187, .17); border-radius: 5px; background: rgba(5, 15, 25, .48); color: #8198a9; font-size: 9px; font-weight: 650; cursor: pointer; transition: all .18s ease; }
.preset-button.active { border-color: rgba(105, 228, 226, .42); background: rgba(31, 115, 126, .17); color: #c2f2ee; }
.preset-indicator { width: 5px; height: 5px; border-radius: 50%; background: #526a7e; }
.preset-button.active .preset-indicator { background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
.control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 17px; row-gap: 11px; }
.control-item { min-width: 0; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; margin-bottom: 6px; }
.control-top label { color: #b4c6d2; font-size: 10px; font-weight: 550; }
.control-top output { color: #74d9d6; font: 700 9px ui-monospace, monospace; white-space: nowrap; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 3px; display: block; border-radius: 3px; background: linear-gradient(90deg, #278a9a, #23475d); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #a8f0e9; background: #167a87; box-shadow: 0 0 0 3px rgba(54, 195, 194, .12), 0 0 8px rgba(90, 226, 221, .42); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #a8f0e9; background: #167a87; box-shadow: 0 0 0 3px rgba(54, 195, 194, .12); }
.range-ends { display: flex; justify-content: space-between; margin-top: 5px; color: #5e7486; font-size: 8px; }
.readouts-panel { padding: 13px 14px 12px; }
.compact-heading h2 { margin-top: 4px; }
.live-indicator { display: inline-flex; align-items: center; gap: 5px; color: #76cdb7; font: 750 8px ui-monospace, monospace; letter-spacing: .08em; }
.live-indicator i { width: 5px; height: 5px; border-radius: 50%; background: #65dcb2; box-shadow: 0 0 7px #65dcb2; }
.s4-card { margin-top: 12px; padding: 10px 11px 8px; border: 1px solid rgba(95, 175, 191, .19); border-radius: 8px; background: linear-gradient(105deg, rgba(14, 59, 70, .32), rgba(9, 28, 43, .5)); position: relative; }
.s4-main { display: grid; gap: 4px; }
.metric-label { color: #7891a4; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.s4-main strong { font: 650 25px/1 ui-monospace, monospace; letter-spacing: -.06em; color: #d9f6f2; }
.metric-provenance { color: #587184; font: 700 7px ui-monospace, monospace; letter-spacing: .1em; }
.severity-tag { position: absolute; top: 11px; right: 11px; border: 1px solid rgba(116, 224, 183, .3); border-radius: 4px; padding: 4px 6px; color: #8fe3c1; font: 800 8px ui-monospace, monospace; letter-spacing: .1em; }
.severity-tag[data-state="moderate"] { color: #f2cb82; border-color: rgba(242, 203, 130, .32); }
.severity-tag[data-state="severe"] { color: #ff9a81; border-color: rgba(255, 154, 129, .34); }
.severity-tag[data-state="weak"] { color: #8ac6e7; border-color: rgba(138, 198, 231, .3); }
.s4-scale { height: 3px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 10px; }
.s4-scale span:nth-child(1) { background: #4dbba0; border-radius: 4px 0 0 4px; }
.s4-scale span:nth-child(2) { background: #65b7ca; }
.s4-scale span:nth-child(3) { background: #e4b66f; }
.s4-scale span:nth-child(4) { background: #e47c6c; border-radius: 0 4px 4px 0; }
.s4-foot { display: flex; justify-content: space-between; margin-top: 5px; color: #5e7689; font-size: 8px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px; border: 1px solid rgba(118, 166, 197, .12); border-radius: 7px; overflow: hidden; }
.metric-cell { min-height: 56px; padding: 8px 10px 7px; display: grid; align-content: center; gap: 4px; background: rgba(4, 14, 24, .28); }
.metric-cell:nth-child(odd) { border-right: 1px solid rgba(118, 166, 197, .12); }
.metric-cell:nth-child(-n+2) { border-bottom: 1px solid rgba(118, 166, 197, .12); }
.metric-cell strong { color: #d4e4ed; font: 650 13px ui-monospace, monospace; }
.metric-cell small { color: #587184; font: 700 7px ui-monospace, monospace; letter-spacing: .1em; }
.validation-panel { padding: 12px 14px 10px; }
.validation-title { display: flex; align-items: center; justify-content: space-between; }
.validation-title h2 { font-size: 13px; }
.check-mark { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; color: #8ce1bc; background: rgba(66, 174, 139, .14); border: 1px solid rgba(116, 224, 183, .22); font-size: 12px; }
.validation-name { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: #9fb4c3; font-size: 9px; }
.textbook-pill { padding: 3px 5px; border: 1px solid rgba(105, 228, 226, .22); border-radius: 3px; color: #7ddbd7; font: 700 7px ui-monospace, monospace; letter-spacing: .08em; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; margin-top: 8px; }
.validation-values div { display: grid; gap: 4px; padding: 7px 8px; border-radius: 5px; background: rgba(4, 13, 22, .42); }
.validation-values small { color: #627b8e; font: 700 7px ui-monospace, monospace; letter-spacing: .1em; }
.validation-values strong { color: #cfe1e9; font: 650 10px ui-monospace, monospace; }
.validation-foot { margin-top: 8px; color: #607789; font-size: 8px; }
.validation-foot span { color: #9ab6c4; font-family: ui-monospace, monospace; }
.science-panel { overflow: hidden; }
.science-toggle { width: 100%; min-height: 53px; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; border: 0; background: transparent; text-align: left; cursor: pointer; }
.science-toggle > span:first-child { display: flex; align-items: center; gap: 10px; }
.science-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 7px; background: rgba(59, 146, 156, .13); border: 1px solid rgba(105, 228, 226, .18); color: var(--cyan); font: 18px Georgia, serif; }
.science-toggle b { display: block; color: #c8d9e2; font-size: 10px; font-weight: 700; }
.science-toggle small { display: block; margin-top: 3px; color: #71889a; font-size: 8px; }
.chevron { color: #7fdedb; font-size: 15px; }
.science-content { padding: 0 14px 13px; }
.science-content[hidden] { display: none; }
.equation-block { padding: 9px 0; border-top: 1px solid rgba(118, 166, 197, .11); }
.equation-label { display: block; color: #7191a5; font: 750 7px ui-monospace, monospace; letter-spacing: .13em; }
.equation-block code { display: block; margin-top: 5px; color: #9de9e0; font: 12px ui-monospace, monospace; }
.equation-block p { margin: 5px 0 0; color: #8198a8; font-size: 9px; line-height: 1.45; }
.science-facts { display: grid; gap: 5px; margin-top: 8px; }
.science-facts div { display: grid; grid-template-columns: 32px 1fr; gap: 7px; color: #8398a7; font-size: 8px; }
.science-facts b { color: #d0e0e9; font-family: ui-monospace, monospace; }
.limitations { margin: 10px 0 0; padding: 9px; border-left: 2px solid rgba(241, 185, 108, .55); background: rgba(241, 185, 108, .055); color: #879aa8; font-size: 8px; line-height: 1.5; }
.limitations b { color: #e2c08f; }
.panel-footer { display: flex; justify-content: space-between; gap: 8px; padding: 1px 3px 0; color: #62798b; font: 8px ui-monospace, monospace; }
.panel-footer b { color: #9bb4c3; font-weight: 650; }
.app-footer { min-height: 25px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px 7px; color: #4e6477; font: 7px ui-monospace, monospace; letter-spacing: .1em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1.45fr) minmax(330px, .95fr); padding-left: 14px; padding-right: 14px; gap: 12px; }
  .topbar { padding: 0 15px; }
  .brand-lockup, .topbar-right { min-width: 180px; }
  .control-list { column-gap: 12px; }
  .transport-right { gap: 5px; }
  .utility-control { padding: 0 7px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .app-shell { min-height: 100vh; height: auto; }
  .topbar { height: 50px; flex-basis: 50px; padding: 0 12px; }
  .topbar-center { display: none; }
  .brand-lockup, .topbar-right { min-width: 0; }
  .workspace { display: flex; flex-direction: column; padding: 12px 12px 16px; gap: 12px; }
  .visual-column { min-height: 0; }
  .scene-header { min-height: 62px; padding-bottom: 10px; }
  .scene-frame { height: min(54vh, 470px); min-height: 290px; flex: none; }
  #world { min-height: 290px; }
  .control-column { overflow: visible; }
  .control-list { grid-template-columns: 1fr 1fr; }
  .transport-bar { flex-wrap: wrap; padding-top: 9px; }
  .transport-right { margin-left: auto; }
  .app-footer { padding: 4px 13px 10px; flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 10px; }
  .brand-title { font-size: 10px; }
  .eyebrow { font-size: 8px; }
  .brand-mark { width: 24px; height: 24px; }
  .seed-label { display: none; }
  .version-label { font-size: 8px; }
  .workspace { padding: 10px 9px 14px; }
  .scene-header { align-items: center; }
  h1 { font-size: 23px; }
  .scene-subtitle { max-width: 250px; font-size: 9px; line-height: 1.35; }
  .scene-header-meta { padding-top: 0; }
  .meta-chip { font-size: 7px; padding: 5px 6px; }
  .meta-caption { font-size: 7px; }
  .scene-frame { height: 43vh; min-height: 285px; max-height: 390px; }
  #world { min-height: 285px; }
  .annotation-top-left { top: 8px; left: 8px; }
  .annotation-top-right { top: 8px; right: 8px; }
  .annotation-bottom-left { bottom: 40px; left: 8px; }
  .scene-annotation { padding: 5px 6px; gap: 5px; }
  .scene-annotation strong { font-size: 7px; }
  .scene-annotation small { font-size: 8px; }
  .scene-legend { right: 8px; bottom: 8px; gap: 7px; max-width: 94%; font-size: 7px; }
  .transport-bar { gap: 7px; }
  .transport-controls { gap: 5px; }
  .transport-right { width: 100%; justify-content: space-between; }
  .speed-control { flex: 1; }
  .speed-control input { flex: 1; max-width: 100px; }
  .utility-control { font-size: 9px; padding: 0 6px; }
  .keyboard-hint { display: none; }
  .control-list { grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 13px; }
  .controls-panel { padding: 13px 12px 12px; }
  .control-top label { font-size: 9px; }
  .control-top output { font-size: 8px; }
  .range-ends { font-size: 7px; }
  .panel-heading h2 { font-size: 13px; }
  .preset-button { font-size: 8px; }
  .panel-footer { font-size: 7px; }
  .app-footer { font-size: 6px; line-height: 1.5; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.embed-mode .topbar, .embed-mode .app-footer { display: none; }
.embed-mode .workspace { padding-top: 10px; min-height: 100vh; }
.embed-mode .scene-header { min-height: 58px; }
.embed-mode .control-column { padding-bottom: 10px; }
