:root {
  color-scheme: dark;
  --bg: #080d12;
  --surface: #0d151c;
  --surface-2: #111c24;
  --surface-3: #14212a;
  --line: #22313b;
  --line-soft: rgba(148, 171, 184, .12);
  --text: #e7f0f2;
  --muted: #8da1aa;
  --quiet: #5e737d;
  --accent: #a4f1dc;
  --accent-dim: rgba(164, 241, 220, .14);
  --accent-glow: rgba(164, 241, 220, .22);
  --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 { overflow-x: 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 { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 20% -10%, rgba(54, 94, 92, .18), transparent 36%), var(--bg); }
.topbar { min-height: 72px; padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); background: rgba(8, 13, 18, .88); }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(164,241,220,.32); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(164,241,220,.06); }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .75; }
.eyebrow, .panel-kicker, .readout-label, .insight-heading, .control-label-row label, .equation-label, .quality-title, .footer { letter-spacing: .12em; text-transform: uppercase; font-size: 9px; font-weight: 750; color: var(--muted); }
.eyebrow { font-size: 8px; margin-bottom: 3px; }
.eyebrow-dot, .footer-dot { color: var(--accent); padding: 0 4px; }
h1 { font-size: 17px; line-height: 1.2; margin: 0; letter-spacing: -.035em; font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.live-indicator { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 750; }
.live-indicator.paused .live-dot { background: #657982; box-shadow: 0 0 0 4px rgba(101,121,130,.08); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(164,241,220,.08), 0 0 14px var(--accent-glow); }
.icon-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 9px; padding: 9px 12px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; font-weight: 650; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.icon-button:hover { border-color: rgba(164,241,220,.5); background: var(--surface-2); transform: translateY(-1px); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { width: 100%; max-width: 1600px; margin: 0 auto; padding: 20px 24px 18px; display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 20px; flex: 1; min-height: 0; }
.visual-column { min-width: 0; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2b3a43 transparent; padding-right: 2px; }
.stage-card, .control-card, .readout-card, .insight-card, .science-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17,28,36,.96), rgba(11,19,25,.98)); box-shadow: 0 16px 40px rgba(0,0,0,.12); }
.stage-card { padding: 16px 16px 12px; min-width: 0; }
.stage-topline { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 0 2px 12px; }
.panel-kicker { font-size: 8px; color: var(--accent); margin-bottom: 6px; }
.stage-title { font-size: 15px; font-weight: 620; letter-spacing: -.025em; }
.stage-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta-pill { border: 1px solid var(--line); padding: 5px 7px; border-radius: 5px; font-size: 8px; letter-spacing: .1em; color: var(--muted); }
.meta-divider { width: 1px; height: 14px; background: var(--line); }
.canvas-wrap { height: clamp(330px, 48vh, 510px); min-height: 330px; width: 100%; position: relative; overflow: hidden; border: 1px solid rgba(129,157,170,.1); border-radius: 10px; background: #0a1218; }
canvas { display: block; width: 100%; height: 100%; }
.stage-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding: 10px 4px 0; font-size: 9px; color: var(--muted); }
.stage-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { width: 16px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.legend-dash { width: 16px; height: 0; border-top: 1px dashed #81949c; }
.legend-note { margin-left: auto; color: var(--quiet); }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.readout-card { padding: 12px 13px 11px; min-width: 0; }
.readout-label { font-size: 8px; letter-spacing: .09em; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--muted); min-height: 18px; }
.type-tag { font-size: 7px; letter-spacing: .09em; border: 1px solid rgba(141,161,170,.2); color: var(--quiet); border-radius: 3px; padding: 2px 4px; line-height: 1; white-space: nowrap; }
.textbook-tag { color: var(--accent); border-color: rgba(164,241,220,.24); }
.readout-value { margin-top: 8px; font-size: clamp(17px, 1.6vw, 22px); letter-spacing: -.045em; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { font-size: 10px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.readout-foot { margin-top: 5px; color: var(--quiet); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(230px, .9fr); gap: 10px; }
.insight-card { padding: 13px 15px; min-width: 0; }
.insight-heading { display: flex; align-items: center; gap: 7px; font-size: 8px; }
.insight-mark { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent-glow); }
.state-card p { color: #b6c6cb; font-size: 11px; line-height: 1.55; margin: 9px 0 0; max-width: 680px; }
.check-main { margin-top: 10px; display: flex; align-items: baseline; gap: 9px; font-size: 16px; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.check-arrow { color: var(--quiet); font-size: 10px; font-weight: 500; }
.check-foot { margin-top: 4px; font-size: 9px; color: var(--quiet); }
.check-foot strong { color: var(--accent); font-weight: 600; }
.science-panel { overflow: hidden; }
.science-panel summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: var(--text); font-size: 11px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: var(--accent-dim); font-size: 14px; }
.summary-hint { margin-left: auto; color: var(--quiet); font-size: 9px; font-weight: 450; }
.chevron { width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease; margin-left: 3px; }
details[open] .chevron { transform: rotate(225deg); }
.science-content { border-top: 1px solid var(--line-soft); padding: 16px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 20px; }
.equation-block { min-width: 0; }
.equation-label { display: flex; align-items: center; gap: 7px; font-size: 8px; margin-bottom: 10px; }
.equation { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.equation-block p { color: var(--muted); font-size: 10px; line-height: 1.65; margin: 8px 0 0; }
.disclaimer { grid-column: 1 / -1; color: var(--quiet); font-size: 9px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.control-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2b3a43 transparent; padding-right: 2px; }
.control-card { padding: 17px; }
.control-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 17px; }
.control-card-header h2 { font-size: 17px; letter-spacing: -.035em; margin: 0; font-weight: 640; }
.control-index { color: var(--quiet); font-size: 8px; letter-spacing: .1em; margin-top: 4px; }
.preset-block { margin-bottom: 15px; }
.control-label-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.control-label-row label { color: #b2c2c8; font-size: 8px; letter-spacing: .1em; }
.preset-grid { display: grid; gap: 7px; margin-top: 9px; }
.preset-button { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: rgba(7,13,18,.42); display: flex; align-items: center; text-align: left; gap: 10px; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: rgba(164,241,220,.36); background: rgba(164,241,220,.035); }
.preset-button.active { border-color: rgba(164,241,220,.45); background: rgba(164,241,220,.07); }
.preset-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; border: 1px solid #60747e; }
.preset-button.active .preset-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.preset-button strong { display: block; font-size: 10px; font-weight: 650; }
.preset-button small { display: block; margin-top: 2px; color: var(--quiet); font-size: 8px; }
.control-divider { height: 1px; background: var(--line-soft); margin: 14px 0; }
.control-group { margin: 0 0 16px; }
.control-group:last-of-type { margin-bottom: 4px; }
.control-value { color: var(--accent); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.math-symbol { font-family: Georgia, serif; font-style: italic; text-transform: none; font-size: 12px; color: var(--accent); letter-spacing: 0; margin-left: 3px; }
input[type="range"] { display: block; width: 100%; height: 17px; margin: 8px 0 3px; appearance: none; background: transparent; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(164,241,220,.5), #30434b); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(164,241,220,.5), #30434b); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; margin-top: -5px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(164,241,220,.65), 0 0 10px rgba(164,241,220,.18); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(164,241,220,.65); }
.range-ends { display: flex; justify-content: space-between; color: var(--quiet); font-size: 8px; font-variant-numeric: tabular-nums; }
.range-ends .threshold-label { color: var(--accent); }
.control-help { margin: 6px 0 0; color: var(--quiet); font-size: 9px; line-height: 1.45; }
.transport-row { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 7px; }
.transport-button { min-width: 0; border: 1px solid var(--line); background: rgba(7,13,18,.55); border-radius: 8px; padding: 10px 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 10px; color: #b9c8cd; font-weight: 600; transition: border-color .18s ease, background .18s ease; }
.transport-button:hover { border-color: rgba(164,241,220,.42); }
.transport-button.primary { color: #08110f; border-color: var(--accent); background: var(--accent); }
.transport-button.primary:hover { background: #c0f7e8; }
.play-icon { font-size: 12px; line-height: 1; }
.rate-row { margin-top: 16px; }
.rate-row input { margin-top: 6px; }
.quality-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.quality-title { display: block; color: #b2c2c8; font-size: 8px; }
.quality-row small { display: block; margin-top: 4px; color: var(--quiet); font-size: 8px; }
.segmented-control { display: flex; gap: 3px; padding: 3px; background: #080f14; border: 1px solid var(--line); border-radius: 7px; }
.segmented-control button { border: 0; border-radius: 5px; padding: 6px 10px; color: var(--quiet); background: transparent; font-size: 9px; cursor: pointer; }
.segmented-control button.selected { background: var(--surface-3); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(164,241,220,.16); }
.side-note { border: 1px solid rgba(164,241,220,.16); background: rgba(164,241,220,.045); border-radius: 10px; padding: 12px 13px; display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 9px; line-height: 1.55; }
.side-note strong { color: var(--accent); font-weight: 650; }
.side-note-mark { color: var(--accent); font-size: 15px; line-height: 1; }
.footer { width: 100%; max-width: 1600px; margin: 0 auto; min-height: 32px; padding: 8px 26px 12px; display: flex; justify-content: space-between; color: var(--quiet); font-size: 7px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; padding: 16px; gap: 14px; }
  .readout-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .canvas-wrap { height: clamp(310px, 45vh, 460px); }
}
@media (max-width: 760px) {
  .app-shell { min-height: 100vh; min-height: 100dvh; }
  .topbar { min-height: 58px; padding: 9px 13px; }
  .brand-mark { width: 30px; height: 30px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 15px; }
  .top-actions { gap: 10px; }
  .live-indicator { font-size: 8px; gap: 6px; }
  .screenshot-button { padding: 8px; }
  .screenshot-button span { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 12px; gap: 12px; overflow: visible; }
  .visual-column, .control-column { overflow: visible; padding: 0; }
  .stage-card { padding: 12px 10px 10px; }
  .stage-topline { align-items: flex-start; gap: 8px; padding: 0 2px 10px; }
  .stage-title { font-size: 13px; }
  .stage-meta { gap: 6px; font-size: 8px; padding-top: 2px; }
  .meta-pill { font-size: 7px; padding: 4px 5px; }
  .canvas-wrap { height: 360px; min-height: 340px; }
  .stage-legend { gap: 10px; font-size: 8px; padding-top: 8px; }
  .legend-note { margin-left: 0; width: 100%; }
  .readout-grid { gap: 8px; }
  .readout-card { padding: 10px; }
  .readout-label { font-size: 7px; gap: 5px; }
  .readout-value { font-size: 19px; margin-top: 7px; }
  .readout-foot { font-size: 8px; }
  .insight-row { grid-template-columns: 1fr; }
  .insight-card { padding: 12px; }
  .science-content { grid-template-columns: 1fr; gap: 14px; }
  .summary-hint { display: none; }
  .control-card { padding: 15px; }
  .control-card-header h2 { font-size: 16px; }
  .footer { padding: 8px 14px 12px; font-size: 6px; }
}
@media (max-width: 390px) {
  .canvas-wrap { height: 350px; min-height: 340px; }
  .stage-meta { flex-direction: column; align-items: flex-end; gap: 4px; }
  .meta-divider { display: none; }
  .stage-title { max-width: 195px; }
  .readout-label { letter-spacing: .06em; }
  .type-tag { font-size: 6px; }
  .readout-value { font-size: 17px; }
  .check-main { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
body.embed-mode .workspace { min-height: 0; }
@media (max-width: 760px) {
  body.embed-mode .workspace { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  body.embed-mode .visual-column, body.embed-mode .control-column { flex: 0 0 auto; }
}
