:root {
  color-scheme: dark;
  --bg: #071119;
  --panel: #0d1b25;
  --panel-2: #11232e;
  --line: rgba(158, 193, 207, .13);
  --line-strong: rgba(158, 193, 207, .24);
  --text: #e4edf0;
  --muted: #91a7b0;
  --dim: #647b85;
  --teal: #50c4c4;
  --cyan: #76d5df;
  --amber: #d8aa65;
  --green: #85c99c;
  --danger: #e2a16e;
  --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 { min-width: 320px; font-size: 13px; letter-spacing: .01em; }
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 { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 34% -20%, rgba(37, 82, 92, .24), transparent 42%), var(--bg); }
.topbar { min-height: 76px; padding: 14px 22px 13px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(7, 17, 25, .93); }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(91, 200, 205, .38); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: linear-gradient(145deg, rgba(80,196,196,.16), rgba(80,196,196,.02)); flex: 0 0 auto; }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--teal); transform: skewY(-24deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .6; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .75; }
.eyebrow, .micro-label, .section-label, .scene-kicker { font-size: 9px; letter-spacing: .15em; font-weight: 750; color: #7e9aa4; }
.eyebrow { margin-bottom: 4px; }
.eyebrow span { color: #496a76; padding: 0 3px; }
h1 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; }
h1 span { color: #8fa5ad; font-size: 13px; font-weight: 450; letter-spacing: 0; }
.topbar-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.field-tag, .seed-tag, .live-tag { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; color: #9ab0b9; font-size: 9px; letter-spacing: .1em; font-weight: 700; white-space: nowrap; }
.seed-tag { color: #8098a2; }
.live-tag { color: #9bd8c3; display: inline-flex; align-items: center; gap: 6px; }
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: #64c99d; box-shadow: 0 0 10px rgba(100,201,157,.7); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 382px; gap: 14px; padding: 14px; flex: 1; min-height: 0; }
.stage-column { min-width: 0; display: flex; flex-direction: column; }
.scene-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 3px 10px 5px; }
.scene-caption { display: flex; flex-direction: column; gap: 4px; }
.scene-kicker { color: #8db2bc; }
.scene-subtitle { font-size: 10px; color: var(--dim); }
.scene-actions { display: flex; gap: 7px; }
.icon-button { width: 32px; height: 30px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(18, 38, 49, .78); color: #b8cbd0; font-size: 17px; cursor: pointer; transition: background .18s, border-color .18s, color .18s; }
.icon-button:hover { background: #1b3947; border-color: rgba(111, 207, 212, .4); color: white; }
.scene-wrap { position: relative; min-height: 420px; height: min(64vh, 660px); overflow: hidden; border: 1px solid rgba(111, 166, 179, .22); border-radius: 13px; background: #0a1720; box-shadow: 0 16px 48px rgba(0,0,0,.24), inset 0 0 0 1px rgba(255,255,255,.015); }
.scene { position: absolute; inset: 0; }
.river-webgl { display: block; width: 100%; height: 100%; outline: none; }
.scene-vignette { pointer-events: none; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4,11,16,.18), transparent 20%, transparent 70%, rgba(4,11,16,.30)); box-shadow: inset 0 0 80px rgba(2,8,12,.27); }
.scene-legend { position: absolute; z-index: 2; left: 14px; bottom: 13px; display: flex; gap: 12px; padding: 8px 10px; border: 1px solid rgba(154,193,203,.18); border-radius: 7px; background: rgba(7,17,25,.78); backdrop-filter: blur(8px); color: #a7bbc2; font-size: 8px; letter-spacing: .09em; font-weight: 700; }
.scene-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.scene-legend i { width: 8px; height: 8px; display: inline-block; border-radius: 2px; }
.legend-water { background: #2d9ab2; }
.legend-levee { background: #c3a06c; }
.legend-splay { background: #d5b17b; }
.annotation-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.scene-label { position: absolute; z-index: 3; padding: 5px 7px; border: 1px solid rgba(142, 197, 206, .25); border-radius: 4px; background: rgba(6, 19, 26, .80); color: #d4e8e9; font-size: 8px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; box-shadow: 0 2px 10px rgba(0,0,0,.22); }
.scene-label::after { content: ''; position: absolute; top: 100%; left: 50%; width: 1px; height: 12px; background: rgba(126, 198, 205, .5); }
.scene-label-new { border-color: rgba(76, 205, 218, .42); color: #9ce9ee; }
.scene-label-breach { border-color: rgba(226, 173, 104, .46); color: #f1c78d; }
.webgl-warning { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 25px; text-align: center; background: rgba(4,13,19,.93); }
.webgl-warning[hidden] { display: none; }
.warning-icon { width: 38px; height: 38px; border: 1px solid rgba(226,161,110,.45); border-radius: 50%; display: grid; place-items: center; color: #f0bd86; font-size: 20px; }
.webgl-warning strong { font-size: 14px; }
.webgl-warning p { max-width: 340px; margin: 0; color: var(--muted); line-height: 1.55; }
.embed-controls { display: none; }
.stage-bottom { display: grid; grid-template-columns: 1.15fr .85fr; gap: 10px; margin-top: 10px; }
.phase-card, .transport-card { min-height: 91px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(135deg, rgba(17,36,47,.85), rgba(11,26,36,.9)); }
.phase-topline, .transport-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.phase-chip { color: #9fc6c8; border: 1px solid rgba(80,196,196,.22); border-radius: 4px; padding: 3px 6px; font-size: 8px; letter-spacing: .1em; font-weight: 800; }
.phase-chip.is-active { color: #e8c58d; }
.phase-title { font-size: 14px; font-weight: 650; margin: 6px 0 3px; letter-spacing: -.01em; }
.phase-card p { margin: 0; color: #91a7b0; font-size: 10px; line-height: 1.45; }
.transport-top strong { color: #9ce1e2; font-size: 16px; font-variant-numeric: tabular-nums; }
.flow-track { height: 7px; background: #233640; border-radius: 8px; overflow: hidden; margin: 14px 0 8px; }
.flow-track div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #237b94, #69d2d0); transition: width .3s ease; }
.transport-foot { display: flex; justify-content: space-between; color: #718b95; font-size: 9px; }
.keyboard-hint { color: #617a84; font-size: 9px; padding: 10px 3px 0; letter-spacing: .03em; }
.keyboard-hint span { color: #9ab0b9; font-weight: 750; letter-spacing: .08em; }
kbd { display: inline-block; min-width: 16px; padding: 1px 4px; border: 1px solid #344b56; border-radius: 3px; color: #b6c8ce; background: #12242e; font: inherit; text-align: center; }
.control-panel { min-width: 0; padding: 15px 15px 11px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(165deg, rgba(16,34,45,.98), rgba(10,24,33,.98)); box-shadow: 0 14px 44px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 14px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; letter-spacing: -.02em; font-weight: 650; }
.control-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 12px rgba(80,196,196,.5); }
.section-label { display: flex; align-items: center; justify-content: space-between; color: #7e9aa4; font-size: 9px; margin-bottom: 9px; }
.preset-block, .controls-block, .metrics-block, .transport-controls { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset-button { min-width: 0; min-height: 65px; padding: 8px 7px 7px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(11,26,35,.85); cursor: pointer; text-align: left; transition: .18s ease; }
.preset-button:hover { border-color: rgba(90,193,199,.45); background: rgba(20,48,59,.9); }
.preset-button.active { border-color: rgba(79,194,196,.7); background: linear-gradient(145deg, rgba(40,104,112,.31), rgba(14,38,48,.92)); box-shadow: inset 0 0 0 1px rgba(79,194,196,.08); }
.preset-number { color: #66818b; font-size: 8px; letter-spacing: .12em; }
.preset-button strong { color: #d9e7e9; font-size: 10px; font-weight: 700; white-space: nowrap; }
.preset-button small { color: #78919a; font-size: 8px; white-space: nowrap; }
.preset-description { min-height: 27px; margin: 7px 1px 0; color: #7f98a1; font-size: 9px; line-height: 1.45; }
.controls-block { padding-bottom: 9px; }
.control-row { margin-bottom: 10px; }
.control-row:last-child { margin-bottom: 0; }
.control-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.control-label label { color: #c4d4d8; font-size: 10px; font-weight: 550; }
.control-label output { color: #9ed8d9; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 4px; margin: 0; border-radius: 5px; background: linear-gradient(90deg, #286b78, #2c4a55); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border: 2px solid #d5f0ee; border-radius: 50%; background: #50b8b9; box-shadow: 0 0 0 3px rgba(80,184,185,.13); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #d5f0ee; border-radius: 50%; background: #50b8b9; box-shadow: 0 0 0 3px rgba(80,184,185,.13); }
.range-ends { display: flex; justify-content: space-between; color: #647e88; font-size: 8px; margin-top: 5px; }
.scaled-tag { color: #c6a56e; font-size: 8px; border: 1px solid rgba(198,165,110,.2); border-radius: 4px; padding: 3px 5px; letter-spacing: .09em; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric { padding: 8px 9px; border: 1px solid rgba(151,184,195,.10); border-radius: 6px; background: rgba(6,18,26,.43); display: flex; flex-direction: column; gap: 4px; }
.metric span { color: #7f98a1; font-size: 9px; }
.metric strong { color: #dce9eb; font-size: 13px; font-weight: 650; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.metric:nth-child(1) strong, .metric:nth-child(4) strong { color: #94d9dc; }
.time-line { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; padding: 8px 2px 0; border-top: 1px solid rgba(151,184,195,.09); }
.time-line span { color: #6d8791; font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.time-line strong { color: #b5d3d7; font-size: 11px; font-variant-numeric: tabular-nums; }
.transport-control-head { display: flex; align-items: center; justify-content: space-between; }
.running-state { color: #7bc9aa; font-size: 8px; letter-spacing: .12em; font-weight: 800; }
.running-state.paused { color: #d7ad74; }
.control-button-row { display: grid; grid-template-columns: 1.25fr .8fr .8fr; gap: 6px; }
.action-button { min-height: 32px; display: flex; justify-content: center; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(17,39,50,.9); color: #b5c8ce; font-size: 10px; font-weight: 650; cursor: pointer; transition: .18s; }
.action-button:hover { border-color: rgba(93,202,207,.5); color: white; background: #183b49; }
.action-button.primary { border-color: rgba(75,188,191,.42); background: linear-gradient(135deg, rgba(35,111,119,.75), rgba(20,71,82,.9)); color: #e4f7f4; }
.button-icon { font-size: 12px; line-height: 1; }
.option-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: #8ca3ac; font-size: 9px; }
.segmented { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: rgba(5,16,23,.55); gap: 2px; }
.segmented button { min-width: 29px; height: 22px; padding: 0 7px; border: 0; border-radius: 4px; background: transparent; color: #79929b; font-size: 9px; cursor: pointer; }
.segmented button.active { background: #234d58; color: #c8ecea; box-shadow: inset 0 0 0 1px rgba(98,202,205,.14); }
.science-block { border: 1px solid rgba(151,184,195,.12); border-radius: 7px; background: rgba(5,16,23,.32); overflow: hidden; }
.science-toggle { width: 100%; padding: 10px 11px; display: flex; align-items: center; justify-content: space-between; border: 0; background: transparent; color: #c6d7da; font-size: 11px; font-weight: 650; cursor: pointer; }
.science-toggle > span:first-child { display: flex; align-items: center; gap: 8px; }
.science-icon { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 5px; color: #93d8d8; background: rgba(80,196,196,.13); font-size: 12px; }
.chevron { color: #80a1a9; font-size: 16px; font-weight: 400; }
.science-panel { padding: 0 11px 11px; border-top: 1px solid var(--line); }
.science-panel[hidden] { display: none; }
.science-section { margin-top: 11px; }
.science-section h3 { margin: 0 0 5px; color: #b8d3d7; font-size: 10px; }
.science-section p, .science-section li { color: #849da6; font-size: 9px; line-height: 1.55; }
.science-section p { margin: 0; }
.science-section ul { margin: 5px 0 0; padding-left: 16px; }
.science-section li b { color: #b4d4d7; }
.equation { margin-top: 9px; padding: 8px; border: 1px solid rgba(105,163,176,.14); border-radius: 5px; background: rgba(15,36,46,.7); display: flex; flex-direction: column; gap: 5px; }
.equation-label { color: #7d9ca6; font-size: 8px; letter-spacing: .11em; font-weight: 750; }
.equation code { color: #c1e2e2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; white-space: normal; }
.validation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 8px; }
.validation-grid div { display: flex; flex-direction: column; gap: 4px; padding: 7px; border-radius: 5px; background: rgba(15,36,46,.72); }
.validation-grid span { color: #77949d; font-size: 7px; letter-spacing: .1em; }
.validation-grid strong { color: #c9e5e4; font-size: 11px; font-variant-numeric: tabular-nums; }
.textbook-label { display: block; margin-top: 7px; color: #c5a66f; font-size: 7px; line-height: 1.5; letter-spacing: .06em; }
.limitations { padding-top: 9px; border-top: 1px solid var(--line); }
.disclaimer { margin: 10px 0 0; color: #637d87; font-size: 8px; line-height: 1.45; }
.panel-footer { margin-top: auto; padding-top: 2px; color: #5d7680; font-size: 8px; letter-spacing: .11em; text-align: center; }
.panel-footer span { padding: 0 4px; color: #3c5d69; }
body.embed .topbar, body.embed .control-panel, body.embed .scene-toolbar, body.embed .stage-bottom, body.embed .keyboard-hint { display: none; }
body.embed .workspace { display: block; padding: 0; }
body.embed .stage-column { height: 100vh; }
body.embed .scene-wrap { height: 100%; min-height: 100%; border: 0; border-radius: 0; }
body.embed .embed-controls { position: absolute; z-index: 10; left: 12px; top: 12px; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 1px solid rgba(130,190,200,.25); border-radius: 7px; background: rgba(5,17,25,.78); color: #a9c3c8; font-size: 9px; letter-spacing: .08em; backdrop-filter: blur(8px); }
body.embed .embed-controls button { width: 25px; height: 23px; border: 0; border-radius: 4px; background: #20515c; color: #e0f6f2; cursor: pointer; }
body.embed .embed-time { color: #d0e5e6; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 345px; gap: 10px; padding: 10px; }
  .control-panel { padding: 12px; gap: 11px; }
  .scene-wrap { height: 61vh; }
  h1 { font-size: 16px; }
  h1 span { font-size: 11px; }
  .topbar-meta { gap: 5px; }
}
@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px 14px; }
  .topbar-meta { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; padding: 10px; }
  .scene-wrap { height: min(58vh, 560px); min-height: 330px; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 12px; }
  .panel-heading, .preset-block, .controls-block, .metrics-block, .transport-controls, .science-block, .panel-footer { min-width: 0; }
  .panel-heading { grid-column: 1 / -1; }
  .controls-block { grid-row: span 2; }
  .preset-block { grid-column: 1 / -1; }
  .science-block, .panel-footer { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  body { font-size: 12px; }
  .topbar { min-height: auto; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 15px; }
  h1 span { display: block; margin-top: 2px; font-size: 10px; }
  .field-tag, .seed-tag, .live-tag { font-size: 8px; padding: 5px 6px; }
  .workspace { padding: 8px; gap: 9px; }
  .scene-toolbar { min-height: 37px; padding-bottom: 7px; }
  .scene-wrap { height: 48vh; min-height: 300px; max-height: 430px; border-radius: 9px; }
  .scene-legend { left: 7px; bottom: 7px; gap: 7px; padding: 6px 7px; font-size: 7px; }
  .scene-legend i { width: 6px; height: 6px; }
  .stage-bottom { grid-template-columns: 1fr; gap: 7px; }
  .phase-card, .transport-card { min-height: 78px; padding: 9px 10px; }
  .keyboard-hint { font-size: 8px; line-height: 1.7; }
  .control-panel { display: flex; padding: 11px; gap: 11px; }
  .preset-grid { gap: 5px; }
  .preset-button { min-height: 60px; padding: 7px 5px; }
  .preset-button strong { font-size: 9px; }
  .preset-button small { font-size: 7px; }
  .control-row { margin-bottom: 11px; }
  .metrics-grid { gap: 6px; }
  .metric { padding: 8px; }
  .option-row { font-size: 9px; }
  .segmented button { min-width: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
