:root {
  color-scheme: dark;
  --bg: #07131d;
  --panel: #0b1a25;
  --panel-2: #0e202c;
  --line: rgba(143, 190, 205, 0.14);
  --line-strong: rgba(143, 190, 205, 0.24);
  --text: #e4f1f4;
  --muted: #829aa5;
  --dim: #536c78;
  --cyan: #6dd6e7;
  --cyan-soft: #b6eff5;
  --ice: #9be7f1;
  --amber: #e8bd78;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; font-size: 12px; letter-spacing: 0.01em; }
button, input { font: inherit; }
button { color: inherit; }
#app { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 56% 42%, rgba(17, 54, 67, 0.22), transparent 54%), var(--bg); }
.topbar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; gap: 13px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(6, 17, 26, 0.94); z-index: 5; }
.brand-mark { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; gap: 2px; border: 1px solid rgba(109,214,231,.36); border-radius: 7px; transform: rotate(45deg); }
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--cyan); transform: rotate(-45deg); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 9px; opacity: .72; }
.brand-copy { min-width: 0; }
.eyebrow, .section-label, .metric-label, .equation-label, .validation-head, .scene-micro-label, .toolbar-note, .footer, .range-hints, .transport-top, .topbar-meta { font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.eyebrow { color: #84a4b1; line-height: 1.1; }
.eyebrow span { color: #4d6976; }
h1 { margin: 3px 0 0; font-size: 12px; line-height: 1; letter-spacing: .085em; font-weight: 700; color: #d9e9ee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 span { color: #548e9d; padding: 0 4px; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 9px; color: #8ea7b0; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: #63d7bb; box-shadow: 0 0 10px rgba(99,215,187,.65); }
.topbar-divider, .toolbar-divider { width: 1px; height: 14px; background: var(--line-strong); }
.seed-label { color: #55717e; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 254px minmax(0, 1fr) 266px; gap: 10px; padding: 10px; }
.panel { min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(14,32,44,.98), rgba(8,22,32,.98)); box-shadow: 0 10px 28px rgba(0,0,0,.16); }
.control-panel, .science-panel { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #294451 transparent; }
.control-panel { padding: 16px 14px 14px; }
.science-panel { padding: 16px 14px 12px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 15px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 17px; line-height: 1.1; font-weight: 650; letter-spacing: -.02em; }
.panel-index { color: #45616d; font-size: 10px; font-weight: 700; letter-spacing: .12em; padding-top: 2px; }
.preset-block { padding: 11px 0 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-label { color: #6f8b97; display: block; margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: 1fr; gap: 5px; }
.preset-button { min-height: 29px; border: 1px solid transparent; border-radius: 7px; background: rgba(255,255,255,.025); color: #9eb4bc; display: flex; align-items: center; gap: 8px; padding: 0 9px; cursor: pointer; text-align: left; font-size: 10px; transition: background .18s ease, border-color .18s ease, color .18s ease; }
.preset-button:hover { background: rgba(109,214,231,.08); color: var(--text); }
.preset-button.active { background: rgba(67,157,177,.13); border-color: rgba(109,214,231,.27); color: #d7f4f6; }
.preset-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ice); box-shadow: 0 0 8px rgba(155,231,241,.45); }
.preset-dot.shear { background: var(--amber); box-shadow: 0 0 8px rgba(232,189,120,.35); }
.preset-dot.quiet { background: #8a9fab; box-shadow: none; }
.control-list { padding-top: 5px; }
.control-row { padding: 9px 0 8px; border-bottom: 1px solid rgba(143,190,205,.09); }
.control-row label { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; color: #b8cbd1; font-size: 10px; font-weight: 550; }
.control-row output { color: var(--cyan-soft); font-variant-numeric: tabular-nums; font-size: 10px; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 7px 0 3px; appearance: none; background: transparent; cursor: pointer; accent-color: var(--cyan); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(77,168,187,.8), rgba(77,168,187,.28)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(77,168,187,.8), rgba(77,168,187,.28)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #b8f0f4; border-radius: 50%; background: #2b8093; box-shadow: 0 0 0 3px rgba(109,214,231,.11); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #b8f0f4; border-radius: 50%; background: #2b8093; box-shadow: 0 0 0 3px rgba(109,214,231,.11); }
input[type="range"]:focus-visible { outline: 1px solid var(--cyan); outline-offset: 4px; border-radius: 3px; }
.range-hints { display: flex; justify-content: space-between; color: #4f6975; font-size: 7px; letter-spacing: .09em; font-weight: 600; }
.range-hints span:nth-child(2) { color: #607d89; }
.speed-row { border-bottom: 0; }
.transport-block { margin-top: 6px; padding: 11px 10px 9px; border: 1px solid rgba(109,214,231,.15); border-radius: 9px; background: rgba(4,15,23,.36); }
.transport-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.transport-top .section-label { margin: 0; }
.clock { color: #b6e9ee; font-size: 11px; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.transport-buttons { display: grid; grid-template-columns: 1fr 48px 38px; gap: 6px; }
.primary-button, .icon-button { min-height: 32px; border-radius: 7px; border: 1px solid rgba(109,214,231,.24); cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.primary-button { background: linear-gradient(135deg, #267e91, #185468); color: #effcff; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.primary-button:hover { background: linear-gradient(135deg, #3196a8, #1e6b80); }
.icon-button { background: rgba(255,255,255,.035); color: #a9c1c9; font-size: 10px; }
.icon-button:hover { border-color: rgba(109,214,231,.45); background: rgba(109,214,231,.08); }
button:focus-visible { outline: 2px solid #7fe0ea; outline-offset: 2px; }
button:active { transform: translateY(1px); }
.transport-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; color: #66838f; font-size: 9px; font-variant-numeric: tabular-nums; }
.status-pill { color: #76d7bd; letter-spacing: .12em; font-weight: 700; }
.status-pill.paused { color: #e7bb76; }
.viewport-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #07131d; box-shadow: 0 10px 28px rgba(0,0,0,.2); }
.webgl-mount { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 52% 45%, #0d2c39 0%, #081b28 58%, #06131e 100%); }
#sceneCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.scene-topline { position: absolute; z-index: 2; top: 13px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-label, .scene-time { padding: 7px 9px; border: 1px solid rgba(154,208,219,.16); border-radius: 6px; background: rgba(5,17,26,.68); backdrop-filter: blur(8px); color: #b5d2da; font-size: 8px; font-weight: 700; letter-spacing: .13em; }
.scene-label-icon { color: var(--cyan); margin-right: 5px; font-size: 11px; }
.scene-label-sep { color: #587681; margin: 0 5px; }
.scene-time { display: flex; align-items: center; gap: 7px; color: #a5c1ca; font-variant-numeric: tabular-nums; }
.scene-callouts { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.callout { position: absolute; padding: 7px 9px 7px 10px; min-width: 125px; border-left: 1px solid rgba(116,220,235,.68); background: linear-gradient(90deg, rgba(6,21,31,.82), rgba(6,21,31,.16)); text-shadow: 0 1px 5px #001018; }
.callout-top { top: 25%; left: 5%; }
.callout-bottom { bottom: 24%; right: 4%; border-left: 0; border-right: 1px solid rgba(116,220,235,.68); text-align: right; background: linear-gradient(270deg, rgba(6,21,31,.82), rgba(6,21,31,.16)); }
.callout b { display: block; color: #c9f4f5; font-size: 8px; letter-spacing: .15em; }
.callout small { display: block; margin-top: 3px; color: #82a9b4; font-size: 8px; letter-spacing: .02em; }
.callout-dot { position: absolute; top: 50%; right: -5px; width: 5px; height: 5px; border-radius: 50%; background: #a4eff2; box-shadow: 0 0 9px #70d5e7; }
.callout-bottom .callout-dot { left: -5px; right: auto; }
.scene-bottomline { position: absolute; z-index: 2; left: 14px; right: 14px; bottom: 13px; display: flex; align-items: flex-end; justify-content: space-between; pointer-events: none; }
.scene-bottomline > div:first-child { padding: 8px 10px; border: 1px solid rgba(154,208,219,.13); border-radius: 6px; background: rgba(5,17,26,.66); backdrop-filter: blur(8px); }
.scene-micro-label { display: block; color: #64828e; font-size: 7px; margin-bottom: 4px; }
.scene-bottomline strong { display: block; color: #a8e7eb; font-size: 10px; letter-spacing: .1em; }
.scene-legend { display: flex; gap: 12px; padding: 8px 10px; border: 1px solid rgba(154,208,219,.13); border-radius: 6px; background: rgba(5,17,26,.66); color: #89aab4; font-size: 8px; }
.scene-legend span { display: flex; align-items: center; gap: 5px; }
.scene-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-frazil { background: #b9f4f4; box-shadow: 0 0 6px #8ee5ee; }
.legend-anchor { background: #68bfd3; }
.legend-flow { background: #398da7; }
.viewport-toolbar { min-height: 38px; flex: 0 0 38px; display: flex; justify-content: space-between; align-items: center; padding: 0 12px; border-top: 1px solid var(--line); background: #091923; }
.toolbar-left, .toolbar-actions { display: flex; align-items: center; gap: 10px; }
.toolbar-note { color: #5d7884; font-size: 7px; letter-spacing: .11em; }
.toolbar-note b { color: #45616c; padding: 0 3px; }
.tool-button { min-height: 25px; padding: 0 8px; border: 1px solid rgba(109,214,231,.15); border-radius: 5px; background: rgba(255,255,255,.025); color: #8daab5; font-size: 8px; letter-spacing: .1em; cursor: pointer; }
.tool-button:hover { color: #d4f3f4; border-color: rgba(109,214,231,.42); background: rgba(109,214,231,.07); }
.tool-button span { margin-left: 4px; }
.export-button { color: #a9dce4; }
.science-heading { margin-bottom: 13px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-height: 75px; padding: 9px 9px 8px; border: 1px solid rgba(143,190,205,.11); border-radius: 8px; background: rgba(4,16,24,.33); min-width: 0; }
.metric-label { display: block; color: #6f8d98; font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
.metric-label i { color: #4f6d79; font-style: normal; font-size: 6px; letter-spacing: .06em; }
.metric-card strong { display: block; margin-top: 7px; color: #d2f0f1; font-size: 19px; line-height: 1; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-card small { display: block; margin-top: 6px; color: #607b87; font-size: 8px; line-height: 1.25; }
.metric-wide { grid-column: 1 / -1; min-height: 68px; }
.metric-inline { display: flex; justify-content: space-between; align-items: center; }
.metric-inline strong { margin: 0; font-size: 16px; }
.coverage-track { height: 4px; margin-top: 9px; border-radius: 6px; background: #1c3642; overflow: hidden; }
.coverage-track span { display: block; width: var(--coverage, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3b9eae, #a4e7e9); transition: width .25s ease; }
.event-strip { display: flex; align-items: center; gap: 8px; padding: 9px 2px 10px; border-bottom: 1px solid var(--line); }
.event-icon { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid rgba(109,214,231,.2); border-radius: 6px; color: var(--cyan); font-size: 14px; }
.event-strip div { display: flex; flex-direction: column; gap: 1px; }
.event-strip div b { color: #c7e8eb; font-size: 12px; font-variant-numeric: tabular-nums; }
.event-strip div span { color: #66828e; font-size: 8px; }
.event-strip > small { margin-left: auto; color: #526e79; font-size: 7px; text-align: right; }
.science-details { margin-top: 10px; }
.science-details summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 8px 0; color: #9fc2cb; font-size: 9px; font-weight: 750; letter-spacing: .14em; cursor: pointer; border-bottom: 1px solid var(--line); }
.science-details summary::-webkit-details-marker { display: none; }
.summary-plus { color: #6a929f; font-size: 14px; font-weight: 400; }
.science-details:not([open]) .summary-plus { transform: rotate(45deg); }
.science-content { padding-top: 9px; }
.mechanism-step { display: grid; grid-template-columns: 23px 1fr; gap: 7px; padding: 7px 0; }
.step-no { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; background: rgba(109,214,231,.08); color: #72bdcb; font-size: 8px; font-weight: 700; }
.mechanism-step b { color: #b9d6dd; font-size: 9px; font-weight: 650; }
.mechanism-step p { margin: 4px 0 0; color: #78919b; font-size: 8px; line-height: 1.45; }
.equation-block { margin-top: 8px; padding: 9px; border: 1px solid rgba(143,190,205,.11); border-radius: 7px; background: rgba(4,16,24,.34); }
.equation-label { color: #6b8b97; font-size: 7px; }
.equation { margin: 8px 0 4px; color: #d3f2f3; font-family: Georgia, "Times New Roman", serif; font-size: 15px; letter-spacing: .01em; text-align: center; }
.equation-block small { display: block; color: #647f8b; font-size: 8px; text-align: center; }
.validation-card { margin-top: 9px; padding: 9px; border: 1px solid rgba(103,202,186,.2); border-radius: 8px; background: linear-gradient(140deg, rgba(20,66,68,.18), rgba(4,16,24,.3)); }
.validation-head { display: flex; align-items: center; justify-content: space-between; color: #88b5b8; font-size: 7px; }
.validation-ok { color: #7bd2b9; font-size: 7px; letter-spacing: .1em; }
.validation-caption { margin-top: 6px; color: #66848d; font-size: 8px; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.validation-values div { padding: 7px; border-radius: 5px; background: rgba(255,255,255,.025); }
.validation-values small { display: block; color: #65828c; font-size: 7px; letter-spacing: .1em; }
.validation-values b { display: block; margin-top: 4px; color: #d1eeee; font-size: 14px; font-weight: 600; }
.validation-diff { display: flex; justify-content: space-between; margin-top: 8px; color: #719099; font-size: 8px; }
.validation-diff b { color: #8ce0c4; font-variant-numeric: tabular-nums; }
.assumptions { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.assumptions > b { color: #688691; font-size: 7px; letter-spacing: .12em; }
.assumptions ul { margin: 7px 0 0; padding-left: 14px; color: #718a94; font-size: 8px; line-height: 1.45; }
.assumptions li { margin: 4px 0; }
.footer { min-height: 25px; flex: 0 0 25px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-top: 1px solid rgba(143,190,205,.08); color: #4d6874; font-size: 7px; letter-spacing: .12em; }
.context-overlay, .renderer-error { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; background: rgba(4,14,22,.78); backdrop-filter: blur(5px); }
.context-overlay.visible, .renderer-error.visible { display: flex; }
.context-card { max-width: 270px; padding: 18px; border: 1px solid var(--line-strong); border-radius: 10px; background: #0c202b; text-align: center; }
.context-card b { display: block; color: #d8eff1; font-size: 13px; }
.context-card span { display: block; margin-top: 7px; color: #8ba7b1; font-size: 10px; line-height: 1.45; }
.renderer-error { color: #d8e8ec; padding: 25px; text-align: center; font-size: 12px; line-height: 1.5; }
.embed-mode .topbar, .embed-mode .footer { display: none; }
.embed-mode .layout { height: 100vh; }

@media (max-width: 1120px) {
  .layout { grid-template-columns: 232px minmax(0, 1fr) 236px; gap: 8px; padding: 8px; }
  .control-panel, .science-panel { padding-left: 11px; padding-right: 11px; }
  .metric-card { padding: 8px 7px; }
  .metric-card strong { font-size: 17px; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  #app { min-height: 100vh; }
  .topbar { position: sticky; top: 0; }
  .layout { flex: initial; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(340px, 48vh) auto auto; grid-template-areas: "viewport" "controls" "science"; gap: 9px; padding: 9px; }
  .viewport-panel { grid-area: viewport; min-height: 340px; }
  .control-panel { grid-area: controls; overflow: visible; }
  .science-panel { grid-area: science; overflow: visible; }
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preset-button { justify-content: center; padding: 0 5px; font-size: 9px; }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .control-row:nth-child(odd) { padding-right: 4px; }
  .transport-block { max-width: 380px; margin-left: auto; margin-right: auto; }
  .science-panel { padding-bottom: 14px; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-wide { grid-column: auto; }
  .metric-card { min-height: 76px; }
  .footer { min-height: 28px; flex-basis: auto; padding: 7px 12px; gap: 8px; font-size: 6px; }
}
@media (max-width: 560px) {
  .topbar { height: 52px; flex-basis: 52px; padding: 0 11px; gap: 9px; }
  .brand-mark { width: 21px; height: 21px; flex: 0 0 21px; }
  .eyebrow { font-size: 8px; }
  h1 { max-width: 220px; font-size: 9px; letter-spacing: .05em; }
  .topbar-meta { gap: 6px; font-size: 7px; }
  .seed-label, .topbar-divider { display: none; }
  .layout { grid-template-rows: minmax(310px, 45svh) auto auto; padding: 7px; gap: 7px; }
  .viewport-panel { min-height: 310px; }
  .scene-topline { top: 8px; left: 8px; right: 8px; }
  .scene-label, .scene-time { padding: 6px 7px; font-size: 7px; }
  .callout-top { top: 23%; left: 3%; }
  .callout-bottom { bottom: 24%; right: 2%; }
  .callout { min-width: 106px; padding: 6px 7px; }
  .callout b { font-size: 7px; }
  .callout small { font-size: 7px; }
  .scene-bottomline { left: 8px; right: 8px; bottom: 8px; align-items: flex-end; }
  .scene-bottomline > div:first-child { padding: 6px 7px; }
  .scene-bottomline strong { font-size: 8px; }
  .scene-legend { gap: 7px; padding: 7px; font-size: 7px; }
  .scene-legend span { gap: 4px; }
  .viewport-toolbar { padding: 0 7px; min-height: 35px; flex-basis: 35px; }
  .toolbar-left { display: none; }
  .toolbar-actions { width: 100%; justify-content: flex-end; gap: 6px; }
  .tool-button { min-height: 24px; padding: 0 7px; font-size: 7px; }
  .panel { border-radius: 10px; }
  .control-panel, .science-panel { padding: 13px 11px; }
  .panel-heading h2 { font-size: 16px; }
  .preset-grid { gap: 4px; }
  .preset-button { min-height: 31px; flex-direction: column; gap: 3px; font-size: 8px; line-height: 1.1; }
  .preset-dot { width: 5px; height: 5px; }
  .control-list { column-gap: 11px; }
  .control-row { padding: 8px 0 7px; }
  .control-row label { font-size: 9px; gap: 4px; }
  .control-row output { font-size: 9px; }
  .range-hints { font-size: 6px; }
  .transport-block { margin-top: 7px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .metric-wide { grid-column: 1 / -1; }
  .metric-card { min-height: 70px; padding: 8px; }
  .metric-card strong { font-size: 18px; }
  .metric-label { font-size: 7px; }
  .metric-card small { font-size: 7px; }
  .event-strip > small { max-width: 105px; }
  .footer { flex-direction: column; align-items: flex-start; line-height: 1.35; }
  .embed-mode .layout { grid-template-rows: minmax(310px, 47svh) auto; }
  .embed-mode .science-panel { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
