:root {
  color-scheme: dark;
  --bg: #080d12;
  --panel: #101820;
  --panel-raised: #141f28;
  --panel-soft: #0c131a;
  --line: #24323d;
  --line-soft: #1b2832;
  --text: #edf5f5;
  --muted: #8c9ba4;
  --muted-2: #64747e;
  --accent: #8be2d0;
  --accent-dim: rgba(139, 226, 208, .15);
  --accent-line: rgba(139, 226, 208, .42);
  --radius: 13px;
  --space: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: 100%; height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; background: radial-gradient(ellipse at 75% 8%, rgba(43, 83, 84, .12), transparent 38%), var(--bg); }
.topbar { height: 66px; min-height: 66px; padding: 0 24px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: rgba(8, 13, 18, .92); }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 35px; height: 35px; border: 1px solid var(--accent-line); border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--accent-dim); font-size: 21px; line-height: 1; }
.brand-copy { min-width: 0; }
.eyebrow { color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.4; }
.eyebrow-dot { display: inline-block; width: 4px; height: 4px; margin: 0 6px 2px; border-radius: 50%; background: var(--accent); }
h1 { margin: 2px 0 0; font-size: 19px; line-height: 1.2; letter-spacing: -.035em; font-weight: 650; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.live-indicator { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .14em; white-space: nowrap; }
.live-dot, .corner-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(139, 226, 208, .6); }
.live-dot.paused { background: var(--muted-2); box-shadow: none; }
.icon-button, .secondary-button, .primary-button, .preset-button, .segment { border: 1px solid var(--line); border-radius: 9px; background: var(--panel-raised); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.icon-button:hover, .secondary-button:hover, .preset-button:hover, .segment:hover { border-color: var(--accent-line); background: #192730; }
.icon-button:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.screenshot-button { display: flex; align-items: center; gap: 8px; height: 35px; padding: 0 11px; color: var(--text); font-size: 11px; font-weight: 650; }
.screenshot-button svg, .action-row svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 304px minmax(0, 1fr); gap: 16px; padding: 16px 18px 18px; overflow: hidden; }
.control-rail { min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #344650 transparent; padding-right: 2px; }
.panel, .stage-card, .readout-card { border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(155deg, rgba(20, 31, 40, .96), rgba(13, 21, 28, .98)); box-shadow: 0 12px 34px rgba(0, 0, 0, .14); }
.control-panel { padding: 17px 16px 14px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.025em; font-weight: 650; }
.panel-index { color: var(--muted-2); font-size: 10px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.preset-block { margin-bottom: 20px; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.field-heading label, .toggle-copy label { color: #dce6e7; font-size: 11px; font-weight: 650; }
.field-heading output { color: var(--accent); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.micro-tag { color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { min-height: 34px; padding: 0 7px; font-size: 10px; font-weight: 650; color: var(--muted); }
.preset-button.selected { border-color: var(--accent-line); color: var(--accent); background: var(--accent-dim); }
.control-group { padding: 13px 0 12px; border-top: 1px solid var(--line-soft); }
input[type="range"] { width: 100%; height: 16px; margin: 1px 0 0; background: transparent; appearance: none; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #34434d; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #34434d; }
input[type="range"]::-webkit-slider-thumb { width: 13px; height: 13px; margin-top: -4.5px; border: 2px solid #0c171c; border-radius: 50%; background: var(--accent); appearance: none; box-shadow: 0 0 0 3px rgba(139, 226, 208, .12); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #0c171c; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(139, 226, 208, .12); }
.range-ends { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 9px; margin-top: 2px; }
.helper-line { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted-2); font-size: 9px; }
.toggle-group { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-copy { display: flex; flex-direction: column; gap: 4px; }
.toggle-copy span { color: var(--muted-2); font-size: 9px; }
.switch { display: inline-flex; position: relative; flex: 0 0 auto; width: 36px; height: 20px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: absolute; inset: 0; border-radius: 20px; background: #33424c; transition: background .18s ease; }
.switch-track::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #d3dddf; transition: transform .18s ease; }
.switch input:checked + .switch-track { background: rgba(139, 226, 208, .55); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #f2fffc; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.quality-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.quality-row .field-heading { margin-bottom: 3px; }
.quality-note { color: var(--muted-2); font-size: 9px; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #0b1218; }
.segment { border: 0; background: transparent; color: var(--muted-2); padding: 5px 8px; font-size: 9px; font-weight: 750; }
.segment.active { color: var(--accent); background: var(--accent-dim); box-shadow: inset 0 0 0 1px rgba(139, 226, 208, .18); }
.action-row { display: grid; grid-template-columns: 1.2fr 1fr 38px; gap: 7px; margin-top: 6px; }
.primary-button, .secondary-button { height: 38px; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; font-weight: 700; }
.primary-button { border-color: var(--accent-line); background: var(--accent); color: #071311; }
.primary-button:hover { background: #a6f0e2; border-color: #a6f0e2; }
.primary-button svg { stroke: #071311; }
.secondary-button { color: #dce6e7; }
.reset-button { padding: 0; }
.keyboard-hint { margin-top: 10px; text-align: center; color: var(--muted-2); font-size: 9px; }
kbd { display: inline-block; padding: 2px 5px; border: 1px solid #34434d; border-radius: 4px; color: #b7c4c8; font: inherit; font-size: 8px; }
.science-panel { overflow: hidden; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary span:first-child { display: flex; flex-direction: column; gap: 3px; }
.science-panel summary strong { font-size: 12px; font-weight: 650; }
.science-panel summary svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.7; transition: transform .18s ease; }
.science-panel[open] summary svg { transform: rotate(180deg); }
.science-content { padding: 0 16px 15px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.science-content p { margin: 10px 0 0; }
.science-content strong { color: #dce6e7; }
.science-lead { color: #c7d3d5; }
.equation-block { margin-top: 12px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(5, 11, 15, .38); }
.equation-label { margin: 5px 0 2px; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.equation { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.disclaimer { color: var(--muted-2); font-size: 9px; }
.visual-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 10px; }
.stage-card { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 38% 60%, rgba(35, 73, 74, .16), transparent 48%), linear-gradient(150deg, #101a22, #0b1218); }
#simulation { display: block; width: 100%; height: 100%; }
.stage-corner-label { position: absolute; top: 13px; right: 15px; display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .12em; pointer-events: none; }
.stage-corner-label .corner-dot { width: 5px; height: 5px; }
.corner-separator { color: #40515c; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.readout-card { min-width: 0; padding: 11px 13px 10px; background: rgba(15, 24, 32, .88); }
.readout-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.readout-label { color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .13em; white-space: nowrap; }
.readout-value { margin-top: 7px; color: #edf7f5; font-size: clamp(17px, 1.7vw, 22px); line-height: 1.05; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout-value small { color: var(--muted); font-size: 9px; font-weight: 550; letter-spacing: 0; }
.readout-foot { margin-top: 6px; color: var(--muted-2); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance-card .readout-value { color: var(--accent); }
.caption-bar { min-height: 48px; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(13, 21, 28, .92); }
.caption-symbol { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: var(--accent-dim); font-size: 16px; }
.caption-bar p { flex: 1; min-width: 0; margin: 0; color: #bdcacc; font-size: 10px; line-height: 1.4; }
.sample-counter { display: flex; align-items: center; gap: 7px; padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted-2); font-size: 7px; line-height: 1.35; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.sample-number { color: var(--accent); font-size: 16px; letter-spacing: -.03em; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 1080px) and (min-width: 761px) {
  .workspace { grid-template-columns: 278px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .readout-card { padding: 10px 9px; }
  .readout-label { font-size: 7px; }
  .readout-foot { font-size: 8px; }
}
@media (max-width: 760px) {
  body { overflow: hidden; }
  .topbar { height: 58px; min-height: 58px; padding: 0 13px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 16px; }
  .topbar-right { gap: 10px; }
  .live-indicator { font-size: 8px; gap: 6px; }
  .screenshot-button { width: 34px; height: 34px; justify-content: center; padding: 0; }
  .screenshot-button span { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 18px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
  .visual-column { display: contents; }
  .stage-card { order: 0; flex: 0 0 auto; height: clamp(300px, 43vh, 390px); min-height: 300px; }
  .stage-corner-label { display: none; }
  .readout-grid { order: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .readout-card { padding: 9px 10px 8px; }
  .readout-value { margin-top: 6px; font-size: 20px; }
  .readout-foot { margin-top: 4px; font-size: 8px; }
  .readout-label { font-size: 7px; }
  .caption-bar { order: 2; min-height: 52px; padding: 7px 9px; gap: 8px; }
  .caption-bar p { font-size: 9px; }
  .sample-counter { padding-left: 8px; gap: 5px; }
  .sample-number { font-size: 14px; }
  .control-rail { display: contents; }
  .control-panel { order: 3; padding: 14px 13px 12px; }
  .science-panel { order: 4; flex: 0 0 auto; }
  .panel-heading { margin-bottom: 13px; }
  .preset-block { margin-bottom: 14px; }
  .control-group { padding: 10px 0 9px; }
  .action-row { margin-top: 5px; }
}
@media (max-width: 380px) {
  .topbar { padding: 0 9px; }
  .workspace { padding-left: 8px; padding-right: 8px; }
  .readout-top { align-items: flex-start; }
  .micro-tag { font-size: 7px; }
  .readout-value { font-size: 18px; }
}
@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; overflow: hidden; }
@media (max-width: 760px) {
  body.embed-mode .workspace { min-height: 0; }
}
