:root {
  color-scheme: dark;
  --bg: #080d13;
  --panel: #0d141d;
  --panel-raised: #111b26;
  --line: #1d2a37;
  --line-soft: rgba(147, 169, 186, .13);
  --text: #e8f0f4;
  --muted: #8b9ba8;
  --faint: #60717e;
  --accent: #63d7c3;
  --accent-soft: rgba(99, 215, 195, .13);
  --accent-glow: rgba(99, 215, 195, .22);
  --radius: 12px;
  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-width: 320px; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 18% 0%, rgba(30, 62, 68, .18), transparent 42%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(8, 13, 19, .92); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; position: relative; display: grid; place-items: center; border: 1px solid rgba(99, 215, 195, .38); border-radius: 50%; box-shadow: 0 0 24px rgba(99, 215, 195, .08); }
.brand-mark i { position: absolute; width: 17px; height: 17px; border: 1px solid var(--accent); border-radius: 50%; transform: rotate(0deg) scaleX(.48); opacity: .85; }
.brand-mark i:nth-child(2) { transform: rotate(60deg) scaleX(.48); }
.brand-mark i:nth-child(3) { transform: rotate(120deg) scaleX(.48); }
.eyebrow { color: var(--faint); font-size: 9px; line-height: 1.2; letter-spacing: .17em; font-weight: 750; }
h1 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.035em; font-weight: 650; line-height: 1.1; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: #a5b5bf; font-size: 9px; letter-spacing: .14em; font-weight: 700; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent-glow); }
.icon-button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #101923; color: #d5e1e7; font-size: 11px; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.icon-button:hover, .secondary-button:hover { border-color: rgba(99, 215, 195, .55); background: #14212a; }
.camera-icon { display: inline-block; width: 13px; height: 10px; border: 1.4px solid var(--accent); border-radius: 2px; position: relative; }
.camera-icon::before { content: ""; position: absolute; width: 5px; height: 3px; top: -4px; left: 2px; border: 1.2px solid var(--accent); border-bottom: 0; border-radius: 2px 2px 0 0; }
.camera-icon::after { content: ""; position: absolute; width: 4px; height: 4px; left: 3px; top: 1px; border: 1px solid var(--accent); border-radius: 50%; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 0; min-height: 0; flex: 1; }
.visual-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px 16px 16px 20px; }
.canvas-wrap { position: relative; animation: stage-enter 850ms cubic-bezier(.2,.72,.2,1) both; flex: 1; min-height: 0; overflow: hidden; border: 1px solid #1b2b36; border-radius: 14px; background: #0a1119; box-shadow: inset 0 0 0 1px rgba(255,255,255,.012), 0 16px 48px rgba(0,0,0,.18); }
#simulationCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-overlay { position: absolute; pointer-events: none; display: flex; align-items: center; }
.top-left { top: 16px; left: 18px; flex-direction: column; align-items: flex-start; gap: 4px; }
.overlay-kicker { color: #b9c9d1; font-size: 9px; font-weight: 750; letter-spacing: .16em; }
.overlay-sub { color: #738692; font-size: 10px; }
.bottom-left { left: 18px; bottom: 14px; gap: 8px; color: #81939f; font-size: 9px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(99,215,195,.35); }
.legend-dash { width: 16px; border-top: 1px dashed var(--accent); opacity: .75; margin-left: 9px; }
.visual-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 4px 0; min-height: 68px; }
.state-caption { min-width: 0; }
.caption-label { display: block; color: var(--faint); font-size: 8px; font-weight: 800; letter-spacing: .17em; margin-bottom: 4px; }
.state-caption p { margin: 0; color: #b8c6ce; font-size: 11px; line-height: 1.4; max-width: 700px; }
.iteration-readout { text-align: right; flex: 0 0 auto; }
.iteration-readout span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .16em; font-weight: 750; }
.iteration-readout strong { display: block; margin-top: 3px; color: var(--accent); font-size: 15px; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.control-panel { min-width: 0; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(17, 27, 38, .78), rgba(11, 18, 27, .96)); padding: 20px 18px 12px; scrollbar-width: thin; scrollbar-color: #2b3b47 transparent; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 18px; letter-spacing: -.035em; font-weight: 640; }
.model-tag { border: 1px solid #293b46; border-radius: 5px; padding: 5px 7px; color: #92a7b2; font-size: 8px; letter-spacing: .1em; font-weight: 750; }
.section-label { display: flex; align-items: center; justify-content: space-between; color: #91a2ad; font-size: 8px; font-weight: 800; letter-spacing: .15em; }
.muted-note { color: #5e707d; font-size: 9px; font-weight: 500; letter-spacing: .02em; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.preset-button { text-align: left; padding: 10px 11px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(10, 17, 25, .68); color: #d5e1e7; font-size: 11px; font-weight: 680; cursor: pointer; transition: .18s ease; }
.preset-button span { display: block; margin-top: 4px; color: #70818d; font-size: 9px; font-weight: 500; }
.preset-button:hover { border-color: rgba(99,215,195,.42); }
.preset-button.active { border-color: rgba(99,215,195,.6); background: linear-gradient(135deg, rgba(99,215,195,.13), rgba(10,17,25,.8)); box-shadow: inset 0 0 0 1px rgba(99,215,195,.05); }
.preset-button.active span { color: #9bbdb8; }
.quality-row { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; color: #91a2ad; font-size: 8px; font-weight: 800; letter-spacing: .15em; }
.quality-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid #243541; border-radius: 7px; background: rgba(7, 13, 19, .72); }
.quality-button { border: 0; border-radius: 4px; padding: 5px 9px; background: transparent; color: #71828e; font-size: 8px; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.quality-button.active { background: rgba(99,215,195,.14); color: #bdece3; box-shadow: inset 0 0 0 1px rgba(99,215,195,.25); }
.slider-stack { display: grid; gap: 15px; margin-top: 19px; }
.slider-control { min-width: 0; }
.slider-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.slider-heading label { color: #bdcbd2; font-size: 10px; font-weight: 570; }
.slider-heading label b { color: var(--accent); font-size: 11px; margin-left: 3px; }
.slider-heading output { color: #e4edf0; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 650; }
input[type="range"] { appearance: none; width: 100%; height: 16px; margin: 0; background: transparent; cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, rgba(99,215,195,.62), #2b3b47); border-radius: 4px; }
input[type="range"]::-moz-range-track { height: 3px; background: linear-gradient(90deg, rgba(99,215,195,.62), #2b3b47); border-radius: 4px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #0b141b; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(99,215,195,.25); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #0b141b; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(99,215,195,.25); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 5px; }
.range-meta { display: flex; align-items: center; justify-content: space-between; color: #627481; font-size: 8px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.meta-kind { color: #607e7b; font-size: 8px; letter-spacing: .02em; font-weight: 550; }
.run-controls { display: grid; grid-template-columns: 1.1fr .9fr .8fr; gap: 7px; margin-top: 19px; }
.run-controls button { min-height: 34px; border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 650; transition: .18s ease; }
.primary-button { display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid rgba(99,215,195,.55); background: rgba(99,215,195,.14); color: #c8f2e9; }
.primary-button:hover { background: rgba(99,215,195,.22); }
.secondary-button { border: 1px solid #263744; background: #111b25; color: #b5c4cc; }
.pause-glyph { display: inline-block; width: 9px; height: 11px; border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.play-glyph { display: inline-block; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid var(--accent); }
.readout-section { margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.metric-card { min-height: 61px; padding: 9px 10px 8px; border: 1px solid #1f303c; border-radius: 8px; background: rgba(8, 14, 21, .52); }
.metric-card.main-metric { background: linear-gradient(135deg, rgba(99,215,195,.11), rgba(8,14,21,.6)); border-color: rgba(99,215,195,.25); }
.metric-label { display: block; color: #758793; font-size: 7px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.metric-card strong { display: block; margin-top: 5px; color: #e4edf0; font-size: 17px; line-height: 1; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.metric-card.main-metric strong { color: var(--accent); }
.metric-card small { display: block; margin-top: 4px; color: #71818d; font-size: 8px; }
.check-card { margin-top: 8px; padding: 9px 10px; border: 1px solid #24343f; border-radius: 8px; background: rgba(12, 20, 28, .68); }
.check-head { display: flex; align-items: center; gap: 6px; color: #9aadb7; font-size: 8px; letter-spacing: .12em; font-weight: 800; }
.check-mark { display: inline-grid; place-items: center; width: 13px; height: 13px; border: 1px solid rgba(99,215,195,.5); border-radius: 50%; color: var(--accent); font-size: 9px; }
.check-kind { margin-left: auto; color: #637b78; font-size: 7px; letter-spacing: .02em; font-weight: 550; }
.check-card p { margin: 6px 0 0; color: #bac8ce; font-size: 9px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.science-panel { margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; list-style: none; cursor: pointer; color: #b5c4cc; font-size: 8px; letter-spacing: .15em; font-weight: 800; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary::after { content: "+"; color: var(--accent); font-size: 16px; font-weight: 400; line-height: 10px; }
.science-panel[open] summary::after { content: "−"; }
.summary-hint { margin-left: auto; margin-right: 10px; color: #627481; font-size: 8px; font-weight: 500; letter-spacing: 0; }
.science-content { padding: 0 0 12px; color: #8799a4; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 8px 0; }
.science-content .equation { padding: 8px 9px; border-left: 2px solid var(--accent); background: rgba(99,215,195,.07); color: #d1e4e2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.science-content .small-equation { font-size: 9px; }
.science-content .disclaimer { color: #6e818c; font-style: italic; }
.panel-bottom { display: flex; justify-content: space-between; padding: 11px 0 2px; color: #50616e; font-size: 7px; letter-spacing: .12em; font-weight: 750; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
@keyframes stage-enter {
  from { opacity: .35; transform: translateY(5px) scale(.994); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 820px) {
  .topbar { height: 58px; flex-basis: 58px; padding: 0 15px; }
  .brand-mark { width: 26px; height: 26px; }
  h1 { font-size: 16px; }
  .eyebrow { font-size: 8px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(270px, 46%) minmax(0, 1fr); }
  .visual-column { padding: 10px 10px 6px; min-height: 0; }
  .visual-footer { min-height: 54px; padding-top: 8px; }
  .state-caption p { font-size: 10px; }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px 12px; }
  .panel-heading { margin-bottom: 13px; }
  .slider-stack { grid-template-columns: 1fr 1fr; column-gap: 18px; row-gap: 12px; margin-top: 15px; }
  .run-controls { margin-top: 14px; }
  .readout-section { margin-top: 14px; padding-top: 12px; }
  .science-panel { margin-top: 10px; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .top-actions { gap: 9px; }
  .live-indicator { font-size: 8px; gap: 5px; }
  .icon-button { padding: 8px 9px; }
  .button-text { display: none; }
  .workspace { grid-template-rows: minmax(270px, 46%) minmax(0, 1fr); }
  .visual-column { padding: 8px 8px 5px; }
  .top-left { top: 12px; left: 12px; }
  .overlay-kicker { font-size: 8px; }
  .overlay-sub { font-size: 8px; }
  .bottom-left { display: none; }
  .visual-footer { min-height: 50px; padding-left: 2px; padding-right: 2px; gap: 8px; }
  .caption-label { font-size: 7px; }
  .state-caption p { font-size: 9px; max-width: 290px; }
  .iteration-readout strong { font-size: 12px; }
  .control-panel { padding: 12px 13px 10px; }
  .panel-heading h2 { font-size: 16px; }
  .slider-stack { column-gap: 13px; row-gap: 10px; }
  .slider-heading label { font-size: 9px; }
  .slider-heading output { font-size: 10px; }
  .range-meta { font-size: 7px; }
  .run-controls button { min-height: 32px; font-size: 9px; }
  .metric-card { min-height: 55px; padding: 8px; }
  .metric-card strong { font-size: 15px; }
  .check-card p { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
