:root {
  color-scheme: dark;
  --bg: #0a1118;
  --panel: #101b25;
  --panel-2: #13212c;
  --panel-3: #172733;
  --line: rgba(174, 202, 215, .13);
  --line-strong: rgba(174, 202, 215, .22);
  --text: #edf5f7;
  --muted: #91a4af;
  --faint: #617580;
  --accent: #65e4d2;
  --accent-dim: rgba(101, 228, 210, .14);
  --warm: #d5b58a;
  --radius: 16px;
  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; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: 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 { width: 100%; min-height: 100vh; padding: 18px 22px 10px; display: flex; flex-direction: column; gap: 14px; background: radial-gradient(ellipse at 18% 0%, rgba(40, 89, 91, .15), transparent 38%), var(--bg); }
body.embed-mode .app-shell { height: 100%; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex: 0 0 auto; min-height: 78px; }
.heading-block { min-width: 0; }
.eyebrow, .section-kicker, .illustrative-tag, .computed-tag, .quality-label, .check-title, .footer-line { font-size: 9px; font-weight: 750; letter-spacing: .16em; color: var(--muted); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.eyebrow-dot, .mode-dot, .live-pip { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(101,228,210,.6); }
.eyebrow-divider, .footer-dot { color: var(--faint); }
h1 { font-size: clamp(23px, 2.1vw, 31px); line-height: 1.05; letter-spacing: -.045em; margin: 0; font-weight: 650; }
.subtitle { color: var(--muted); margin: 6px 0 0; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mode-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; color: #c9d8dc; font-size: 9px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; background: rgba(18,31,41,.72); }
.button { border: 1px solid var(--line-strong); border-radius: 10px; min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 11px; font-weight: 650; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover, .preset-button:hover { border-color: rgba(101,228,210,.5); }
.button:active, .preset-button:active { transform: translateY(1px); }
.button-quiet { background: rgba(19,33,44,.75); color: #c4d2d8; }
.button-quiet:hover { background: #1a2c38; }
.button-primary { background: var(--accent); border-color: var(--accent); color: #08201f; font-weight: 800; }
.button-primary:hover { background: #83f0e1; }
.button-icon { font-size: 15px; line-height: 1; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 360px); gap: 14px; }
.stage-card, .control-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(150deg, rgba(20,34,45,.96), rgba(12,23,32,.98)); min-height: 0; }
.stage-card { display: grid; grid-template-rows: 38px minmax(0, 1fr) auto; overflow: hidden; }
.stage-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-bottom: 1px solid var(--line); }
.stage-state { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.canvas-wrap { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 27% 42%, rgba(36,83,83,.12), transparent 38%), #0c1720; }
canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.canvas-overlay { position: absolute; top: 13px; left: 16px; display: flex; align-items: center; gap: 7px; color: #78909a; font-size: 8px; font-weight: 800; letter-spacing: .13em; pointer-events: none; }
.live-pip { width: 5px; height: 5px; }
.stage-caption { min-height: 50px; display: flex; align-items: center; gap: 11px; padding: 9px 17px; border-top: 1px solid var(--line); background: rgba(10,19,27,.4); }
.caption-mark { color: var(--accent); font-size: 17px; line-height: 1; }
.stage-caption p { margin: 0; color: #b5c5ca; font-size: 11px; line-height: 1.45; }
.control-panel { overflow-y: auto; overscroll-behavior: contain; padding: 15px 15px 13px; scrollbar-width: thin; scrollbar-color: #344955 transparent; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; font-weight: 620; letter-spacing: -.025em; }
.illustrative-tag, .computed-tag { font-size: 8px; letter-spacing: .11em; white-space: nowrap; color: #78929b; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 13px; }
.preset-button { min-height: 33px; border: 1px solid var(--line); background: rgba(22,38,49,.68); color: #aebfc5; border-radius: 9px; font-size: 10px; font-weight: 650; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button span { margin-left: 5px; color: var(--faint); }
.preset-button.selected { color: var(--accent); background: var(--accent-dim); border-color: rgba(101,228,210,.38); }
.control-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 13px; }
.control-block { min-width: 0; }
.control-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; margin-bottom: 7px; }
.control-label-row label { color: #d6e1e4; font-size: 10px; font-weight: 620; white-space: nowrap; }
.unit { color: var(--faint); font-size: 9px; font-weight: 500; margin-left: 2px; }
.control-label-row output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; color: #657984; font-size: 8px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.readout-heading { display: flex; justify-content: space-between; align-items: center; margin: 15px 0 7px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { background: rgba(23,39,51,.76); border: 1px solid rgba(174,202,215,.09); border-radius: 10px; padding: 8px 10px 7px; min-width: 0; }
.readout-name { display: block; color: #91a5ae; font-size: 9px; }
.readout-card strong { display: block; color: #e8f1f2; font-size: 18px; line-height: 1.35; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.readout-note { color: #667c86; font-size: 8px; }
.check-card { margin-top: 9px; padding: 9px 10px 8px; border: 1px solid rgba(101,228,210,.19); background: rgba(101,228,210,.055); border-radius: 10px; }
.check-topline { display: flex; align-items: center; gap: 7px; }
.check-icon { width: 15px; height: 15px; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(101,228,210,.18); color: var(--accent); font-size: 10px; font-weight: 900; }
.check-title { color: #9bb8b8; font-size: 8px; }
.check-status { margin-left: auto; color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .12em; }
.check-card p { margin: 7px 0 3px; color: #d5e3e4; font-size: 10px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.check-separator { color: #6d858c; padding: 0 3px; }
.check-foot { color: #80999e; font-size: 8px; line-height: 1.35; }
.transport-row { display: grid; grid-template-columns: 1.15fr .8fr .85fr; gap: 7px; margin-top: 11px; }
.transport-row .button { min-height: 34px; padding: 0 9px; font-size: 10px; }
.quality-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.quality-label { font-size: 8px; }
.quality-switch { display: inline-flex; gap: 3px; padding: 3px; background: rgba(5,13,19,.5); border: 1px solid var(--line); border-radius: 8px; }
.quality-switch button { border: 0; border-radius: 5px; background: transparent; color: #80939b; padding: 4px 9px; font-size: 9px; cursor: pointer; }
.quality-switch button[aria-pressed="true"] { background: #263c47; color: var(--accent); }
.science-panel { margin-top: 9px; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; color: #d0dcdf; font-size: 10px; font-weight: 650; padding: 3px 1px; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-plus { color: var(--accent); font-size: 16px; font-weight: 400; transition: transform .2s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 8px 2px 2px; color: #9fb0b6; font-size: 9px; line-height: 1.5; }
.science-lead { color: #c6d5d8; margin: 0 0 8px; }
.equation-block { padding: 8px 9px; border-radius: 8px; background: rgba(5,13,19,.48); border: 1px solid var(--line); margin-bottom: 8px; }
.equation-label { display: block; color: #78929a; font-size: 7px; font-weight: 800; letter-spacing: .13em; margin-bottom: 5px; }
.equation-block code { color: var(--accent); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.science-content ul { margin: 0 0 8px; padding-left: 16px; }
.science-content li { margin: 3px 0; }
.science-content strong { color: #d5e2e3; }
.science-note { margin: 0 0 7px; color: #879ca4; }
.disclaimer { margin: 0; color: #738992; font-style: italic; }
.footer-line { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; min-height: 16px; font-size: 8px; letter-spacing: .12em; color: #5f737e; }
kbd { border: 1px solid rgba(174,202,215,.18); border-radius: 4px; padding: 2px 4px; font: inherit; color: #9aabb2; letter-spacing: .05em; }
@media (max-width: 980px) and (min-width: 701px) {
  .app-shell { padding: 14px; gap: 10px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 10px; }
  .control-panel { padding: 12px; }
  .control-list { gap: 10px 9px; }
  .control-label-row label { font-size: 9px; }
  .control-label-row output { font-size: 9px; }
}
@media (max-width: 700px) {
  .app-shell { padding: max(8px, env(safe-area-inset-top)) 9px max(6px, env(safe-area-inset-bottom)); gap: 8px; }
  .topbar { min-height: 66px; gap: 8px; }
  .eyebrow { font-size: 7px; gap: 5px; margin-bottom: 5px; letter-spacing: .12em; }
  h1 { font-size: 22px; }
  .subtitle { font-size: 9px; margin-top: 4px; max-width: 250px; }
  .top-actions { gap: 5px; flex-direction: column; align-items: flex-end; }
  .mode-chip { padding: 5px 7px; font-size: 7px; gap: 5px; }
  .mode-dot { width: 5px; height: 5px; }
  .screenshot-button { min-height: 27px; padding: 0 8px; font-size: 9px; border-radius: 8px; }
  .workspace { display: flex; flex-direction: column; gap: 8px; }
  .stage-card { flex: 0 0 42%; min-height: 230px; grid-template-rows: 29px minmax(0,1fr) auto; }
  .stage-heading { padding: 0 11px; }
  .section-kicker, .stage-state { font-size: 8px; }
  .canvas-overlay { display: none; }
  .stage-caption { min-height: 39px; padding: 6px 10px; gap: 7px; }
  .stage-caption p { font-size: 9px; line-height: 1.3; }
  .caption-mark { font-size: 14px; }
  .control-panel { flex: 1 1 auto; min-height: 0; padding: 10px 11px 9px; }
  .panel-heading { margin-bottom: 8px; }
  .panel-heading h2 { font-size: 14px; }
  .illustrative-tag, .computed-tag { font-size: 7px; }
  .preset-row { margin-bottom: 9px; gap: 6px; }
  .preset-button { min-height: 29px; font-size: 9px; }
  .control-list { gap: 9px 10px; }
  .control-label-row { margin-bottom: 3px; }
  .control-label-row label { font-size: 9px; }
  .unit { font-size: 8px; }
  .control-label-row output { font-size: 9px; }
  input[type="range"] { height: 13px; }
  .range-ends { font-size: 7px; }
  .readout-heading { margin: 9px 0 5px; }
  .readout-grid { gap: 5px; }
  .readout-card { padding: 5px 7px 4px; border-radius: 8px; }
  .readout-name { font-size: 8px; }
  .readout-card strong { font-size: 15px; }
  .readout-note { font-size: 7px; }
  .check-card { margin-top: 6px; padding: 6px 8px 5px; }
  .check-title, .check-status { font-size: 7px; }
  .check-icon { width: 13px; height: 13px; font-size: 9px; }
  .check-card p { margin: 4px 0 2px; font-size: 8px; }
  .check-foot { font-size: 7px; }
  .transport-row { margin-top: 7px; gap: 5px; }
  .transport-row .button { min-height: 29px; font-size: 9px; }
  .quality-row { margin-top: 6px; padding-bottom: 6px; }
  .quality-label { font-size: 7px; }
  .quality-switch button { padding: 3px 8px; font-size: 8px; }
  .science-panel { margin-top: 6px; }
  .science-panel summary { font-size: 9px; }
  .science-content { font-size: 8px; }
  .footer-line { display: none; }
}
@media (max-width: 390px) {
  .stage-card { flex-basis: 39%; min-height: 218px; }
  .topbar { min-height: 62px; }
  h1 { font-size: 20px; }
  .subtitle { max-width: 210px; }
  .control-panel { padding: 8px 9px; }
  .control-list { gap: 7px 8px; }
  .control-label-row label { font-size: 8px; }
  .readout-card strong { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
