:root {
  color-scheme: dark;
  --bg: #08131b;
  --panel: #0d1b24;
  --panel-2: #10212b;
  --line: rgba(169, 205, 214, .12);
  --line-strong: rgba(169, 205, 214, .2);
  --text: #e8f1f2;
  --muted: #91a7ad;
  --dim: #627980;
  --accent: #7ce5c1;
  --accent-strong: #a4f2d8;
  --transmit: #7ce5c1;
  --upper: #ffbd78;
  --lower: #b7a1ff;
  --linger: #81949c;
  --radius: 14px;
  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 { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: 62px minmax(0, 1fr); background: radial-gradient(ellipse at 28% -18%, rgba(38, 103, 105, .16), transparent 43%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 18px 0 22px; border-bottom: 1px solid var(--line); background: rgba(7, 18, 25, .92); min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; border: 1px solid rgba(124,229,193,.42); border-radius: 11px; position: relative; display: grid; place-items: center; background: rgba(124,229,193,.07); box-shadow: 0 0 22px rgba(124,229,193,.08); }
.brand-mark span { width: 13px; height: 13px; border: 1.6px solid var(--accent); border-radius: 50%; position: absolute; }
.brand-mark i { width: 23px; height: 7px; border: 1px solid rgba(124,229,193,.7); border-radius: 50%; transform: rotate(-34deg); }
.eyebrow, .section-kicker { color: #83a0a6; font-size: 9px; letter-spacing: .16em; font-weight: 750; line-height: 1.2; }
.brand-copy h1 { font-size: 16px; font-weight: 650; letter-spacing: -.025em; line-height: 1.25; margin: 3px 0 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.system-pill { display: flex; align-items: center; gap: 7px; color: #a9bec1; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 99px; padding: 7px 10px; font-size: 9px; letter-spacing: .1em; font-weight: 700; white-space: nowrap; }
.system-dot, .stage-live i, .chart-live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(124,229,193,.75); }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 10px; background: #10232c; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.icon-button:hover { border-color: rgba(124,229,193,.55); background: #17313a; transform: translateY(-1px); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 10px; padding: 10px; min-height: 0; height: 100%; }
.left-stack { display: grid; grid-template-rows: minmax(0, 1fr) 184px; gap: 10px; min-width: 0; min-height: 0; }
.stage-card, .chart-card, .side-panel { background: linear-gradient(145deg, rgba(16,33,43,.98), rgba(10,24,33,.98)); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; min-height: 0; }
.stage-card { display: flex; flex-direction: column; overflow: hidden; }
.stage-head { min-height: 54px; padding: 10px 15px 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid rgba(169,205,214,.08); }
.stage-title { font-size: 13px; font-weight: 630; margin-top: 4px; letter-spacing: -.015em; }
.stage-head-right { display: flex; align-items: center; gap: 12px; }
.scale-tag { color: #83a0a6; border: 1px solid rgba(169,205,214,.15); border-radius: 5px; padding: 4px 6px; font-size: 8px; font-weight: 750; letter-spacing: .11em; white-space: nowrap; }
.stage-live { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 8px; letter-spacing: .12em; font-weight: 750; white-space: nowrap; }
.stage-live i { width: 5px; height: 5px; }
.scene-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 51% 50%, rgba(17,55,63,.27), transparent 62%), #091820; }
#sceneCanvas { display: block; width: 100%; height: 100%; }
.scene-corner { position: absolute; top: 13px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.scene-corner-left { left: 14px; }
.scene-corner-right { right: 14px; text-align: right; }
.corner-label { font-size: 8px; color: #6f8990; font-weight: 750; letter-spacing: .13em; }
.corner-value { font-size: 10px; color: #b9cacc; font-weight: 650; letter-spacing: .04em; }
.scene-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 14px 10px; min-height: 52px; border-top: 1px solid rgba(169,205,214,.08); }
.scene-footer p { color: #afc2c4; font-size: 10px; line-height: 1.45; margin: 0; max-width: 58%; }
.scene-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.scene-legend span, .chart-legend span { color: #82999e; font-size: 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.legend-dot.ray { background: var(--accent); box-shadow: 0 0 7px rgba(124,229,193,.6); }
.legend-dot.neighbour { background: var(--upper); }
.legend-dot.disk { background: #66808a; }
.chart-card { padding: 10px 13px 8px; display: flex; flex-direction: column; overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 31px; }
.chart-title { margin-top: 3px; font-size: 12px; font-weight: 630; letter-spacing: -.01em; }
.chart-meta { display: flex; align-items: center; gap: 6px; color: #83999e; font-size: 8px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.chart-live-dot { width: 5px; height: 5px; }
.chart-scale { color: #647b81; }
#chartCanvas { width: 100%; flex: 1; min-height: 78px; display: block; }
.chart-legend { display: flex; align-items: center; justify-content: flex-end; gap: 13px; min-height: 15px; }
.legend-swatch { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.legend-swatch.transmit { background: var(--transmit); }
.legend-swatch.upper { background: var(--upper); }
.legend-swatch.lower { background: var(--lower); }
.legend-swatch.linger { background: var(--linger); }
.side-panel { overflow-y: auto; overscroll-behavior: contain; padding: 12px; scrollbar-width: thin; scrollbar-color: #29424a transparent; }
.side-panel::-webkit-scrollbar { width: 6px; }
.side-panel::-webkit-scrollbar-thumb { background: #29424a; border-radius: 9px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; background: rgba(255,255,255,.025); border: 1px solid rgba(169,205,214,.1); border-radius: 10px; padding: 9px 10px 8px; }
.readout-wide { grid-column: 1 / -1; }
.readout-label { color: #82999e; font-size: 8px; letter-spacing: .12em; font-weight: 750; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.readout-label span { color: #58747a; font-size: 7px; letter-spacing: .09em; }
.readout-value { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.04em; color: #edf5f4; margin-top: 4px; font-variant-numeric: tabular-nums; }
.readout-value small { font-size: 11px; font-weight: 550; color: #91a9ad; letter-spacing: 0; }
.readout-foot { color: #6f858a; font-size: 8px; margin-top: 2px; }
.channel-card { margin-top: 8px; border: 1px solid rgba(124,229,193,.16); border-radius: 10px; padding: 9px 10px; background: linear-gradient(100deg, rgba(124,229,193,.075), rgba(124,229,193,.015)); }
.channel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.channel-badge { padding: 4px 6px; border-radius: 5px; font-size: 7px; letter-spacing: .1em; font-weight: 800; background: rgba(124,229,193,.12); color: var(--transmit); white-space: nowrap; }
.channel-badge.upper { color: var(--upper); background: rgba(255,189,120,.12); }
.channel-badge.lower { color: var(--lower); background: rgba(183,161,255,.12); }
.channel-badge.linger { color: #b1c0c5; background: rgba(129,148,156,.14); }
.channel-card p { margin: 7px 0 0; color: #a9bec0; font-size: 9px; line-height: 1.45; }
.controls-section, .preset-section, .transport-section { margin-top: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.small-note { color: #607b81; font-size: 7px; font-weight: 750; letter-spacing: .11em; }
.control-block { min-width: 0; margin-bottom: 10px; }
.control-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.control-top label { font-size: 10px; font-weight: 570; color: #c9d7d8; }
.control-top label em { color: #8ba3a7; font-style: italic; }
.control-top output { color: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 14px; background: transparent; margin: 0; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(124,229,193,.8), rgba(124,229,193,.22)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(124,229,193,.8), rgba(124,229,193,.22)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: #c9ffeb; border: 2px solid #4dbd9b; box-shadow: 0 0 0 3px rgba(124,229,193,.1), 0 0 10px rgba(124,229,193,.25); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #c9ffeb; border: 2px solid #4dbd9b; box-shadow: 0 0 0 3px rgba(124,229,193,.1); }
input:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.range-labels { display: flex; justify-content: space-between; color: #60777d; font-size: 7px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.control-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 9px; border: 1px solid rgba(169,205,214,.1); border-radius: 9px; background: rgba(255,255,255,.018); cursor: pointer; }
.toggle-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle-copy strong { color: #cbdadb; font-size: 9px; font-weight: 600; }
.toggle-copy small { color: #6d858a; font-size: 7px; }
.compare-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { flex: 0 0 auto; width: 30px; height: 17px; padding: 2px; border-radius: 20px; background: #2a4148; transition: background .18s; }
.toggle-track i { display: block; width: 13px; height: 13px; border-radius: 50%; background: #93a8aa; transition: transform .18s, background .18s; }
.compare-toggle input:checked + .toggle-track { background: rgba(124,229,193,.36); }
.compare-toggle input:checked + .toggle-track i { transform: translateX(13px); background: var(--accent-strong); }
.compare-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; border-radius: 9px; border: 1px solid rgba(169,205,214,.12); background: rgba(255,255,255,.025); text-align: left; cursor: pointer; transition: border-color .18s, background .18s; }
.preset-button:hover { border-color: rgba(124,229,193,.42); }
.preset-button.active { border-color: rgba(124,229,193,.42); background: rgba(124,229,193,.07); }
.preset-icon { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 auto; border-radius: 7px; background: rgba(124,229,193,.09); color: var(--accent); font-size: 16px; }
.open-icon { background: rgba(255,189,120,.09); color: var(--upper); }
.preset-button strong, .preset-button small { display: block; }
.preset-button strong { font-size: 8px; color: #d4e1e0; font-weight: 650; white-space: nowrap; }
.preset-button small { color: #70888d; font-size: 7px; margin-top: 3px; white-space: nowrap; }
.transport-buttons { display: grid; grid-template-columns: 1.15fr .9fr .9fr; gap: 6px; }
.transport-buttons button { min-width: 0; height: 34px; border-radius: 8px; font-size: 9px; font-weight: 650; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 6px; transition: transform .16s, border-color .16s, background .16s; }
.transport-buttons button:hover { transform: translateY(-1px); }
.primary-button { color: #072019; background: var(--accent); border: 1px solid var(--accent); }
.primary-button:hover { background: var(--accent-strong); }
.secondary-button { color: #c4d2d3; background: rgba(255,255,255,.035); border: 1px solid rgba(169,205,214,.16); }
.secondary-button:hover { border-color: rgba(124,229,193,.4); background: rgba(124,229,193,.06); }
.button-icon { font-size: 13px; line-height: 1; }
.quality-row { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; color: #81989c; font-size: 8px; }
.quality-switch { display: flex; padding: 2px; border: 1px solid rgba(169,205,214,.13); border-radius: 7px; background: rgba(0,0,0,.15); }
.quality-switch button { border: 0; background: transparent; color: #71888d; border-radius: 5px; font-size: 7px; padding: 4px 9px; cursor: pointer; }
.quality-switch button.selected { color: #d4e5e1; background: rgba(124,229,193,.14); }
.check-card { margin-top: 12px; border: 1px solid rgba(124,229,193,.18); border-radius: 10px; padding: 9px 10px; background: linear-gradient(105deg, rgba(124,229,193,.06), rgba(255,255,255,.015)); }
.check-top { display: flex; justify-content: space-between; align-items: center; color: #8ca6a7; font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.textbook-tag { color: #8ce7c6; border: 1px solid rgba(124,229,193,.2); padding: 3px 5px; border-radius: 4px; font-size: 7px; }
.check-value { color: #e2f0ec; font-size: 13px; font-weight: 650; margin-top: 7px; font-variant-numeric: tabular-nums; }
.check-detail { color: #7c9999; font-size: 8px; margin-top: 3px; }
.science-panel { margin-top: 11px; border: 1px solid rgba(169,205,214,.12); border-radius: 9px; background: rgba(255,255,255,.018); }
.science-panel summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 10px; color: #b7caca; font-size: 8px; font-weight: 750; letter-spacing: .13em; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-plus { color: var(--accent); font-size: 15px; font-weight: 400; transition: transform .18s; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 10px 10px; color: #91a7aa; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 9px 0 5px; color: #c7d7d6; font-size: 9px; font-weight: 700; }
.science-content p { margin: 5px 0; }
.science-content code { color: #a5efd6; background: rgba(124,229,193,.07); border-radius: 4px; padding: 2px 4px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.science-note { color: #b0c5c2; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 9px !important; }
.panel-foot { text-align: center; color: #526b72; font-size: 7px; font-weight: 750; letter-spacing: .12em; padding: 11px 0 3px; }
.panel-foot span { color: #789096; }
@media (max-width: 900px) and (min-width: 681px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; }
  .side-panel { padding: 10px; }
  .scene-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
  .scene-footer p { max-width: 100%; }
  .scene-legend { justify-content: flex-start; }
}
@media (max-width: 680px) {
  .app-shell { grid-template-rows: 54px minmax(0, 1fr); }
  .topbar { padding: 0 11px 0 13px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-copy h1 { font-size: 14px; }
  .eyebrow { font-size: 8px; }
  .topbar-actions { gap: 8px; }
  .system-pill { padding: 6px 8px; font-size: 7px; }
  .icon-button { width: 31px; height: 31px; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(205px, 1.02fr) minmax(128px, .62fr) minmax(240px, 1.1fr); gap: 7px; padding: 7px; }
  .left-stack { display: contents; }
  .stage-card { grid-row: 1; }
  .chart-card { grid-row: 2; }
  .side-panel { grid-row: 3; padding: 10px; }
  .stage-head { min-height: 43px; padding: 7px 10px; }
  .stage-title { font-size: 11px; }
  .section-kicker { font-size: 8px; }
  .scale-tag { font-size: 7px; padding: 3px 5px; }
  .stage-live { font-size: 7px; }
  .scene-footer { min-height: 42px; padding: 6px 9px; align-items: flex-start; flex-direction: column; gap: 4px; }
  .scene-footer p { max-width: 100%; font-size: 8px; line-height: 1.35; }
  .scene-legend { justify-content: flex-start; gap: 10px; }
  .scene-legend span { font-size: 7px; }
  .scene-corner { top: 8px; }
  .scene-corner-left { left: 9px; }
  .scene-corner-right { right: 9px; }
  .corner-label { font-size: 7px; }
  .corner-value { font-size: 8px; }
  .chart-card { padding: 7px 9px 5px; }
  .chart-title { font-size: 10px; }
  .chart-meta { font-size: 6px; gap: 4px; }
  .chart-legend { gap: 9px; min-height: 12px; }
  .chart-legend span { font-size: 7px; }
  .readout-grid { grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
  .readout-wide { grid-column: auto; }
  .readout-card { padding: 7px 7px 6px; }
  .readout-label { font-size: 6px; letter-spacing: .08em; }
  .readout-label span { font-size: 6px; }
  .readout-value { font-size: 17px; margin-top: 3px; }
  .readout-value small { font-size: 9px; }
  .readout-foot { font-size: 6px; line-height: 1.25; }
  .channel-card { margin-top: 6px; padding: 7px 8px; }
  .channel-card p { font-size: 8px; margin-top: 5px; }
  .channel-badge { font-size: 6px; }
  .controls-section, .preset-section, .transport-section { margin-top: 11px; }
  .control-top label { font-size: 9px; }
  .control-top output { font-size: 8px; }
  .control-block { margin-bottom: 8px; }
  .range-labels { font-size: 6px; }
  .compare-toggle { padding: 7px 8px; }
  .toggle-copy strong { font-size: 8px; }
  .toggle-copy small { font-size: 6px; }
  .preset-button { padding: 7px; }
  .preset-button strong { font-size: 7px; }
  .preset-button small { font-size: 6px; }
  .transport-buttons button { height: 32px; font-size: 8px; }
  .check-card { margin-top: 10px; }
}
@media (max-width: 390px) {
  .system-pill { display: none; }
  .stage-head-right { gap: 7px; }
  .scene-legend { gap: 7px; }
  .scene-legend span { font-size: 6px; }
  .chart-meta { letter-spacing: .06em; }
  .control-pair { gap: 8px; }
  .preset-row { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
html:has(body.embed-mode) { height: 100vh; height: 100dvh; overflow: hidden; }
