:root {
  color-scheme: dark;
  --bg: #07121a;
  --panel: #0c1a24;
  --panel-2: #10212c;
  --panel-3: #132733;
  --line: rgba(153, 190, 199, .14);
  --line-strong: rgba(153, 190, 199, .24);
  --text: #e7f0ed;
  --muted: #8ca4a7;
  --dim: #60777d;
  --mint: #78e0c5;
  --cyan: #6ac7d4;
  --sand: #e5bf83;
  --orange: #e7a36f;
  --danger: #ee8b74;
  --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; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; background: radial-gradient(ellipse at 42% 8%, rgba(27, 66, 72, .22), transparent 48%), var(--bg); }
.topbar { height: 72px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(7, 18, 26, .96); position: relative; z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 270px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(120,224,197,.32); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); background: rgba(120,224,197,.07); }
.brand-mark span { display: block; width: 4px; border-radius: 5px; background: var(--mint); transform: skewY(-24deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .75; }
.eyebrow { color: #6d9698; font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.2; }
.brand-copy h1 { margin: 4px 0 0; font-size: 16px; font-weight: 650; letter-spacing: -.035em; line-height: 1; }
.brand-copy h1 span { color: #89a3a6; font-weight: 450; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.transport-group { display: flex; align-items: center; gap: 6px; }
.action-button, .icon-button { height: 36px; border: 1px solid var(--line-strong); background: rgba(17, 37, 48, .8); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 11px; color: #b9cbca; font-size: 11px; font-weight: 650; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.action-button:hover, .icon-button:hover { background: #19313d; border-color: rgba(120,224,197,.42); color: #eaf8f2; }
.action-button:active, .icon-button:active { transform: translateY(1px); }
.action-button.primary { background: #173b3c; border-color: rgba(120,224,197,.45); color: #a9f1d9; min-width: 88px; }
.action-button.primary:hover { background: #1d4c49; }
.button-icon { font-size: 14px; line-height: 1; color: var(--mint); }
.action-divider { width: 1px; height: 24px; background: var(--line-strong); margin: 0 5px; }
.icon-button { width: 38px; padding: 0; position: relative; }
.icon-button > span { font-size: 18px; color: #9ab9b6; }
.icon-button small { position: absolute; bottom: 3px; right: 4px; font-size: 6px; color: var(--mint); font-weight: 800; letter-spacing: .08em; }
.export-button { border-color: rgba(120,224,197,.25); color: #a7d6c9; background: rgba(28, 63, 61, .45); margin-left: 2px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 344px; min-height: 560px; height: calc(100vh - 72px - 56px - 30px); max-height: 850px; border-bottom: 1px solid var(--line); }
.stage-panel { min-width: 0; min-height: 0; padding: 12px; background: #07151d; }
.scene-wrap { height: 100%; width: 100%; min-height: 420px; position: relative; overflow: hidden; border: 1px solid rgba(134, 182, 183, .18); border-radius: 13px; background: radial-gradient(ellipse at 50% 40%, #173039, #081820 72%); box-shadow: 0 16px 42px rgba(0,0,0,.22), inset 0 0 0 1px rgba(255,255,255,.015); }
#sceneCanvas { width: 100%; height: 100%; display: block; outline: none; }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(4,13,18,.48), transparent 22%, transparent 72%, rgba(4,13,18,.52)), linear-gradient(90deg, rgba(4,13,18,.16), transparent 20%, transparent 80%, rgba(4,13,18,.12)); }
.scene-topline { position: absolute; top: 15px; left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; z-index: 2; pointer-events: none; }
.scene-kicker, .scene-coordinates { font-size: 8px; font-weight: 800; letter-spacing: .13em; color: #a5c0bd; text-shadow: 0 1px 8px #061116; }
.scene-kicker { display: flex; align-items: center; gap: 8px; }
.live-dot, .status-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px rgba(120,224,197,.65); display: inline-block; }
.live-dot.paused { background: var(--sand); box-shadow: 0 0 9px rgba(229,191,131,.5); }
.kicker-divider { color: #52747a; }
.scene-coordinates { color: #79999a; font-weight: 600; letter-spacing: .09em; }
.scene-coordinates strong { color: #c5d9d3; font-weight: 750; }
.scene-coordinates span { padding: 0 5px; color: #486a70; }
.metric-strip { position: absolute; z-index: 2; top: 48px; left: 16px; display: grid; grid-template-columns: repeat(4, minmax(106px, 1fr)); gap: 7px; max-width: 590px; pointer-events: none; }
.metric-card { padding: 9px 11px 8px; border: 1px solid rgba(155,197,194,.14); border-radius: 8px; background: rgba(7,20,27,.76); backdrop-filter: blur(10px); min-width: 0; }
.metric-label { display: block; color: #759397; font-size: 7px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.metric-card strong { display: block; margin-top: 5px; font-size: 17px; font-weight: 650; letter-spacing: -.045em; color: #e0f0e9; font-variant-numeric: tabular-nums; }
.metric-card strong small { font-size: 9px; font-weight: 500; color: #91aaa8; letter-spacing: 0; }
.metric-note { display: block; margin-top: 1px; color: #617b7e; font-size: 8px; }
.annotation-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.scene-annotation { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: rgba(215,235,226,.88); font-size: 8px; font-weight: 800; letter-spacing: .13em; white-space: nowrap; text-shadow: 0 2px 6px #07131a, 0 0 12px #07131a; transform: translate(-50%, -50%); }
.annotation-line { display: block; width: 1px; height: 18px; margin-left: 2px; background: linear-gradient(180deg, rgba(120,224,197,.9), rgba(120,224,197,0)); }
.scene-annotation.accent { color: #f0c28b; }
.scene-annotation.accent .annotation-line { background: linear-gradient(180deg, #f0b878, transparent); }
.scene-annotation.new-route { color: #92e4d4; }
.scene-annotation.new-route .annotation-line { background: linear-gradient(180deg, #71e0ca, transparent); }
.scene-annotation.quiet { color: #9cb7a8; opacity: .8; }
.scene-bottomline { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.stage-status { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(150,193,185,.18); border-radius: 8px; background: rgba(7,20,27,.78); backdrop-filter: blur(8px); color: #b6d1c8; font-size: 9px; font-weight: 650; }
.status-indicator { background: var(--sand); box-shadow: 0 0 9px rgba(229,191,131,.5); }
.status-indicator.active { background: var(--mint); box-shadow: 0 0 9px rgba(120,224,197,.6); }
.simulation-clock { display: flex; align-items: center; gap: 8px; color: #88a3a2; font-size: 8px; font-weight: 750; letter-spacing: .1em; text-shadow: 0 1px 8px #061116; }
.simulation-clock strong { color: #e0eee8; font-size: 12px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.clock-divider { color: #4c7377; }
.context-hint { position: absolute; right: 17px; top: 50%; transform: translateY(-50%); z-index: 2; color: rgba(171,205,198,.52); font-size: 7px; font-weight: 800; letter-spacing: .12em; writing-mode: vertical-rl; pointer-events: none; }
.mouse-icon { font-size: 13px; margin-bottom: 6px; }
.webgl-message { position: absolute; z-index: 8; inset: 0; background: rgba(5,15,21,.88); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; text-align: center; padding: 24px; }
.webgl-message[hidden] { display: none; }
.webgl-message strong { font-size: 14px; color: #f0c28b; }
.webgl-message span { max-width: 300px; color: #9cb5b4; font-size: 11px; line-height: 1.6; }
.control-rail { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: linear-gradient(180deg, #0d1c26, #0a1821); border-left: 1px solid var(--line); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #29434c transparent; }
.rail-heading { padding: 18px 18px 14px; display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid var(--line); }
.rail-heading h2 { margin: 5px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -.035em; }
.rail-tag { border: 1px solid rgba(120,224,197,.2); border-radius: 5px; padding: 4px 6px; color: #8ec7b8; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.preset-section, .control-section { padding: 14px 17px 13px; border-bottom: 1px solid var(--line); }
.section-label { display: flex; justify-content: space-between; align-items: center; color: #7e9a9d; font-size: 8px; font-weight: 850; letter-spacing: .13em; margin-bottom: 10px; }
.micro-note { color: #4f7479; font-size: 7px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset-card { min-width: 0; height: 67px; padding: 7px 6px 6px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; border: 1px solid rgba(147,186,185,.14); border-radius: 8px; background: rgba(17,37,47,.65); text-align: left; cursor: pointer; transition: .18s ease; }
.preset-card:hover { border-color: rgba(120,224,197,.36); background: rgba(24,52,59,.8); }
.preset-card.selected { border-color: rgba(120,224,197,.52); background: linear-gradient(135deg, rgba(35,80,74,.6), rgba(18,45,51,.8)); box-shadow: inset 0 0 0 1px rgba(120,224,197,.06); }
.preset-glyph { font-size: 15px; line-height: 1; color: #85d8c2; }
.threshold-glyph { color: #e8bd84; }
.rapid-glyph { color: #ee987b; }
.preset-card strong { font-size: 9px; font-weight: 700; color: #d8e7e1; white-space: nowrap; }
.preset-card small { font-size: 7px; color: #799398; }
.control-section { padding-top: 13px; }
.range-control { margin: 0 0 13px; }
.range-control:last-child { margin-bottom: 0; }
.range-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.range-heading label { color: #c1d1cb; font-size: 9px; font-weight: 600; }
.range-heading output { color: #8ed7c2; font-size: 9px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; width: 100%; height: 4px; border-radius: 8px; background: linear-gradient(90deg, #4eaa96 0%, #347d7c 48%, #263f49 48%, #263f49 100%); outline: none; display: block; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #b8f1dc; border: 2px solid #225c55; box-shadow: 0 0 0 3px rgba(120,224,197,.1); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #b8f1dc; border: 2px solid #225c55; box-shadow: 0 0 0 3px rgba(120,224,197,.1); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(120,224,197,.2); }
.range-limits { display: flex; justify-content: space-between; margin-top: 5px; color: #5f7a80; font-size: 7px; font-variant-numeric: tabular-nums; }
.speed-control { padding-top: 10px; border-top: 1px solid rgba(153,190,199,.1); }
.rail-footer { margin-top: auto; padding: 13px 17px 15px; background: rgba(5,15,21,.28); }
.progress-head { display: flex; align-items: center; justify-content: space-between; color: #7e9a9d; font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.progress-head strong { color: #a9e5d2; font-size: 9px; font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; background: #213841; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress-track span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #4ba58f, #b2e7c9); border-radius: inherit; transition: width .25s ease; }
.footer-readouts { display: flex; justify-content: space-between; gap: 8px; margin-top: 11px; color: #617c80; font-size: 7px; font-weight: 750; letter-spacing: .08em; }
.footer-readouts strong { display: block; margin-top: 3px; color: #b8cdc5; font-size: 10px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.science-section { border-bottom: 1px solid var(--line); background: #091720; }
.science-section details { width: 100%; }
.science-section summary { list-style: none; min-height: 54px; display: flex; align-items: center; gap: 11px; padding: 0 22px; cursor: pointer; user-select: none; }
.science-section summary::-webkit-details-marker { display: none; }
.science-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(120,224,197,.09); border: 1px solid rgba(120,224,197,.2); color: #9be4cf; font-size: 13px; }
.science-title { color: #dcebe4; font-size: 11px; font-weight: 700; }
.science-subtitle { color: #718b8f; font-size: 9px; }
.summary-chevron { margin-left: auto; color: #83aaa6; font-size: 16px; transition: transform .2s ease; }
.science-section details[open] .summary-chevron { transform: rotate(180deg); }
.science-content { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; border-top: 1px solid var(--line); }
.science-column { padding: 18px 20px 16px; border-right: 1px solid var(--line); }
.science-column:last-child { border-right: 0; }
.science-kicker { color: #75b6a6; font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.science-column h3 { margin: 8px 0 7px; font-size: 12px; font-weight: 650; color: #dce9e3; }
.science-column p { margin: 0; color: #8aa2a2; font-size: 9px; line-height: 1.55; }
.equation { margin-top: 11px; padding: 9px 10px; background: rgba(17,40,48,.72); border: 1px solid rgba(126,179,172,.12); border-radius: 6px; color: #c4e9dc; font-family: Georgia, serif; font-size: 13px; text-align: center; }
.variable-list { display: grid; gap: 4px; margin-top: 9px; }
.variable-list span { color: #759093; font-size: 8px; }
.variable-list b { color: #c0d9cf; font-family: Georgia, serif; font-weight: 600; }
.validation-column { background: rgba(22,53,54,.18); }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 12px; }
.validation-values div { min-width: 0; padding: 8px 6px; background: rgba(9,26,32,.7); border-radius: 5px; }
.validation-values span { display: block; color: #668b87; font-size: 6px; font-weight: 850; letter-spacing: .1em; }
.validation-values strong { display: block; margin-top: 5px; color: #d0eee0; font-size: 10px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.validation-tag { display: inline-block; margin-top: 9px; color: #79b5a3; font-size: 6px; font-weight: 850; letter-spacing: .1em; }
.assumptions { display: flex; gap: 13px; padding: 12px 20px 14px; border-top: 1px solid var(--line); color: #6f898d; font-size: 8px; line-height: 1.55; }
.assumptions strong { flex: 0 0 auto; color: #9bb7ad; font-size: 7px; letter-spacing: .12em; }
.app-footer { min-height: 30px; padding: 8px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #536e75; font-size: 7px; font-weight: 750; letter-spacing: .11em; }
.app-footer span:nth-child(2) { color: #627b7e; font-weight: 500; letter-spacing: .015em; }
button:focus-visible, summary:focus-visible { outline: 2px solid #8ee5cc; outline-offset: 3px; }
body.embed .topbar, body.embed .science-section, body.embed .app-footer { display: none; }
body.embed .workspace { height: 100vh; min-height: 100vh; }
body.embed .stage-panel { padding: 0; }
body.embed .scene-wrap { border: 0; border-radius: 0; }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; }
  .topbar { padding: 0 16px; }
  .brand-lockup { min-width: 220px; }
  .export-button span:last-child { display: none; }
  .metric-strip { max-width: 500px; }
  .metric-card { padding: 8px 9px; }
  .metric-card strong { font-size: 15px; }
}
@media (max-width: 780px) {
  .topbar { height: auto; min-height: 72px; padding: 12px 14px; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .brand-lockup { min-width: 0; flex: 1 1 100%; }
  .top-actions { width: 100%; justify-content: space-between; }
  .transport-group { flex: 1; }
  .action-button { height: 33px; padding: 0 9px; }
  .action-divider { margin: 0 2px; }
  .workspace { display: flex; flex-direction: column; height: auto; max-height: none; min-height: 0; }
  .stage-panel { padding: 8px; height: 48vh; min-height: 360px; max-height: 520px; }
  .scene-wrap { min-height: 0; }
  .control-rail { border-left: 0; border-top: 1px solid var(--line); max-height: none; overflow: visible; }
  .rail-heading { padding: 14px 16px 11px; }
  .preset-section, .control-section { padding-left: 16px; padding-right: 16px; }
  .control-section { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 18px; }
  .control-section > .section-label { grid-column: 1 / -1; }
  .range-control { margin-bottom: 15px; }
  .rail-footer { padding: 12px 16px; }
  .science-content { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .science-column:nth-child(2) { border-right: 0; }
  .science-column:nth-child(1), .science-column:nth-child(2) { border-bottom: 1px solid var(--line); }
  .science-subtitle { display: none; }
  .app-footer { flex-wrap: wrap; justify-content: center; text-align: center; }
}
@media (max-width: 480px) {
  .brand-copy h1 { font-size: 15px; }
  .top-actions { gap: 5px; }
  .action-button { font-size: 10px; gap: 5px; padding: 0 7px; }
  .action-button.primary { min-width: 76px; }
  .export-button { min-width: 34px; width: 34px; padding: 0; }
  .export-button span:last-child { display: none; }
  .icon-button { width: 33px; height: 33px; }
  .stage-panel { height: 44vh; min-height: 330px; padding: 6px; }
  .scene-topline { top: 10px; left: 10px; right: 10px; }
  .scene-kicker { font-size: 6px; gap: 5px; }
  .scene-coordinates { font-size: 6px; }
  .metric-strip { top: 37px; left: 9px; right: 9px; grid-template-columns: repeat(2,minmax(0,1fr)); max-width: none; gap: 5px; }
  .metric-card { padding: 6px 8px; }
  .metric-label { font-size: 6px; }
  .metric-card strong { font-size: 14px; margin-top: 3px; }
  .metric-note { display: none; }
  .scene-bottomline { left: 9px; right: 9px; bottom: 9px; align-items: flex-end; }
  .stage-status { padding: 7px 8px; font-size: 8px; max-width: 62%; }
  .simulation-clock { gap: 5px; font-size: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 35%; }
  .simulation-clock strong { font-size: 10px; }
  .context-hint { display: none; }
  .control-section { grid-template-columns: 1fr; }
  .preset-card { height: 62px; }
  .science-section summary { padding: 0 14px; }
  .science-content { grid-template-columns: 1fr; }
  .science-column { border-right: 0; border-bottom: 1px solid var(--line); padding: 15px; }
  .science-column:last-child { border-bottom: 0; }
  .assumptions { flex-direction: column; gap: 5px; padding: 12px 15px; }
  .app-footer { padding: 10px; font-size: 6px; }
  .app-footer span:nth-child(2) { flex-basis: 100%; order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
