:root {
  color-scheme: dark;
  --bg: #0d1416;
  --panel: #151f22;
  --panel-2: #192528;
  --panel-3: #101a1d;
  --line: #2b3a3d;
  --line-soft: rgba(169, 190, 190, .12);
  --text: #e9efeb;
  --muted: #a1b0ad;
  --quiet: #738581;
  --accent: #d7a85b;
  --accent-strong: #efc77d;
  --accent-dim: rgba(215,168,91,.14);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line-soft); background: #10191b; }
.wordmark { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 800; letter-spacing: .16em; color: #e8efea; }
.mark { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(215,168,91,.65); color: var(--accent-strong); border-radius: 7px; font-size: 13px; letter-spacing: 0; }
.wordmark-sub { color: var(--quiet); font-size: 9px; font-weight: 700; letter-spacing: .18em; padding-left: 9px; border-left: 1px solid var(--line); }
.topbar-meta { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.meta-dot { display: inline-block; width: 4px; height: 4px; margin: 0 8px 2px; border-radius: 50%; background: var(--accent); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 390px); gap: 16px; padding: 16px; align-items: start; max-width: 1800px; margin: 0 auto; }
.stage-card { min-width: 0; height: calc(100dvh - 94px); min-height: 570px; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, #172326, #111a1c 72%); overflow: hidden; }
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 0 2px 16px; }
.eyebrow { color: var(--accent); font-size: 9px; line-height: 1.3; font-weight: 800; letter-spacing: .16em; }
.eyebrow span { color: var(--quiet); padding: 0 5px; }
h1 { margin: 7px 0 0; font-size: clamp(25px, 3vw, 38px); line-height: 1.04; font-weight: 650; letter-spacing: -.04em; }
.stage-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.live-state { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; margin-top: 7px; padding: 7px 10px; border: 1px solid rgba(215,168,91,.24); border-radius: 99px; background: rgba(215,168,91,.07); color: var(--accent-strong); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(215,168,91,.55); }
.canvas-host { position: relative; flex: 1 1 auto; min-height: 300px; overflow: hidden; border: 1px solid rgba(167,190,186,.12); border-radius: 10px; background: #101a1d; }
#scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.canvas-topline, .canvas-bottomline { position: absolute; z-index: 1; left: 14px; right: 14px; display: flex; align-items: center; justify-content: space-between; color: #82928e; font-size: 8px; font-weight: 800; letter-spacing: .15em; pointer-events: none; }
.canvas-topline { top: 12px; }
.canvas-bottomline { bottom: 11px; }
.canvas-topline i { color: var(--accent); font-style: normal; padding: 0 5px; }
.canvas-topline small { color: #657571; font-size: 7px; letter-spacing: .12em; margin-left: 5px; }
.canvas-bottomline b { color: #b3bfba; font-size: 8px; font-weight: 700; }
.caption-row { display: grid; grid-template-columns: 132px 1fr; align-items: start; gap: 12px; min-height: 52px; padding: 13px 2px 0; }
.caption-mark { padding-top: 2px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .15em; }
.caption-row p { margin: 0; color: #b7c3be; font-size: 12px; line-height: 1.5; }
.control-rail { display: flex; flex-direction: column; gap: 12px; height: calc(100dvh - 94px); min-height: 570px; overflow-y: auto; padding: 0 2px 6px 0; scrollbar-width: thin; scrollbar-color: #405052 transparent; }
.rail-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 15px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.section-heading h2 { margin: 4px 0 0; font-size: 16px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; }
.section-heading.compact { margin-bottom: 12px; }
.tag { flex: 0 0 auto; padding: 4px 7px; border: 1px solid rgba(215,168,91,.25); border-radius: 5px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.control { min-width: 0; display: block; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; color: #dce5df; font-size: 11px; font-weight: 650; }
.control output, .speed-control output { color: var(--accent-strong); font-variant-numeric: tabular-nums; font-size: 10px; white-space: nowrap; }
.control input[type="range"], .speed-control input[type="range"] { width: 100%; display: block; margin: 8px 0 5px; accent-color: var(--accent); cursor: ew-resize; }
input[type="range"] { height: 4px; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: #354548; }
input[type="range"]::-webkit-slider-thumb { margin-top: -5px; width: 14px; height: 14px; border: 2px solid #192326; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(215,168,91,.45); -webkit-appearance: none; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: #354548; }
input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border: 2px solid #192326; border-radius: 50%; background: var(--accent); }
.control-hint { display: block; color: var(--quiet); font-size: 9px; line-height: 1.25; }
.preset-block { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.mini-heading { display: flex; justify-content: space-between; margin-bottom: 9px; color: #d3ddd7; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.mini-heading span { color: var(--quiet); font-size: 8px; font-weight: 600; letter-spacing: .1em; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset { min-height: 34px; padding: 7px 9px; border: 1px solid #344448; border-radius: 7px; background: #172225; color: #b9c5bf; text-align: left; font-size: 10px; font-weight: 650; transition: border-color .15s, background .15s, color .15s; }
.preset:hover, .preset.active { border-color: rgba(215,168,91,.72); background: var(--accent-dim); color: var(--accent-strong); }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readout { min-height: 74px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-3); }
.readout span { display: block; color: var(--muted); font-size: 9px; }
.readout strong { display: block; margin-top: 4px; color: #edf1eb; font-size: 22px; line-height: 1.05; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout strong small { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; }
.readout em { display: block; margin-top: 5px; color: var(--quiet); font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .12em; }
.transport-row { display: grid; grid-template-columns: 1.1fr 1fr .75fr; gap: 7px; margin-top: 11px; }
.transport-row button { min-height: 36px; border-radius: 7px; font-size: 10px; font-weight: 700; }
.primary-btn { border: 1px solid var(--accent); background: var(--accent); color: #172022; }
.primary-btn:hover { background: var(--accent-strong); }
.btn-icon { padding-right: 5px; font-size: 10px; }
.utility-btn { border: 1px solid #35464a; background: #192629; color: #c8d1cb; }
.utility-btn:hover { border-color: #657a78; color: #fff; }
.quality-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--quiet); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.quality-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border: 1px solid #435356; border-radius: 5px; background: #192629; color: #d4ded7; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.quality-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.quality-note { margin-left: auto; color: #6e807b; font-size: 8px; font-weight: 500; letter-spacing: 0; }
.speed-control { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; margin-top: 9px; color: #c5d0ca; font-size: 10px; }
.speed-control input { grid-column: 1 / -1; margin: 7px 0 0 !important; }
.experiment-card p { margin: -3px 0 12px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.experiment-card p b { color: #e4eae3; font-weight: 700; }
.experiment-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 10px 11px; border: 1px solid rgba(215,168,91,.55); border-radius: 7px; background: rgba(215,168,91,.1); color: var(--accent-strong); font-size: 10px; font-weight: 750; }
.experiment-btn:hover { background: rgba(215,168,91,.17); }
.experiment-btn span { font-size: 15px; }
.experiment-result { margin-top: 10px; padding: 9px 10px; border-left: 2px solid var(--accent); background: #111b1e; color: #aebbb5; font-size: 9px; line-height: 1.5; min-height: 38px; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.check-row:first-of-type { border-top: 0; }
.check-row div { min-width: 0; }
.check-row b { display: block; color: #dce5df; font-size: 10px; font-weight: 650; }
.check-row span { display: block; margin-top: 2px; color: var(--quiet); font-size: 8px; }
.check-row strong { flex: 0 0 auto; color: var(--accent-strong); font-size: 11px; font-variant-numeric: tabular-nums; }
.check-foot { margin: 7px 0 0; color: var(--quiet); font-size: 8px; line-height: 1.45; }
.science-card { padding: 0; overflow: hidden; }
.science-card summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px; list-style: none; cursor: pointer; }
.science-card summary::-webkit-details-marker { display: none; }
.science-card summary b { display: block; margin-top: 3px; color: #e5ece5; font-size: 14px; font-weight: 650; }
.chevron { color: var(--accent); font-size: 18px; transition: transform .2s; }
.science-card[open] .chevron { transform: rotate(45deg); }
.science-content { padding: 0 15px 15px; border-top: 1px solid var(--line-soft); }
.science-content h3 { margin: 14px 0 5px; color: #dce5df; font-size: 11px; }
.science-content p { margin: 5px 0 8px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.equation { margin: 7px 0; padding: 9px; border: 1px solid var(--line-soft); border-radius: 6px; background: #101a1d; color: var(--accent-strong); font-family: Georgia, "Times New Roman", serif; font-size: 12px; text-align: center; }
.rail-footnote { padding: 0 4px 4px; color: #6d7d78; font-size: 8px; font-weight: 700; letter-spacing: .12em; text-align: center; }
.rail-footnote span { color: var(--accent); padding: 0 4px; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .topbar { display: none; }
body.embed-mode .layout { height: 100vh; height: 100dvh; min-height: 0; padding: 12px; }
body.embed-mode .stage-card, body.embed-mode .control-rail { height: calc(100dvh - 24px); min-height: 0; }

@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; padding: 12px; }
  .stage-card { padding: 14px; }
  .control-rail { gap: 10px; }
  .rail-card { padding: 12px; }
  .control-grid { gap: 12px 10px; }
}
@media (max-width: 720px) {
  .topbar { height: 54px; padding: 0 14px; }
  .topbar-meta { font-size: 8px; }
  .layout { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
  .stage-card { width: 100%; height: auto; min-height: 0; padding: 12px; }
  .stage-head { padding-bottom: 12px; }
  h1 { font-size: 28px; }
  .stage-subtitle { font-size: 12px; }
  .live-state { padding: 6px 8px; font-size: 8px; }
  .canvas-host { width: 100%; height: 360px; min-height: 320px; flex: 0 0 auto; }
  .caption-row { grid-template-columns: 1fr; gap: 5px; min-height: 0; padding-top: 10px; }
  .control-rail { width: 100%; height: auto; min-height: 0; overflow: visible; padding: 0 0 6px; }
  .rail-card { padding: 14px; }
  body.embed-mode .layout { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(330px, 48dvh) minmax(0,1fr); gap: 10px; height: 100dvh; overflow: hidden; padding: 10px; }
  body.embed-mode .stage-card { height: 100%; min-height: 0; padding: 10px; }
  body.embed-mode .stage-head { padding-bottom: 8px; }
  body.embed-mode h1 { font-size: 23px; }
  body.embed-mode .stage-subtitle { font-size: 10px; }
  body.embed-mode .canvas-host { min-height: 0; height: auto; flex: 1 1 auto; }
  body.embed-mode .caption-row { display: none; }
  body.embed-mode .control-rail { height: 100%; min-height: 0; overflow-y: auto; padding-right: 2px; }
}
@media (max-width: 390px) {
  .wordmark { gap: 7px; font-size: 10px; }
  .wordmark-sub { font-size: 8px; padding-left: 6px; }
  .topbar-meta { letter-spacing: .1em; }
  .stage-card { padding: 10px; }
  .canvas-host { height: 340px; }
  .control-grid { gap: 12px 9px; }
  .control-top { font-size: 10px; }
  .control output { font-size: 9px; }
  .readout strong { font-size: 20px; }
  body.embed-mode .layout { grid-template-rows: minmax(320px, 50dvh) minmax(0,1fr); }
}
