:root {
  color-scheme: dark;
  --bg: #080d16;
  --panel: #0e1624;
  --panel-2: #111c2c;
  --panel-3: #0b1320;
  --line: #1e2b3d;
  --line-soft: rgba(128, 158, 190, .14);
  --text: #e8f0f8;
  --muted: #8b9cb0;
  --dim: #63758a;
  --accent: #67e0d0;
  --accent-rgb: 103, 224, 208;
  --warning: #e4b66f;
  --radius: 14px;
  --gap: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 14px 18px 9px; gap: 10px; background: radial-gradient(ellipse at 45% -20%, rgba(30, 68, 88, .19), transparent 48%), var(--bg); }
.topbar { flex: 0 0 58px; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { position: relative; width: 34px; height: 34px; border: 1px solid rgba(var(--accent-rgb), .35); border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 0 22px rgba(var(--accent-rgb), .08), inset 0 0 12px rgba(var(--accent-rgb), .08); }
.brand-mark:before, .brand-mark:after { content: ""; position: absolute; width: 26px; height: 8px; border: 1px solid rgba(var(--accent-rgb), .75); border-radius: 50%; transform: rotate(-28deg); }
.brand-mark:after { transform: rotate(62deg); opacity: .55; }
.brand-mark span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); z-index: 1; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { display: none; }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.4; }
.eyebrow-dot { display: inline-block; width: 3px; height: 3px; margin: 0 6px 2px; border-radius: 50%; background: var(--dim); }
h1 { margin: 2px 0 0; font-size: clamp(17px, 2vw, 21px); line-height: 1.15; letter-spacing: -.035em; font-weight: 650; white-space: nowrap; }
h1 span { color: #9aabba; font-weight: 450; }
.top-meta { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.status-pill { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: #b9c8d8; font-size: 9px; letter-spacing: .11em; font-weight: 700; white-space: nowrap; }
.status-dot, .mini-led { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(var(--accent-rgb), .8); }
.status-dot.quiet { background: var(--warning); box-shadow: 0 0 9px rgba(228,182,111,.6); }
.scale-note { font-size: 9px; letter-spacing: .12em; color: var(--dim); white-space: nowrap; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 356px); gap: 10px; }
.visual-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(260px, 1fr) 146px auto; gap: 8px; }
.stage-card, .chart-card, .control-panel { background: linear-gradient(145deg, rgba(17, 28, 44, .98), rgba(10, 17, 29, .98)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage-card { min-height: 0; display: flex; flex-direction: column; }
.stage-heading { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 13px 16px 10px; gap: 10px; }
.stage-title { margin-top: 3px; font-size: 14px; font-weight: 570; letter-spacing: -.02em; }
.stage-tag { color: #7f91a6; font-size: 8px; letter-spacing: .13em; border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; white-space: nowrap; }
.stage-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 55%, rgba(19, 54, 72, .16), transparent 56%), linear-gradient(180deg, #0b1422 0%, #08101c 100%); }
#starCanvas { width: 100%; height: 100%; display: block; }
.canvas-overlay { position: absolute; z-index: 1; display: flex; align-items: center; gap: 7px; color: #9babbc; font-size: 8px; letter-spacing: .13em; font-weight: 700; text-shadow: 0 1px 5px #07101b; pointer-events: none; }
.overlay-top-left { top: 14px; left: 16px; }
.overlay-bottom-left { bottom: 15px; left: 16px; }
.overlay-top-right { top: 14px; right: 16px; color: var(--accent); }
.overlay-key { width: 7px; height: 7px; border-radius: 50%; background: #d8e7f3; box-shadow: 0 0 7px rgba(216,231,243,.6); }
.reservoir-key { background: var(--accent); box-shadow: 0 0 7px rgba(var(--accent-rgb), .7); }
.canvas-center-caption { position: absolute; left: 50%; bottom: 13px; transform: translateX(-50%); color: rgba(192, 210, 225, .68); font-size: 8px; letter-spacing: .22em; white-space: nowrap; pointer-events: none; }
.stage-footer { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 15px 11px; border-top: 1px solid var(--line-soft); }
.caption-copy { color: #a8b8c9; font-size: 10px; line-height: 1.45; max-width: 78%; }
.stage-footer-meta { display: flex; align-items: center; gap: 7px; color: #6e8298; font-size: 8px; letter-spacing: .12em; white-space: nowrap; }
.mini-led { width: 5px; height: 5px; }
.chart-card { min-height: 0; display: flex; flex-direction: column; padding: 10px 14px 7px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex: 0 0 auto; }
.chart-title { margin-top: 2px; font-size: 12px; font-weight: 600; }
.chart-title span { color: var(--dim); font-size: 9px; font-weight: 450; }
.chart-legend { display: flex; align-items: center; gap: 6px; color: #8c9db0; font-size: 8px; white-space: nowrap; }
.legend-line { width: 16px; height: 2px; background: var(--accent); border-radius: 2px; }
.legend-dash { width: 16px; border-top: 1px dashed var(--warning); margin-left: 5px; }
#lagChart { width: 100%; flex: 1 1 auto; min-height: 65px; display: block; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; min-height: 76px; }
.readout-card { min-width: 0; background: rgba(15, 25, 40, .85); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px 8px; overflow: hidden; }
.readout-label { display: flex; justify-content: space-between; gap: 5px; align-items: center; color: #8b9eb2; font-size: 8px; letter-spacing: .1em; font-weight: 750; white-space: nowrap; }
.readout-label span { font-size: 6px; letter-spacing: .07em; color: #637b8d; font-weight: 650; }
.readout-value { margin-top: 7px; font-size: clamp(16px, 2vw, 21px); font-variant-numeric: tabular-nums; font-weight: 630; letter-spacing: -.045em; white-space: nowrap; }
.readout-value small { font-size: 9px; letter-spacing: 0; color: #9caec0; font-weight: 500; }
.readout-sub { margin-top: 3px; color: #65788e; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accent-readout .readout-value { color: var(--accent); }
.control-column { min-height: 0; min-width: 0; }
.control-panel { height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2b3d52 transparent; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; }
.panel-heading h2 { margin: 3px 0 0; font-size: 16px; letter-spacing: -.025em; font-weight: 630; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: #101c2b; cursor: pointer; transition: border-color .2s, background .2s; }
.icon-button:hover, .transport-button:hover, .screenshot-button:hover { border-color: rgba(var(--accent-rgb), .5); background: #142536; }
.icon-button svg, .transport-button svg, .primary-button svg, .screenshot-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-button { display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; border: 1px solid var(--line); background: #0b1421; border-radius: 9px; padding: 9px 8px; cursor: pointer; transition: .2s ease; }
.preset-button.active { border-color: rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .07); }
.preset-indicator { width: 7px; height: 7px; flex: 0 0 auto; border: 1px solid #65798e; border-radius: 50%; }
.preset-button.active .preset-indicator { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb), .65); }
.preset-button b { display: block; color: #d8e4ef; font-size: 9px; font-weight: 650; }
.preset-button small { display: block; margin-top: 2px; color: #74879c; font-size: 8px; }
.control-list { display: flex; flex-direction: column; gap: 10px; }
.control-item { min-width: 0; }
.control-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.control-top label { color: #b6c5d4; font-size: 10px; font-weight: 580; }
.control-top output { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 650; }
.range-wrap { display: flex; align-items: center; gap: 10px; }
input[type="range"] { --range-progress: 50%; appearance: none; -webkit-appearance: none; width: 100%; min-width: 40px; height: 4px; border-radius: 10px; background: linear-gradient(90deg, var(--accent) 0 var(--range-progress), #2b3b4e var(--range-progress) 100%); cursor: pointer; outline: none; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #e4faf6; border: 3px solid #4abdae; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .11); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #e4faf6; border: 3px solid #4abdae; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .11); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.range-unit { flex: 0 0 auto; color: #75899e; font-size: 8px; min-width: 78px; text-align: right; white-space: nowrap; }
.control-hint { margin-top: 4px; color: #63768b; font-size: 8px; line-height: 1.35; }
.time-control { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.time-scale-labels { display: flex; justify-content: space-between; margin-top: 5px; color: #61758a; font-size: 8px; }
.transport-row { display: grid; grid-template-columns: 1.1fr .8fr 1fr .8fr; gap: 6px; }
.primary-button, .transport-button { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 34px; border-radius: 8px; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.primary-button { background: var(--accent); border: 1px solid var(--accent); color: #08201f; font-size: 10px; font-weight: 750; }
.primary-button:hover { background: #8cf0e3; }
.primary-button svg { fill: currentColor; stroke: none; width: 13px; height: 13px; }
.primary-button.paused svg { fill: none; stroke: currentColor; stroke-width: 2.2; }
.transport-button { background: #101b2a; border: 1px solid var(--line); color: #aebed0; font-size: 9px; }
.transport-button svg { width: 13px; height: 13px; }
.transport-button[aria-pressed="true"] { color: var(--accent); border-color: rgba(var(--accent-rgb), .45); }
.quality-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px rgba(var(--accent-rgb), .7); }
.check-card { border: 1px solid rgba(var(--accent-rgb), .2); border-radius: 9px; background: linear-gradient(110deg, rgba(var(--accent-rgb), .055), rgba(13, 25, 38, .7)); padding: 9px 10px 8px; }
.check-heading { display: flex; align-items: center; gap: 6px; color: #9cb2c3; font-size: 8px; letter-spacing: .1em; font-weight: 750; }
.check-icon { width: 13px; height: 13px; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--accent-rgb), .15); color: var(--accent); font-size: 9px; }
.check-tag { margin-left: auto; color: #688a8a; font-size: 7px; }
.check-main { margin-top: 8px; color: #c7d5e1; font-size: 9px; font-variant-numeric: tabular-nums; }
.check-main b { color: #f0f6fa; font-weight: 650; }
.check-main small { color: #7f94a8; font-size: 8px; }
.check-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; color: var(--accent); font-size: 8px; }
.check-caption { color: #63798c; }
.screenshot-button { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #0b1421; color: #aabaca; font-size: 9px; cursor: pointer; transition: .2s ease; }
.screenshot-button svg { width: 14px; height: 14px; }
.science-panel { border-top: 1px solid var(--line-soft); padding-top: 9px; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; color: #c3d0dc; font-size: 10px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-plus { color: var(--accent); font-size: 16px; font-weight: 350; transition: transform .2s; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding-top: 9px; color: #8ea0b3; font-size: 9px; line-height: 1.55; }
.science-intro { margin: 0 0 9px; }
.equation-block { padding: 8px 9px; margin: 7px 0; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(4, 11, 20, .35); }
.equation-label { display: block; margin-bottom: 5px; color: var(--accent); font-size: 7px; font-weight: 750; letter-spacing: .13em; }
.equation-block code { display: block; color: #d2e0ec; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 1.7; white-space: normal; }
.equation-block small { display: block; margin-top: 4px; color: #778da2; font-size: 8px; }
.science-note { margin: 9px 0; color: #8396a9; }
.science-note b { color: #c2d1de; }
.institution-note { border-top: 1px solid var(--line-soft); margin: 9px 0 0; padding-top: 8px; color: #667b90; font-size: 8px; }
.bottomline { flex: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #52677d; font-size: 7px; letter-spacing: .14em; padding: 0 4px; white-space: nowrap; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:active { transform: translateY(1px); }
@media (max-width: 900px) {
  .app-shell { padding: 10px 10px 7px; gap: 8px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 8px; }
  .visual-column { grid-template-rows: minmax(250px, 1fr) 132px auto; gap: 7px; }
  .readout-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .readout-card { min-height: 68px; }
  .control-panel { padding: 12px; }
}
@media (max-width: 680px) {
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { height: 100%; padding: max(7px, env(safe-area-inset-top)) 8px max(6px, env(safe-area-inset-bottom)); gap: 7px; }
  .topbar { flex: 0 0 48px; min-height: 48px; padding: 0 2px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-mark:before, .brand-mark:after { width: 22px; height: 7px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 16px; }
  .top-meta { gap: 6px; }
  .status-pill { padding: 6px 7px; font-size: 7px; }
  .scale-note { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 7px; overflow: hidden; }
  .visual-column { flex: 0 0 auto; display: grid; grid-template-rows: minmax(230px, 32dvh) 104px; gap: 7px; }
  .stage-card { min-height: 0; }
  .stage-heading { padding: 8px 10px 7px; }
  .section-kicker { font-size: 7px; }
  .stage-title { font-size: 11px; }
  .stage-tag { font-size: 6px; padding: 4px 5px; }
  .canvas-overlay { font-size: 6px; }
  .overlay-top-left { top: 9px; left: 10px; }
  .overlay-bottom-left { bottom: 9px; left: 10px; }
  .overlay-top-right { top: 9px; right: 10px; }
  .canvas-center-caption { bottom: 8px; font-size: 6px; }
  .stage-footer { padding: 7px 10px; }
  .caption-copy { font-size: 8px; max-width: 84%; }
  .stage-footer-meta { font-size: 6px; }
  .chart-card { padding: 7px 10px 5px; }
  .chart-title { font-size: 10px; }
  .chart-legend { font-size: 6px; gap: 4px; }
  .legend-line, .legend-dash { width: 11px; }
  .readout-grid { display: none; }
  .control-column { flex: 1 1 auto; min-height: 0; }
  .control-panel { padding: 10px; gap: 9px; border-radius: 11px; }
  .panel-heading h2 { font-size: 13px; }
  .panel-heading .section-kicker { font-size: 7px; }
  .icon-button { width: 28px; height: 28px; }
  .preset-button { padding: 7px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 9px; }
  .control-top { margin-bottom: 5px; }
  .control-top label { font-size: 8px; }
  .control-top output { font-size: 8px; }
  .range-wrap { gap: 5px; }
  .range-unit { font-size: 6px; min-width: 54px; }
  .control-hint { font-size: 6px; line-height: 1.25; }
  .time-control { padding-top: 7px; }
  .time-scale-labels { font-size: 6px; }
  .transport-row { grid-template-columns: 1fr .8fr 1fr .8fr; gap: 5px; }
  .primary-button, .transport-button { min-height: 29px; font-size: 8px; }
  .check-card { padding: 7px 8px; }
  .check-heading { font-size: 7px; }
  .check-main { font-size: 8px; margin-top: 6px; }
  .check-foot { font-size: 7px; }
  .screenshot-button { min-height: 28px; font-size: 8px; }
  .science-panel { padding-top: 7px; }
  .science-panel summary { font-size: 9px; }
  .science-content { font-size: 8px; }
  .equation-block code { font-size: 8px; }
  .bottomline { flex: 0 0 10px; font-size: 5px; }
  .bottomline span:last-child { display: none; }
}
@media (max-width: 380px) {
  .visual-column { grid-template-rows: minmax(220px, 30dvh) 98px; }
  .control-list { column-gap: 8px; }
  .range-unit { min-width: 48px; }
  .status-pill { 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; }
}
