:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #0d1924;
  --panel-2: #101f2b;
  --line: #203342;
  --line-soft: rgba(125, 151, 169, .16);
  --text: #edf3f7;
  --muted: #8ea2b1;
  --muted-2: #667d8d;
  --accent: #ff718a;
  --accent-soft: rgba(255, 113, 138, .14);
  --wild: #91a7b7;
  --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; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app {
  width: min(1600px, 100%);
  height: 100dvh;
  min-height: 620px;
  margin: 0 auto;
  padding: 14px 18px 16px;
  display: grid;
  grid-template-rows: 62px minmax(0, 1fr);
  gap: 14px;
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app { height: 100vh; height: 100dvh; min-height: 0; }
.topbar { display: flex; align-items: center; min-width: 0; gap: 13px; border-bottom: 1px solid var(--line-soft); padding: 0 3px 10px; }
.brand-mark { width: 35px; height: 35px; border: 1px solid rgba(255,113,138,.45); border-radius: 11px; position: relative; flex: 0 0 auto; background: linear-gradient(145deg, rgba(255,113,138,.14), rgba(255,113,138,.025)); }
.brand-mark span { position: absolute; width: 20px; height: 2px; background: var(--accent); border-radius: 4px; left: 7px; top: 11px; transform: rotate(58deg); }
.brand-mark span:nth-child(2) { top: 20px; transform: rotate(-58deg); opacity: .7; }
.brand-mark i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--text); left: 14px; top: 14px; box-shadow: 0 0 10px var(--accent); }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker, .stage-kicker { color: var(--muted); font-size: 9px; letter-spacing: .17em; font-weight: 750; }
.eyebrow b { color: var(--accent); padding: 0 4px; }
h1 { font-size: clamp(15px, 1.5vw, 20px); line-height: 1.2; margin: 4px 0 0; font-weight: 680; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 span { color: var(--muted-2); font-weight: 400; }
.top-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.model-tag { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 750; white-space: nowrap; }
.model-tag i, .live-indicator span { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(255,113,138,.6); }
.quality-button { border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 8px; padding: 8px 10px; font-size: 9px; letter-spacing: .1em; color: var(--muted); cursor: pointer; }
.quality-button:hover, .quality-button:focus-visible { border-color: var(--accent); color: var(--text); outline: none; }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(340px, .88fr); gap: 14px; }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #203341; border-radius: 18px; background: #09141e; box-shadow: 0 18px 50px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.stage-heading { display: flex; justify-content: space-between; align-items: center; padding: 15px 17px 4px; position: relative; z-index: 1; }
.stage-kicker { color: #b2c1ca; }
.stage-subtitle { color: var(--muted-2); font-size: 10px; margin-top: 4px; }
.live-indicator { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 9px; letter-spacing: .13em; }
.live-indicator.paused span { background: var(--muted-2); box-shadow: none; }
.stage canvas { display: block; width: 100%; height: 100%; min-height: 0; outline: none; }
.stage-footer { display: flex; align-items: center; gap: 16px; padding: 9px 16px 12px; color: var(--muted); font-size: 9px; border-top: 1px solid rgba(125,151,169,.10); }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.legend-dot.drive { background: var(--accent); box-shadow: 0 0 8px rgba(255,113,138,.4); }
.legend-dot.wild { background: var(--wild); }
.footer-note { margin-left: auto; color: #617888; }
.sidebar { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 2px 3px 0; scrollbar-width: thin; scrollbar-color: #294050 transparent; }
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: #294050; border-radius: 8px; }
.state-card, .readout-card, .check-card, .science-panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(16,31,43,.96), rgba(10,22,32,.96)); border-radius: 13px; }
.state-card { padding: 12px 14px 13px; margin-bottom: 9px; }
.state-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.state-pill { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(255,113,138,.23); border-radius: 999px; padding: 4px 7px; font-size: 8px; letter-spacing: .11em; font-weight: 800; white-space: nowrap; }
.state-pill.neutral { color: var(--muted); background: rgba(142,162,177,.09); border-color: rgba(142,162,177,.18); }
.state-card p { margin: 9px 0 0; color: #c2ced5; font-size: 11px; line-height: 1.48; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 13px; }
.readout-card { padding: 10px 12px 9px; min-width: 0; }
.readout-card.primary-readout { border-color: rgba(255,113,138,.28); background: linear-gradient(145deg, rgba(255,113,138,.10), rgba(16,31,43,.96) 75%); }
.readout-label { color: var(--muted); font-size: 8px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.readout-value { font-size: 24px; line-height: 1.12; font-weight: 680; letter-spacing: -.04em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.primary-readout .readout-value { color: var(--accent); }
.readout-value span { font-size: 14px; margin-left: 2px; }
.readout-foot { color: #718797; font-size: 8px; margin-top: 5px; }
.control-section { border: 1px solid var(--line); background: rgba(12,24,34,.72); border-radius: 13px; padding: 13px 14px 12px; margin-bottom: 9px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 10px; }
.section-heading h2 { margin: 4px 0 0; font-size: 16px; font-weight: 650; letter-spacing: -.025em; }
.unit-note { font-size: 8px; letter-spacing: .12em; color: var(--muted-2); padding-bottom: 2px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 13px; }
.preset-button { background: rgba(255,255,255,.025); border: 1px solid var(--line); color: #aebdc6; border-radius: 8px; min-height: 31px; font-size: 10px; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.preset-button:hover, .preset-button:focus-visible { border-color: rgba(255,113,138,.55); color: var(--text); outline: none; }
.preset-button.active { background: var(--accent-soft); border-color: rgba(255,113,138,.35); color: #ffc0cb; }
.slider-control { margin: 0 0 12px; }
.slider-control.last-slider { margin-bottom: 10px; }
.slider-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.slider-heading label { color: #dce5ea; font-size: 10px; font-weight: 620; }
.slider-heading em { font-style: italic; color: var(--muted); }
.slider-heading sub { font-size: 8px; color: var(--muted); }
.slider-heading output { color: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 14px; margin: 0; appearance: none; background: transparent; cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 10px; background: linear-gradient(90deg, rgba(255,113,138,.65), #314656); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 10px; background: linear-gradient(90deg, rgba(255,113,138,.65), #314656); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border: 2px solid #ffd5dc; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255,113,138,.12), 0 0 12px rgba(255,113,138,.35); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #ffd5dc; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255,113,138,.12); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 5px; border-radius: 5px; }
.slider-hint { color: #748a99; font-size: 8px; margin-top: 4px; line-height: 1.35; }
.transport-row { display: grid; grid-template-columns: 1.12fr 1fr .9fr; gap: 7px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.transport-button { min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: #b8c6ce; font-size: 10px; font-weight: 700; cursor: pointer; }
.transport-button span { font-size: 9px; font-weight: 550; }
.transport-button.primary { color: #ffe8ec; background: rgba(255,113,138,.17); border-color: rgba(255,113,138,.42); }
.transport-button:hover, .transport-button:focus-visible { border-color: var(--accent); color: var(--text); outline: none; }
.check-card { padding: 11px 13px 10px; margin-bottom: 9px; }
.check-heading { display: flex; align-items: center; gap: 9px; }
.check-symbol { width: 27px; height: 27px; border: 1px solid rgba(255,113,138,.28); color: var(--accent); background: var(--accent-soft); display: grid; place-items: center; border-radius: 8px; font-size: 18px; }
.check-heading h3 { margin: 3px 0 0; font-size: 12px; font-weight: 650; }
.check-card p { margin: 9px 0 5px 36px; font-size: 9px; line-height: 1.6; color: #b7c5cd; font-variant-numeric: tabular-nums; }
.check-card p strong { color: #f0f4f6; font-weight: 700; }
.check-foot { color: #728797; font-size: 8px; line-height: 1.4; margin-left: 36px; }
.science-panel { margin-bottom: 9px; overflow: hidden; }
.science-panel summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 13px; cursor: pointer; list-style: none; color: #e4edf1; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-right { color: var(--muted-2); font-size: 8px; letter-spacing: .09em; }
.summary-right i { font-style: normal; color: var(--accent); font-size: 13px; margin-left: 5px; }
.science-panel[open] .summary-right i { display: inline-block; transform: rotate(45deg); }
.science-content { padding: 0 13px 13px; border-top: 1px solid var(--line-soft); }
.science-intro, .science-note { color: #aebdc6; font-size: 9px; line-height: 1.5; }
.equation-block { padding: 8px 9px; background: rgba(3,10,16,.38); border: 1px solid rgba(125,151,169,.12); border-radius: 7px; margin: 7px 0; }
.equation-label { display: block; color: var(--muted-2); font-size: 7px; letter-spacing: .11em; font-weight: 800; margin-bottom: 5px; }
.equation-block code { display: block; color: #e6edf1; font-size: 9px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.science-note b { color: #e4edf1; }
.disclaimer { color: #8296a4; font-size: 8px; line-height: 1.4; border-top: 1px solid var(--line-soft); padding-top: 8px; margin: 8px 0 0; }
.sidebar-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 3px 4px; color: #637988; font-size: 7px; letter-spacing: .12em; }
.sidebar-bottom button { border: 0; background: none; color: #9db0bc; font-size: 8px; letter-spacing: .1em; cursor: pointer; padding: 5px 2px; }
.sidebar-bottom button:hover, .sidebar-bottom button:focus-visible { color: var(--accent); outline: none; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 900px) {
  .app { padding: 10px 12px 12px; gap: 10px; grid-template-rows: 56px minmax(0,1fr); }
  .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(310px, .9fr); gap: 10px; }
  .model-tag { display: none; }
}
@media (max-width: 650px) {
  .app { padding: 8px 9px 9px; gap: 8px; grid-template-rows: 49px minmax(0,1fr); }
  .topbar { gap: 9px; padding: 0 2px 7px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-mark span { left: 5px; top: 9px; }
  .brand-mark span:nth-child(2) { top: 18px; }
  .brand-mark i { left: 12px; top: 12px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 14px; max-width: 205px; }
  .quality-button { padding: 7px 8px; font-size: 8px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(220px, 37dvh) minmax(0,1fr); gap: 8px; }
  .stage { border-radius: 13px; }
  .stage-heading { padding: 9px 11px 1px; }
  .stage-kicker { font-size: 8px; }
  .stage-subtitle { font-size: 8px; margin-top: 3px; }
  .live-indicator { font-size: 7px; }
  .stage-footer { padding: 6px 10px 8px; gap: 10px; font-size: 7px; }
  .footer-note { display: none; }
  .sidebar { padding-right: 1px; }
  .state-card { padding: 9px 11px 10px; margin-bottom: 7px; }
  .section-kicker { font-size: 8px; }
  .state-pill { font-size: 7px; padding: 4px 6px; }
  .state-card p { font-size: 10px; line-height: 1.4; margin-top: 7px; }
  .readout-grid { gap: 6px; margin-bottom: 8px; }
  .readout-card { padding: 8px 10px 7px; border-radius: 10px; }
  .readout-label { font-size: 7px; }
  .readout-value { font-size: 20px; margin-top: 5px; }
  .readout-value span { font-size: 12px; }
  .readout-foot { font-size: 7px; margin-top: 3px; }
  .control-section { padding: 10px 11px; margin-bottom: 7px; }
  .section-heading h2 { font-size: 14px; }
  .unit-note { font-size: 7px; }
  .preset-row { margin-bottom: 10px; }
  .preset-button { min-height: 29px; font-size: 9px; }
  .slider-control { margin-bottom: 10px; }
  .slider-heading label { font-size: 9px; }
  .slider-heading output { font-size: 8px; }
  .slider-hint { font-size: 7px; }
  .transport-row { padding-top: 8px; }
  .transport-button { min-height: 32px; font-size: 9px; }
  .transport-button span { font-size: 8px; }
  .check-card { padding: 9px 11px; margin-bottom: 7px; }
  .check-card p { font-size: 8px; margin-left: 35px; }
  .check-foot { font-size: 7px; margin-left: 35px; }
  .science-panel summary { min-height: 38px; font-size: 8px; padding: 0 11px; }
  .summary-right { font-size: 7px; }
  .science-content { padding: 0 11px 11px; }
  .science-intro, .science-note { font-size: 8px; }
  .equation-block code { font-size: 8px; }
  .sidebar-bottom { font-size: 6px; }
}
@media (max-width: 370px) {
  h1 { max-width: 175px; font-size: 13px; }
  .stage-footer { gap: 7px; }
  .stage-footer span { font-size: 6px; }
  .readout-value { font-size: 18px; }
  .readout-label { letter-spacing: .08em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.threshold-readout { margin: 9px 0 4px 36px; padding: 7px 9px; border: 1px solid rgba(255,113,138,.18); background: rgba(255,113,138,.055); border-radius: 7px; }
.threshold-readout .readout-label { color: #aebdc6; font-size: 7px; }
.threshold-value { color: var(--accent); font-size: 12px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 650px) { .threshold-readout { margin-left: 35px; padding: 6px 8px; } .threshold-value { font-size: 11px; } }
