:root {
  color-scheme: dark;
  --bg: #081412;
  --panel: #0d1b18;
  --panel-2: #11221e;
  --panel-3: #142823;
  --line: rgba(191, 211, 196, .12);
  --line-strong: rgba(191, 211, 196, .22);
  --text: #e9eee6;
  --muted: #98aaa0;
  --dim: #6f8278;
  --accent: #e8b85d;
  --accent-soft: rgba(232, 184, 93, .13);
  --good: #e8b85d;
  --warn: #e8b85d;
  --bad: #e8b85d;
  --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 { min-height: 100dvh; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100dvh; background: radial-gradient(ellipse at 20% 0%, rgba(35, 75, 61, .18), transparent 42%), var(--bg); }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 18, 15, .9); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(232,184,93,.35); border-radius: 12px; background: var(--accent-soft); flex: 0 0 auto; }
.brand-mark svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.35; stroke-linejoin: round; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: .16em; font-weight: 800; line-height: 1.2; }
h1 { font-size: 17px; line-height: 1.1; letter-spacing: -.025em; margin: 4px 0 0; font-weight: 680; }
.subtitle { color: var(--muted); font-size: 11px; margin: 2px 0 0; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.quiet-button, .primary-button, .preset-button, .run-button, .step-button, .reset-button { border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.quiet-button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; background: transparent; color: var(--muted); font-size: 11px; }
.button-dot, .live-dot, .status-led { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(232,184,93,.1); }
.primary-button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; background: var(--accent); border-color: var(--accent); color: #201a0e; font-size: 11px; font-weight: 800; }
.primary-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
button:hover { border-color: rgba(232,184,93,.65); }
.primary-button:hover { background: #f0c875; }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.layout { height: calc(100dvh - 68px); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 354px; gap: 0; }
.stage-column { min-width: 0; min-height: 0; padding: 16px 16px 14px 20px; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 10px; }
.stage-shell { min-width: 0; min-height: 0; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #0a1714; box-shadow: 0 18px 50px rgba(0,0,0,.22); }
#scene { display: block; width: 100%; height: 100%; }
.scene-topline { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-kicker, .scene-model { font-size: 9px; letter-spacing: .14em; font-weight: 800; color: #c4d1c8; }
.scene-kicker { display: flex; align-items: center; gap: 8px; }
.scene-model { color: #84988e; font-size: 8px; }
.live-dot { width: 6px; height: 6px; }
.scene-bottomline { position: absolute; left: 16px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 14px; color: #9eafa4; font-size: 9px; pointer-events: none; }
.scene-bottomline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend-swatch.brood { background: #d9a95a; box-shadow: 0 0 8px rgba(232,184,93,.45); }
.legend-swatch.airflow { background: #8caeaa; }
.legend-swatch.workers { background: #e8b85d; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.readout-card { min-width: 0; min-height: 84px; padding: 10px 12px 9px; background: linear-gradient(145deg, rgba(19,39,33,.95), rgba(12,27,23,.96)); border: 1px solid var(--line); border-radius: 12px; }
.readout-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 9px; line-height: 1.2; }
.readout-value { margin-top: 7px; font-size: clamp(19px, 2vw, 25px); font-weight: 720; letter-spacing: -.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.readout-value small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0; }
.readout-foot { margin-top: 6px; color: var(--dim); font-size: 8px; line-height: 1.35; }
.readout-foot .source-tag { margin-left: 3px; vertical-align: 1px; }
.source-tag { display: inline-flex; align-items: center; padding: 2px 4px; border-radius: 4px; font-size: 7px; line-height: 1; letter-spacing: .08em; font-weight: 800; white-space: nowrap; }
.source-tag.illustrative { color: #d8bb82; background: rgba(232,184,93,.1); }
.source-tag.textbook { color: #b5cdbb; background: rgba(151,190,162,.1); }
.source-tag.scaled { color: #a8c2bf; background: rgba(129,174,169,.1); }
.check-values { display: flex; align-items: baseline; gap: 7px; margin-top: 8px; white-space: nowrap; }
.check-values strong { font-size: 14px; font-weight: 730; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.check-values span { color: var(--dim); font-size: 9px; }
.check-card .readout-foot { white-space: nowrap; }
.check-card .readout-foot b { color: var(--good); font-weight: 700; }
.caption-panel { display: flex; align-items: center; gap: 11px; min-height: 57px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(15,32,27,.76); }
.caption-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: var(--accent); background: var(--accent-soft); font-size: 17px; }
.caption-copy { min-width: 0; flex: 1; }
.caption-label { color: var(--accent); font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.caption-copy p { margin: 3px 0 0; color: #c4d0c8; font-size: 10px; line-height: 1.35; }
.sim-clock { flex: 0 0 auto; text-align: right; padding-left: 12px; border-left: 1px solid var(--line); }
.sim-clock span, .sim-clock small { display: block; color: var(--dim); font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.sim-clock strong { display: block; margin: 2px 0; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; padding: 18px 18px 22px; border-left: 1px solid var(--line); background: rgba(10,23,19,.8); scrollbar-width: thin; scrollbar-color: #354b40 transparent; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 17px; font-weight: 670; letter-spacing: -.03em; }
.panel-index { color: var(--dim); font-size: 9px; letter-spacing: .1em; }
.section-label { display: flex; align-items: center; justify-content: space-between; color: #c6d0c8; font-size: 9px; letter-spacing: .12em; font-weight: 800; margin-bottom: 9px; }
.section-label span { color: var(--dim); font-size: 7px; letter-spacing: .1em; }
.preset-block { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 8px; background: var(--panel); border-color: var(--line); }
.preset-button.active { background: var(--accent-soft); border-color: rgba(232,184,93,.42); }
.preset-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.045); color: var(--accent); font-size: 17px; flex: 0 0 auto; }
.preset-button b { display: block; color: var(--text); font-size: 9px; line-height: 1.25; font-weight: 700; }
.preset-button small { display: block; margin-top: 3px; color: var(--muted); font-size: 7px; line-height: 1.2; }
.controls-section { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.response-section { padding-top: 14px; }
.control-item { margin-top: 12px; }
.control-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.control-label-row label { color: #dce5dd; font-size: 10px; font-weight: 580; }
.control-label-row output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; width: 100%; height: 18px; display: block; margin: 5px 0 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 5px; background: linear-gradient(90deg, rgba(232,184,93,.62), rgba(232,184,93,.15)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 5px; background: linear-gradient(90deg, rgba(232,184,93,.62), rgba(232,184,93,.15)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border-radius: 50%; border: 2px solid #f4d79c; background: #c88f37; box-shadow: 0 0 0 3px rgba(232,184,93,.13); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #f4d79c; background: #c88f37; box-shadow: 0 0 0 3px rgba(232,184,93,.13); }
.range-ends { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: var(--dim); font-size: 7px; line-height: 1.2; }
.transport-controls { padding: 14px 0 12px; }
.transport-row { display: grid; grid-template-columns: 1.2fr 1fr .8fr; gap: 7px; }
.run-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 8px; background: var(--accent); border-color: var(--accent); color: #211b10; font-size: 10px; font-weight: 800; }
.run-button span:first-child { font-size: 13px; line-height: 1; }
.step-button, .reset-button { padding: 6px 6px; background: var(--panel-2); border-color: var(--line); color: #c5d0c7; font-size: 9px; }
.step-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.05; }
.step-button .source-tag { font-size: 6px; padding: 1px 3px; }
.transport-note { display: flex; align-items: center; gap: 7px; margin-top: 9px; color: var(--muted); font-size: 8px; }
.status-led { width: 6px; height: 6px; box-shadow: none; }
.status-led.paused { background: #74847b; }
.fixed-step { margin-left: auto; color: var(--dim); font-size: 7px; letter-spacing: .1em; }
.science-panel { border-top: 1px solid var(--line); padding-top: 11px; }
.science-panel summary { display: flex; align-items: center; gap: 9px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 16px; }
.science-panel summary b { display: block; font-size: 10px; font-weight: 700; }
.science-panel summary small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.chevron { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 10px 0 0 36px; color: #aebdb3; font-size: 9px; line-height: 1.5; }
.science-content h3 { margin: 12px 0 5px; color: #e0e8df; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.science-content p { margin: 5px 0 8px; }
.equation { margin: 7px 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.025); color: #e7d5ac; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.science-list { margin: 5px 0 9px; padding-left: 15px; }
.science-list li { margin: 5px 0; }
.disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #d5c59f; font-size: 8px; }

@media (max-width: 900px) and (min-width: 701px) {
  .layout { grid-template-columns: minmax(0,1fr) 320px; }
  .stage-column { padding-left: 12px; padding-right: 12px; }
  .control-panel { padding-left: 14px; padding-right: 14px; }
  .readout-card { padding: 8px; }
  .readout-head { font-size: 8px; }
  .readout-foot { font-size: 7px; }
  .source-tag { font-size: 6px; }
}
@media (max-width: 700px) {
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { min-height: 100dvh; }
  .topbar { height: 58px; padding: 0 12px; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-mark svg { width: 24px; height: 24px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 14px; margin-top: 3px; }
  .subtitle { font-size: 9px; }
  .top-actions { gap: 5px; }
  .quiet-button { padding: 7px 8px; font-size: 9px; }
  .primary-button { padding: 7px 8px; gap: 5px; font-size: 9px; }
  .primary-button svg { width: 13px; height: 13px; }
  .layout { height: calc(100dvh - 58px); grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(310px, 45dvh) minmax(0,1fr); gap: 0; }
  .stage-column { padding: 8px 8px 7px; grid-template-rows: minmax(0,1fr) auto auto; gap: 6px; overflow: hidden; }
  .stage-shell { border-radius: 13px; }
  .scene-topline { top: 9px; left: 10px; right: 10px; }
  .scene-kicker { font-size: 7px; }
  .scene-model { font-size: 6px; }
  .scene-bottomline { left: 10px; bottom: 7px; gap: 9px; font-size: 7px; }
  .readout-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
  .readout-card { min-height: 59px; padding: 6px 6px 5px; border-radius: 8px; }
  .readout-head { font-size: 6px; line-height: 1.1; }
  .readout-head .source-tag { display: none; }
  .readout-value { margin-top: 5px; font-size: clamp(13px,4vw,17px); }
  .readout-value small { font-size: 8px; }
  .readout-foot { margin-top: 3px; font-size: 6px; line-height: 1.2; }
  .readout-foot .source-tag { font-size: 5px; padding: 1px 2px; }
  .check-values { gap: 3px; margin-top: 5px; }
  .check-values strong { font-size: 9px; }
  .check-values span { font-size: 7px; }
  .check-card .readout-foot { white-space: normal; font-size: 5.5px; }
  .caption-panel { min-height: 43px; padding: 5px 7px; gap: 7px; border-radius: 8px; }
  .caption-icon { width: 23px; height: 23px; border-radius: 7px; font-size: 13px; }
  .caption-label { font-size: 6px; }
  .caption-copy p { margin-top: 2px; font-size: 7px; line-height: 1.25; }
  .sim-clock { padding-left: 7px; }
  .sim-clock span, .sim-clock small { font-size: 5px; }
  .sim-clock strong { font-size: 10px; }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); padding: 12px 13px 20px; overflow-y: auto; overscroll-behavior: contain; }
  .panel-heading { margin-bottom: 10px; }
  .panel-heading h2 { font-size: 15px; }
  .panel-index { font-size: 8px; }
  .preset-block { padding-bottom: 11px; }
  .preset-button { padding: 8px 7px; }
  .preset-button b { font-size: 9px; }
  .preset-button small { font-size: 7px; }
  .controls-section { padding: 11px 0 9px; }
  .response-section { padding-top: 11px; }
  .control-item { margin-top: 10px; }
  .transport-controls { padding: 11px 0 10px; }
  .science-panel { padding-top: 9px; }
}
@media (max-width: 370px) {
  .topbar { padding: 0 8px; }
  .brand-lockup { gap: 7px; }
  .brand-mark { display: none; }
  .quiet-button { padding: 6px; }
  .primary-button { padding: 6px; }
  .readout-card { padding-left: 4px; padding-right: 4px; }
  .readout-head { font-size: 5.5px; }
  .readout-value { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
