:root {
  color-scheme: dark;
  --bg: #0b1014;
  --panel: #11191e;
  --panel-raised: #172127;
  --panel-soft: #0e1519;
  --line: #26343b;
  --line-soft: #1d2a30;
  --text: #e8eeed;
  --muted: #9aa9a9;
  --subtle: #6f8082;
  --accent: #56d6c2;
  --accent-dim: rgba(86, 214, 194, .13);
  --warning: #d6b38a;
  --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; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 13px; line-height: 1.45; }
button, input { font: inherit; }
button { color: inherit; }
.app { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; }
.topbar { min-height: 76px; padding: 13px 22px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #0d1317; }
.brand-lockup { min-width: 0; display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(86,214,194,.55); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; flex: 0 0 auto; background: var(--accent-dim); }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 9px; opacity: .7; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .85; }
.brand-copy { min-width: 0; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; margin-bottom: 3px; }
.eyebrow span { color: var(--subtle); padding: 0 4px; }
h1 { font-size: clamp(15px, 1.55vw, 19px); line-height: 1.2; letter-spacing: -.025em; margin: 0; font-weight: 650; }
.top-meta { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .11em; white-space: nowrap; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 10px rgba(86,214,194,.45); }
.meta-divider { color: var(--subtle); padding: 0 7px; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 16px; padding: 16px 18px 10px; }
.stage-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(260px, 1fr) auto auto auto; gap: 9px; }
.stage { min-width: 0; min-height: 0; position: relative; overflow: hidden; border: 1px solid #25343a; border-radius: 16px; background: #0c1318; box-shadow: 0 18px 48px rgba(0,0,0,.18); }
#scene { display: block; width: 100%; height: 100%; }
.caption { min-height: 58px; display: flex; gap: 12px; align-items: center; padding: 9px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: #10181d; }
.caption-mark { width: 3px; min-height: 34px; border-radius: 3px; background: var(--accent); flex: 0 0 auto; }
.caption-label { color: var(--accent); font-size: 8px; letter-spacing: .15em; font-weight: 800; margin-bottom: 2px; }
.caption p { margin: 0; color: #c2cecd; font-size: 11px; line-height: 1.42; }
.transport-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.transport-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.control-button, .experiment-button { border: 1px solid #2a3a41; border-radius: 8px; background: #141e23; color: #bdc9c8; min-height: 31px; padding: 6px 10px; cursor: pointer; font-size: 10px; font-weight: 700; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.control-button:hover, .experiment-button:hover { border-color: var(--accent); color: var(--text); }
.control-button.primary { border-color: rgba(86,214,194,.48); background: var(--accent-dim); color: var(--accent); }
.button-icon { font-size: 11px; padding-right: 5px; }
.quality-button { color: var(--muted); }
.experiment-button { color: var(--accent); border-color: rgba(86,214,194,.38); background: rgba(86,214,194,.08); }
.experiment-button span { font-size: 14px; padding-right: 4px; }
.experiment-result { min-height: 27px; color: #94a3a2; font-size: 9px; letter-spacing: .045em; padding: 5px 3px 0; }
.experiment-result span { color: var(--accent); padding: 0 4px; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 2px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: #33434a transparent; }
.panel-section, .science-panel { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); padding: 12px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #c4d0cf; font-size: 9px; font-weight: 800; letter-spacing: .13em; margin-bottom: 10px; }
.section-tag { color: var(--subtle); font-size: 8px; letter-spacing: .08em; white-space: nowrap; }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.readout-card { min-width: 0; border: 1px solid #26343a; background: #0e161b; border-radius: 9px; padding: 9px 10px 8px; }
.readout-name { color: #819291; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.readout-value { margin-top: 3px; color: #f0f4f2; font-size: 22px; line-height: 1.15; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: var(--accent); font-size: 10px; letter-spacing: 0; font-weight: 700; }
.readout-note { color: #758583; font-size: 8px; margin-top: 3px; }
.status-line { display: flex; align-items: center; gap: 7px; min-height: 23px; margin-top: 7px; color: #9dacab; font-size: 9px; }
.status-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(86,214,194,.45); }
.status-line.caution .status-indicator { background: var(--warning); box-shadow: none; }
.status-line.caution { color: var(--warning); }
.status-mach { margin-left: auto; color: #758583; font-variant-numeric: tabular-nums; }
.slider-list { display: flex; flex-direction: column; gap: 11px; }
.slider-control { display: block; min-width: 0; cursor: default; }
.slider-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: #c8d2d0; font-size: 10px; }
.slider-heading output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 14px; display: block; margin: 4px 0 0; background: transparent; accent-color: var(--accent); cursor: ew-resize; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: #33434a; border-radius: 3px; }
input[type="range"]::-moz-range-track { height: 3px; background: #33434a; border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #10201f; margin-top: -4.5px; box-shadow: 0 0 0 2px rgba(86,214,194,.16); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid #10201f; box-shadow: 0 0 0 2px rgba(86,214,194,.16); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.range-labels { display: flex; justify-content: space-between; color: #6f7f80; font-size: 8px; margin-top: -2px; }
.preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.preset-button { min-height: 31px; border: 1px solid #2b3a40; border-radius: 7px; background: #0f171b; color: #aebcba; cursor: pointer; text-align: left; padding: 6px 9px; font-size: 9px; font-weight: 700; }
.preset-button:hover { border-color: #728381; color: var(--text); }
.preset-button.active { border-color: rgba(86,214,194,.55); background: var(--accent-dim); color: var(--accent); }
.preset-button.caution-preset { color: #c5ad92; }
.preset-button.caution-preset.active { border-color: #b99a76; background: rgba(185,154,118,.12); color: #e1c4a1; }
.check-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #202d32; color: #aab8b6; font-size: 9px; }
.check-row:last-of-type { border-bottom: 0; }
.check-row b { display: inline-block; color: #647775; font-size: 8px; margin-right: 6px; }
.check-row strong { flex: 0 0 auto; color: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; }
.check-footnote { margin: 7px 0 0; color: #758583; font-size: 8px; line-height: 1.45; }
.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 13px 12px; color: #c4d0cf; font-size: 9px; font-weight: 800; letter-spacing: .13em; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-plus { color: var(--accent); font-size: 15px; font-weight: 400; transition: transform .15s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { border-top: 1px solid var(--line-soft); padding: 12px; color: #9cacab; font-size: 10px; line-height: 1.55; }
.science-content h2 { margin: 0 0 6px; color: #e1e9e7; font-size: 13px; font-weight: 650; }
.science-content h3 { margin: 13px 0 5px; color: #d2dcda; font-size: 10px; }
.science-content p { margin: 6px 0; }
.science-content b { color: #d9e2e0; }
.science-content ul { padding-left: 17px; margin: 5px 0 9px; }
.science-content li { margin: 4px 0; }
.equation { padding: 8px 9px; margin: 8px 0; background: #0c1418; border: 1px solid #233239; border-radius: 7px; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.equation sub { font-size: 8px; }
.model-note { padding-left: 8px; border-left: 2px solid #927e68; color: #c0aa8d; }
.source-note { color: #778886; font-size: 9px; }
.page-foot { min-height: 24px; padding: 4px 22px 8px; display: flex; justify-content: space-between; gap: 12px; color: #596a6b; font-size: 8px; font-weight: 700; letter-spacing: .11em; }
.foot-dot { color: var(--accent); padding: 0 4px; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app { height: 100%; min-height: 0; }
body.embed-mode .topbar, body.embed-mode .page-foot { display: none; }
body.embed-mode .workspace { height: 100%; min-height: 0; padding: 12px; grid-template-columns: minmax(0, 1fr) 360px; }

@media (max-width: 900px) {
  .top-meta { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; padding: 12px; }
  .panel-section { padding: 10px; }
  .readout-value { font-size: 20px; }
}
@media (max-width: 720px) {
  .app { height: auto; min-height: 100vh; min-height: 100dvh; }
  .topbar { min-height: 62px; padding: 10px 13px; }
  .brand-mark { width: 29px; height: 29px; }
  .workspace { display: block; padding: 10px; }
  .stage-column { grid-template-rows: minmax(270px, 42vh) auto auto auto; gap: 8px; }
  .control-panel { margin-top: 11px; overflow: visible; }
  .panel-section { padding: 12px; }
  .slider-list { gap: 13px; }
  .page-foot { padding: 7px 13px 12px; font-size: 7px; }
  body.embed-mode .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 42dvh minmax(0, 1fr); gap: 8px; padding: 8px; overflow: hidden; }
  body.embed-mode .stage-column { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr) auto auto auto; gap: 5px; }
  body.embed-mode .stage { min-height: 0; }
  body.embed-mode .caption { min-height: 40px; padding: 5px 8px; }
  body.embed-mode .caption-mark { min-height: 24px; }
  body.embed-mode .caption-label { font-size: 7px; }
  body.embed-mode .caption p { font-size: 9px; line-height: 1.25; }
  body.embed-mode .transport-row { gap: 5px; }
  body.embed-mode .transport-controls { gap: 4px; }
  body.embed-mode .control-button, body.embed-mode .experiment-button { min-height: 26px; padding: 4px 7px; font-size: 8px; }
  body.embed-mode .experiment-result { min-height: 20px; font-size: 7px; padding-top: 1px; }
  body.embed-mode .control-panel { height: 100%; min-height: 0; margin: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 12px; }
}
@media (max-width: 420px) {
  h1 { font-size: 14px; }
  .eyebrow { font-size: 8px; }
  .stage-column { grid-template-rows: minmax(265px, 40vh) auto auto auto; }
  .readout-value { font-size: 21px; }
  .caption { align-items: flex-start; }
  .caption p { font-size: 10px; }
  .transport-row { align-items: flex-start; }
  .transport-controls { gap: 4px; }
  .control-button, .experiment-button { padding: 6px 8px; font-size: 9px; }
  body.embed-mode .workspace { grid-template-rows: 42dvh minmax(0, 1fr); }
  body.embed-mode .transport-controls { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
