:root {
  color-scheme: dark;
  --bg: #07131f;
  --panel: #0b1b29;
  --panel-2: #102433;
  --line: rgba(165, 204, 218, .12);
  --line-strong: rgba(165, 204, 218, .2);
  --text: #e7f2f3;
  --muted: #8da8b2;
  --dim: #617d88;
  --accent: #63e0c0;
  --accent-soft: rgba(99, 224, 192, .12);
  --warm: #f1bd72;
  --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; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 15% -25%, rgba(38, 104, 111, .16), transparent 46%), var(--bg); }
.topbar { height: 68px; min-height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(7, 19, 31, .94); z-index: 2; }
.brand-mark { width: 30px; height: 30px; border: 1px solid rgba(99,224,192,.45); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); background: rgba(99,224,192,.06); }
.brand-mark span { width: 3px; height: 12px; border-radius: 4px; background: var(--accent); transform: rotate(8deg); }
.brand-mark span:nth-child(2) { height: 17px; opacity: .7; }
.brand-mark span:nth-child(3) { height: 9px; opacity: .45; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.eyebrow, .stage-kicker, .section-kicker { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .16em; }
.eyebrow-dot { color: var(--accent); padding: 0 4px; }
h1 { margin: 0; font-size: 17px; line-height: 1.2; font-weight: 650; letter-spacing: -.025em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .13em; }
.live-dot, .note-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(99,224,192,.6); }
.live-dot.paused { background: var(--warm); box-shadow: 0 0 8px rgba(241,189,114,.35); }
.icon-button { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; background: rgba(255,255,255,.025); color: #b8cdd2; font-size: 10px; font-weight: 650; cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.icon-button:hover, .text-button:hover, .step-button:hover, .quality-button:hover { border-color: rgba(99,224,192,.45); background: rgba(99,224,192,.07); }
.icon-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 354px; }
.stage-panel { min-width: 0; min-height: 0; padding: 19px 20px 15px 22px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.stage-heading { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.stage-kicker { color: var(--accent); font-size: 9px; }
.stage-subtitle { margin-top: 5px; color: #c4d5d8; font-size: 12px; letter-spacing: -.01em; }
.stage-legend { display: flex; align-items: center; gap: 7px; padding-top: 4px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.legend-line { width: 17px; height: 1px; border-top: 1px dashed rgba(132, 210, 221, .7); }
.legend-band { width: 13px; height: 8px; margin-left: 6px; border-radius: 2px; background: rgba(99,224,192,.22); border: 1px solid rgba(99,224,192,.6); }
.canvas-frame { position: relative; flex: 1; min-height: 0; overflow: hidden; border: 1px solid rgba(132,184,194,.16); border-radius: 14px; background: #081c2a; box-shadow: 0 16px 44px rgba(0,0,0,.18), inset 0 0 0 1px rgba(255,255,255,.015); }
#world { display: block; width: 100%; height: 100%; }
.canvas-label { position: absolute; left: 15px; display: flex; align-items: center; gap: 7px; color: rgba(219,239,237,.72); font-size: 8px; font-weight: 750; letter-spacing: .13em; pointer-events: none; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.label-top { top: 14px; }
.label-bottom { bottom: 14px; }
.label-pip { width: 5px; height: 5px; border-radius: 50%; }
.pip-high { background: #6fd8c2; box-shadow: 0 0 8px rgba(111,216,194,.8); }
.pip-low { background: #7393c6; box-shadow: 0 0 8px rgba(115,147,198,.65); }
.field-chip { position: absolute; right: 14px; top: 13px; display: flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid rgba(139,198,207,.18); border-radius: 7px; color: rgba(202,224,228,.72); background: rgba(5,18,29,.48); font-size: 8px; letter-spacing: .12em; pointer-events: none; }
.field-chip-icon { color: var(--accent); font-size: 14px; }
.scale-chip { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 7px; color: rgba(203,222,226,.7); font-size: 9px; pointer-events: none; }
.scale-chip i { color: var(--dim); font-size: 8px; font-style: normal; }
.scale-bar { width: 73px; height: 4px; border-left: 1px solid rgba(220,239,240,.65); border-right: 1px solid rgba(220,239,240,.65); border-bottom: 1px solid rgba(220,239,240,.65); }
.stage-bottom { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-note { display: flex; align-items: center; gap: 9px; min-width: 0; color: #9eb6bd; font-size: 10px; line-height: 1.4; }
.note-pulse { flex: 0 0 6px; width: 6px; height: 6px; }
.model-clock { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.model-clock span { color: var(--dim); font-size: 8px; letter-spacing: .13em; font-weight: 750; }
.model-clock strong { color: #cfe0e1; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.control-panel { min-height: 0; overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, rgba(13,31,45,.98), rgba(8,24,36,.98)); scrollbar-width: thin; scrollbar-color: rgba(125,164,176,.28) transparent; }
.panel-section { padding: 17px 17px 15px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-kicker { color: var(--accent); font-size: 8px; }
h2 { margin: 4px 0 0; color: #dce9e9; font-size: 13px; font-weight: 630; letter-spacing: -.02em; }
.text-button { border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; color: #a8c0c5; background: transparent; font-size: 9px; cursor: pointer; transition: .2s ease; }
.text-button span { margin-left: 3px; color: var(--accent); font-size: 13px; vertical-align: -1px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 14px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 7px; padding: 8px 8px; border: 1px solid var(--line); border-radius: 8px; color: #8faab2; background: rgba(255,255,255,.018); font-size: 9px; font-weight: 600; cursor: pointer; text-align: left; transition: .2s ease; }
.preset-button:hover { border-color: rgba(99,224,192,.32); }
.preset-button.active { border-color: rgba(99,224,192,.48); color: #d4efea; background: rgba(99,224,192,.08); }
.preset-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #59737d; }
.preset-button.active .preset-dot { background: var(--accent); box-shadow: 0 0 7px rgba(99,224,192,.65); }
.control-list { display: grid; gap: 12px; }
.control-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.control-head label { color: #a9c0c5; font-size: 10px; font-weight: 560; }
.control-head label small { margin-left: 4px; color: #6e8992; font-size: 7px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.control-head output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 13px; margin: 0; 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(99,224,192,.58), rgba(99,224,192,.14)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(99,224,192,.58), rgba(99,224,192,.14)); }
input[type="range"]::-webkit-slider-thumb { width: 11px; height: 11px; margin-top: -4px; appearance: none; border: 2px solid #d9fff5; border-radius: 50%; background: #46c9a8; box-shadow: 0 0 0 3px rgba(99,224,192,.12); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid #d9fff5; border-radius: 50%; background: #46c9a8; box-shadow: 0 0 0 3px rgba(99,224,192,.12); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.range-ends { display: flex; justify-content: space-between; color: #627e88; font-size: 8px; font-variant-numeric: tabular-nums; }
.readouts-section { padding-top: 14px; }
.compact-heading { margin-bottom: 10px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; padding: 9px 9px 8px; border: 1px solid rgba(155,193,203,.1); border-radius: 9px; background: rgba(255,255,255,.025); }
.readout-label { color: #819da5; font-size: 7px; font-weight: 760; letter-spacing: .1em; white-space: nowrap; }
.readout-label small { display: block; margin-top: 3px; color: #607c85; font-size: 7px; font-weight: 550; letter-spacing: .025em; text-transform: none; }
.readout-value { margin-top: 7px; color: #e2f2ef; font-size: 19px; line-height: 1; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-value span { color: #7d9aa2; font-size: 9px; font-weight: 550; letter-spacing: 0; }
.readout-track { height: 3px; margin-top: 9px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.07); }
.readout-track span { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--accent); transition: width .2s linear; }
.readout-sub { margin-top: 8px; color: #607c85; font-size: 8px; }
.check-card { margin-top: 8px; padding: 9px 10px 8px; border: 1px solid rgba(99,224,192,.18); border-radius: 9px; background: rgba(99,224,192,.035); }
.check-head { display: flex; align-items: center; gap: 6px; color: #9eb9bc; font-size: 7px; font-weight: 760; letter-spacing: .1em; }
.check-icon { display: inline-flex; width: 13px; height: 13px; align-items: center; justify-content: center; border-radius: 50%; color: #071d20; background: var(--accent); font-size: 9px; font-weight: 900; }
.check-tag { margin-left: auto; color: var(--accent); font-size: 7px; }
.check-values { display: flex; align-items: end; gap: 9px; margin-top: 9px; }
.check-values div { display: flex; flex-direction: column; gap: 3px; }
.check-values small { color: #708c94; font-size: 7px; }
.check-values strong { color: #d9ece8; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check-equals { padding-bottom: 2px; color: #59757d; font-size: 8px; }
.check-values .check-diff { margin-left: auto; align-items: flex-end; }
.check-values .check-diff strong { color: var(--accent); }
.check-foot { margin-top: 8px; color: #6f8991; font-size: 7px; line-height: 1.45; }
.playback-section { padding-top: 13px; padding-bottom: 13px; }
.playback-row { display: flex; align-items: center; gap: 7px; }
.play-button, .step-button, .quality-button { height: 31px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; cursor: pointer; transition: .2s ease; }
.play-button { flex: 1; border: 1px solid rgba(99,224,192,.5); color: #06251f; background: var(--accent); font-size: 10px; font-weight: 750; }
.play-button:hover { background: #7bf0d0; }
.play-icon { font-size: 12px; line-height: 1; }
.step-button, .quality-button { padding: 0 10px; border: 1px solid var(--line-strong); color: #a9c0c5; background: rgba(255,255,255,.025); font-size: 9px; font-weight: 650; }
.step-button span { color: var(--accent); font-size: 12px; }
.quality-button { gap: 6px; min-width: 67px; }
.quality-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.quality-button.low .quality-dot { background: var(--warm); }
.science-panel { margin-top: 12px; border-top: 1px solid var(--line); }
.science-panel summary { display: flex; align-items: center; gap: 8px; padding: 11px 1px 1px; color: #b7cdd0; font-size: 10px; font-weight: 650; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-symbol { color: var(--accent); font-size: 15px; }
.summary-chevron { margin-left: auto; color: #78939a; font-size: 14px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding-top: 11px; color: #94adb3; font-size: 9px; line-height: 1.55; }
.science-intro { margin: 0 0 10px; }
.equation-block { margin: 8px 0; padding: 9px; border: 1px solid rgba(150,190,200,.1); border-radius: 8px; background: rgba(255,255,255,.02); }
.equation-label { margin-bottom: 6px; color: var(--accent); font-size: 7px; font-weight: 750; letter-spacing: .12em; }
.equation-block code { display: block; overflow-wrap: anywhere; color: #d8eae7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; line-height: 1.7; }
.equation-block p { margin: 6px 0 0; color: #809ba2; font-size: 8px; }
.constants-list { display: grid; gap: 6px; margin-top: 10px; }
.constants-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(150,190,200,.07); padding-bottom: 4px; }
.constants-list span { color: #819ba2; font-size: 8px; }
.constants-list strong { color: #c6d9d9; font-size: 8px; text-align: right; font-weight: 600; }
.constants-list em { color: var(--accent); font-size: 7px; font-style: normal; text-transform: uppercase; letter-spacing: .06em; }
.simplifications { margin: 10px 0 7px; color: #8099a1; font-size: 8px; }
.disclaimer { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); color: #8aa5ab; font-size: 8px; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 980px) and (min-width: 701px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; }
  .stage-panel { padding-left: 16px; padding-right: 15px; }
  .panel-section { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 700px) {
  body { overflow: auto; }
  .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .topbar { height: 56px; min-height: 56px; padding: 0 13px; gap: 10px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 8px; }
  h1 { font-size: 15px; }
  .eyebrow { font-size: 8px; }
  .topbar-right { gap: 9px; }
  .live-indicator { font-size: 8px; gap: 5px; }
  .icon-button { padding: 7px 8px; }
  .icon-button span { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(250px, 42dvh) minmax(0,1fr); min-height: 0; overflow: hidden; }
  .stage-panel { padding: 11px 11px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-heading { min-height: 42px; }
  .stage-kicker { font-size: 8px; }
  .stage-subtitle { font-size: 10px; margin-top: 4px; }
  .stage-legend { display: none; }
  .canvas-frame { border-radius: 10px; }
  .canvas-label { left: 10px; font-size: 7px; }
  .label-top { top: 10px; }
  .label-bottom { bottom: 10px; }
  .field-chip { top: 9px; right: 9px; padding: 5px 6px; font-size: 7px; }
  .scale-chip { right: 9px; bottom: 9px; font-size: 8px; }
  .stage-bottom { min-height: 33px; }
  .stage-note { font-size: 8px; gap: 6px; }
  .model-clock { gap: 5px; }
  .model-clock span { font-size: 7px; }
  .model-clock strong { font-size: 9px; }
  .control-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .panel-section { padding: 13px 13px 12px; }
  .section-heading { margin-bottom: 9px; }
  h2 { font-size: 12px; }
  .preset-row { margin-bottom: 11px; }
  .preset-button { padding: 8px 7px; font-size: 8px; }
  .control-list { grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 10px; }
  .control-head { align-items: flex-start; min-height: 27px; margin-bottom: 3px; }
  .control-head label { font-size: 9px; line-height: 1.3; }
  .control-head label small { display: block; margin: 2px 0 0; font-size: 6px; }
  .control-head output { font-size: 9px; white-space: nowrap; }
  .range-ends { font-size: 7px; }
  .readouts-section { padding-top: 11px; }
  .readout-card { padding: 8px; }
  .readout-label { font-size: 6px; }
  .readout-label small { font-size: 6px; }
  .readout-value { font-size: 17px; }
  .check-card { padding: 8px; }
  .playback-section { padding-top: 11px; }
}
@media (max-width: 370px) {
  .workspace { grid-template-rows: minmax(235px, 40dvh) minmax(0,1fr); }
  .control-list { column-gap: 9px; }
  .control-head label { font-size: 8px; }
  .preset-button { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
@media (max-width: 700px) {
  body.embed-mode .workspace { grid-template-rows: minmax(250px, 42dvh) minmax(0,1fr); }
}
