:root {
  color-scheme: dark;
  --bg: #081318;
  --panel: #0d1b20;
  --panel-2: #102329;
  --panel-3: #132a30;
  --line: rgba(172, 220, 213, .11);
  --line-strong: rgba(172, 220, 213, .2);
  --text: #e9f2ee;
  --muted: #91a7a3;
  --quiet: #647d79;
  --accent: #76e0c0;
  --accent-dim: #2c9c80;
  --warm: #f0b477;
  --danger: #ed8c7c;
  --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; min-height: 100%; background: var(--bg); color: var(--text); }
body { background-image: radial-gradient(ellipse at 16% 0%, rgba(31, 102, 87, .17), transparent 37%), linear-gradient(145deg, #081318, #0a171c 55%, #091419); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { min-height: 0; }
.topbar { height: 76px; flex: 0 0 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(8, 19, 24, .82); }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(118,224,192,.38); border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-7deg); background: linear-gradient(145deg, rgba(118,224,192,.15), rgba(118,224,192,.02)); box-shadow: 0 0 24px rgba(76,198,162,.08); }
.brand-mark span { display: block; width: 4px; border-radius: 8px; background: var(--accent); transform: rotate(7deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 14px; opacity: .75; }
.eyebrow { color: #76918b; font-size: 9px; font-weight: 750; letter-spacing: .17em; line-height: 1.3; }
.topbar h1 { margin: 3px 0 0; font-size: 16px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; }
.top-meta { display: flex; align-items: center; gap: 10px; }
.model-tag, .seed-tag { height: 27px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); color: #8fa9a1; font-size: 9px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.model-tag i, .live-indicator i, .pulse-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(118,224,192,.8); }
.seed-tag { color: #637b77; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 358px; gap: 14px; padding: 14px; }
.stage-panel, .control-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, rgba(16,35,41,.94), rgba(10,24,29,.98)); box-shadow: 0 16px 60px rgba(0,0,0,.15); min-width: 0; }
.stage-panel { min-height: 0; display: flex; flex-direction: column; padding: 18px; gap: 11px; overflow: hidden; }
.stage-heading { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; min-height: 40px; }
.stage-heading h2, .panel-title-row h2 { margin: 3px 0 0; font-size: 18px; line-height: 1.2; letter-spacing: -.035em; font-weight: 650; }
.stage-legend { display: flex; gap: 15px; color: #809893; font-size: 10px; align-items: center; }
.stage-legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.population-dot { background: #e8b17a; box-shadow: 0 0 8px rgba(232,177,122,.5); }
.habitat-dot { background: var(--accent); box-shadow: 0 0 8px rgba(118,224,192,.5); }
.canvas-frame { position: relative; flex: 1 1 auto; min-height: 180px; overflow: hidden; border-radius: 13px; border: 1px solid rgba(143,193,182,.13); background: #09181c; }
#scene { display: block; width: 100%; height: 100%; }
.canvas-stamp { position: absolute; top: 12px; left: 14px; display: flex; align-items: center; gap: 8px; color: rgba(177,205,195,.72); font-size: 8px; font-weight: 750; letter-spacing: .16em; pointer-events: none; }
.pulse-dot { width: 5px; height: 5px; }
.caption-row { display: flex; align-items: flex-start; gap: 14px; flex: 0 0 auto; min-height: 45px; padding: 3px 2px 0; }
.caption-kicker { flex: 0 0 132px; padding-top: 3px; color: #77cbb1; font-size: 8px; font-weight: 800; letter-spacing: .13em; line-height: 1.5; }
.caption-row p { margin: 0; color: #a5b9b2; font-size: 11px; line-height: 1.55; max-width: 700px; }
.transport-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; min-height: 45px; padding-top: 10px; border-top: 1px solid var(--line); }
.transport-actions { display: flex; gap: 7px; align-items: center; }
.primary-button, .quiet-button, .utility-button, .preset-button, .speed-option { border: 1px solid var(--line-strong); cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.primary-button:active, .quiet-button:active, .utility-button:active, .preset-button:active { transform: translateY(1px); }
.primary-button { display: inline-flex; align-items: center; gap: 8px; min-height: 33px; padding: 0 13px; border-radius: 8px; color: #071b17; background: var(--accent); border-color: rgba(118,224,192,.6); font-size: 10px; font-weight: 800; }
.primary-button:hover { background: #91ebcf; }
.button-symbol { font-size: 10px; }
.quiet-button { min-height: 33px; display: inline-flex; align-items: center; gap: 9px; padding: 0 10px; border-radius: 8px; background: rgba(255,255,255,.025); color: #a9bcb6; font-size: 10px; }
.quiet-button:hover, .utility-button:hover { background: rgba(118,224,192,.08); border-color: rgba(118,224,192,.35); }
.icon-button { width: 33px; justify-content: center; padding: 0; font-size: 17px; color: #8da59e; }
.transport-readout { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.transport-readout span { color: #69817b; font-size: 7px; font-weight: 800; letter-spacing: .14em; }
.transport-readout strong { font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.transport-readout small { color: #7e9690; font-size: 9px; font-weight: 500; }
.speed-control { display: flex; gap: 3px; padding: 3px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.15); }
.speed-option { min-width: 28px; height: 23px; padding: 0 5px; border: 0; border-radius: 5px; background: transparent; color: #718984; font-size: 9px; font-weight: 750; }
.speed-option.active { color: var(--accent); background: rgba(118,224,192,.12); }
.control-panel { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #29433f transparent; padding: 17px; display: flex; flex-direction: column; gap: 14px; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #29433f; border-radius: 10px; }
.panel-intro { padding-bottom: 2px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; }
.panel-title-row h2 { font-size: 16px; }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; color: #83cbb3; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.live-indicator i { width: 5px; height: 5px; }
.panel-hint { margin: 8px 0 0; color: #819791; font-size: 10px; line-height: 1.45; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 9px; background: rgba(255,255,255,.018); text-align: left; }
.preset-button.selected { border-color: rgba(118,224,192,.42); background: rgba(118,224,192,.075); }
.preset-icon { flex: 0 0 25px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: rgba(118,224,192,.11); font-size: 15px; }
.brake-icon { color: var(--warm); background: rgba(240,180,119,.1); }
.preset-button strong, .preset-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-button strong { color: #d7e5df; font-size: 9px; font-weight: 750; }
.preset-button small { margin-top: 3px; color: #77908a; font-size: 8px; }
.controls-block { padding-top: 2px; }
.section-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #719088; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.unit-note { color: #526d66; font-size: 8px; font-weight: 600; letter-spacing: .03em; text-transform: none; }
.slider-control { margin-bottom: 11px; }
.slider-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.slider-heading label { color: #c5d4ce; font-size: 10px; font-weight: 600; }
.slider-heading em { color: #78cdb2; font-style: italic; }
.slider-heading output { color: #9ab6ac; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 10px; background: linear-gradient(90deg, #347c6a, #24483f); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 10px; background: linear-gradient(90deg, #347c6a, #24483f); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; border: 2px solid #b4f0dc; background: #3c9f83; box-shadow: 0 0 0 3px rgba(118,224,192,.12), 0 0 10px rgba(118,224,192,.22); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #b4f0dc; background: #3c9f83; box-shadow: 0 0 0 3px rgba(118,224,192,.12); }
.range-ends { display: flex; justify-content: space-between; margin-top: -1px; color: #4f6b65; font-size: 7px; font-variant-numeric: tabular-nums; }
.readout-section { padding-top: 2px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; padding: 10px 10px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.022); }
.readout-label { display: block; color: #6e8981; font-size: 7px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.readout-card strong { display: block; margin-top: 6px; color: #e2eee8; font-size: 18px; line-height: 1; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-card strong small { color: #8ca59c; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.readout-foot { display: block; margin-top: 5px; color: #607b73; font-size: 7px; }
.audit-card { padding: 10px 11px 9px; border: 1px solid rgba(118,224,192,.18); border-radius: 10px; background: linear-gradient(130deg, rgba(38,93,77,.14), rgba(14,36,37,.28)); }
.audit-heading { display: flex; align-items: center; gap: 8px; }
.audit-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: rgba(118,224,192,.12); color: var(--accent); font-size: 12px; }
.audit-heading strong, .audit-heading small { display: block; }
.audit-heading strong { color: #d3e4dc; font-size: 9px; }
.audit-heading small { margin-top: 2px; color: #76938a; font-size: 7px; }
.audit-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.audit-values div { min-width: 0; }
.audit-values span { display: block; color: #69857c; font-size: 7px; white-space: nowrap; }
.audit-values strong { display: block; margin-top: 4px; color: #bce6d6; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-difference strong { color: var(--accent); }
.audit-note { margin-top: 8px; color: #627e74; font-size: 7px; }
.utility-row { display: flex; gap: 7px; }
.utility-button { flex: 1; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; background: rgba(255,255,255,.02); color: #94aaa2; font-size: 9px; }
.utility-glyph { color: var(--accent); font-size: 13px; }
.science-panel { border-top: 1px solid var(--line); padding-top: 11px; }
.science-panel summary { display: flex; align-items: center; gap: 9px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: rgba(118,224,192,.09); font-size: 14px; }
.science-panel summary strong, .science-panel summary small { display: block; }
.science-panel summary strong { color: #c7d8d0; font-size: 10px; }
.science-panel summary small { margin-top: 2px; color: #6d8780; font-size: 8px; }
.summary-chevron { margin-left: auto; color: #718c83; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 11px 2px 0 34px; color: #8da49c; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 11px 0 4px; color: #b8d2c7; font-size: 9px; font-weight: 750; }
.science-content p { margin: 4px 0 8px; }
.science-content .equation { padding: 7px 9px; border-left: 2px solid rgba(118,224,192,.45); border-radius: 0 6px 6px 0; background: rgba(118,224,192,.045); color: #c7e4d8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; }
.science-footnote { color: #76958a; }
.affiliation-note { padding-top: 8px; border-top: 1px solid var(--line); color: #8aa49a; font-style: italic; }
.panel-footer { padding-top: 9px; border-top: 1px solid var(--line); color: #536d66; font-size: 7px; letter-spacing: .03em; }
.panel-footer span { padding: 0 5px; color: #71968a; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1fr) 390px; } .stage-panel { padding: 22px; } }
@media (max-width: 900px) and (min-width: 701px) { .workspace { grid-template-columns: minmax(0, 1fr) 320px; padding: 10px; gap: 10px; } .stage-panel { padding: 14px; } .control-panel { padding: 13px; } .caption-kicker { flex-basis: 110px; } }
@media (max-width: 700px) {
  .topbar { height: 64px; flex-basis: 64px; padding: 0 13px; }
  .brand-lockup { gap: 10px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; }
  .topbar .eyebrow { font-size: 7px; }
  .topbar h1 { font-size: 13px; }
  .top-meta { gap: 0; }
  .model-tag { height: 23px; padding: 0 7px; font-size: 7px; }
  .seed-tag { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(320px, 45dvh) minmax(580px, auto); gap: 9px; padding: 9px; min-height: calc(100vh - 64px); }
  .stage-panel { padding: 11px; gap: 7px; border-radius: 13px; }
  .stage-heading { min-height: 32px; }
  .stage-heading h2 { font-size: 15px; }
  .stage-heading .eyebrow { font-size: 7px; }
  .stage-legend { gap: 8px; font-size: 8px; }
  .stage-legend span { gap: 4px; }
  .legend-dot { width: 6px; height: 6px; }
  .canvas-frame { min-height: 190px; border-radius: 10px; }
  .canvas-stamp { top: 8px; left: 9px; font-size: 7px; }
  .caption-row { gap: 8px; min-height: 37px; padding-top: 2px; }
  .caption-kicker { flex-basis: 91px; font-size: 7px; }
  .caption-row p { font-size: 9px; line-height: 1.4; }
  .transport-bar { min-height: 39px; padding-top: 7px; gap: 5px; }
  .transport-actions { gap: 5px; }
  .primary-button, .quiet-button { min-height: 29px; font-size: 9px; padding: 0 8px; gap: 6px; }
  .icon-button { width: 29px; padding: 0; font-size: 15px; }
  .transport-readout span { font-size: 6px; }
  .transport-readout strong { font-size: 12px; }
  .speed-control { padding: 2px; }
  .speed-option { height: 21px; min-width: 25px; font-size: 8px; }
  .control-panel { padding: 14px; gap: 13px; border-radius: 13px; overflow: visible; }
  .panel-title-row h2 { font-size: 15px; }
  .panel-hint { font-size: 9px; }
  .preset-button { padding: 8px 7px; gap: 6px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .preset-icon { flex-basis: 22px; width: 22px; height: 22px; }
  .slider-control { margin-bottom: 10px; }
  .slider-heading label { font-size: 10px; }
  .slider-heading output { font-size: 8px; }
  .readout-card strong { font-size: 17px; }
  .science-content { font-size: 9px; }
  body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  body.embed-mode .workspace { height: calc(100vh - 64px); height: calc(100dvh - 64px); min-height: 0; grid-template-rows: minmax(300px, 45% ) minmax(0, 1fr); }
  body.embed-mode .control-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 390px) {
  .topbar { padding: 0 10px; }
  .brand-mark { display: none; }
  .topbar h1 { font-size: 12px; }
  .model-tag { font-size: 6px; }
  .workspace { padding: 7px; gap: 7px; }
  .stage-panel { padding: 9px; }
  .stage-legend { font-size: 7px; }
  .caption-kicker { flex-basis: 80px; }
  .caption-row p { font-size: 8px; }
  .transport-readout { display: none; }
  .transport-bar { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
