:root {
  color-scheme: dark;
  --bg: #07111d;
  --panel: #0c1a29;
  --panel-2: #102235;
  --panel-3: #132a3d;
  --line: rgba(166, 196, 219, .13);
  --line-strong: rgba(166, 196, 219, .22);
  --text: #e8f2fa;
  --muted: #91a8bb;
  --dim: #5e768a;
  --accent: #79d4f2;
  --accent-2: #b8efff;
  --accent-soft: rgba(121, 212, 242, .12);
  --amber: #e9c17d;
  --green: #84d9bf;
  --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; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { width: 100%; min-height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 0 20px 18px; background: radial-gradient(ellipse at 44% -24%, rgba(42, 94, 126, .23), transparent 47%), var(--bg); }
.topbar { height: 70px; flex: 0 0 70px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 2px; }
.brand-lockup, .topbar-actions, .stage-tools, .stage-title, .controls-heading, .slider-label-row, .readout-top, .transport-row { display: flex; align-items: center; }
.brand-lockup { gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--accent); background: linear-gradient(145deg, rgba(121,212,242,.18), rgba(121,212,242,.035)); border: 1px solid rgba(121,212,242,.2); }
.brand-mark svg { width: 30px; height: 30px; }
.brand-copy .eyebrow { margin-bottom: 3px; }
.brand-copy h1 { margin: 0; font-size: 19px; letter-spacing: -.035em; font-weight: 650; }
.eyebrow { display: block; margin: 0; color: var(--dim); font-size: 9px; font-weight: 750; letter-spacing: .15em; line-height: 1.25; }
.eyebrow span { color: #3d657d; padding: 0 3px; }
.topbar-actions { gap: 14px; }
.top-chip, .live-pill { display: inline-flex; align-items: center; gap: 7px; color: #a9c2d2; font-size: 9px; letter-spacing: .12em; font-weight: 750; border: 1px solid var(--line); background: rgba(13, 30, 46, .7); padding: 8px 10px; border-radius: 99px; white-space: nowrap; }
.status-dot, .live-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px rgba(132,217,191,.5); }
.icon-button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; background: rgba(17, 39, 57, .8); color: #c6d9e6; cursor: pointer; font-size: 11px; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.icon-button:hover { border-color: rgba(121,212,242,.55); background: rgba(28, 59, 79, .8); transform: translateY(-1px); }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; padding-top: 14px; }
.stage-card, .controls-card { min-width: 0; min-height: 0; background: linear-gradient(150deg, rgba(16, 34, 51, .97), rgba(9, 24, 38, .98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 14px 36px rgba(0,0,0,.16); }
.stage-card { display: grid; grid-template-rows: 48px minmax(0, 1fr) auto auto; overflow: hidden; }
.stage-header { min-width: 0; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid rgba(166,196,219,.08); }
.stage-title { gap: 9px; min-width: 0; }
.stage-title .eyebrow { font-size: 8px; color: var(--accent); white-space: nowrap; }
.stage-title strong { font-size: 12px; font-weight: 580; color: #c8d9e5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-tools { gap: 7px; }
.small-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: rgba(5,17,28,.38); color: #9db3c4; padding: 6px 8px; border-radius: 7px; font-size: 9px; cursor: pointer; white-space: nowrap; transition: .18s ease; }
.small-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.small-toggle.is-active { color: var(--accent-2); border-color: rgba(121,212,242,.28); background: rgba(121,212,242,.075); }
.toggle-glyph { font-size: 13px; line-height: 9px; }
.quality-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.canvas-wrap { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 40% 48%, rgba(20, 56, 78, .15), transparent 55%), #071421; }
#sceneCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-corner { position: absolute; z-index: 2; bottom: 9px; pointer-events: none; color: rgba(142,170,190,.58); font-size: 8px; font-weight: 700; letter-spacing: .13em; text-shadow: 0 1px 4px #06111c; }
.canvas-corner-left { left: 13px; display: flex; align-items: center; gap: 7px; }
.canvas-corner-right { right: 13px; }
.corner-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px rgba(121,212,242,.7); }
.corner-divider { color: #476175; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; padding: 10px 12px 8px; border-top: 1px solid rgba(166,196,219,.08); }
.readout-card { min-width: 0; border: 1px solid rgba(166,196,219,.1); border-radius: 9px; background: rgba(4, 17, 29, .43); padding: 8px 10px 7px; }
.readout-top { justify-content: space-between; gap: 5px; color: #829bad; font-size: 8px; font-weight: 750; letter-spacing: .095em; white-space: nowrap; }
.value-tag { color: #6f9aaf; font-size: 7px; letter-spacing: .08em; font-weight: 750; }
.readout-card strong { display: block; margin-top: 5px; font-size: clamp(16px, 1.65vw, 21px); letter-spacing: -.045em; font-weight: 650; font-variant-numeric: tabular-nums; color: #e7f4fb; white-space: nowrap; }
.readout-card small { display: block; margin-top: 3px; color: #70899d; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accent-readout strong { color: var(--accent-2); }
.caption-bar { display: flex; align-items: center; gap: 9px; padding: 8px 14px 10px; border-top: 1px solid rgba(166,196,219,.07); color: #b0c5d3; }
.caption-icon { color: var(--accent); font-size: 13px; }
.caption-bar p { margin: 0; font-size: 10px; line-height: 1.4; }
.controls-card { padding: 15px 15px 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #29475b transparent; }
.controls-heading { justify-content: space-between; margin-bottom: 13px; }
.controls-heading h2 { margin: 3px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 630; }
.live-pill { padding: 6px 8px; font-size: 8px; color: #8fcab9; }
.preset-block { margin-bottom: 13px; }
.section-label { display: block; margin-bottom: 7px; color: #728b9f; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: rgba(5,17,28,.45); color: #91aabd; font-size: 9px; line-height: 1.2; padding: 6px 7px; cursor: pointer; transition: .18s ease; }
.preset-button:hover { color: var(--text); border-color: var(--line-strong); }
.preset-button.is-selected { border-color: rgba(121,212,242,.42); background: rgba(121,212,242,.10); color: #d1f3ff; box-shadow: inset 0 0 0 1px rgba(121,212,242,.04); }
.slider-stack { display: flex; flex-direction: column; gap: 10px; }
.slider-field { min-width: 0; }
.slider-label-row { justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.slider-label-row label { color: #c6d7e2; font-size: 10px; font-weight: 570; }
.slider-label-row output { color: var(--accent-2); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(121,212,242,.8), rgba(121,212,242,.25)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(121,212,242,.8), rgba(121,212,242,.25)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; border: 2px solid #d6f5ff; background: #4caacb; box-shadow: 0 0 0 3px rgba(121,212,242,.12), 0 0 10px rgba(121,212,242,.28); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #d6f5ff; background: #4caacb; box-shadow: 0 0 0 3px rgba(121,212,242,.12), 0 0 10px rgba(121,212,242,.28); }
.slider-note { display: flex; justify-content: space-between; gap: 6px; margin-top: 1px; color: #607b8f; font-size: 7px; font-weight: 750; letter-spacing: .075em; white-space: nowrap; }
.slider-note span:first-child { color: #739eb1; }
.time-slider-field { padding-top: 1px; }
.transport-row { gap: 6px; margin-top: 14px; }
.transport-button { min-height: 34px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgba(17,39,57,.65); color: #aec3d1; font-size: 9px; cursor: pointer; white-space: nowrap; transition: .18s ease; }
.transport-button:hover { color: #e9f7ff; border-color: rgba(121,212,242,.42); background: rgba(28,59,79,.65); }
.primary-transport { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 83px; color: #d8f6ff; border-color: rgba(121,212,242,.35); background: rgba(67,145,174,.17); }
.pause-icon { font-size: 11px; letter-spacing: -2px; }
.reset-button { margin-left: auto; }

.value-legend { display: flex; flex-wrap: wrap; gap: 5px 9px; margin: -4px 0 12px; padding: 7px 8px; border: 1px solid rgba(166,196,219,.08); border-radius: 7px; background: rgba(4,17,29,.32); color: #71899b; font-size: 7px; line-height: 1.25; }
.value-legend b { color: #9dc5d5; font-size: 7px; letter-spacing: .045em; }
.quick-check { margin-top: 11px; padding: 8px 9px; border: 1px solid rgba(132,217,191,.18); border-radius: 8px; background: rgba(64,137,119,.065); }
.quick-check-heading { display: flex; justify-content: space-between; gap: 6px; color: #7fa99e; font-size: 7px; font-weight: 800; letter-spacing: .09em; }
.quick-check strong { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; color: #d7eee8; font-size: 13px; font-variant-numeric: tabular-nums; }
.quick-check strong i { color: #73968e; font-size: 8px; font-style: normal; font-weight: 500; }
.quick-check small { display: block; margin-top: 2px; color: #75968d; font-size: 7px; }

.science-panel { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.science-panel summary { list-style: none; display: flex; align-items: center; gap: 8px; color: #d1e1eb; font-size: 10px; font-weight: 650; cursor: pointer; user-select: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); font-size: 12px; }
.summary-hint { margin-left: auto; color: #607b8f; font-size: 7px; font-weight: 750; letter-spacing: .09em; }
.science-panel[open] .summary-hint { display: none; }
.science-content { padding: 12px 1px 2px; color: #91a8b9; font-size: 9px; line-height: 1.5; }
.science-content h3 { margin: 12px 0 6px; color: #cfe0eb; font-size: 10px; font-weight: 700; }
.science-content h3:first-child { margin-top: 0; }
.science-content p { margin: 5px 0; }
.equation { padding: 6px 8px; border: 1px solid rgba(166,196,219,.09); border-radius: 6px; background: rgba(3,14,24,.38); color: #c1e8f5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; }
.check-card { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 7px 0; }
.check-card > div { padding: 7px; border-radius: 7px; background: rgba(4,17,29,.55); border: 1px solid rgba(166,196,219,.09); }
.check-card span { display: block; color: #6f8b9f; font-size: 7px; letter-spacing: .08em; font-weight: 750; }
.check-card strong { display: block; margin-top: 3px; color: #d5edf7; font-size: 12px; font-variant-numeric: tabular-nums; }
.check-card .check-diff { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.check-card .check-diff strong { color: var(--green); }
.check-note { color: #71899b; font-size: 8px; }
.constant-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 5px; }
.constant-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; align-items: center; padding-bottom: 4px; border-bottom: 1px solid rgba(166,196,219,.07); }
.constant-list li span { color: #8ca5b7; }
.constant-list li b { color: #d4e4ed; font-size: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.constant-list li em { color: #709bad; font-size: 7px; font-style: normal; font-weight: 750; letter-spacing: .06em; }
.model-disclaimer { margin-top: 10px; padding: 8px; border-left: 2px solid rgba(121,212,242,.42); background: rgba(121,212,242,.055); color: #9ab7c7; font-size: 8px; }
@media (max-width: 920px) {
  .app-shell { padding: 0 12px 12px; }
  .workspace { grid-template-columns: minmax(0,1fr) 318px; gap: 10px; }
  .controls-card { padding: 13px 12px 10px; }
  .stage-header { padding: 0 12px; }
  .readout-grid { gap: 6px; padding: 8px; }
  .readout-card { padding: 7px; }
  .readout-top { font-size: 7px; }
  .value-tag { font-size: 6px; }
}
@media (max-width: 720px) {
  .app-shell { padding: 0 8px 8px; }
  .topbar { height: 58px; flex-basis: 58px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark svg { width: 25px; height: 25px; }
  .brand-lockup { gap: 8px; }
  .brand-copy h1 { font-size: 16px; }
  .brand-copy .eyebrow { font-size: 7px; }
  .topbar-actions { gap: 6px; }
  .top-chip { display: none; }
  .icon-button { padding: 7px 8px; font-size: 9px; }
  .icon-button svg { width: 14px; height: 14px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(265px, 45dvh) minmax(0,1fr); gap: 8px; padding-top: 8px; }
  .stage-card { grid-template-rows: 40px minmax(0,1fr) auto auto; border-radius: 11px; }
  .stage-header { padding: 0 9px; }
  .stage-title { gap: 6px; }
  .stage-title .eyebrow { font-size: 7px; }
  .stage-title strong { font-size: 10px; }
  .stage-tools { gap: 4px; }
  .small-toggle { padding: 5px 6px; font-size: 8px; }
  .quality-toggle { font-size: 0; gap: 0; width: 25px; height: 25px; justify-content: center; }
  .quality-dot { width: 7px; height: 7px; }
  .canvas-corner { font-size: 6px; bottom: 5px; }
  .canvas-corner-left { left: 8px; gap: 4px; }
  .canvas-corner-right { right: 8px; }
  .readout-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 4px; padding: 6px; }
  .readout-card { padding: 5px 5px 4px; border-radius: 7px; }
  .readout-top { display: block; font-size: 6px; letter-spacing: .045em; white-space: normal; line-height: 1.2; min-height: 17px; }
  .value-tag { display: block; font-size: 5px; letter-spacing: .015em; margin-top: 1px; }
  .readout-card strong { margin-top: 4px; font-size: clamp(12px, 3.6vw, 15px); }
  .readout-card small { font-size: 7px; margin-top: 2px; }
  .caption-bar { padding: 6px 9px 7px; gap: 6px; }
  .caption-icon { font-size: 10px; }
  .caption-bar p { font-size: 8px; line-height: 1.25; }
  .controls-card { border-radius: 11px; padding: 11px 12px 12px; }
  .controls-heading { margin-bottom: 9px; }
  .controls-heading h2 { font-size: 15px; }
  .preset-block { margin-bottom: 9px; }
  .value-legend { margin: -2px 0 8px; padding: 6px; gap: 4px 7px; font-size: 6px; }
  .value-legend b { font-size: 6px; }
  .quick-check { margin-top: 8px; padding: 7px 8px; }
  .quick-check strong { font-size: 12px; }
  .section-label { margin-bottom: 5px; }
  .preset-button { min-height: 31px; font-size: 8px; }
  .slider-stack { gap: 8px; }
  .slider-label-row { margin-bottom: 3px; }
  .slider-label-row label, .slider-label-row output { font-size: 9px; }
  .slider-note { font-size: 6px; }
  .transport-row { margin-top: 10px; }
  .transport-button { min-height: 31px; font-size: 8px; }
  .science-panel { margin-top: 10px; padding-top: 8px; }
}
@media (max-width: 420px) {
  .workspace { grid-template-rows: minmax(250px, 43dvh) minmax(0,1fr); }
  .stage-title strong { max-width: 132px; }
  .small-toggle { font-size: 7px; }
  .quality-toggle { font-size: 0; }
  .readout-card small { font-size: 6px; }
  .slider-note { letter-spacing: .025em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
