:root {
  color-scheme: dark;
  --bg: #07111d;
  --panel: #0d1a28;
  --panel-2: #101f2f;
  --panel-3: #142538;
  --line: rgba(164, 194, 216, .13);
  --line-strong: rgba(164, 194, 216, .22);
  --text: #eaf2f8;
  --muted: #8da3b6;
  --dim: #627a8e;
  --ice: #a9d9ef;
  --ice-bright: #d9f3ff;
  --amber: #f0c98a;
  --green: #79d4b0;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-size: 13px; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }
.app-shell { height: 100%; display: grid; grid-template-rows: 68px minmax(0, 1fr); }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: #091522; min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; display: flex; align-items: end; justify-content: center; gap: 3px; padding: 6px; border: 1px solid rgba(169,217,239,.3); border-radius: 9px; background: linear-gradient(145deg, rgba(169,217,239,.14), rgba(169,217,239,.025)); }
.brand-mark span { display: block; width: 4px; background: var(--ice); border-radius: 4px 4px 1px 1px; transform: skew(-12deg); }
.brand-mark span:nth-child(1) { height: 12px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 15px; opacity: .75; }
.eyebrow, .section-kicker { font-size: 9px; letter-spacing: .16em; color: #7f9bb0; font-weight: 750; }
h1 { margin: 3px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 span { color: #9fb2c2; font-weight: 450; }
.header-meta { display: flex; align-items: center; gap: 9px; color: #839aaf; font-size: 9px; font-weight: 700; letter-spacing: .11em; white-space: nowrap; }
.live-dot, .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(121,212,176,.55); }
.header-divider, .footer-separator { width: 1px; height: 13px; background: var(--line-strong); margin: 0 5px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 354px; min-height: 0; }
.stage-wrap { min-width: 0; min-height: 0; display: grid; grid-template-rows: 42px minmax(0, 1fr) 34px; background: #091522; border-right: 1px solid var(--line); }
.stage-topline { display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-bottom: 1px solid var(--line); }
.scene-label { display: flex; align-items: center; gap: 9px; color: #9cb2c5; font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.scene-index { color: var(--ice); font-variant-numeric: tabular-nums; }
.stage-actions { display: flex; gap: 7px; }
.icon-button { width: 29px; height: 27px; border-radius: 7px; border: 1px solid var(--line-strong); background: rgba(17,34,50,.75); color: #b7cbd9; cursor: pointer; font-size: 17px; line-height: 1; transition: background .18s, border-color .18s; }
.icon-button:hover { background: #1b354b; border-color: rgba(169,217,239,.45); }
.stage { position: relative; overflow: hidden; min-height: 0; background: linear-gradient(180deg, #172b3d, #8fa7b7 76%, #263b4a); }
.stage canvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; outline: none; }
.scene-callout { position: absolute; z-index: 2; display: flex; align-items: center; gap: 7px; color: rgba(238,247,252,.76); font-size: 8px; font-weight: 800; letter-spacing: .16em; pointer-events: none; text-shadow: 0 1px 4px rgba(4,13,22,.65); }
.callout-sun { top: 16%; left: 11%; }
.callout-ice { top: 47%; right: 8%; }
.callout-line { display: inline-block; width: 23px; height: 1px; background: rgba(217,243,255,.7); box-shadow: 0 0 6px rgba(217,243,255,.5); }
.stage-bottom { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 14px; display: flex; align-items: end; justify-content: space-between; pointer-events: none; }
.stage-caption { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid rgba(230,244,252,.22); border-radius: 9px; background: rgba(7,17,29,.48); backdrop-filter: blur(10px); }
.stage-caption strong { font-size: 11px; font-weight: 700; color: #f0f7fb; }
.stage-caption span { color: #c0d0dc; font-size: 9px; }
.stage-chip { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(230,244,252,.2); background: rgba(7,17,29,.48); color: #e0edf5; font-size: 9px; letter-spacing: .12em; font-weight: 800; backdrop-filter: blur(10px); }
.stage-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; border-top: 1px solid var(--line); background: #0a1724; min-width: 0; }
.legend { display: flex; align-items: center; gap: 7px; color: #7f95a8; font-size: 8px; font-weight: 750; letter-spacing: .08em; white-space: nowrap; }
.legend-swatch { width: 7px; height: 7px; border-radius: 2px; margin-left: 7px; }
.legend-swatch:first-child { margin-left: 0; }
.legend-swatch.sunlight { background: #f1c78d; }
.legend-swatch.shadow { background: #4c6375; }
.legend-swatch.sublimation { background: #9dddf5; }
.stage-footer-right { display: flex; align-items: center; gap: 8px; color: #688196; font-size: 8px; letter-spacing: .1em; font-weight: 700; white-space: nowrap; }
#statusMessage { color: #7f9bb0; font-size: 9px; letter-spacing: 0; font-weight: 500; text-transform: none; max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.fallback { position: absolute; inset: 18px; z-index: 5; display: grid; place-items: center; padding: 20px; border: 1px solid rgba(240,201,138,.4); border-radius: 10px; background: rgba(9,21,34,.9); color: #f0c98a; text-align: center; }
.fallback[hidden] { display: none; }
.sidebar { overflow-y: auto; min-height: 0; background: var(--panel); scrollbar-width: thin; scrollbar-color: #294156 transparent; }
.panel-section { padding: 17px 17px 18px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.section-heading h2 { margin: 4px 0 0; font-size: 14px; letter-spacing: -.02em; font-weight: 680; }
.section-number { color: #607a8f; font-size: 10px; font-weight: 800; }
.state-pill { padding: 4px 7px; border-radius: 5px; border: 1px solid rgba(121,212,176,.22); background: rgba(121,212,176,.08); color: var(--green); font-size: 8px; letter-spacing: .1em; font-weight: 800; }
.state-pill:not(.running) { color: #a1b0bc; border-color: var(--line-strong); background: rgba(255,255,255,.035); }
.playback-row { display: grid; grid-template-columns: 1.2fr 1fr .8fr; gap: 7px; }
.primary-button, .secondary-button { min-height: 34px; padding: 0 9px; border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 750; transition: transform .15s, background .15s, border-color .15s; }
.primary-button { border: 1px solid rgba(169,217,239,.36); background: #24485f; color: #e6f6ff; }
.primary-button.is-active { background: #2c596f; }
.secondary-button { border: 1px solid var(--line-strong); background: #14283a; color: #b6c7d4; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); border-color: rgba(169,217,239,.55); }
.time-progress { height: 3px; margin: 14px 0 11px; border-radius: 4px; background: #203549; overflow: hidden; }
.time-progress-fill { height: 100%; width: 0%; border-radius: 4px; background: linear-gradient(90deg, #7bbbd6, #d3effa); transition: width .2s linear; }
.time-scale-row, .control-label, .quality-row { display: flex; align-items: center; justify-content: space-between; }
.time-scale-row label, .quality-row > span { color: #8198ab; font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.time-scale-row output, .control-label output { color: #cde7f4; font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 750; }
.range-input { display: block; width: 100%; height: 14px; margin: 7px 0 0; appearance: none; background: transparent; cursor: pointer; accent-color: #9bd3ea; }
.range-input::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, #679fbd, #263e53); }
.range-input::-moz-range-track { height: 3px; border-radius: 3px; background: #29465d; }
.range-input::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #dff6ff; border-radius: 50%; background: #72b4d0; box-shadow: 0 0 0 3px rgba(114,180,208,.14); }
.range-input::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #dff6ff; border-radius: 50%; background: #72b4d0; box-shadow: 0 0 0 3px rgba(114,180,208,.14); }
.range-ends { display: flex; justify-content: space-between; color: #536e83; font-size: 8px; }
.preset-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-bottom: 15px; }
.preset-button { min-height: 48px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; background: #102031; color: #8fa5b7; cursor: pointer; font-size: 8px; font-weight: 700; transition: .16s; }
.preset-button:hover { border-color: var(--line-strong); color: #dcebf4; }
.preset-button.selected { border-color: rgba(169,217,239,.45); background: rgba(108,169,197,.13); color: #dff4ff; box-shadow: inset 0 0 0 1px rgba(169,217,239,.07); }
.preset-icon { font-size: 14px; color: #b7ddec; }
.control-list { display: grid; gap: 11px; }
.control-label { gap: 8px; }
.control-label label { color: #c0cfda; font-size: 10px; font-weight: 600; }
.control-label label span { color: #6f8ba1; margin-left: 4px; font-family: Georgia, serif; font-style: italic; }
.control-item .range-input { margin-top: 4px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; padding: 10px 10px 9px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(145deg, rgba(20,39,57,.95), rgba(14,29,44,.95)); }
.readout-label { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: #7f98ac; font-size: 7px; letter-spacing: .08em; font-weight: 800; }
.readout-label i { color: #6e8da1; font-style: normal; font-size: 6px; }
.readout-card strong { display: block; margin-top: 7px; color: #e4f5fd; font-size: 19px; line-height: 1.05; letter-spacing: -.04em; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-card strong small { color: #8da9bc; font-size: 10px; font-weight: 600; letter-spacing: 0; }
.readout-foot { display: block; margin-top: 5px; color: #627b8f; font-size: 8px; }
.secondary-readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin: 11px 1px 0; }
.secondary-readouts div { display: flex; justify-content: space-between; gap: 6px; padding: 7px 0; border-bottom: 1px solid rgba(164,194,216,.08); }
.secondary-readouts span { color: #7890a4; font-size: 8px; }
.secondary-readouts strong { color: #c6d9e5; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.validation-card { margin-top: 12px; padding: 11px; border: 1px solid rgba(169,217,239,.17); border-radius: 8px; background: rgba(13,31,46,.72); }
.validation-head { display: flex; align-items: center; justify-content: space-between; color: #7e9bb0; font-size: 8px; letter-spacing: .12em; font-weight: 800; }
.validation-tag { padding: 3px 5px; border-radius: 4px; background: rgba(121,212,176,.09); color: #88d7b7; font-size: 7px; }
.validation-title { margin: 8px 0; color: #cddde8; font-size: 10px; font-weight: 650; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.validation-values div { display: flex; flex-direction: column; gap: 4px; }
.validation-values span { color: #6f879b; font-size: 7px; letter-spacing: .08em; }
.validation-values strong { color: #d9eff9; font-size: 11px; font-variant-numeric: tabular-nums; }
.validation-card p { margin: 8px 0 0; color: #748a9c; font-size: 8px; line-height: 1.45; }
.science-section { padding-top: 14px; }
details summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details summary > span:first-child { display: flex; flex-direction: column; gap: 4px; }
details summary strong { color: #dbeaf3; font-size: 13px; }
.details-chevron { color: #85a2b6; font-size: 17px; transition: transform .2s; }
details[open] .details-chevron { transform: rotate(180deg); }
.science-content { padding-top: 12px; color: #9cb0bf; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 13px 0 5px; color: #cde0eb; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.science-content h3:first-child { margin-top: 0; }
.science-content p { margin: 0 0 8px; }
.science-content ul { margin: 5px 0 10px; padding-left: 15px; }
.science-content li { margin: 4px 0; }
.equation { margin: 5px 0; padding: 7px 8px; border: 1px solid rgba(164,194,216,.1); border-radius: 5px; background: #0a1724; color: #c8e4f1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; overflow-wrap: anywhere; }
.disclaimer { margin-top: 12px !important; color: #7992a5; font-style: italic; }
.quality-section { padding-top: 12px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 7px; background: #091725; }
.segmented button { min-width: 42px; padding: 5px 8px; border: 0; border-radius: 5px; background: transparent; color: #7f97aa; font-size: 9px; cursor: pointer; }
.segmented button.selected { background: #24465b; color: #e2f4fc; }
.motion-note { margin: 9px 0 0; color: #8da3b6; font-size: 9px; }
.embed .app-shell { grid-template-rows: minmax(0,1fr); }
.embed .app-header, .embed .sidebar, .embed .stage-topline, .embed .stage-footer { display: none; }
.embed .workspace { grid-template-columns: minmax(0,1fr); }
.embed .stage-wrap { grid-template-rows: minmax(0,1fr); border: 0; }
.embed .stage { min-height: 100vh; }
.embed .stage-bottom { bottom: 16px; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; }
  .app-header { padding: 0 16px; }
  .header-meta { font-size: 8px; }
  .stage-footer-right { display: none; }
}
@media (max-width: 720px) {
  html, body { overflow: auto; }
  .app-shell { min-height: 100%; height: auto; grid-template-rows: 58px minmax(0,1fr); }
  .app-header { padding: 0 12px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 14px; }
  h1 span { display: none; }
  .header-meta { gap: 6px; font-size: 7px; }
  .header-meta .header-divider, .header-meta span:last-child { display: none; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(300px, 43vh) auto; }
  .stage-wrap { grid-template-rows: 34px minmax(0,1fr) 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-topline { padding: 0 12px; }
  .stage-footer { padding: 0 10px; }
  .legend { font-size: 7px; gap: 5px; }
  .legend-swatch { margin-left: 4px; }
  .sidebar { overflow: visible; }
  .panel-section { padding: 15px 13px; }
  .stage-caption { padding: 8px 9px; }
  .stage-caption span { max-width: 220px; font-size: 8px; }
  .callout-sun { left: 7%; }
  .callout-ice { right: 5%; }
  .embed .stage { min-height: 100vh; }
}
@media (max-width: 390px) {
  .header-meta { display: none; }
  .stage-wrap { grid-template-rows: 32px minmax(0,1fr) 26px; }
  .legend { font-size: 6px; gap: 4px; letter-spacing: .04em; }
  .legend-swatch { width: 6px; height: 6px; margin-left: 3px; }
  .readout-card strong { font-size: 17px; }
}
