:root {
  color-scheme: dark;
  --bg: #07131d;
  --panel: #0c1b26;
  --panel-2: #102330;
  --line: rgba(160, 199, 211, 0.13);
  --line-strong: rgba(160, 199, 211, 0.22);
  --text: #e6f0f1;
  --muted: #8ca3aa;
  --dim: #627b84;
  --cyan: #78d0d8;
  --cyan-soft: rgba(120, 208, 216, 0.12);
  --sand: #d4b78b;
  --radius: 12px;
  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: 100vh; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.topbar {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--line); background: #081722;
  position: relative; z-index: 4;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: #dce9eb; text-decoration: none; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.brand-accent { color: #78cbd3; }
.brand-mark { width: 24px; height: 24px; display: flex; align-items: center; gap: 2px; justify-content: center; border: 1px solid rgba(120,208,216,.42); border-radius: 7px; background: rgba(120,208,216,.06); transform: rotate(-8deg); }
.brand-mark i { display: block; width: 3px; border-radius: 4px; background: var(--cyan); }
.brand-mark i:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3) { height: 10px; opacity: .75; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.category-pill { display: inline-flex; align-items: center; gap: 8px; color: #9bb4bc; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.pulse-dot, .live-mark { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #78d0b1; box-shadow: 0 0 10px rgba(120,208,177,.5); }
.seed-label { color: #637d86; font-size: 9px; letter-spacing: .13em; }
.seed-label b { color: #c1d1d3; margin-left: 5px; font-variant-numeric: tabular-nums; }
.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0; height: calc(100vh - 62px); min-height: 620px; max-width: 1920px; margin: 0 auto; }
.stage-column { min-width: 0; display: flex; flex-direction: column; padding: 22px 22px 15px 24px; border-right: 1px solid var(--line); }
.stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 1px 2px 16px; flex: 0 0 auto; }
.eyebrow { color: #72929c; font-size: 9px; font-weight: 800; letter-spacing: .18em; line-height: 1.5; }
h1, h2, h3, h4, p { margin-top: 0; }
.stage-heading h1 { margin: 4px 0 3px; font-size: clamp(21px, 2.2vw, 29px); line-height: 1.08; font-weight: 650; letter-spacing: -.045em; }
.stage-heading h1 span { color: #83cdd2; }
.stage-heading p { margin: 0; color: #8ba2a8; font-size: 11px; }
.stage-number { display: flex; align-items: center; gap: 8px; color: #6f8990; font-size: 8px; letter-spacing: .16em; }
.stage-number b { font-size: 26px; font-weight: 500; color: rgba(127, 198, 205, .55); letter-spacing: -.06em; }
.viewport-shell { flex: 1 1 auto; min-height: 280px; position: relative; border: 1px solid rgba(128, 183, 194, .18); border-radius: 13px; overflow: hidden; background: radial-gradient(ellipse at 50% 44%, #122d39 0%, #081722 64%, #06111a 100%); box-shadow: 0 16px 48px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.025); }
.viewport { position: absolute; inset: 0; overflow: hidden; }
.viewport canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.scene-overlay { position: absolute; z-index: 2; pointer-events: none; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.scene-top-left { top: 19px; left: 20px; display: flex; flex-direction: column; gap: 4px; }
.overlay-kicker { color: #9cc6ca; font-size: 8px; font-weight: 800; letter-spacing: .18em; }
.scene-top-left strong { color: #e1eded; font-size: 13px; font-weight: 600; }
.overlay-sub { color: #8ca8af; font-size: 9px; }
.scene-top-right { top: 22px; right: 22px; display: flex; align-items: center; gap: 8px; color: #8cb8c0; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.flow-arrow { color: #8bdde0; font-size: 22px; line-height: 10px; }
.scene-bottom-left { bottom: 42px; left: 19px; display: flex; flex-wrap: wrap; gap: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: #a0b5b8; font-size: 8px; letter-spacing: .04em; }
.legend-swatch { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.mussel-swatch { background: #397d91; box-shadow: 0 0 7px rgba(71,171,190,.35); }
.sand-swatch { background: #a78b63; }
.tracer-swatch { background: #a7e6e8; box-shadow: 0 0 7px rgba(167,230,232,.55); }
.scene-bottom-right { right: 19px; bottom: 42px; display: flex; gap: 10px; color: #708b93; font-size: 7px; font-weight: 700; letter-spacing: .12em; }
.render-status { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 27px; display: flex; align-items: center; padding: 0 12px; background: rgba(4,14,22,.78); border-top: 1px solid rgba(160,199,211,.10); color: #7da5ad; font-size: 8px; font-weight: 800; letter-spacing: .14em; backdrop-filter: blur(8px); }
.webgl-fallback { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 28px; background: rgba(5,15,23,.95); }
.webgl-fallback[hidden] { display: none; }
.webgl-fallback strong { font-size: 17px; }
.webgl-fallback p { color: var(--muted); max-width: 330px; font-size: 12px; }
.stage-footer { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 12px; padding: 12px 3px 0; color: #708890; font-size: 8px; font-weight: 700; letter-spacing: .12em; }
.stage-footer-left { display: flex; align-items: center; gap: 10px; }
.stage-footer-left b { color: #c5d9da; font-size: 9px; font-variant-numeric: tabular-nums; margin-left: 4px; }
.footer-separator { height: 10px; width: 1px; background: var(--line-strong); }
.stage-footer-right { color: #5c747c; }
.control-column { min-width: 0; overflow-y: auto; padding: 19px 17px 14px; background: linear-gradient(180deg, #0b1a25 0%, #091722 100%); scrollbar-width: thin; scrollbar-color: #29414b transparent; }
.panel-block { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 15px; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.panel-heading h2 { margin: 3px 0 0; color: #e0ecee; font-size: 17px; line-height: 1.1; font-weight: 630; letter-spacing: -.03em; }
.panel-index { color: #5c7881; font-size: 8px; letter-spacing: .13em; padding-bottom: 2px; }
.transport-row { display: grid; grid-template-columns: 1.1fr .95fr .9fr; gap: 7px; margin-bottom: 16px; }
.primary-button, .icon-button, .tool-button, .preset-button { border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.primary-button:active, .icon-button:active, .tool-button:active, .preset-button:active { transform: translateY(1px); }
.primary-button { min-height: 37px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #07191e; background: #80d3d7; border-color: #80d3d7; font-size: 10px; font-weight: 800; }
.primary-button:hover { background: #a0e3e2; }
.primary-button span:first-child { font-size: 13px; }
.icon-button { min-height: 37px; color: #a7bdc1; background: rgba(255,255,255,.025); font-size: 8px; font-weight: 800; letter-spacing: .09em; }
.icon-button:hover, .tool-button:hover { border-color: rgba(120,208,216,.48); background: rgba(120,208,216,.08); color: #d6e9e9; }
.preset-label-row, .control-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preset-label-row { margin-bottom: 8px; color: #7f9aa1; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.micro-note { color: #536e77; font-size: 7px; font-weight: 600; letter-spacing: .08em; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset-button { min-width: 0; min-height: 72px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; padding: 8px 8px 7px; text-align: left; background: rgba(255,255,255,.018); }
.preset-button:hover { background: rgba(120,208,216,.055); }
.preset-button.active { border-color: rgba(120,208,216,.55); background: rgba(120,208,216,.085); box-shadow: inset 0 0 0 1px rgba(120,208,216,.08); }
.preset-icon { font-size: 14px; line-height: 1; color: #80cbd2; margin-bottom: 2px; }
.storm-icon { color: #c6a77d; }
.preset-button b { color: #cbdcde; font-size: 9px; font-weight: 700; white-space: nowrap; }
.preset-button small { color: #6f8991; font-size: 7px; line-height: 1.2; }
.controls-divider { height: 1px; background: var(--line); margin: 14px 0 12px; }
.control-title-row { margin-bottom: 12px; }
.control-title-row h3 { margin: 0; color: #c4d6d8; font-size: 11px; font-weight: 700; }
.control-title-row span { color: #55717a; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.range-control { margin-bottom: 12px; }
.range-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.range-heading label { color: #b3c6c9; font-size: 9px; font-weight: 600; }
.range-heading output { color: #83d2d7; font-size: 9px; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 15px; margin: 0; padding: 0; appearance: none; background: transparent; cursor: pointer; accent-color: #7acbd2; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(106,190,198,.65), rgba(106,190,198,.15)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(106,190,198,.65), rgba(106,190,198,.15)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #d5f1ee; border-radius: 50%; background: #65bdc7; box-shadow: 0 0 0 3px rgba(101,189,199,.14); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #d5f1ee; border-radius: 50%; background: #65bdc7; box-shadow: 0 0 0 3px rgba(101,189,199,.14); }
.range-ends { display: flex; justify-content: space-between; color: #536c75; font-size: 6px; font-weight: 700; letter-spacing: .12em; }
.last-range { margin-bottom: 5px; }
.speed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 9px 10px 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); }
.speed-row > div { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.speed-label { color: #6e8991; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.speed-row strong { color: #bfe0df; font-size: 10px; }
.speed-row input { max-width: 126px; }
.data-block { padding-bottom: 15px; }
.compact-heading { margin-bottom: 11px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-height: 75px; padding: 9px 10px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); overflow: hidden; }
.readout-name { display: block; color: #78939a; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.readout-card strong { display: block; margin: 4px 0 1px; color: #e2f1ef; font-size: 19px; font-weight: 570; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-unit { display: block; color: #627a82; font-size: 7px; }
.wide-readout { grid-column: 1 / -1; min-height: 60px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.wide-readout .readout-name { grid-column: 1; }
.wide-readout strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 20px; }
.wide-readout .readout-unit { grid-column: 1; }
.mini-track { height: 3px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.07); }
.mini-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: #6cc7cd; transition: width .2s ease; }
.food-track i { background: #c9b27f; }
.tools-block { border-bottom: 0; margin-bottom: 8px; padding-bottom: 8px; }
.tool-grid { display: grid; grid-template-columns: 1fr .6fr 1.1fr; gap: 7px; }
.tool-button { min-height: 34px; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 0 7px; color: #9fb6ba; background: rgba(255,255,255,.02); font-size: 8px; font-weight: 800; letter-spacing: .05em; }
.tool-button span { color: #83d1d5; font-size: 14px; }
.export-button { color: #b9d9d9; border-color: rgba(120,208,216,.27); }
.science-details { margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); }
.science-details summary { min-height: 41px; display: flex; align-items: center; justify-content: space-between; padding: 0 11px; color: #c9dcde; cursor: pointer; list-style: none; font-size: 10px; font-weight: 700; }
.science-details summary::-webkit-details-marker { display: none; }
.science-details summary > span:first-child { display: flex; align-items: center; gap: 9px; }
.science-symbol { color: #7bcbd2; font-size: 15px; }
.summary-plus { color: #7e9aa1; font-size: 16px; transition: transform .18s ease; }
.science-details[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 11px 12px; color: #8fa7ad; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 0 0 9px; }
.science-lead { color: #b7cbce; font-size: 9px; }
.science-content h4 { margin: 13px 0 5px; color: #b6d4d6; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.science-content b { color: #c9dedf; }
.equation { padding: 8px 9px; margin: 6px 0 8px; border-left: 2px solid rgba(120,208,216,.45); border-radius: 0 6px 6px 0; background: rgba(120,208,216,.055); color: #c8e4e2; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8px; line-height: 1.7; overflow-wrap: anywhere; }
.validation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.validation-grid > div { padding: 7px; border: 1px solid var(--line); border-radius: 6px; }
.validation-grid span { display: block; color: #67838a; font-size: 6px; font-weight: 800; letter-spacing: .1em; }
.validation-grid b { display: block; margin-top: 3px; color: #c6e3df; font-family: ui-monospace, monospace; font-size: 10px; font-weight: 600; }
.validation-grid .validation-diff { border-color: rgba(120,208,216,.26); background: rgba(120,208,216,.04); }
.validation-note { color: #78949b; font-size: 8px; }
.science-content ul { margin: 6px 0 10px; padding-left: 15px; }
.science-content li { margin: 0 0 5px; }
.science-disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #a8c6c8; font-style: italic; }
.panel-footnote { display: flex; justify-content: space-between; color: #526d76; font-size: 7px; font-weight: 700; letter-spacing: .13em; }
.panel-footnote span { color: #688891; }
.embed-mode .topbar { display: none; }
.embed-mode .app-layout { height: 100vh; min-height: 0; }
.embed-mode .stage-column { padding-top: 13px; }
.embed-mode .stage-heading { padding-bottom: 10px; }
.embed-mode .panel-footnote { display: none; }

@media (min-width: 1500px) {
  .app-layout { grid-template-columns: minmax(0, 1fr) 410px; }
  .control-column { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 1050px) {
  .app-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .stage-column { padding-left: 16px; padding-right: 16px; }
  .control-column { padding-left: 13px; padding-right: 13px; }
  .preset-button { padding-left: 6px; padding-right: 6px; }
  .preset-button b { font-size: 8px; }
}
@media (max-width: 760px) {
  .topbar { height: 54px; padding: 0 14px; }
  .topbar-right { gap: 10px; }
  .category-pill { font-size: 7px; }
  .seed-label { font-size: 7px; }
  .app-layout { display: flex; flex-direction: column; height: auto; min-height: calc(100vh - 54px); }
  .stage-column { flex: 0 0 auto; padding: 14px 12px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-heading { padding: 0 2px 10px; }
  .stage-heading h1 { font-size: 21px; }
  .stage-heading p { font-size: 10px; }
  .stage-number b { font-size: 21px; }
  .viewport-shell { flex: none; height: min(53vh, 430px); min-height: 290px; border-radius: 10px; }
  .scene-top-left { top: 13px; left: 13px; }
  .scene-top-right { top: 14px; right: 13px; }
  .scene-bottom-left { left: 12px; bottom: 36px; gap: 8px; }
  .scene-bottom-right { display: none; }
  .legend-item { font-size: 7px; }
  .stage-footer { padding-top: 9px; font-size: 7px; }
  .stage-footer-right { display: none; }
  .control-column { overflow: visible; padding: 15px 12px 24px; }
  .panel-block { padding-bottom: 14px; margin-bottom: 13px; }
  .panel-heading h2 { font-size: 16px; }
  .range-control { margin-bottom: 13px; }
  .range-heading label, .range-heading output { font-size: 10px; }
  .preset-button { min-height: 73px; padding: 8px; }
  .preset-button b { font-size: 9px; }
  .preset-button small { font-size: 7px; }
  .readout-card { min-height: 78px; }
  .readout-card strong { font-size: 20px; }
  .embed-mode .stage-column { padding-top: 10px; }
  .embed-mode .stage-heading { display: none; }
  .embed-mode .viewport-shell { height: 56vh; }
}
@media (max-width: 380px) {
  .brand { font-size: 10px; }
  .brand-mark { width: 21px; height: 21px; }
  .category-pill { letter-spacing: .08em; }
  .preset-grid { gap: 4px; }
  .preset-button { padding-left: 5px; padding-right: 5px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 6px; }
  .scene-top-left strong { font-size: 11px; }
  .overlay-sub { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
