:root {
  color-scheme: dark;
  --bg: #0b1118;
  --panel: #101923;
  --panel-2: #131f2b;
  --line: #263441;
  --line-soft: rgba(131, 158, 179, .15);
  --text: #e8eef1;
  --muted: #8fa1ad;
  --faint: #60717d;
  --accent: #7ce0d3;
  --accent-dim: rgba(124, 224, 211, .12);
  --accent-line: rgba(124, 224, 211, .38);
  --danger: #d9a16d;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 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); font-family: var(--sans); }
body { overflow: auto; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 38% 0%, rgba(41, 72, 87, .17), transparent 48%), var(--bg); }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.topbar { height: 70px; flex: 0 0 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 25px; border-bottom: 1px solid var(--line); background: rgba(10, 16, 23, .94); }
.brand-lockup, .topbar-right, .brand-copy, .status-pill, .icon-button, .stage-toolbar, .stage-meta, .stage-footer, .caption-copy, .bottom-left, .section-heading, .control-head, .check-head, .check-main, .check-detail, .playback-row, .quality-row, .time-rate-row { display: flex; align-items: center; }
.brand-lockup { gap: 13px; min-width: 0; }
.brand-mark { width: 29px; height: 29px; border: 1px solid var(--accent-line); border-radius: 8px; position: relative; transform: rotate(45deg); display: grid; place-items: center; }
.brand-mark span { position: absolute; width: 13px; height: 1px; background: var(--accent); opacity: .9; }
.brand-mark span:nth-child(2) { transform: rotate(60deg); }
.brand-mark span:nth-child(3) { transform: rotate(120deg); }
.brand-copy { display: block; }
.eyebrow, .section-heading, .caption-heading, .metric-label, .metric-foot, .corner-kicker, .canvas-corner, .stage-meta, .quality-label, .time-rate-row, .science-kicker, .check-head, .bottom-left, .science-toggle, .label-legend { font-family: var(--mono); letter-spacing: .1em; }
.eyebrow { color: var(--accent); font-size: 9px; line-height: 1.3; margin-bottom: 3px; }
h1 { margin: 0; font-size: 15px; line-height: 1.15; font-weight: 650; letter-spacing: .105em; }
h1 span { color: #9aabb5; font-weight: 450; }
.topbar-right { gap: 17px; }
.status-pill { gap: 7px; color: #9aabb5; font: 10px var(--mono); letter-spacing: .1em; }
.status-dot, .live-line, .footer-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); display: inline-block; }
.status-dot.running { background: var(--accent); box-shadow: 0 0 10px rgba(124,224,211,.6); }
.icon-button { height: 34px; gap: 8px; border: 1px solid var(--line); border-radius: 5px; padding: 0 11px; background: #121d27; color: #cbd6dc; font-size: 11px; cursor: pointer; transition: border-color .2s, background .2s; }
.icon-button:hover { border-color: var(--accent-line); background: #172630; }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 358px; gap: 0; }
.stage-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.stage-toolbar { height: 48px; flex: 0 0 48px; padding: 0 22px; justify-content: space-between; border-bottom: 1px solid var(--line-soft); background: rgba(16, 25, 35, .54); }
.view-switch { display: flex; align-items: center; gap: 4px; }
.view-button { border: 1px solid transparent; border-radius: 3px; background: transparent; padding: 7px 9px; color: #7f929e; font: 9px var(--mono); letter-spacing: .09em; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.view-button:hover { color: var(--text); }
.view-button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-dim); }
.stage-meta { gap: 8px; font-size: 9px; color: #c3d0d7; }
.meta-label { color: var(--faint); }
.canvas-wrap { flex: 1 1 auto; min-height: 230px; position: relative; overflow: hidden; background: #0b141d; }
#scene { display: block; width: 100%; height: 100%; }
.canvas-corner { position: absolute; bottom: 13px; display: flex; align-items: center; gap: 8px; font-size: 8px; color: #8397a4; pointer-events: none; }
.corner-left { left: 17px; }
.corner-right { right: 17px; color: #9eb2bc; }
.corner-kicker { color: var(--accent); }
.corner-separator { height: 10px; width: 1px; background: #41515d; }
.stage-footer { min-height: 70px; flex: 0 0 auto; padding: 12px 20px; gap: 12px; background: #0e1720; border-top: 1px solid var(--line-soft); }
.caption-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--accent-line); color: var(--accent); flex: 0 0 auto; font-size: 13px; }
.caption-copy { display: block; min-width: 0; flex: 1; }
.caption-heading { color: var(--accent); font-size: 8px; margin-bottom: 4px; }
.caption-copy p { margin: 0; color: #afbec6; font-size: 11px; line-height: 1.45; }
.stage-footer-note { display: flex; align-items: center; gap: 7px; color: #788b96; font: 8px var(--mono); letter-spacing: .08em; white-space: nowrap; }
.live-line { background: var(--accent); box-shadow: 0 0 8px rgba(124,224,211,.5); }
.control-rail { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 17px 17px 16px; background: linear-gradient(180deg, rgba(17,27,38,.98), rgba(13,21,30,.98)); scrollbar-color: #31434f transparent; scrollbar-width: thin; }
.rail-section + .rail-section { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.section-heading { gap: 9px; color: #91a5b1; font-size: 9px; white-space: nowrap; margin-bottom: 15px; }
.section-rule { height: 1px; flex: 1; background: var(--line); }
.control-group { margin-bottom: 12px; }
.control-head { justify-content: space-between; margin-bottom: 7px; gap: 8px; }
.control-head label { color: #c6d1d7; font-size: 11px; }
.control-head output { color: var(--accent); font: 11px var(--mono); white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 0; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(124,224,211,.75), rgba(124,224,211,.2)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(124,224,211,.75), rgba(124,224,211,.2)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #0d1720; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid #0d1720; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-scale { display: flex; justify-content: space-between; gap: 4px; color: #647784; font: 8px var(--mono); margin-top: 3px; }
.range-scale .ideal-mark { color: var(--accent); }
.compact-group { margin-bottom: 10px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.preset-button { height: 31px; border: 1px solid var(--line); border-radius: 3px; background: #121e29; color: #8799a4; font: 8px var(--mono); letter-spacing: .08em; cursor: pointer; transition: all .2s; }
.preset-button:hover, .preset-button.selected { border-color: var(--accent-line); color: var(--accent); background: var(--accent-dim); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; min-height: 74px; padding: 9px 10px 8px; border: 1px solid #263541; border-radius: 4px; background: linear-gradient(145deg, rgba(22,35,47,.96), rgba(15,25,35,.96)); }
.metric-primary { border-color: rgba(124,224,211,.35); background: linear-gradient(145deg, rgba(24,53,57,.56), rgba(15,25,35,.96)); }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #8296a2; font-size: 8px; white-space: nowrap; }
.metric-label span { color: #5c727f; font-size: 7px; }
.metric-value { margin-top: 7px; color: #e4eff1; font: 19px var(--mono); letter-spacing: -.06em; white-space: nowrap; }
.metric-primary .metric-value { color: var(--accent); }
.metric-value small { color: #8fa2ad; font: 9px var(--mono); letter-spacing: 0; }
.metric-foot { margin-top: 4px; color: #647985; font-size: 7px; }
.check-panel { margin-top: 8px; padding: 9px 10px 8px; border: 1px solid #293943; border-radius: 4px; background: rgba(12,20,28,.72); }
.check-head { gap: 7px; color: #a3b3bb; font-size: 8px; }
.check-symbol { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; color: var(--accent); border: 1px solid var(--accent-line); font-size: 9px; }
.check-tag { margin-left: auto; color: var(--accent); font-size: 7px; }
.check-main, .check-detail { justify-content: space-between; gap: 10px; margin-top: 8px; color: #8fa1ac; font-size: 9px; }
.check-main strong { color: #e4eff1; font: 12px var(--mono); }
.check-detail { margin-top: 5px; font-size: 8px; }
.check-detail strong { color: var(--accent); font: 9px var(--mono); white-space: nowrap; }
.check-formula { margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(131,158,179,.12); color: #758a96; font: 8px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playback-row { gap: 6px; }
.transport-button { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: #121e28; color: #9caeb8; font: 8px var(--mono); letter-spacing: .08em; cursor: pointer; flex: 1; transition: all .2s; }
.transport-button:hover { border-color: var(--accent-line); color: var(--text); }
.primary-transport { border-color: var(--accent-line); background: var(--accent-dim); color: var(--accent); }
.play-glyph { margin-right: 5px; font-size: 8px; }
.quality-row { justify-content: space-between; margin-top: 12px; }
.quality-label, .time-rate-row { color: #8296a2; font-size: 8px; }
.quality-switch { display: flex; gap: 3px; }
.quality-button, .rate-options button { border: 1px solid var(--line); background: #111c26; color: #728692; font: 8px var(--mono); padding: 5px 8px; border-radius: 2px; cursor: pointer; }
.quality-button.active, .rate-options button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-dim); }
.time-rate-row { justify-content: space-between; gap: 8px; margin-top: 10px; }
.rate-options { display: flex; gap: 3px; }
.rate-options button { padding: 5px 6px; }
.bottom-bar { min-height: 35px; flex: 0 0 35px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-top: 1px solid var(--line); background: #0a1118; }
.bottom-left { gap: 8px; color: #687d89; font-size: 8px; }
.footer-dot { width: 5px; height: 5px; background: var(--accent); }
.footer-divider { color: #3d4d58; }
.science-toggle { display: flex; align-items: center; gap: 10px; border: 0; padding: 6px 0 6px 10px; background: transparent; color: #a5b6bf; font-size: 8px; cursor: pointer; }
.science-toggle:hover { color: var(--accent); }
.chevron { color: var(--accent); font: 15px var(--sans); transition: transform .2s; }
.science-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.science-panel { flex: 0 0 auto; max-height: 44vh; overflow: auto; padding: 19px 25px 15px; border-top: 1px solid var(--accent-line); background: #101b25; }
.science-content { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; max-width: 1200px; margin: 0 auto; }
.science-kicker { color: var(--accent); font-size: 8px; margin-bottom: 7px; }
.science-column h2 { margin: 0 0 8px; font-size: 14px; font-weight: 560; }
.science-column p, .science-column li { color: #9eafb8; font-size: 10px; line-height: 1.55; }
.science-column p { margin: 0 0 9px; }
.science-column ul { margin: 0; padding-left: 16px; }
.science-column li + li { margin-top: 3px; }
.equation { color: #d2e4e5; font: 11px var(--mono); margin-top: 5px; }
.label-legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: #738792; font-size: 7px; flex-wrap: wrap; }
.label-legend span { border: 1px solid #344651; border-radius: 2px; padding: 3px 5px; color: var(--accent); }
.science-disclaimer { max-width: 1200px; margin: 12px auto 0; padding-top: 9px; border-top: 1px solid rgba(131,158,179,.14); color: #738792; font-size: 9px; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; }
  .control-rail { padding-left: 14px; padding-right: 14px; }
  .metric-value { font-size: 17px; }
}
@media (max-width: 800px) {
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(245px, 39dvh) minmax(0, 1fr); overflow: hidden; }
  .stage-column { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .stage-toolbar { height: 39px; flex-basis: 39px; padding: 0 10px; }
  .view-button { padding: 6px 7px; font-size: 8px; }
  .stage-meta { font-size: 8px; }
  .canvas-wrap { min-height: 0; }
  .stage-footer { min-height: 54px; padding: 7px 11px; gap: 8px; }
  .caption-icon { width: 21px; height: 21px; font-size: 11px; }
  .caption-copy p { font-size: 9px; line-height: 1.35; }
  .caption-heading { font-size: 7px; margin-bottom: 2px; }
  .stage-footer-note { font-size: 7px; }
  .control-rail { overflow-y: auto; padding: 12px 13px 18px; }
  .rail-section + .rail-section { margin-top: 13px; padding-top: 12px; }
  .section-heading { margin-bottom: 10px; }
  .control-group { margin-bottom: 8px; }
  .preset-row { margin-top: 10px; }
  .bottom-bar { min-height: 30px; flex-basis: 30px; padding: 0 12px; }
  .bottom-left { font-size: 7px; gap: 6px; }
  .science-panel { max-height: 55dvh; }
}
@media (max-width: 480px) {
  .topbar { height: 55px; flex-basis: 55px; padding: 0 11px; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-lockup { gap: 9px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 12px; letter-spacing: .07em; }
  h1 span { font-size: 10px; }
  .topbar-right { gap: 7px; }
  .status-pill { font-size: 8px; }
  .icon-button { width: 31px; padding: 0; justify-content: center; }
  .icon-button span { display: none; }
  .workspace { grid-template-rows: minmax(240px, 40dvh) minmax(0, 1fr); }
  .stage-meta { gap: 4px; font-size: 7px; }
  .view-button { padding: 6px 5px; letter-spacing: .04em; }
  .canvas-corner { bottom: 5px; font-size: 7px; }
  .corner-left { left: 8px; }
  .corner-right { right: 8px; }
  .stage-footer-note { display: none; }
  .control-rail { padding: 10px 11px 16px; }
  .control-head label { font-size: 10px; }
  .control-head output { font-size: 10px; }
  .range-scale { font-size: 7px; }
  .metric-card { min-height: 66px; padding: 7px 8px; }
  .metric-value { font-size: 17px; }
  .check-panel { padding: 8px; }
  .science-content { grid-template-columns: 1fr; gap: 17px; }
  .bottom-left { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.origin-tag { display: inline-block; margin-left: 4px; padding: 1px 3px; border: 1px solid rgba(124,224,211,.23); border-radius: 2px; color: #7dbab3; font: 6px var(--mono); letter-spacing: .07em; vertical-align: 1px; white-space: nowrap; }
.control-head label { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.metric-label .origin-tag { margin-left: auto; font-size: 6px; }
.equation .origin-tag { font-size: 6px; }
.range-scale .ideal-mark em { font-style: normal; font-size: 6px; letter-spacing: .05em; color: #9fc8c2; }
.history-note { margin-top: 10px !important; padding-top: 8px; border-top: 1px solid rgba(131,158,179,.13); color: #7e949f !important; font-size: 9px !important; }

body.embed-mode.science-open .science-panel { max-height: 28dvh; }
body.embed-mode.science-open .workspace { min-height: 0; }
@media (max-width: 800px) {
  body.embed-mode.science-open .workspace { grid-template-rows: minmax(280px, 34dvh) minmax(0, 1fr); }
  body.embed-mode.science-open .science-panel { max-height: 30dvh; }
}
