:root {
  color-scheme: dark;
  --bg: #06151d;
  --panel: rgba(10, 31, 41, .94);
  --panel-2: #0b2632;
  --panel-3: #0d303b;
  --line: rgba(131, 202, 207, .15);
  --line-strong: rgba(131, 202, 207, .28);
  --text: #e5f2ef;
  --muted: #87a9aa;
  --muted-2: #5c8288;
  --teal: #70e0d1;
  --cyan: #55c8dd;
  --gold: #e8c18b;
  --danger: #f1a58e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(ellipse at 54% -18%, rgba(24, 98, 111, .22), transparent 42%),
    linear-gradient(180deg, #071a23 0%, #06151d 58%, #06131a 100%);
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.app-shell { width: min(1600px, 100%); margin: 0 auto; padding: 0 26px 18px; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(135, 190, 193, .13);
}
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border: 1px solid rgba(112,224,209,.42); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(145deg, rgba(36,123,130,.24), rgba(6,39,49,.4));
  box-shadow: 0 0 24px rgba(41, 194, 188, .08), inset 0 0 12px rgba(78, 206, 200, .08);
}
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--teal); transform: skewY(-28deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .78; }
.brand-copy { min-width: 0; }
.eyebrow, .panel-kicker, .stage-index, .section-label, .control-count, .range-ends, .metric-name, .metric-note, .metrics-state, .science-index, .validation-values span, .validation-condition, .science-toggle, .footer-line, .transport-right, .topbar-status, .seed-label, .scene-hint, .sim-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .105em;
}
.eyebrow { color: #6f9b9f; font-size: 9px; line-height: 1.3; font-weight: 700; }
.eyebrow span { color: #4b777d; padding: 0 4px; }
.brand-copy h1 { margin: 2px 0 0; font-size: 17px; font-weight: 620; letter-spacing: -.025em; white-space: nowrap; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: #72999c; font: 9px ui-monospace, monospace; letter-spacing: .12em; }
.live-dot, .tiny-pulse { width: 6px; height: 6px; border-radius: 50%; background: #69ddc5; box-shadow: 0 0 10px rgba(105,221,197,.75); }
.seed-label b { color: #b6d5d0; font-weight: 600; }
.meta-divider { width: 1px; height: 14px; background: var(--line-strong); margin: 0 5px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 326px; gap: 14px; padding-top: 16px; align-items: stretch; }
.stage-card, .control-card, .science-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(12, 38, 49, .94), rgba(7, 27, 37, .96));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(206,255,246,.025);
  overflow: hidden;
}
.stage-card { min-width: 0; display: flex; flex-direction: column; }
.stage-topline { height: 54px; padding: 0 16px 0 19px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-heading { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage-index { font-size: 8px; color: #699499; font-weight: 700; }
.stage-title { color: #c6dfd9; font-size: 12px; font-weight: 550; letter-spacing: .005em; }
.stage-actions { display: flex; align-items: center; gap: 6px; }
.icon-button, .transport-button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(134, 199, 199, .2); background: rgba(9, 37, 47, .76);
  color: #9bc5c2; border-radius: 8px; cursor: pointer; transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.icon-button { width: 31px; height: 29px; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; }
.icon-button svg, .transport-button svg, .play-button svg, .science-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover, .transport-button:hover { background: rgba(31, 91, 98, .42); border-color: rgba(112,224,209,.48); color: #d4f6ed; }
.scene-wrap { position: relative; height: clamp(410px, 48vw, 590px); min-height: 380px; overflow: hidden; background: radial-gradient(ellipse at 50% 25%, #0c3540 0%, #071e2b 52%, #06131d 100%); }
.scene-mount { position: absolute; inset: 0; }
.ocean-canvas { display: block; width: 100%; height: 100%; outline: none; }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(4,17,25,.17), transparent 25%, transparent 75%, rgba(4,15,22,.48)); }
.scene-error, .scene-context {
  position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 36px)); padding: 20px 22px; border: 1px solid rgba(241,165,142,.3);
  border-radius: 12px; background: rgba(5,20,28,.94); box-shadow: 0 18px 50px #0008;
  display: flex; flex-direction: column; gap: 8px; text-align: center;
}
.scene-error[hidden], .scene-context[hidden] { display: none; }
.error-symbol { font-size: 27px; color: var(--gold); }
.scene-error strong, .scene-context strong { font-size: 13px; color: #f0d8c0; }
.scene-error span, .scene-context span { color: #9cb6b5; font-size: 11px; line-height: 1.55; }
.scene-context { border-color: rgba(112,224,209,.28); }
.scene-context strong { color: var(--teal); }
.annotation { position: absolute; z-index: 2; pointer-events: none; display: flex; align-items: center; gap: 7px; color: rgba(183,231,223,.76); font: 8px ui-monospace, monospace; letter-spacing: .13em; text-shadow: 0 1px 5px #00151e; }
.annotation-wind { top: 18%; left: 7%; color: #f1d6a6; }
.annotation-line { width: 24px; height: 1px; background: #e8c18b; box-shadow: 0 0 7px #e8c18b; }
.annotation-streak { left: 43%; top: 28%; }
.annotation-roll { left: 61%; top: 65%; }
.annotation-dot { width: 5px; height: 5px; border: 1px solid #82e9db; border-radius: 50%; box-shadow: 0 0 9px #64dfd1; }
.scene-legend { position: absolute; z-index: 2; left: 17px; bottom: 39px; display: flex; flex-wrap: wrap; gap: 12px; color: rgba(171,204,202,.75); font: 8px ui-monospace, monospace; letter-spacing: .04em; pointer-events: none; }
.scene-legend span { display: inline-flex; align-items: center; gap: 5px; }
.scene-legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.legend-surface { background: #9cf8e9; box-shadow: 0 0 6px #9cf8e9; }
.legend-deep { background: #55c5db; }
.legend-flow { width: 13px !important; height: 2px !important; border-radius: 2px !important; background: #55e4dc; }
.scene-bottomline { position: absolute; z-index: 3; left: 17px; right: 17px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.sim-clock { color: #9cc4bf; font-size: 8px; letter-spacing: .12em; }
.scene-hint { color: rgba(126,170,172,.65); font-size: 8px; }
.scene-hint i { color: #527c82; font-style: normal; padding: 0 5px; }
.transport-bar { min-height: 55px; padding: 0 17px; display: flex; align-items: center; gap: 18px; border-top: 1px solid rgba(131,202,207,.13); background: rgba(5, 22, 30, .62); }
.transport-controls { display: flex; align-items: center; gap: 6px; }
.play-button { height: 31px; min-width: 93px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(112,224,209,.36); border-radius: 8px; background: rgba(37,110,107,.22); color: #a9eadd; cursor: pointer; font: 700 9px ui-monospace, monospace; letter-spacing: .1em; transition: background .18s ease; }
.play-button:hover { background: rgba(52,146,137,.32); }
.play-button svg { width: 13px; height: 13px; }
.transport-button { width: 31px; height: 31px; }
.transport-note { display: flex; align-items: center; gap: 8px; color: #70999a; font: 8px ui-monospace, monospace; letter-spacing: .11em; }
.transport-right { margin-left: auto; display: flex; align-items: center; gap: 7px; color: #5d858a; font-size: 8px; }
.transport-right b { color: #a0c2bd; font-weight: 600; }

.control-card { padding: 17px 16px 14px; display: flex; flex-direction: column; min-width: 0; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.panel-kicker { display: block; color: #69979b; font-size: 8px; font-weight: 700; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; font-weight: 620; letter-spacing: -.025em; }
.control-count { margin-top: 4px; padding: 5px 7px; border: 1px solid rgba(113,191,190,.17); border-radius: 5px; color: #7ba8a8; font-size: 7px; white-space: nowrap; }
.preset-block { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.section-label { margin-bottom: 8px; color: #70999a; font-size: 8px; font-weight: 700; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset-button { min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 7px 8px; border: 1px solid rgba(131,202,207,.13); border-radius: 8px; background: rgba(7,28,37,.68); color: #87a9aa; text-align: left; cursor: pointer; font-size: 9px; line-height: 1.2; transition: all .18s ease; }
.preset-button:hover { border-color: rgba(112,224,209,.38); color: #c9e7df; }
.preset-button.active { border-color: rgba(112,224,209,.45); background: linear-gradient(145deg, rgba(34,103,102,.3), rgba(7,36,43,.82)); color: #c7eee4; box-shadow: inset 0 0 18px rgba(81,209,190,.06); }
.preset-icon { font-size: 17px; line-height: 1; color: #6ecdc4; }
.classic-icon { color: #83e2d4; }
.strong-icon { color: #e7c28e; }
.control-list { padding-top: 3px; }
.control-row { padding: 10px 0 8px; border-bottom: 1px solid rgba(131,202,207,.09); }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.control-label label { color: #bdd5d0; font-size: 10px; font-weight: 540; }
.control-label output { color: #9de5d7; font: 600 10px ui-monospace, monospace; white-space: nowrap; }
.control-label output small { color: #759c9c; font-size: 8px; font-weight: 500; }
input[type="range"] { width: 100%; height: 14px; margin: 0; display: block; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; accent-color: var(--teal); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(66,168,160,.72), rgba(49,112,126,.62)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(66,168,160,.72), rgba(49,112,126,.62)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #b5f2e4; border-radius: 50%; background: #237f7e; box-shadow: 0 0 0 3px rgba(93,215,198,.12), 0 0 10px rgba(93,215,198,.45); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #b5f2e4; border-radius: 50%; background: #237f7e; box-shadow: 0 0 0 3px rgba(93,215,198,.12), 0 0 10px rgba(93,215,198,.45); }
.range-ends { display: flex; justify-content: space-between; gap: 4px; margin-top: 4px; color: #587e83; font-size: 6px; letter-spacing: .07em; }
.range-ends span:nth-child(2) { text-align: center; }
.speed-control { padding: 12px 0 10px; }
.panel-footnote { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 10px 9px; border: 1px solid rgba(100,173,174,.13); border-radius: 7px; background: rgba(6,27,35,.55); color: #75999a; font-size: 8px; line-height: 1.5; }
.info-mark { flex: 0 0 13px; width: 13px; height: 13px; display: grid; place-items: center; border: 1px solid #528e8b; border-radius: 50%; color: #8ed7c9; font: italic 9px Georgia, serif; }

.metrics-section { padding: 17px 1px 14px; }
.metrics-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.metrics-state { display: flex; align-items: center; gap: 7px; color: #668c90; font-size: 8px; }
.metrics-state i { width: 5px; height: 5px; border-radius: 50%; background: #64d8c2; box-shadow: 0 0 7px #64d8c2; }
.metrics-state b { color: #426b72; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric-card { min-height: 85px; padding: 12px 14px 10px; border: 1px solid rgba(131,202,207,.13); border-radius: 9px; background: linear-gradient(135deg, rgba(11,38,49,.88), rgba(7,26,36,.88)); }
.metric-card.metric-highlight { border-color: rgba(112,224,209,.25); background: linear-gradient(135deg, rgba(15,54,59,.9), rgba(7,30,38,.9)); }
.metric-name { display: block; color: #759b9d; font-size: 7px; font-weight: 700; }
.metric-name em { color: #a3c9c0; font-size: 9px; font-style: italic; }
.metric-card strong { display: block; margin-top: 6px; color: #d6f1e9; font: 600 22px/1.05 ui-monospace, monospace; letter-spacing: -.055em; }
.metric-highlight strong { color: #8de3d4; }
.metric-card strong small { color: #7fa8a6; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.metric-note { display: block; margin-top: 6px; color: #547d82; font-size: 7px; }

.science-card { margin-top: 1px; }
.science-card summary { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 17px; list-style: none; cursor: pointer; }
.science-card summary::-webkit-details-marker { display: none; }
.science-summary-left { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 13px; row-gap: 3px; }
.science-summary-left .panel-kicker { grid-column: 1 / -1; }
.science-summary-left strong { color: #d2e9e2; font-size: 13px; font-weight: 620; }
.science-summary-desc { color: #75999b; font-size: 9px; }
.science-toggle { display: flex; align-items: center; gap: 8px; color: #83b8b0; font-size: 8px; }
.science-toggle svg { transition: transform .2s ease; }
.science-card[open] .science-toggle svg { transform: rotate(180deg); }
.science-card[open] .science-toggle span { color: #b5e9dc; }
.science-content { padding: 0 17px 14px; border-top: 1px solid rgba(131,202,207,.1); }
.science-columns { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 22px; padding: 17px 0 14px; }
.science-index { color: #67a6a1; font-size: 8px; font-weight: 700; }
.science-block h3, .validation-head h3 { margin: 5px 0 7px; color: #d0e7df; font-size: 12px; font-weight: 620; }
.science-block p, .validation-card p { margin: 0 0 9px; color: #8aaba9; font-size: 9px; line-height: 1.65; }
.equation { margin: 5px 0; padding: 6px 8px; border-left: 2px solid rgba(103,202,188,.42); background: rgba(4,23,31,.56); color: #b2ddd2; font: 9px ui-monospace, monospace; line-height: 1.5; overflow-wrap: anywhere; }
.science-caveat { margin-top: 8px; color: #d2b88f; font-size: 8px; line-height: 1.55; }
.validation-card { padding: 12px 13px 11px; border: 1px solid rgba(105,190,184,.18); border-radius: 8px; background: rgba(5,24,32,.64); }
.validation-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.validation-head h3 { margin-bottom: 5px; }
.validation-status { padding: 5px 7px; border: 1px solid rgba(103,216,190,.25); border-radius: 5px; color: #8cdec9; font: 7px ui-monospace, monospace; letter-spacing: .08em; white-space: nowrap; }
.validation-status.warning { border-color: rgba(232,193,139,.28); color: #e8c18b; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 10px; }
.validation-values div { display: flex; flex-direction: column; gap: 5px; }
.validation-values span { color: #628a8e; font-size: 7px; }
.validation-values strong { color: #d1e9e1; font: 600 14px ui-monospace, monospace; }
.validation-values strong small { color: #7ea7a3; font-size: 8px; font-weight: 500; }
.validation-condition { margin-top: 10px; color: #6c999a; font-size: 8px; }
.science-footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 11px; color: #587e82; font: 7px ui-monospace, monospace; letter-spacing: .055em; line-height: 1.6; }
.science-footer b { color: #9bbdb5; font-weight: 600; }
.footer-line { min-height: 35px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: #53767b; font-size: 7px; letter-spacing: .07em; }
.footer-line b { color: #38656c; }

@media (max-width: 1050px) {
  .app-shell { padding: 0 18px 16px; }
  .workspace { grid-template-columns: minmax(0,1fr) 300px; gap: 10px; }
  .control-card { padding: 14px 13px; }
  .scene-wrap { height: clamp(390px, 50vw, 520px); }
  .science-columns { gap: 14px; }
}
@media (max-width: 820px) {
  .app-shell { padding: 0 14px 14px; }
  .workspace { grid-template-columns: 1fr; }
  .scene-wrap { height: min(58vw, 520px); min-height: 360px; }
  .control-card { display: block; }
  .control-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); column-gap: 16px; }
  .control-row:nth-child(odd) { padding-right: 4px; }
  .control-row:nth-child(even) { padding-left: 4px; }
  .speed-control { max-width: 420px; }
  .panel-footnote { margin-top: 5px; }
  .science-columns { grid-template-columns: 1fr 1fr; }
  .science-block:last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .app-shell { padding: 0 9px 12px; }
  .topbar { height: 59px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .eyebrow { font-size: 7px; }
  .brand-copy h1 { font-size: 14px; }
  .topbar-meta { gap: 6px; font-size: 7px; }
  .topbar-status { display: none; }
  .meta-divider { margin: 0 2px; }
  .workspace { padding-top: 9px; gap: 9px; }
  .stage-card, .control-card, .science-card { border-radius: 11px; }
  .stage-topline { height: 48px; padding: 0 10px 0 12px; }
  .stage-index { font-size: 7px; }
  .stage-title { font-size: 10px; }
  .stage-actions { gap: 4px; }
  .icon-button { width: 28px; height: 27px; border-radius: 7px; }
  .scene-wrap { height: 390px; min-height: 360px; }
  .annotation { font-size: 6px; gap: 5px; }
  .annotation-wind { top: 12%; left: 5%; }
  .annotation-streak { top: 26%; left: 36%; }
  .annotation-roll { top: 64%; left: 53%; }
  .scene-legend { left: 10px; bottom: 37px; gap: 8px; font-size: 7px; }
  .scene-bottomline { left: 10px; right: 10px; bottom: 10px; }
  .scene-hint { font-size: 6px; }
  .transport-bar { min-height: 49px; padding: 0 10px; gap: 10px; }
  .play-button { min-width: 79px; height: 29px; font-size: 8px; }
  .transport-button { width: 29px; height: 29px; }
  .transport-note { font-size: 7px; gap: 6px; }
  .transport-right { display: none; }
  .control-card { padding: 13px 12px 11px; }
  .panel-heading h2 { font-size: 15px; }
  .preset-button { min-height: 51px; padding: 6px; font-size: 8px; }
  .control-list { grid-template-columns: 1fr; }
  .control-row:nth-child(odd), .control-row:nth-child(even) { padding-left: 0; padding-right: 0; }
  .control-row { padding: 9px 0 7px; }
  .range-ends { font-size: 6px; }
  .panel-footnote { font-size: 8px; }
  .metrics-section { padding: 13px 0 10px; }
  .metrics-heading { margin-bottom: 8px; }
  .metrics-state { font-size: 6px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .metric-card { min-height: 76px; padding: 10px 10px 8px; }
  .metric-name { font-size: 6px; }
  .metric-card strong { font-size: 20px; }
  .metric-note { font-size: 6px; }
  .science-card summary { min-height: 57px; padding: 10px 12px; }
  .science-summary-left { grid-template-columns: 1fr; gap: 3px; }
  .science-summary-left strong { font-size: 12px; }
  .science-summary-desc { font-size: 8px; }
  .science-toggle { font-size: 7px; }
  .science-content { padding: 0 11px 12px; }
  .science-columns { grid-template-columns: 1fr; gap: 15px; padding-top: 13px; }
  .science-block:last-child { grid-column: auto; }
  .science-block p, .validation-card p { font-size: 9px; }
  .validation-values { grid-template-columns: 1fr 1fr; }
  .validation-values div:last-child { grid-column: 1 / -1; }
  .science-footer { flex-direction: column; gap: 5px; }
  .footer-line { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; padding: 9px 2px 0; font-size: 6px; }
}

@media (max-width: 360px) {
  .topbar-meta { display: none; }
  .scene-wrap { height: 360px; }
  .scene-legend { gap: 6px; }
  .scene-legend span { font-size: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.app-shell.embed-mode { padding-top: 0; }
.embed-mode .topbar, .embed-mode .footer-line { display: none; }
.embed-mode .workspace { padding-top: 0; }
.embed-mode .scene-wrap { height: clamp(340px, 55vh, 590px); }
