:root {
  color-scheme: dark;
  --bg: #08131c;
  --panel: #0e1d28;
  --panel-2: #122431;
  --line: rgba(173, 205, 211, 0.12);
  --line-strong: rgba(173, 205, 211, 0.2);
  --text: #e6f0ed;
  --muted: #91a9ad;
  --muted-2: #6e888e;
  --teal: #70d5ca;
  --teal-bright: #9ce8dc;
  --amber: #e8bc78;
  --danger: #ef9a82;
  --radius: 14px;
  --space: 8px;
  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 { min-height: 100vh; background: radial-gradient(ellipse at 45% -20%, #173342 0, #0a1822 44%, #07121a 100%); font-size: 13px; letter-spacing: 0.01em; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 18, 26, 0.72); }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(112,213,202,.35); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); }
.brand-mark span { display: block; width: 4px; border-radius: 8px; background: var(--teal); transform: skew(-18deg); }
.brand-mark span:nth-child(1) { height: 11px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 14px; opacity: .75; }
.eyebrow { font-size: 9px; font-weight: 800; letter-spacing: .17em; color: var(--muted-2); }
h1 { margin: 3px 0 0; font-size: 19px; line-height: 1; font-weight: 650; letter-spacing: -.035em; }
h1 span { color: #9cb6b8; font-weight: 450; }
.top-meta { display: flex; align-items: center; gap: 20px; }
.live-pill, .seed-label { font-size: 9px; font-weight: 800; letter-spacing: .12em; color: #9bb2b4; }
.live-pill { display: flex; align-items: center; gap: 7px; }
.live-pill i, .scene-dot, .status-led { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px rgba(112,213,202,.7); }
.seed-label { border-left: 1px solid var(--line-strong); padding-left: 18px; }
.seed-label b { color: var(--teal-bright); margin-left: 5px; }
.workspace { display: grid; grid-template-columns: 264px minmax(420px, 1fr) 274px; gap: 12px; padding: 14px 16px 10px; align-items: stretch; max-width: 1800px; margin: 0 auto; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(18,36,49,.97), rgba(11,26,36,.97)); box-shadow: 0 16px 36px rgba(0,0,0,.15); padding: 16px 15px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-heading h2 { font-size: 15px; font-weight: 620; margin: 4px 0 0; letter-spacing: -.02em; }
.panel-heading-meta { display: flex; align-items: center; gap: 8px; }
.panel-index { font-size: 10px; color: #617c83; font-weight: 800; letter-spacing: .1em; }
.preset-block { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.field-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.field-top label, .regime-heading, .readout-label, .migration-head, .wave-card-top, .validation-metric span { font-size: 9px; letter-spacing: .11em; font-weight: 800; color: #8ca5a9; }
.micro-tag { font-size: 8px; color: #6d8c8d; letter-spacing: .12em; }
.preset-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 9px; }
.preset-btn { min-width: 0; border: 1px solid var(--line); background: rgba(6,17,24,.45); border-radius: 9px; padding: 8px 3px 7px; color: #93a9ac; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; transition: border-color .2s, background .2s, color .2s; font-size: 9px; }
.preset-btn:hover { border-color: rgba(112,213,202,.45); color: var(--text); }
.preset-btn.active { border-color: rgba(112,213,202,.52); color: var(--teal-bright); background: rgba(49,123,121,.16); box-shadow: inset 0 0 0 1px rgba(112,213,202,.07); }
.preset-icon { font-size: 16px; line-height: 1; }
.preset-description { margin: 9px 0 0; color: #82999d; font-size: 10px; line-height: 1.45; min-height: 29px; }
.control-list { padding-top: 14px; display: flex; flex-direction: column; gap: 13px; }
.control-row { min-width: 0; }
.control-row output, .speed-control output { color: var(--teal-bright); font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 650; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 4px; border-radius: 99px; background: linear-gradient(90deg, #4eaaa4, #2b555f); margin: 11px 0 5px; cursor: pointer; accent-color: var(--teal); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #c7f5e9; border: 3px solid #286d6b; box-shadow: 0 0 0 2px rgba(112,213,202,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #c7f5e9; border: 3px solid #286d6b; box-shadow: 0 0 0 2px rgba(112,213,202,.12); }
.range-ends { display: flex; justify-content: space-between; color: #617b82; font-size: 8px; font-variant-numeric: tabular-nums; }
.transport-note { margin-top: 16px; padding: 10px; border: 1px solid rgba(112,213,202,.16); border-radius: 10px; display: flex; gap: 9px; background: rgba(36,103,101,.09); }
.note-icon { color: var(--teal); font-size: 18px; line-height: 1; }
.transport-note strong { display: block; font-size: 10px; margin-bottom: 4px; color: #b7d5d1; }
.transport-note span:not(.note-icon) { display: block; color: #819b9e; font-size: 9px; line-height: 1.45; }
.scene-column { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.scene-card { min-width: 0; min-height: 0; flex: 1; overflow: hidden; border: 1px solid rgba(155,199,202,.18); border-radius: var(--radius); background: #07151d; box-shadow: 0 18px 42px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.scene-topline { flex: 0 0 40px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; background: rgba(10,26,35,.92); border-bottom: 1px solid var(--line); z-index: 3; }
.scene-label { display: flex; align-items: center; gap: 8px; font-size: 8px; font-weight: 800; letter-spacing: .13em; color: #91aaad; }
.scene-separator { color: #49656b; }
.scene-tools { display: flex; gap: 6px; }
.icon-btn { width: 27px; height: 25px; border-radius: 7px; border: 1px solid var(--line); background: #132a35; color: #a6c0c1; cursor: pointer; font-size: 15px; }
.icon-btn:hover { border-color: var(--teal); color: var(--teal-bright); }
.scene-host { position: relative; flex: 1; min-height: 390px; overflow: hidden; background: radial-gradient(ellipse at 52% 42%, #193b43, #0a1c27 62%, #08141d); }
.river-canvas { display: block; width: 100%; height: 100%; outline: none; }
.scene-fallback { position: absolute; inset: 0; z-index: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; color: #9cb6b8; font-size: 12px; background: radial-gradient(ellipse at 50% 40%, #193b43, #0a1c27 65%); }
.scene-fallback strong { color: #d6e9e4; font-size: 14px; }
.scene-fallback span { color: #789297; font-size: 10px; }
.fallback-orbit { color: var(--teal); font-size: 32px; animation: orbit 4s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.scene-annotations { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.annotation-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; border: 1px solid rgba(112,213,202,.18); background: rgba(7,20,28,.68); backdrop-filter: blur(6px); font-size: 9px; }
.annotation-chip b { font-size: 8px; letter-spacing: .1em; color: #7adbd0; }
.annotation-chip span { color: #b0c8c6; }
.bed-chip { border-color: rgba(232,188,120,.22); }
.bed-chip b { color: var(--amber); }
.scene-scale { position: absolute; bottom: 12px; left: 14px; display: flex; align-items: center; gap: 7px; font-size: 8px; color: #9ab3b2; text-shadow: 0 1px 5px #061017; pointer-events: none; }
.scene-scale i { display: block; width: 42px; height: 1px; background: #b5d8d2; position: relative; }
.scene-scale i:before, .scene-scale i:after { content: ""; position: absolute; width: 1px; height: 5px; background: #b5d8d2; top: -2px; }
.scene-scale i:after { right: 0; }
.scene-compass { position: absolute; right: 14px; bottom: 11px; width: 27px; height: 35px; color: #a5c2c1; font-size: 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; opacity: .85; }
.compass-arrow { font-size: 17px; line-height: 1; }
.webgl-context-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(5,13,19,.82); }
.webgl-context-overlay[hidden] { display: none; }
.context-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 22px; border: 1px solid var(--line-strong); border-radius: 12px; background: #112631; color: #d7e8e5; }
.context-card span { color: #90a9ad; font-size: 11px; }
.scene-toolbar { min-height: 48px; padding: 0 10px; display: flex; align-items: center; gap: 10px; background: #0d202b; border-top: 1px solid var(--line); }
.transport-controls { display: flex; align-items: center; gap: 6px; }
.play-btn, .tool-btn, .export-btn { border-radius: 7px; cursor: pointer; height: 29px; border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 10px; font-weight: 650; transition: background .18s, border-color .18s; }
.play-btn { min-width: 76px; padding: 0 9px; color: #08201f; background: var(--teal); border-color: var(--teal); }
.play-btn:hover { background: var(--teal-bright); }
.play-glyph { font-size: 11px; }
.tool-btn { padding: 0 9px; color: #a8c0c1; background: rgba(25,48,59,.7); }
.tool-btn:hover { border-color: var(--teal); color: var(--teal-bright); }
kbd { font-size: 8px; color: #779298; border: 1px solid #3a5962; border-radius: 3px; padding: 1px 3px; }
.toolbar-divider { width: 1px; height: 23px; background: var(--line-strong); }
.speed-control { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 90px; }
.speed-control label { color: #7f9a9e; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.speed-control input { margin: 0; min-width: 35px; }
.speed-control output { white-space: nowrap; font-size: 9px; }
.quality-control { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #081821; }
.quality-btn { border: 0; background: transparent; padding: 4px 6px; color: #728d93; font-size: 8px; font-weight: 800; border-radius: 4px; cursor: pointer; }
.quality-btn.active { color: var(--teal-bright); background: #1b3d46; }
.export-btn { padding: 0 9px; color: #c5d9d6; background: #17313c; white-space: nowrap; }
.export-btn span { font-size: 14px; color: var(--teal); }
.export-btn:hover { border-color: var(--teal); }
.scene-footnote { display: flex; align-items: center; gap: 7px; padding: 0 4px; color: #6f8b91; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.scene-footnote .status-led { width: 5px; height: 5px; }
.footnote-spacer { flex: 1; }
.footnote-dot { color: #38535b; }
.regime-card { padding: 12px; border: 1px solid rgba(112,213,202,.18); border-radius: 10px; background: linear-gradient(135deg, rgba(39,101,100,.16), rgba(14,37,47,.35)); }
.regime-heading { display: flex; justify-content: space-between; align-items: center; }
.regime-signal { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px rgba(112,213,202,.65); }
.regime-value { display: flex; align-items: baseline; justify-content: space-between; margin: 9px 0 8px; }
.regime-value strong { color: var(--teal-bright); font-size: 15px; letter-spacing: .02em; }
.regime-value span { color: #b1c7c4; font-size: 11px; font-variant-numeric: tabular-nums; }
.regime-meter { position: relative; height: 5px; border-radius: 9px; background: linear-gradient(90deg, #486f6d 0 45%, #c09b65 45% 53%, #347e7a 53% 100%); overflow: hidden; }
.regime-meter span { display: block; height: 100%; background: rgba(180,247,226,.42); border-right: 2px solid #b7f2e0; transition: width .25s; }
.regime-meter i { position: absolute; left: 50%; top: -2px; width: 1px; height: 9px; background: #f3d09b; }
.regime-scale { display: flex; justify-content: space-between; margin-top: 5px; font-size: 7px; color: #708b8e; letter-spacing: .07em; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.readout-card { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 9px 8px 8px; background: rgba(5,17,25,.32); }
.readout-label { display: block; font-size: 8px; line-height: 1.3; min-height: 20px; }
.readout-card strong { display: block; margin-top: 5px; color: #e0efea; font-size: 17px; line-height: 1; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.readout-card strong small, .wave-card strong small { font-size: 9px; color: #8ea8aa; font-weight: 500; letter-spacing: 0; }
.readout-sub { display: block; margin-top: 5px; color: #708a90; font-size: 8px; }
.migration-card { margin-top: 9px; border: 1px solid rgba(232,188,120,.2); border-radius: 9px; padding: 10px; background: rgba(100,70,37,.09); }
.migration-head { display: flex; justify-content: space-between; align-items: center; }
.scaled-tag, .textbook-tag { color: #e6bd80; font-size: 7px; letter-spacing: .1em; font-weight: 850; border: 1px solid rgba(232,188,120,.25); padding: 3px 5px; border-radius: 4px; }
.migration-value { display: flex; align-items: baseline; gap: 5px; margin-top: 7px; }
.migration-value strong { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; color: #f0d3a5; letter-spacing: -.03em; }
.migration-value span { font-size: 9px; color: #a48d6e; }
.migration-value b { margin-left: auto; font-size: 8px; letter-spacing: .1em; color: #d9b67f; }
.migration-track { height: 4px; border-radius: 9px; margin: 8px 0 7px; background: linear-gradient(90deg, rgba(232,188,120,.5), rgba(232,188,120,.08)); position: relative; }
.migration-track span { position: absolute; left: 5%; top: 0; width: 40%; height: 100%; background: #d9ae72; border-radius: 9px; }
.migration-track i { position: absolute; left: 4%; top: -3px; border: 5px solid transparent; border-right-color: #d9ae72; }
.migration-card p { margin: 0; font-size: 8px; line-height: 1.4; color: #8d806d; }
.wave-card { margin-top: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,17,25,.3); }
.wave-card-top { display: flex; align-items: center; justify-content: space-between; }
.textbook-tag { color: #83c9c0; border-color: rgba(112,213,202,.23); }
.wave-card strong { display: block; margin-top: 6px; font-size: 18px; font-weight: 620; color: #cfe6e1; font-variant-numeric: tabular-nums; }
.wave-formula { display: block; margin-top: 2px; color: #6e8d93; font-size: 8px; }
.science-details { margin-top: 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,17,25,.26); }
.science-details summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; padding: 10px; color: #c5d9d5; font-size: 10px; font-weight: 700; }
.science-details summary::-webkit-details-marker { display: none; }
.science-icon { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; background: rgba(112,213,202,.13); color: var(--teal); font-size: 13px; }
.chevron { margin-left: auto; color: #789499; transition: transform .2s; }
.science-details[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 10px 11px; }
.science-intro { margin: 0 0 9px; color: #8da5a8; font-size: 9px; line-height: 1.5; }
.equation-block { padding: 7px 8px; margin-top: 6px; border-left: 2px solid rgba(112,213,202,.45); background: rgba(21,49,57,.42); }
.equation-block span { display: block; color: #6f9697; font-size: 7px; font-weight: 800; letter-spacing: .1em; margin-bottom: 4px; }
.equation-block code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #d2e6df; font-size: 8px; line-height: 1.45; white-space: normal; }
.variable-list, .assumption-note { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 8px; line-height: 1.45; color: #82999e; }
.variable-list b, .assumption-note b { color: #b7cbc7; font-size: 8px; }
.validation-strip { display: grid; grid-template-columns: minmax(220px,1.4fr) repeat(3,minmax(130px,.7fr)) minmax(190px,1.1fr); align-items: center; gap: 14px; margin: 2px 16px 0; padding: 11px 15px; border: 1px solid var(--line); border-radius: 11px; background: rgba(13,30,40,.84); }
.validation-title { display: flex; align-items: center; gap: 9px; }
.validation-icon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #8ce1d2; background: rgba(112,213,202,.13); font-size: 14px; }
.validation-title b { display: block; font-size: 9px; letter-spacing: .1em; color: #b7cfca; }
.validation-title span:not(.validation-icon) { display: block; color: #708b90; font-size: 8px; margin-top: 3px; }
.validation-metric { border-left: 1px solid var(--line); padding-left: 13px; }
.validation-metric span { display: block; font-size: 7px; }
.validation-metric strong { display: block; margin-top: 4px; color: #d5e9e3; font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; }
.validation-metric strong small { color: #7d999c; font-size: 9px; font-weight: 500; }
.validation-metric.difference strong { color: var(--teal-bright); }
.validation-note { color: #718b90; font-size: 8px; line-height: 1.4; text-align: right; }
.footer-note { max-width: 1800px; margin: 8px auto 0; padding: 0 20px 12px; display: flex; justify-content: space-between; gap: 10px; color: #59737a; font-size: 8px; letter-spacing: .04em; }
body.embed .topbar, body.embed .controls-panel, body.embed .insight-panel, body.embed .validation-strip, body.embed .footer-note, body.embed .scene-footnote { display: none; }
body.embed .workspace { display: block; padding: 0; height: 100vh; }
body.embed .scene-card { height: 100vh; border-radius: 0; border: 0; }
body.embed .scene-host { min-height: 0; }
body.embed .scene-toolbar { padding-left: 14px; }
@media (min-width: 1500px) {
  .workspace { grid-template-columns: 285px minmax(500px,1fr) 294px; }
  .scene-host { min-height: 540px; }
}
@media (max-width: 1160px) {
  .workspace { grid-template-columns: 245px minmax(360px,1fr); }
  .insight-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 190px 1fr 1fr; gap: 10px; align-items: start; }
  .insight-panel .panel-heading { grid-column: 1; margin: 0; }
  .regime-card { grid-column: 1; }
  .readout-grid { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .migration-card, .wave-card { grid-column: 3; margin: 0; }
  .science-details { grid-column: 1 / -1; }
  .validation-strip { grid-template-columns: 1.2fr repeat(3,.7fr); }
  .validation-note { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 14px; }
  .top-meta { gap: 8px; }
  .live-pill { display: none; }
  .seed-label { padding-left: 10px; }
  .workspace { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
  .scene-column { order: 0; }
  .scene-card { min-height: 0; }
  .scene-host { min-height: 350px; height: 46vh; max-height: 470px; }
  .scene-toolbar { flex-wrap: wrap; padding: 8px; gap: 7px; }
  .toolbar-divider { display: none; }
  .transport-controls { order: 0; }
  .speed-control { order: 1; flex: 1 1 130px; }
  .quality-control { order: 2; }
  .export-btn { order: 3; }
  .scene-footnote { padding: 0 2px; }
  .controls-panel { order: 1; }
  .insight-panel { order: 2; display: block; }
  .insight-panel .panel-heading { margin-bottom: 12px; }
  .readout-grid { margin-top: 9px; }
  .migration-card, .wave-card { margin-top: 8px; }
  .science-details { margin-top: 9px; }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .transport-note { margin-top: 12px; }
  .validation-strip { margin: 0 10px; grid-template-columns: 1fr 1fr; gap: 10px; }
  .validation-title { grid-column: 1 / -1; }
  .validation-metric { padding-left: 8px; }
  .validation-metric:nth-of-type(2) { border-left: 0; }
  .validation-note { grid-column: 1 / -1; }
  .footer-note { padding: 8px 12px 14px; flex-direction: column; }
}
@media (max-width: 420px) {
  h1 { font-size: 17px; }
  .workspace { padding: 8px; }
  .scene-host { min-height: 310px; height: 40vh; }
  .scene-label { font-size: 7px; gap: 5px; }
  .scene-toolbar { gap: 6px; }
  .tool-btn { padding: 0 7px; }
  .play-btn { min-width: 70px; }
  .quality-btn { padding: 4px 5px; }
  .export-btn { padding: 0 7px; }
  .control-list { column-gap: 12px; }
  .panel { padding: 14px 12px; }
  .validation-strip { margin: 0 8px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
