:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0d1421;
  --panel-2: #101a2a;
  --line: rgba(160, 184, 218, .13);
  --line-strong: rgba(160, 184, 218, .22);
  --text: #eef4ff;
  --muted: #94a4bb;
  --dim: #65758e;
  --accent: #55d6c2;
  --accent-2: #87f0df;
  --gold: #f4c77a;
  --danger: #f08c91;
  --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: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-rows: 72px minmax(0, 1fr) 28px; background: radial-gradient(ellipse at 28% -20%, rgba(36, 75, 104, .18), transparent 48%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(7, 11, 20, .88); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(85, 214, 194, .5); border-radius: 50%; position: relative; flex: 0 0 auto; display: grid; place-items: center; box-shadow: 0 0 22px rgba(85, 214, 194, .09); }
.brand-mark span { width: 13px; height: 13px; background: #02040a; border: 1px solid rgba(85, 214, 194, .6); border-radius: 50%; box-shadow: 0 0 12px rgba(85, 214, 194, .28); }
.brand-mark i { position: absolute; width: 28px; height: 10px; border: 1px solid var(--accent); border-radius: 50%; transform: rotate(-27deg); opacity: .75; }
.eyebrow { font-size: 9px; font-weight: 750; letter-spacing: .19em; color: var(--accent); margin-bottom: 4px; }
h1 { margin: 0; font-size: 17px; line-height: 1.15; letter-spacing: -.025em; font-weight: 650; white-space: nowrap; }
h1 span { color: var(--accent); font-weight: 400; padding: 0 2px; }
.top-actions { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.live-pill { display: flex; align-items: center; gap: 7px; color: #a5b7cb; font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.live-dot, .mini-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(85, 214, 194, .65); }
.button { border: 1px solid var(--line-strong); border-radius: 9px; min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-size: 11px; font-weight: 650; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover, .preset-button:hover { border-color: rgba(85, 214, 194, .5); }
.button:active, .preset-button:active { transform: translateY(1px); }
.button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button-quiet { background: rgba(255,255,255,.025); color: #c8d5e7; }
.button-primary { background: rgba(85, 214, 194, .15); border-color: rgba(85, 214, 194, .45); color: #a9fff0; }
.button-primary:hover { background: rgba(85, 214, 194, .22); }
.button-secondary { background: rgba(255,255,255,.035); color: #c1cde0; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 374px; gap: 16px; padding: 16px 20px 12px; min-height: 0; overflow: hidden; }
.visual-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; gap: 10px; }
.canvas-wrap { min-height: 0; min-width: 0; position: relative; overflow: hidden; border: 1px solid rgba(125, 159, 197, .18); border-radius: 16px; background: #060a13; box-shadow: 0 16px 50px rgba(0,0,0,.2), inset 0 0 80px rgba(24, 46, 69, .16); }
#spaceCanvas { width: 100%; height: 100%; display: block; }
.canvas-topline { position: absolute; left: 20px; right: 20px; top: 17px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.scene-label, .scene-scale { display: flex; align-items: center; gap: 9px; font-size: 9px; font-weight: 750; letter-spacing: .14em; color: #8da1ba; }
.scene-index { color: var(--accent); border: 1px solid rgba(85,214,194,.36); border-radius: 5px; padding: 4px 6px; letter-spacing: .05em; }
.scene-scale { color: #72849c; font-size: 8px; }
.scene-scale b { color: #b8c9dc; font-weight: 650; letter-spacing: .04em; }
.scale-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.canvas-legend { position: absolute; left: 20px; bottom: 17px; display: flex; gap: 15px; flex-wrap: wrap; color: #8da0b7; font-size: 9px; letter-spacing: .02em; pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 6px; }
.canvas-legend i { width: 13px; height: 2px; display: inline-block; border-radius: 2px; }
.legend-ray { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.legend-photon { border-top: 1px dashed var(--gold); height: 0 !important; }
.legend-horizon { background: #253246; border: 1px solid #62718a; height: 7px !important; width: 7px !important; border-radius: 50% !important; }
.canvas-readout { position: absolute; right: 20px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; pointer-events: none; text-align: right; }
.readout-kicker { font-size: 8px; letter-spacing: .16em; color: #71849c; font-weight: 750; }
.canvas-readout strong { font-size: 10px; letter-spacing: .1em; color: var(--accent-2); }
.canvas-readout span:last-child { font-size: 9px; color: #8395ac; }
.visual-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; padding: 0 4px; }
.visual-footer p { margin: 0; max-width: 70%; color: #a8b7ca; font-size: 11px; line-height: 1.45; }
.footer-meta { color: #71829a; font-size: 9px; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.footer-meta .mini-dot { width: 5px; height: 5px; }
.meta-sep { color: #3f5067; }
.control-rail { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 3px 3px 4px 1px; scrollbar-width: thin; scrollbar-color: #26364c transparent; }
.control-rail::-webkit-scrollbar { width: 5px; }
.control-rail::-webkit-scrollbar-thumb { background: #26364c; border-radius: 8px; }
.metrics-section, .controls-section { background: linear-gradient(145deg, rgba(16,26,42,.9), rgba(10,16,28,.94)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.controls-section { margin-top: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; font-size: 9px; font-weight: 800; letter-spacing: .15em; color: #9eafc4; }
.tiny-tag { font-size: 7px; font-weight: 750; color: #70839b; border: 1px solid rgba(133,157,189,.18); padding: 4px 6px; border-radius: 4px; letter-spacing: .12em; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 10px 10px 9px; border-radius: 9px; background: rgba(4,9,17,.42); border: 1px solid rgba(151,175,207,.09); }
.metric-wide { grid-column: 1 / -1; }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #8395ac; font-size: 8px; font-weight: 650; letter-spacing: .04em; }
.value-kind { color: #637890; font-size: 7px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.value-kind.textbook { color: var(--gold); }
.metric-value { margin-top: 5px; font-size: 21px; line-height: 1.1; font-weight: 650; letter-spacing: -.04em; color: #eff8ff; font-variant-numeric: tabular-nums; }
.metric-value small { font-size: 11px; color: #9eb0c7; font-weight: 550; letter-spacing: 0; }
.metric-detail { color: #6f829b; font-size: 8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.metric-check { padding: 9px 10px; }
.check-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; font-size: 8px; color: #8395ac; }
.check-row b { color: #d8e5f5; font-size: 9px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check-diff b { color: var(--accent-2); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 13px; }
.preset-button { min-height: 31px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); color: #8fa1b8; font-size: 9px; font-weight: 650; cursor: pointer; transition: .18s ease; }
.preset-button.active { background: rgba(85,214,194,.11); color: #a9f8e9; border-color: rgba(85,214,194,.4); }
.control-item { margin-top: 11px; }
.control-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.control-head label { color: #b6c5d8; font-size: 10px; font-weight: 600; }
.control-head label em { margin-left: 4px; color: #637a91; font-style: normal; font-size: 6px; letter-spacing: .1em; font-weight: 800; vertical-align: 1px; }
.control-head output { color: var(--accent-2); font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 16px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, rgba(85,214,194,.52), rgba(95,123,153,.38)); border-radius: 5px; }
input[type="range"]::-moz-range-track { height: 3px; background: linear-gradient(90deg, rgba(85,214,194,.52), rgba(95,123,153,.38)); border-radius: 5px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: var(--accent); border: 2px solid #d4fff7; box-shadow: 0 0 0 3px rgba(85,214,194,.13), 0 0 12px rgba(85,214,194,.35); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid #d4fff7; box-shadow: 0 0 0 3px rgba(85,214,194,.13); }
.range-ends { display: flex; justify-content: space-between; color: #64768e; font-size: 7px; margin-top: 1px; }
.range-ends b { color: #8294aa; font-weight: 600; }
.control-last { margin-top: 10px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 12px; padding: 10px 0; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; color: #aebdd0; font-size: 9px; cursor: pointer; }
.switch { width: 27px; height: 15px; display: inline-block; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { position: absolute; inset: 0; border-radius: 20px; background: #2a394e; transition: background .2s; }
.switch i::after { content: ""; position: absolute; width: 9px; height: 9px; top: 3px; left: 3px; border-radius: 50%; background: #b5c4d7; transition: transform .2s; }
.switch input:checked + i { background: rgba(85,214,194,.5); }
.switch input:checked + i::after { transform: translateX(12px); background: #e1fff9; }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 3px; }
.quality-control { display: flex; align-items: center; gap: 4px; color: #64768e; font-size: 7px; letter-spacing: .12em; }
.quality-control button { border: 1px solid transparent; background: transparent; color: #71839a; border-radius: 5px; padding: 4px 6px; font-size: 8px; cursor: pointer; }
.quality-control button.selected { border-color: rgba(85,214,194,.28); color: #a4f2e4; background: rgba(85,214,194,.08); }
.transport-row { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 6px; margin-top: 11px; }
.transport-row .button { min-height: 34px; padding: 0 8px; font-size: 9px; }
.transport-row .button svg { width: 13px; height: 13px; }
.science-panel { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(13,20,33,.78); overflow: hidden; }
.science-panel summary { min-height: 40px; padding: 0 13px; display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; color: #c1d0e2; font-size: 10px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 19px; height: 19px; border: 1px solid rgba(85,214,194,.3); border-radius: 5px; display: grid; place-items: center; color: var(--accent); font-size: 12px; }
.summary-hint { margin-left: auto; color: #657891; font-size: 7px; letter-spacing: .12em; font-weight: 750; }
.science-content { padding: 0 13px 13px; }
.science-block { border-top: 1px solid var(--line); padding: 10px 0 7px; }
.science-block h3 { margin: 0 0 5px; color: #a8bbd1; font-size: 9px; letter-spacing: .06em; }
.science-block p { margin: 4px 0; color: #8294aa; font-size: 8px; line-height: 1.5; }
.science-block .equation { color: #d7e7f5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.disclaimer { margin: 8px 0 0; color: #71839a; font-size: 8px; line-height: 1.45; }
.bottomline { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 0 14px; color: #61738b; border-top: 1px solid var(--line); font-size: 8px; letter-spacing: .015em; white-space: nowrap; }
.bottomline i { color: #8394a9; font-style: normal; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; padding: 12px; }
  .topbar { padding: 0 18px; }
  .app-shell { grid-template-rows: 66px minmax(0, 1fr) 25px; }
  .bottomline { gap: 12px; font-size: 7px; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-rows: 58px minmax(0, 1fr) 0; min-width: 0; width: 100%; }
  .topbar { padding: 0 12px; gap: 8px; min-width: 0; width: 100%; }
  .brand-lockup { gap: 9px; flex: 1 1 auto; min-width: 0; }
  .brand-lockup > div:last-child { min-width: 0; overflow: hidden; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-mark i { width: 24px; }
  .eyebrow { font-size: 7px; margin-bottom: 3px; }
  h1 { font-size: 10px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .top-actions { gap: 0; flex: 0 0 auto; }
  .live-pill { display: none; }
  .button-quiet { min-height: 31px; padding: 0 8px; font-size: 9px; }
  .button-quiet svg { width: 13px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 42dvh) minmax(0, 1fr); gap: 9px; padding: 9px 9px 7px; min-width: 0; width: 100%; }
  .workspace > * { min-width: 0; }
  .visual-panel { grid-template-rows: minmax(0, 1fr) auto; gap: 6px; }
  .canvas-wrap { border-radius: 11px; }
  .canvas-topline { left: 11px; right: 11px; top: 10px; }
  .scene-label, .scene-scale { font-size: 7px; gap: 6px; }
  .scene-index { padding: 3px 4px; }
  .canvas-legend { left: 10px; bottom: 9px; gap: 8px; font-size: 7px; max-width: 68%; }
  .canvas-legend i { width: 9px; }
  .canvas-readout { right: 10px; bottom: 9px; }
  .readout-kicker { font-size: 6px; }
  .canvas-readout strong { font-size: 7px; }
  .canvas-readout span:last-child { font-size: 7px; max-width: 120px; }
  .visual-footer { min-height: 31px; padding: 0 2px; gap: 8px; }
  .visual-footer p { max-width: 100%; font-size: 8px; line-height: 1.3; }
  .footer-meta { display: none; }
  .control-rail { padding: 0 1px 12px; min-width: 0; }
  .metrics-section, .controls-section { padding: 11px; border-radius: 11px; }
  .section-heading { margin-bottom: 8px; font-size: 8px; }
  .metric-grid { gap: 5px; }
  .metric-card { padding: 7px 8px; }
  .metric-label { font-size: 7px; }
  .metric-value { font-size: 17px; margin-top: 3px; }
  .metric-value small { font-size: 9px; }
  .metric-detail { font-size: 7px; margin-top: 2px; }
  .check-row { font-size: 7px; margin-top: 4px; }
  .check-row b { font-size: 8px; }
  .controls-section { margin-top: 8px; }
  .preset-row { margin-bottom: 9px; }
  .preset-button { min-height: 28px; font-size: 8px; }
  .control-item { margin-top: 8px; }
  .control-head { margin-bottom: 3px; }
  .control-head label { font-size: 9px; }
  .control-head output { font-size: 8px; }
  .range-ends { font-size: 6px; }
  .toggle-row { margin-top: 8px; padding: 7px 0; }
  .switch-label { font-size: 8px; }
  .transport-row { margin-top: 8px; }
  .transport-row .button { min-height: 31px; }
  .science-panel { margin-top: 8px; }
  .science-panel summary { min-height: 36px; }
  .bottomline { display: none; }
}
@media (max-width: 390px) {
  h1 { font-size: 11px; }
  .workspace { grid-template-rows: minmax(205px, 40dvh) minmax(0, 1fr); }
  .canvas-legend { max-width: 65%; gap: 6px; }
  .canvas-legend span { gap: 4px; }
  .canvas-readout { max-width: 35%; }
  .canvas-readout span:last-child { max-width: 105px; }
  .metric-value { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
