:root {
  color-scheme: dark;
  --bg: #080d10;
  --panel: #10181c;
  --panel-2: #131e22;
  --line: rgba(176, 197, 188, .12);
  --line-strong: rgba(176, 197, 188, .22);
  --text: #e9eee8;
  --muted: #879590;
  --dim: #586761;
  --accent: #b8d38b;
  --accent-2: #e0b879;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 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); font-family: var(--sans); }
body { min-height: 100vh; overflow: hidden; font-size: 13px; letter-spacing: .01em; }
button, input, select { font: inherit; }
button { color: inherit; }
.topbar { height: 66px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #0a1114; position: relative; z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 32px; height: 32px; border: 1px solid rgba(184,211,139,.45); color: var(--accent); display: grid; place-items: center; font: 600 16px Georgia, serif; transform: rotate(45deg); }
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand-name { font-size: 11px; font-weight: 750; letter-spacing: .14em; color: #e4e9e3; }
.brand-name span { color: #73827c; font-weight: 500; }
.brand-subtitle { margin-top: 4px; color: #67766f; font-size: 8px; letter-spacing: .2em; }
.topbar-meta { display: flex; align-items: center; gap: 16px; color: #aab6af; font: 10px var(--mono); letter-spacing: .08em; }
.seed-chip { display: inline-flex; align-items: center; gap: 8px; }
.live-dot, .status-dot, .hud-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(184,211,139,.45); }
.topbar-divider { height: 18px; width: 1px; background: var(--line-strong); }
.category-label { color: #81918a; }
.meta-index { color: var(--accent); margin-left: 8px; }
.workspace { height: calc(100vh - 66px); padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 14px; min-height: 0; }
.stage-shell { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: #0c1417; overflow: hidden; }
.stage-head { height: 44px; flex: 0 0 44px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(14,22,25,.94); }
.stage-kicker { color: #9eaaa3; font: 9px var(--mono); letter-spacing: .12em; display: flex; align-items: center; gap: 8px; }
.eyebrow-line { width: 17px; height: 1px; background: var(--accent); }
.stage-separator { color: #47564f; }
.stage-actions { display: flex; align-items: center; gap: 7px; }
.icon-button, .quality-button { border: 1px solid var(--line-strong); background: rgba(255,255,255,.02); color: #9ca9a1; height: 28px; border-radius: 4px; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.icon-button { width: 30px; font-size: 17px; line-height: 1; }
.quality-button { padding: 0 10px; font: 9px var(--mono); letter-spacing: .08em; }
.icon-button:hover, .quality-button:hover { color: var(--accent); border-color: rgba(184,211,139,.5); }
.viewport-wrap { position: relative; flex: 1; min-height: 300px; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #20312d 0%, #111c1d 46%, #0b1215 100%); }
#scene { width: 100%; height: 100%; display: block; outline: none; }
.scene-vignette { pointer-events: none; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,10,12,.26), transparent 18%, transparent 65%, rgba(5,10,12,.52)); }
.scene-hud { position: absolute; top: 16px; z-index: 2; display: flex; gap: 7px; align-items: center; pointer-events: none; }
.hud-left { left: 16px; }
.hud-right { right: 16px; }
.hud-tag { padding: 6px 8px; border: 1px solid rgba(211,226,211,.13); border-radius: 3px; background: rgba(9,16,18,.65); color: #c1cfc5; font: 8px var(--mono); letter-spacing: .12em; backdrop-filter: blur(8px); }
.hud-dot { width: 5px; height: 5px; margin-right: 5px; }
.muted-tag { color: #7f9188; }
.north-indicator { width: 24px; height: 24px; border: 1px solid rgba(211,226,211,.22); border-radius: 50%; display: grid; place-items: center; color: #aab7ae; font: 9px var(--mono); background: rgba(9,16,18,.55); }
.north-indicator i { position: absolute; width: 1px; height: 9px; margin-top: -18px; background: var(--accent); }
.annotations { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.annotation { position: absolute; display: flex; align-items: center; gap: 6px; padding: 5px 7px; color: #e2d4ae; background: rgba(12,18,18,.78); border: 1px solid rgba(218,187,126,.25); border-radius: 3px; font: 8px var(--mono); letter-spacing: .1em; white-space: nowrap; transform: translate(-50%,-50%); box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.annotation-pin { width: 5px; height: 5px; background: var(--accent-2); border-radius: 50%; box-shadow: 0 0 8px rgba(224,184,121,.7); }
.scene-caption { position: absolute; left: 17px; bottom: 105px; color: rgba(190,203,193,.62); font: 8px var(--mono); letter-spacing: .11em; pointer-events: none; }
.caption-mark { display: inline-block; width: 7px; height: 7px; border: 1px solid var(--accent); transform: rotate(45deg); margin-right: 6px; }
.caption-divider { margin: 0 6px; color: #5f7068; }
.readout-strip { position: absolute; left: 14px; right: 14px; bottom: 14px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; background: rgba(180,202,188,.14); border: 1px solid rgba(180,202,188,.15); border-radius: 5px; overflow: hidden; backdrop-filter: blur(12px); }
.readout { min-height: 69px; padding: 11px 12px 9px; background: rgba(10,17,19,.88); }
.readout-label { display: block; color: #82928a; font: 8px var(--mono); letter-spacing: .1em; white-space: nowrap; }
.readout-label i { color: #c3b080; font-style: normal; font-size: 7px; margin-left: 3px; }
.readout strong { display: block; margin-top: 8px; font: 500 19px var(--mono); color: #e5eee3; letter-spacing: -.04em; }
.readout strong small { color: #9cac9f; font: 10px var(--mono); letter-spacing: 0; }
.stage-foot { height: 36px; flex: 0 0 36px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; background: #0d1518; border-top: 1px solid var(--line); }
.cause-chain { display: flex; align-items: center; gap: 9px; color: #82928a; font: 8px var(--mono); letter-spacing: .08em; }
.chain-step b { color: var(--accent); font-weight: 500; margin-right: 4px; }
.chain-arrow { color: #52635a; }
.drag-hint { color: #64746c; font: 8px var(--mono); letter-spacing: .12em; }
.drag-icon { color: var(--accent); margin-right: 5px; font-size: 12px; }
.sidebar { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #34443d transparent; }
.panel { border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(145deg, rgba(18,28,31,.98), rgba(13,21,24,.98)); padding: 14px; }
.intro-panel { padding: 16px 15px 13px; }
.panel-kicker { color: #8e9d94; font: 8px var(--mono); letter-spacing: .16em; }
.kicker-index { float: right; color: #596b61; }
h1 { margin: 9px 0 7px; font-size: 27px; font-weight: 520; letter-spacing: -.055em; line-height: 1; }
h1 em { color: var(--accent); font-family: Georgia, serif; font-weight: 400; }
.intro-copy { color: #9aa79f; font-size: 11px; line-height: 1.55; margin: 0; max-width: 300px; }
.status-line { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; color: #b5c49f; font: 8px var(--mono); letter-spacing: .08em; }
.status-dot { width: 5px; height: 5px; }
.scale-note { color: #a68e67; font: 7px var(--mono); letter-spacing: .1em; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.section-heading h2 { margin: 0; color: #d0d9d1; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.section-code { color: #64756b; font: 8px var(--mono); }
.controls-panel { padding-bottom: 10px; }
.control-row { margin-bottom: 12px; }
.control-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; gap: 10px; }
.control-title label { color: #b9c4bc; font-size: 10px; }
.control-title output { color: var(--accent); font: 9px var(--mono); white-space: nowrap; }
input[type="range"] { width: 100%; height: 3px; margin: 0; appearance: none; background: linear-gradient(90deg, #9ebd7e 0%, #9ebd7e 50%, #34433d 50%, #34433d 100%); border-radius: 10px; outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; border-radius: 50%; background: #d5e5b8; border: 2px solid #1b2a24; box-shadow: 0 0 0 1px rgba(184,211,139,.45); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; background: #d5e5b8; border: 2px solid #1b2a24; box-shadow: 0 0 0 1px rgba(184,211,139,.45); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(184,211,139,.22); }
.range-ends { display: flex; justify-content: space-between; margin-top: 6px; color: #63736b; font: 7px var(--mono); }
.last-control { margin-bottom: 0; }
.experiment-panel { padding-bottom: 12px; }
.preset-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.preset-button { min-height: 57px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 7px 8px; text-align: left; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.015); cursor: pointer; transition: .2s ease; }
.preset-button:hover, .preset-button.active { border-color: rgba(184,211,139,.45); background: rgba(184,211,139,.06); }
.preset-glyph { color: var(--accent); font-size: 14px; line-height: 1; }
.preset-button b { display: block; color: #bdc8bf; font-size: 8px; font-weight: 600; white-space: nowrap; }
.preset-button small { display: block; color: #69786f; font-size: 7px; margin-top: 3px; white-space: nowrap; }
.transport-row { display: grid; grid-template-columns: 1.1fr 1fr .72fr; gap: 6px; margin-top: 11px; }
.play-button, .transport-button { min-height: 31px; border-radius: 4px; cursor: pointer; font: 8px var(--mono); letter-spacing: .1em; transition: .2s ease; }
.play-button { border: 1px solid rgba(184,211,139,.5); background: rgba(184,211,139,.12); color: #d8e7c1; display: flex; align-items: center; justify-content: center; gap: 7px; }
.play-button:hover { background: rgba(184,211,139,.2); }
.play-symbol { font-size: 11px; }
.transport-button { border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); color: #aebbb1; }
.transport-button:hover { border-color: rgba(184,211,139,.4); color: var(--accent); }
.transport-button span { color: #6f7f76; font-size: 7px; letter-spacing: 0; }
.speed-row { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; }
.speed-row label { color: #83938a; font: 8px var(--mono); letter-spacing: .1em; }
.speed-row select { min-width: 67px; border: 1px solid var(--line-strong); border-radius: 3px; padding: 5px 7px; background: #172226; color: #c8d5ca; font: 9px var(--mono); }
.speed-note { margin-left: auto; color: #64746c; font: 7px var(--mono); }
.science-panel { padding: 0; }
.science-panel summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; margin-top: 4px; color: #d5ded5; font-size: 10px; letter-spacing: .13em; }
.summary-plus { color: var(--accent); font-size: 17px; transition: transform .2s; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.science-lead { color: #a4b0a6; font-size: 10px; line-height: 1.55; margin: 12px 0; }
.equation-block { padding: 9px 10px; margin: 7px 0; border: 1px solid rgba(184,211,139,.12); border-radius: 4px; background: rgba(184,211,139,.035); }
.equation-label { display: block; color: #8d9c8c; font: 7px var(--mono); letter-spacing: .12em; margin-bottom: 6px; }
.equation { color: #d2dfc4; font: 12px Georgia, serif; line-height: 1.5; overflow-wrap: anywhere; }
.variable-list { display: grid; gap: 6px; padding: 9px 1px; }
.variable-list div { display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: baseline; }
.variable-list b { color: var(--accent); font: 10px Georgia, serif; }
.variable-list span { color: #89978e; font-size: 9px; }
.validation-card { padding: 10px; margin-top: 5px; border: 1px solid rgba(184,211,139,.2); border-radius: 4px; background: rgba(184,211,139,.045); }
.validation-head { display: flex; align-items: center; justify-content: space-between; color: #b9c8aa; font: 7px var(--mono); letter-spacing: .12em; }
.validation-status { color: #d4bb88; }
.validation-card p { color: #89978e; font-size: 9px; line-height: 1.45; margin: 7px 0 9px; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.validation-values small { display: block; color: #6e8074; font: 6px var(--mono); letter-spacing: .08em; }
.validation-values b { display: block; color: #d8e3d2; font: 9px var(--mono); margin-top: 4px; }
.validation-note { display: block; color: #728176; font: 7px var(--mono); margin-top: 9px; }
.limitations { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.limitations b { color: #c7b38d; font: 7px var(--mono); letter-spacing: .12em; }
.limitations p { color: #829088; font-size: 9px; line-height: 1.55; margin: 6px 0 0; }
.disclaimer { color: #627168; font-size: 8px; line-height: 1.45; padding: 2px 4px 8px; }
.webgl-fallback { position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: rgba(8,13,16,.94); }
.webgl-fallback[hidden], .context-notice[hidden] { display: none; }
.fallback-icon { color: var(--accent); font-size: 32px; }
.webgl-fallback h2 { margin: 10px 0 5px; font-size: 18px; font-weight: 500; }
.webgl-fallback p { max-width: 390px; color: #94a29a; font-size: 11px; line-height: 1.6; }
.context-notice { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 5; padding: 8px 12px; border: 1px solid rgba(224,184,121,.3); border-radius: 3px; background: rgba(35,25,15,.88); color: #e0bf8f; font: 8px var(--mono); letter-spacing: .08em; }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0,1fr) 330px; }
  .readout { padding-left: 9px; padding-right: 8px; }
  .readout-label { font-size: 7px; }
  .cause-chain { gap: 6px; font-size: 7px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .topbar { height: 58px; padding: 0 14px; }
  .brand-subtitle { font-size: 7px; }
  .topbar-meta { gap: 9px; font-size: 8px; }
  .workspace { height: auto; min-height: calc(100vh - 58px); display: flex; flex-direction: column; padding: 9px; gap: 9px; }
  .stage-shell { height: min(58vh, 560px); min-height: 410px; flex: 0 0 auto; }
  .stage-head { height: 38px; flex-basis: 38px; padding: 0 9px; }
  .stage-kicker { font-size: 7px; gap: 5px; }
  .icon-button { height: 25px; width: 27px; }
  .quality-button { height: 25px; font-size: 8px; }
  .viewport-wrap { min-height: 0; }
  .readout-strip { left: 8px; right: 8px; bottom: 8px; }
  .readout { min-height: 59px; padding: 8px 6px; }
  .readout-label { font-size: 6px; white-space: normal; line-height: 1.3; min-height: 16px; }
  .readout strong { font-size: 15px; margin-top: 5px; }
  .readout strong small { font-size: 8px; }
  .scene-caption { bottom: 83px; left: 10px; font-size: 7px; }
  .stage-foot { padding: 0 8px; }
  .cause-chain { font-size: 6px; gap: 4px; }
  .chain-step b { margin-right: 2px; }
  .drag-hint { font-size: 6px; }
  .sidebar { overflow: visible; display: grid; grid-template-columns: 1fr; gap: 9px; }
  .panel { padding: 13px; }
  .intro-panel { padding: 14px; }
  .intro-copy { max-width: 520px; }
  .controls-panel { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .controls-panel .section-heading { grid-column: 1 / -1; }
  .control-row { margin-bottom: 14px; }
  .last-control { margin-bottom: 0; }
  .experiment-panel { padding: 13px; }
  .science-panel { padding: 0; }
  .disclaimer { padding-bottom: 12px; }
}
@media (max-width: 480px) {
  .topbar { height: 54px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-name { font-size: 9px; }
  .brand-subtitle { letter-spacing: .12em; }
  .topbar-divider, .category-label { display: none; }
  .topbar-meta { font-size: 8px; }
  .workspace { min-height: calc(100vh - 54px); padding: 7px; }
  .stage-shell { height: 49vh; min-height: 360px; }
  .stage-kicker { font-size: 6px; letter-spacing: .08em; }
  .eyebrow-line { width: 9px; }
  .stage-actions { gap: 4px; }
  .icon-button { width: 25px; }
  .quality-button { padding: 0 6px; font-size: 7px; }
  .hud-left { left: 8px; top: 9px; }
  .hud-right { right: 8px; top: 9px; }
  .hud-tag { font-size: 6px; padding: 5px 6px; }
  .north-indicator { width: 20px; height: 20px; font-size: 7px; }
  .readout-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .readout { min-height: 48px; padding: 6px 8px; }
  .readout-label { font-size: 6px; min-height: 11px; }
  .readout strong { font-size: 14px; margin-top: 2px; }
  .scene-caption { bottom: 112px; font-size: 6px; }
  .stage-foot { height: 30px; flex-basis: 30px; }
  .cause-chain { gap: 3px; font-size: 5px; letter-spacing: .03em; }
  .chain-arrow { font-size: 7px; }
  .drag-hint { display: none; }
  .controls-panel { grid-template-columns: 1fr; }
  .controls-panel .section-heading { grid-column: auto; }
  .control-row { margin-bottom: 13px; }
  .preset-button { min-height: 54px; padding: 6px; }
  .preset-button b { font-size: 7px; }
  .preset-button small { font-size: 6px; }
  .annotation { font-size: 6px; }
}
@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 .topbar, body.embed .sidebar { display: none; }
body.embed .workspace { height: 100vh; padding: 0; display: block; }
body.embed .stage-shell { height: 100vh; border: 0; border-radius: 0; }
