:root {
  color-scheme: dark;
  --bg: #07131b;
  --panel: #0b1a23;
  --panel-2: #0e202a;
  --line: rgba(159, 190, 201, .14);
  --line-strong: rgba(159, 190, 201, .24);
  --text: #e8f1f2;
  --muted: #8ba3ab;
  --muted-2: #5f7983;
  --cyan: #73d6e1;
  --cyan-2: #2baebc;
  --amber: #dca66a;
  --green: #83c9a8;
  --danger: #e28d79;
  --space: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100svh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { height: 100svh; min-height: 620px; display: grid; grid-template-rows: 66px minmax(0, 1fr) 76px; background: radial-gradient(ellipse at 54% 34%, rgba(29, 69, 78, .18), transparent 56%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(7, 19, 27, .92); z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 29px; height: 29px; border: 1px solid rgba(115,214,225,.45); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-8deg); background: rgba(44, 139, 150, .1); }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--cyan); display: block; transform: skewY(-22deg); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .6; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .78; }
.eyebrow { color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.4; }
h1 { margin: 2px 0 0; font-size: 16px; letter-spacing: -.035em; font-weight: 650; white-space: nowrap; }
h1 span { color: #91aab1; font-weight: 450; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: #9eb6bc; font-size: 9px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; }
.live-dot, .stage-dot { width: 7px; height: 7px; border-radius: 50%; background: #78d9b0; box-shadow: 0 0 0 4px rgba(120,217,176,.1), 0 0 14px rgba(120,217,176,.4); }
.meta-divider { width: 1px; height: 14px; background: var(--line-strong); margin: 0 4px; }
.model-tag { border: 1px solid var(--line-strong); padding: 6px 8px; border-radius: 5px; color: #78949d; font-size: 8px; }
.workspace { min-height: 0; display: grid; grid-template-columns: 264px minmax(400px, 1fr) 294px; gap: 10px; padding: 10px; }
.panel { min-width: 0; background: linear-gradient(160deg, rgba(14,32,42,.98), rgba(9,23,32,.98)); border: 1px solid var(--line); border-radius: 11px; overflow: auto; scrollbar-width: thin; scrollbar-color: #29434d transparent; }
.control-panel, .insight-panel { padding: 17px 15px 14px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 17px; }
.panel-heading h2 { font-size: 15px; margin: 4px 0 0; font-weight: 620; letter-spacing: -.025em; }
.panel-index { color: #47616b; font-size: 10px; letter-spacing: .1em; font-weight: 700; border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; }
.preset-block { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label-row label, .field-label-row > label, .field-label-row > span:first-child { color: #9ab0b6; font-size: 9px; font-weight: 750; letter-spacing: .105em; text-transform: uppercase; }
.tiny-note { color: #526d76; font-size: 8px; letter-spacing: .08em; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin-top: 9px; }
.preset-btn { min-width: 0; display: flex; align-items: center; gap: 6px; text-align: left; padding: 8px 6px; background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.preset-btn:hover { border-color: rgba(115,214,225,.45); transform: translateY(-1px); }
.preset-btn.active { border-color: rgba(115,214,225,.5); background: rgba(54,151,162,.12); }
.preset-icon { color: var(--cyan); font-size: 16px; line-height: 1; }
.preset-btn b { display: block; font-size: 9px; font-weight: 700; }
.preset-btn small { display: block; color: var(--muted-2); font-size: 8px; margin-top: 2px; white-space: nowrap; }
.control-list { display: grid; gap: 17px; padding: 17px 0 14px; }
.control-row { min-width: 0; }
.control-row output { color: var(--cyan); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 4px; margin: 11px 0 7px; accent-color: var(--cyan); cursor: pointer; appearance: none; background: linear-gradient(90deg, rgba(84,174,183,.85), rgba(65,111,121,.65)); border-radius: 99px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #d5f7f6; border: 2px solid #3a9ba7; box-shadow: 0 0 0 3px rgba(115,214,225,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d5f7f6; border: 2px solid #3a9ba7; box-shadow: 0 0 0 3px rgba(115,214,225,.12); }
.range-ends { display: flex; justify-content: space-between; color: #526c75; font-size: 8px; letter-spacing: .04em; }
.control-footnote { display: flex; gap: 8px; padding: 10px 9px; border: 1px solid rgba(115,214,225,.13); border-radius: 7px; background: rgba(55,137,148,.055); color: #78949c; font-size: 9px; line-height: 1.5; }
.info-glyph { flex: 0 0 14px; width: 14px; height: 14px; display: grid; place-items: center; border: 1px solid rgba(115,214,225,.35); border-radius: 50%; color: var(--cyan); font-size: 9px; font-weight: 800; }
.stage-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 38px minmax(0,1fr) 29px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #08151e; position: relative; }
.stage-topline { display: flex; justify-content: space-between; align-items: center; padding: 0 13px; background: rgba(12,29,38,.9); border-bottom: 1px solid var(--line); z-index: 2; }
.stage-kicker { display: flex; align-items: center; gap: 9px; color: #9ab1b8; font-size: 9px; font-weight: 750; letter-spacing: .12em; }
.stage-dot { width: 5px; height: 5px; box-shadow: 0 0 0 3px rgba(120,217,176,.1); }
.stage-tools { display: flex; gap: 6px; }
.icon-btn { width: 26px; height: 25px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.025); color: #91abb2; cursor: pointer; font-size: 16px; line-height: 1; transition: .18s ease; }
.icon-btn:hover { border-color: rgba(115,214,225,.5); color: var(--cyan); background: rgba(115,214,225,.08); }
.scene-host { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 44%, #17333b 0%, #0b1b25 56%, #07131b 100%); }
.scene-canvas { position: absolute; inset: 0; }
.scene-canvas canvas { display: block; width: 100%; height: 100%; outline: none; }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(4,13,19,.22), transparent 20%, transparent 74%, rgba(4,13,19,.34)), radial-gradient(ellipse at center, transparent 52%, rgba(2,8,13,.3) 100%); }
.annotation-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.annotation { position: absolute; display: flex; align-items: center; gap: 6px; color: rgba(219,239,238,.82); font-size: 8px; letter-spacing: .14em; font-weight: 800; white-space: nowrap; text-shadow: 0 2px 5px #031016, 0 0 9px #031016; opacity: 0; transition: opacity .25s ease; }
.annotation.visible { opacity: 1; }
.annotation-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); border: 1px solid rgba(4,18,25,.7); box-shadow: 0 0 0 3px rgba(115,214,225,.18), 0 0 10px rgba(115,214,225,.65); }
.annotation-dot.breach { background: var(--amber); box-shadow: 0 0 0 3px rgba(220,166,106,.18), 0 0 10px rgba(220,166,106,.65); }
.annotation-dot.new { background: var(--green); box-shadow: 0 0 0 3px rgba(131,201,168,.18), 0 0 10px rgba(131,201,168,.65); }
.scene-legend { position: absolute; top: 12px; left: 12px; display: flex; gap: 11px; padding: 7px 9px; border: 1px solid rgba(161,194,200,.12); border-radius: 6px; background: rgba(5,17,24,.58); backdrop-filter: blur(8px); color: #9ab0b5; font-size: 8px; letter-spacing: .09em; font-weight: 750; pointer-events: none; }
.scene-legend > div { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.water-swatch { background: #4cbec9; }
.sediment-swatch { background: #d99b62; }
.levee-swatch { background: #a99a75; }
.scale-note { position: absolute; bottom: 10px; right: 12px; color: rgba(171,193,196,.6); font-size: 8px; letter-spacing: .1em; pointer-events: none; }
.scale-note span { padding: 0 4px; color: var(--cyan); }
.stage-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 13px; background: rgba(12,29,38,.94); border-top: 1px solid var(--line); color: #6f8a93; font-size: 8px; letter-spacing: .1em; }
.stage-caption span:last-child { color: #9cb1b7; letter-spacing: .025em; text-align: right; font-size: 9px; }
.webgl-fallback, .context-lost { position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 30px; text-align: center; background: rgba(5,16,23,.92); color: #c7d8dc; }
.webgl-fallback[hidden], .context-lost[hidden] { display: none; }
.webgl-fallback strong, .context-lost strong { font-size: 14px; }
.webgl-fallback span, .context-lost span { max-width: 340px; color: #8da6ae; font-size: 11px; line-height: 1.6; }
.insight-panel .panel-heading { margin-bottom: 14px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; padding: 10px 9px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.018); }
.readout-card.accent-readout { border-color: rgba(115,214,225,.25); background: rgba(44,142,151,.075); }
.readout-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #78939c; font-size: 7px; font-weight: 800; letter-spacing: .085em; line-height: 1.3; }
.readout-label span { color: #5d828b; font-size: 10px; font-weight: 600; letter-spacing: 0; }
.readout-value { margin-top: 8px; color: #e1eff0; font-size: 21px; font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: #91aab0; font-size: 9px; font-weight: 550; letter-spacing: 0; }
.accent-readout .readout-value { color: var(--cyan); }
.readout-foot { margin-top: 4px; color: #58727b; font-size: 8px; line-height: 1.35; }
.mini-metric { margin: 14px 0 13px; padding: 0 1px; }
.mini-metric-head, .mini-metric-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #7f9ba2; font-size: 8px; letter-spacing: .095em; font-weight: 750; }
.mini-metric-head span:last-child { color: #b6d4d6; font-size: 9px; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.metric-track { height: 4px; margin: 8px 0 6px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.metric-track span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3a9fa9, #e1b078); transition: width .3s ease; }
.mini-metric-foot { color: #506c76; font-size: 7px; }
.scaled-tag, .textbook-tag { color: #d6ad7c; border: 1px solid rgba(214,173,124,.25); border-radius: 4px; padding: 3px 5px; font-size: 7px; letter-spacing: .09em; }
.validation-card { padding: 10px; border: 1px solid rgba(131,201,168,.18); border-radius: 7px; background: rgba(75,142,115,.055); }
.validation-head { display: flex; align-items: center; gap: 6px; color: #8fb9a5; font-size: 8px; font-weight: 800; letter-spacing: .11em; }
.validation-icon { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: rgba(131,201,168,.16); color: #91d5b1; font-size: 9px; }
.validation-head .textbook-tag { margin-left: auto; color: #a4cdb4; border-color: rgba(131,201,168,.25); }
.validation-title { margin: 8px 0 9px; color: #c5d6d5; font-size: 10px; font-weight: 600; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.validation-values > div { padding: 6px 7px; border-radius: 5px; background: rgba(0,0,0,.13); }
.validation-values small { display: block; color: #68877d; font-size: 7px; letter-spacing: .1em; }
.validation-values b { display: block; margin-top: 3px; color: #d7e9e2; font-size: 11px; font-variant-numeric: tabular-nums; }
.validation-diff { margin-top: 8px; color: #7d9c8e; font-size: 8px; }
.validation-diff strong { color: #a6d9b8; font-variant-numeric: tabular-nums; }
.science-details { margin-top: 12px; border-top: 1px solid var(--line); }
.science-details summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 12px 1px 9px; color: #a3b9bd; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.science-details summary::-webkit-details-marker { display: none; }
.summary-plus { color: var(--cyan); font-size: 15px; font-weight: 400; transition: transform .2s ease; }
.science-details[open] .summary-plus { transform: rotate(45deg); }
.science-content { color: #8ca5ac; font-size: 9px; line-height: 1.55; }
.science-lead { margin: 0 0 10px; color: #b1c6c9; font-size: 9px; line-height: 1.6; }
.equation-block { margin: 7px 0; padding: 7px 8px; border-left: 2px solid rgba(115,214,225,.35); background: rgba(255,255,255,.018); }
.equation-block span { display: block; color: #66838c; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.equation-block code { display: block; margin-top: 4px; color: #d0e2e1; font-family: Georgia, "Times New Roman", serif; font-size: 10px; white-space: normal; overflow-wrap: anywhere; }
.variable-list { margin-top: 9px; display: grid; gap: 3px; }
.variable-list b, .assumption-note b, .validation-note b { color: #a8c0c3; font-size: 8px; letter-spacing: .1em; }
.variable-list span { color: #78939b; }
.assumption-note, .validation-note { margin-top: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.assumption-note p, .validation-note p { margin: 5px 0 0; color: #78939b; }
.illustrative-note { margin: 10px 0 2px; color: #617d85; font-size: 7px; letter-spacing: .1em; }
.bottom-dock { display: grid; grid-template-columns: 245px minmax(150px,1fr) 355px; align-items: center; gap: 18px; padding: 0 18px; border-top: 1px solid var(--line); background: rgba(7,19,27,.96); z-index: 5; }
.playback-group, .dock-options { display: flex; align-items: center; gap: 7px; }
.play-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 93px; height: 34px; padding: 0 12px; border: 1px solid rgba(115,214,225,.4); border-radius: 7px; background: rgba(55,158,169,.15); color: #c6f2f0; cursor: pointer; font-size: 10px; font-weight: 700; transition: .18s ease; }
.play-btn:hover { background: rgba(55,158,169,.24); border-color: var(--cyan); }
.play-symbol { font-size: 11px; }
.dock-btn { height: 31px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.02); color: #8ea8af; cursor: pointer; font-size: 8px; font-weight: 800; letter-spacing: .08em; transition: .18s ease; white-space: nowrap; }
.dock-btn:hover { border-color: rgba(115,214,225,.4); color: var(--cyan); background: rgba(115,214,225,.06); }
.timeline-group { min-width: 0; }
.timeline-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; color: #66818a; font-size: 8px; letter-spacing: .1em; font-weight: 750; }
.timeline-meta b { color: #b8cbce; font-size: 9px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.timeline-separator { color: #3e5a63; }
.timeline-track { height: 3px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.timeline-track span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, #2b9ca7, #b4d9d5); border-radius: inherit; }
.dock-options { justify-content: flex-end; }
.speed-control { display: flex; align-items: center; gap: 7px; color: #718c94; font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.speed-control input { width: 78px; margin: 0; }
.speed-control b { color: #a9c9ca; font-size: 9px; min-width: 25px; font-variant-numeric: tabular-nums; }
.quality-btn { min-width: 91px; }
body.embed { overflow: hidden; }
body.embed .app-shell { grid-template-rows: minmax(0,1fr); min-height: 0; }
body.embed .topbar, body.embed .insight-panel, body.embed .bottom-dock { display: none; }
body.embed .workspace { grid-template-columns: 1fr; padding: 0; gap: 0; }
body.embed .control-panel { position: absolute; z-index: 8; left: 12px; top: 12px; width: min(265px, calc(100vw - 24px)); max-height: calc(100svh - 24px); opacity: .96; backdrop-filter: blur(10px); }
body.embed .stage-panel { border-radius: 0; border: 0; grid-template-rows: 34px minmax(0,1fr) 25px; }
body.embed .stage-caption { font-size: 7px; }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 238px minmax(330px,1fr) 270px; gap: 8px; padding: 8px; }
  .control-panel, .insight-panel { padding: 14px 12px; }
  .bottom-dock { grid-template-columns: 225px minmax(120px,1fr) 320px; gap: 12px; padding: 0 12px; }
}
@media (max-width: 920px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100svh; grid-template-rows: 62px auto 72px; }
  .workspace { grid-template-columns: minmax(0,1fr) minmax(250px,.8fr); grid-template-rows: minmax(440px, 54svh) auto; }
  .stage-panel { grid-column: 1 / -1; grid-row: 1; }
  .control-panel { grid-column: 1; grid-row: 2; }
  .insight-panel { grid-column: 2; grid-row: 2; }
  .bottom-dock { position: sticky; bottom: 0; grid-template-columns: auto minmax(100px,1fr); grid-template-rows: 1fr; min-height: 72px; }
  .dock-options { grid-column: 1 / -1; display: none; }
  .timeline-group { min-width: 0; }
}
@media (max-width: 620px) {
  .app-shell { min-height: 100svh; grid-template-rows: 58px auto 68px; }
  .topbar { padding: 0 12px; }
  .brand-mark { width: 25px; height: 25px; }
  h1 { font-size: 14px; }
  h1 span { display: block; margin-top: 1px; font-size: 10px; }
  .topbar-meta { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 7px; gap: 7px; }
  .stage-panel { height: 47svh; min-height: 320px; flex: 0 0 auto; }
  .control-panel { order: 2; overflow: visible; }
  .insight-panel { order: 3; overflow: visible; }
  .control-panel, .insight-panel { padding: 14px 13px; }
  .panel-heading { margin-bottom: 12px; }
  .control-list { grid-template-columns: 1fr 1fr; column-gap: 15px; row-gap: 15px; }
  .preset-grid { gap: 5px; }
  .preset-btn { padding: 8px 5px; gap: 4px; }
  .preset-btn b { font-size: 8px; }
  .preset-btn small { font-size: 7px; }
  .scene-legend { top: 8px; left: 8px; gap: 7px; padding: 6px 7px; font-size: 7px; }
  .scale-note { right: 8px; bottom: 7px; font-size: 7px; }
  .annotation { font-size: 7px; }
  .stage-caption { padding: 0 9px; font-size: 7px; }
  .stage-caption span:last-child { font-size: 8px; }
  .bottom-dock { min-height: 68px; padding: 0 8px; grid-template-columns: 1fr 1fr; gap: 7px; }
  .playback-group { gap: 5px; }
  .play-btn { min-width: 77px; height: 32px; padding: 0 8px; font-size: 9px; }
  .dock-btn { height: 30px; padding: 0 7px; font-size: 7px; }
  .timeline-meta { justify-content: flex-end; gap: 6px; font-size: 7px; }
  .timeline-meta b { font-size: 8px; }
  .timeline-meta span:nth-last-child(1) { display: none; }
  .timeline-track { margin-left: auto; width: 100%; }
  .insight-panel .readout-value { font-size: 20px; }
  .webgl-fallback, .context-lost { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
