:root {
  color-scheme: dark;
  --bg: #080c13;
  --panel: #101722;
  --panel-2: #131d2a;
  --line: #263140;
  --line-soft: rgba(130, 150, 174, .16);
  --text: #edf1f6;
  --muted: #9aa7b8;
  --dim: #657386;
  --accent: #f2b56b;
  --accent-soft: rgba(242, 181, 107, .13);
  --green: #92c6a4;
  --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 { min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, label:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 25% -20%, rgba(50, 68, 92, .18), transparent 55%), var(--bg); }
.topbar { height: 72px; flex: 0 0 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 12, 19, .94); }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(242,181,107,.55); border-radius: 50%; display: grid; place-items: center; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border: 1px solid rgba(242,181,107,.45); border-radius: 50%; transform: rotate(-28deg); width: 25px; height: 12px; }
.brand-mark::after { transform: rotate(58deg); width: 27px; height: 13px; }
.brand-mark span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(242,181,107,.7); z-index: 1; }
.eyebrow, .micro-label, .section-kicker, .readout-label, .eq-label { color: var(--dim); font-size: 9px; line-height: 1.2; font-weight: 750; letter-spacing: .16em; }
.brand-title { margin-top: 3px; font-size: 14px; font-weight: 650; letter-spacing: -.015em; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.model-tag { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; display: inline-flex; align-items: center; gap: 8px; }
.status-dot, .chip-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--green); box-shadow: 0 0 8px rgba(146,198,164,.5); }
.icon-button { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.workspace { width: 100%; max-width: 1680px; margin: 0 auto; padding: 20px 24px 24px; display: grid; grid-template-columns: minmax(0, 1fr) 378px; gap: 20px; flex: 1; min-height: 0; }
.visual-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-wrap { position: relative; min-height: 420px; height: clamp(400px, calc(100vh - 250px), 700px); flex: 1 1 auto; overflow: hidden; border: 1px solid #1f2b3b; border-radius: 16px; background: #080e18; isolation: isolate; }
#spaceCanvas { width: 100%; height: 100%; display: block; }
.stage-topline { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.stage-chip { display: inline-flex; gap: 8px; align-items: center; border: 1px solid rgba(125,145,170,.2); background: rgba(8,13,22,.72); border-radius: 20px; padding: 8px 11px; color: #c0cad7; font-size: 9px; font-weight: 700; letter-spacing: .12em; backdrop-filter: blur(8px); }
.stage-chip .chip-dot { width: 5px; height: 5px; background: var(--accent); box-shadow: 0 0 8px rgba(242,181,107,.6); }
.stage-scale { color: #68788d; font-size: 8px; letter-spacing: .12em; font-weight: 700; }
.object-label { position: absolute; color: #a8b3c1; font-size: 8px; letter-spacing: .13em; font-weight: 700; display: flex; align-items: center; gap: 7px; pointer-events: none; text-shadow: 0 2px 6px #05080e; }
.label-line { width: 20px; height: 1px; background: rgba(242,181,107,.7); }
.bh-label { left: 42%; top: 48%; transform: translate(-10%, 30px); }
.peri-label { right: 13%; top: 49%; }
.stage-bottomline { position: absolute; left: 20px; right: 20px; bottom: 82px; display: flex; align-items: end; justify-content: space-between; gap: 18px; pointer-events: none; }
.elapsed-block { min-width: 115px; padding: 10px 12px; border: 1px solid rgba(125,145,170,.19); background: rgba(8,13,22,.76); border-radius: 10px; backdrop-filter: blur(8px); }
.elapsed-block strong { display: block; margin-top: 5px; font-size: 21px; line-height: 1; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stage-caption { max-width: 390px; color: #c0cbd8; font-size: 11px; line-height: 1.55; text-align: right; padding: 10px 13px; border: 1px solid rgba(125,145,170,.15); background: rgba(8,13,22,.72); border-radius: 10px; backdrop-filter: blur(8px); }
.playback-bar { display: flex; align-items: center; min-height: 34px; }
.stage-controls { position: static; display: flex; gap: 7px; }
.control-button { height: 34px; padding: 0 12px; border: 1px solid rgba(137,154,176,.25); background: rgba(15,23,35,.9); border-radius: 8px; color: #bac5d2; font-size: 9px; font-weight: 750; letter-spacing: .1em; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.control-button:hover { border-color: rgba(242,181,107,.65); transform: translateY(-1px); }
.control-button.primary { background: var(--accent); border-color: var(--accent); color: #1a1b1d; min-width: 95px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.play-icon { font-size: 13px; line-height: 1; }
.visual-footer { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.legend { color: var(--muted); font-size: 9px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend-dot.bound { background: var(--accent); box-shadow: 0 0 8px rgba(242,181,107,.5); }
.legend-dot.returned { background: #6f7d8f; margin-left: 6px; }
.visual-actions { display: flex; align-items: center; gap: 14px; }
.switch-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; cursor: pointer; white-space: nowrap; }
.switch-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 25px; height: 14px; border-radius: 10px; background: #354154; position: relative; transition: background .2s ease; }
.switch::after { content: ""; position: absolute; width: 10px; height: 10px; left: 2px; top: 2px; border-radius: 50%; background: #a8b3c1; transition: transform .2s ease, background .2s ease; }
.switch-label input:checked + .switch { background: rgba(242,181,107,.42); }
.switch-label input:checked + .switch::after { transform: translateX(11px); background: var(--accent); }
.quality-toggle { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.quality-option { border: 0; padding: 6px 8px; background: transparent; color: var(--dim); font-size: 8px; letter-spacing: .08em; cursor: pointer; }
.quality-option.active { color: var(--accent); background: var(--accent-soft); }
.screenshot-button { border: 0; background: transparent; color: var(--muted); font-size: 8px; letter-spacing: .1em; font-weight: 750; cursor: pointer; padding: 6px 0; }
.screenshot-button span { color: var(--accent); font-size: 14px; margin-right: 4px; vertical-align: -1px; }
.what-card { display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--line-soft); border-radius: 12px; padding: 13px 15px; background: rgba(16,23,34,.68); }
.what-icon { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 14px; }
.what-card p { margin: 5px 0 0; color: #b5c0cd; font-size: 11px; line-height: 1.5; }
.control-panel { min-width: 0; border: 1px solid var(--line-soft); border-radius: 16px; background: linear-gradient(160deg, rgba(18,27,40,.98), rgba(13,20,30,.98)); padding: 18px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.panel-heading h1 { margin: 4px 0 0; font-size: 19px; font-weight: 620; letter-spacing: -.04em; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(146,198,164,.2); border-radius: 20px; padding: 5px 8px; color: #a7cbb3; font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.live-pill .status-dot { width: 5px; height: 5px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 9px; text-align: left; padding: 10px 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(9,14,22,.48); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover, .preset-button.selected { border-color: rgba(242,181,107,.55); background: var(--accent-soft); }
.preset-symbol { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(242,181,107,.1); color: var(--accent); font-size: 17px; }
.preset-button strong { display: block; font-size: 10px; font-weight: 700; color: #e0e6ed; }
.preset-button small { display: block; margin-top: 3px; color: var(--dim); font-size: 8px; }
.parameter-kicker { color: #718095; font-size: 8px; letter-spacing: .14em; font-weight: 750; margin: 0 0 10px; }
.parameter-list { display: flex; flex-direction: column; gap: 14px; }
.parameter { min-width: 0; }
.parameter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.parameter-head label { color: #c3cdd8; font-size: 10px; font-weight: 600; }
.parameter-head output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.symbol { color: var(--accent); }
input[type="range"] { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 4px; border-radius: 4px; background: #344052; cursor: pointer; margin: 0; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 2px solid #1a2532; box-shadow: 0 0 0 2px rgba(242,181,107,.18); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid #1a2532; box-shadow: 0 0 0 2px rgba(242,181,107,.18); }
.range-ends { display: flex; justify-content: space-between; color: #657387; font-size: 8px; margin-top: 6px; }
.speed-parameter { padding-top: 2px; }
.readout-section { margin-top: 19px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.section-kicker { margin-bottom: 9px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; padding: 10px 10px 9px; border: 1px solid rgba(125,145,170,.16); border-radius: 9px; background: rgba(7,12,20,.4); }
.readout-label { font-size: 8px; letter-spacing: .12em; }
.readout-card strong { display: block; margin-top: 6px; color: #f0f3f7; font-size: 18px; line-height: 1.1; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-card strong small { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: 0; }
.readout-note { display: block; margin-top: 5px; color: var(--dim); font-size: 8px; }
.independent-check { margin-top: 9px; padding: 10px; border: 1px solid rgba(146,198,164,.18); border-radius: 9px; background: rgba(34,57,48,.14); }
.check-head { display: flex; align-items: center; gap: 7px; color: #a8c6b1; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.check-mark { width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; background: rgba(146,198,164,.16); color: var(--green); font-size: 10px; }
.check-status { margin-left: auto; color: var(--green); font-size: 8px; }
.check-values { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; margin-top: 8px; color: #8291a3; font-size: 9px; }
.check-values strong { color: #dbe4eb; font-size: 9px; font-variant-numeric: tabular-nums; }
.check-diff { margin-top: 7px; color: #8291a3; font-size: 8px; }
.check-diff strong { color: var(--green); font-size: 9px; }
.check-diff span { color: #657487; }
.model-note { display: flex; gap: 8px; margin-top: 10px; padding: 9px 10px; border-radius: 8px; background: rgba(242,181,107,.07); color: #aeb9c5; font-size: 9px; line-height: 1.45; }
.note-icon { flex: 0 0 14px; width: 14px; height: 14px; display: grid; place-items: center; border: 1px solid rgba(242,181,107,.5); border-radius: 50%; color: var(--accent); font-size: 9px; font-weight: 700; }
.science-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; margin-top: 8px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; color: #d2dbe5; cursor: pointer; font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.chevron { color: var(--accent); font-size: 16px; transition: transform .2s ease; }
.science-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.science-panel { border-bottom: 1px solid var(--line-soft); }
.science-content { padding: 2px 0 13px; }
.science-content h2 { margin: 8px 0; color: #e8edf3; font-size: 13px; }
.science-content h3 { margin: 14px 0 6px; color: #e0e7ef; font-size: 11px; }
.science-content p { margin: 6px 0; color: #98a7b8; font-size: 9px; line-height: 1.6; }
.equation-block { padding: 8px 9px; margin: 6px 0; border: 1px solid rgba(125,145,170,.13); border-radius: 7px; background: rgba(7,12,20,.35); }
.eq-label { display: block; margin-bottom: 5px; font-size: 7px; }
.equation-block code { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.science-content .science-disclaimer { margin-top: 12px; color: #c0a17d; font-style: italic; }
.panel-footnote { padding-top: 10px; color: #5e6c7e; font-size: 7px; letter-spacing: .14em; text-align: center; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; padding: 16px; gap: 14px; }
  .control-panel { padding: 15px; }
  .stage-wrap { height: clamp(380px, calc(100vh - 235px), 650px); }
}
@media (max-width: 780px) {
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  body.embed-mode .workspace { min-height: 0; }
  .topbar { height: 58px; flex-basis: 58px; padding: 0 15px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-title { font-size: 12px; }
  .model-tag { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 10px 10px 14px; gap: 10px; min-height: 0; }
  .visual-column { flex: 0 0 auto; gap: 8px; }
  .stage-wrap { height: min(53vh, 480px); min-height: 290px; flex: none; border-radius: 12px; }
  .stage-topline { top: 10px; left: 10px; right: 10px; }
  .stage-chip { font-size: 7px; padding: 6px 8px; }
  .stage-scale { font-size: 6px; }
  .object-label { font-size: 6px; }
  .bh-label { left: 38%; }
  .peri-label { right: 5%; }
  .stage-bottomline { left: 10px; right: 10px; bottom: 58px; align-items: end; }
  .elapsed-block { min-width: 86px; padding: 7px 8px; }
  .elapsed-block strong { font-size: 17px; }
  .stage-caption { max-width: 60%; padding: 7px 8px; font-size: 8px; }
  .playback-bar { min-height: 31px; }
  .stage-controls { gap: 5px; }
  .control-button { height: 30px; padding: 0 9px; font-size: 8px; }
  .control-button.primary { min-width: 77px; }
  .visual-footer { min-height: 28px; flex-wrap: wrap; gap: 5px; }
  .legend { font-size: 8px; }
  .visual-actions { gap: 9px; }
  .switch-label { font-size: 8px; }
  .quality-option { padding: 5px 6px; font-size: 7px; }
  .screenshot-button { font-size: 7px; }
  .what-card { padding: 9px 10px; gap: 8px; }
  .what-icon { width: 20px; height: 20px; flex-basis: 20px; font-size: 12px; }
  .what-card p { font-size: 9px; margin-top: 3px; }
  .control-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; border-radius: 12px; padding: 14px; }
  body.embed-mode .visual-column { flex: 0 0 auto; }
  body.embed-mode .control-panel { min-height: 0; }
}
@media (max-width: 420px) {
  .topbar { padding: 0 11px; }
  .workspace { padding: 8px; }
  .stage-wrap { height: 43vh; min-height: 285px; }
  .stage-caption { max-width: 58%; font-size: 7px; }
  .elapsed-block { min-width: 78px; }
  .elapsed-block .micro-label { font-size: 7px; }
  .visual-actions { gap: 7px; }
  .legend { gap: 5px; font-size: 7px; }
  .readout-card strong { font-size: 17px; }
  .preset-button { padding: 8px 7px; gap: 6px; }
  .preset-button strong { font-size: 9px; }
  .panel-heading h1 { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Fixed iframe viewport: the visual stage and the independently scrollable panel share the frame. */
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { height: calc(100dvh - 72px); flex: 1 1 auto; min-height: 0; overflow: hidden; }
body.embed-mode .visual-column { min-height: 0; }
body.embed-mode .control-panel { height: 100%; min-height: 0; }
@media (max-width: 780px) {
  body.embed-mode .workspace { height: calc(100dvh - 58px); }
}
@media (max-width: 420px) {
  .stage-topline { display: block; }
  .stage-chip { max-width: 76%; line-height: 1.35; }
  .stage-scale { position: absolute; top: 42px; right: 0; text-align: right; max-width: 42%; }
}
@media (max-width: 780px) {
  body.embed-mode .control-panel { height: auto; }
}
