:root {
  color-scheme: dark;
  --bg: #07131c;
  --panel: #0c1d28;
  --panel-2: #102531;
  --line: rgba(177, 211, 224, .12);
  --line-strong: rgba(177, 211, 224, .2);
  --text: #e8f2f5;
  --muted: #8ca4af;
  --soft: #b5c8cf;
  --accent: #55d6dc;
  --accent-dim: rgba(85, 214, 220, .14);
  --accent-glow: rgba(85, 214, 220, .32);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 0 20px; max-width: 1800px; margin: 0 auto; overflow: hidden; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(85,214,220,.3); border-radius: 12px; background: linear-gradient(145deg, rgba(85,214,220,.16), rgba(85,214,220,.025)); color: var(--accent); font-size: 25px; box-shadow: inset 0 0 20px rgba(85,214,220,.06); }
.eyebrow { color: #7f9ba6; font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.3; }
.eyebrow span { color: var(--accent); padding: 0 3px; }
h1 { font-size: clamp(16px, 1.5vw, 20px); letter-spacing: -.035em; margin: 3px 0 0; font-weight: 650; line-height: 1.15; }
.top-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.control-btn { min-height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); color: #bfd0d6; font-size: 11px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.control-btn:hover, .preset-btn:hover, .quality-btn:hover { background: rgba(85,214,220,.09); border-color: rgba(85,214,220,.45); color: var(--text); }
.control-btn:active, .preset-btn:active { transform: translateY(1px); }
.control-btn:focus-visible, .preset-btn:focus-visible, .quality-btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.control-btn.primary { background: var(--accent); border-color: var(--accent); color: #062027; }
.control-btn.primary:hover { background: #80e8e9; }
.btn-icon { font-size: 14px; line-height: 1; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 350px); gap: 14px; padding: 14px 0 10px; }
.stage-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 10px; }
.stage-card { min-height: 0; flex: 1 1 auto; display: grid; grid-template-rows: 38px minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: radial-gradient(ellipse at 52% 36%, rgba(25,68,82,.34), transparent 55%), #091923; box-shadow: 0 14px 44px rgba(0,0,0,.14); }
.stage-head { display: flex; justify-content: space-between; align-items: center; padding: 0 15px; border-bottom: 1px solid rgba(177,211,224,.08); background: rgba(255,255,255,.012); }
.stage-label { font-size: 9px; letter-spacing: .15em; font-weight: 800; color: #a9c0c8; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.stage-sub { color: #58727e; font-size: 8px; letter-spacing: .11em; margin-left: 3px; }
.stage-time { font-variant-numeric: tabular-nums; color: #d8e8eb; font-size: 12px; display: flex; gap: 4px; align-items: baseline; }
.stage-time .unit { color: #7d98a3; font-size: 10px; }
.tag { display: inline-flex; align-items: center; justify-content: center; padding: 2px 5px; border-radius: 4px; font-size: 7px; line-height: 1.2; letter-spacing: .08em; font-weight: 800; white-space: nowrap; }
.scaled-tag { background: rgba(144,168,181,.1); color: #9fb3bc; }
.textbook-tag { background: rgba(85,214,220,.12); color: #72dce0; }
.illustrative-tag { background: rgba(145,163,174,.1); color: #9aadb5; }
.canvas-wrap { position: relative; min-height: 0; overflow: hidden; }
#scene { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.canvas-legend { position: absolute; left: 15px; bottom: 12px; display: flex; gap: 13px; color: rgba(172,197,207,.72); font-size: 9px; pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 5px; }
.canvas-legend i { display: inline-block; width: 12px; height: 4px; border-radius: 4px; }
.legend-ring { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.legend-body { background: #d6e5e9; }
.legend-flow { background: rgba(85,214,220,.45); }
.canvas-note { position: absolute; right: 14px; bottom: 12px; color: rgba(173,203,211,.7); font-size: 9px; letter-spacing: .04em; text-align: right; pointer-events: none; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-top: 1px solid rgba(177,211,224,.1); background: rgba(255,255,255,.018); }
.readout-card { min-width: 0; padding: 10px 13px 9px; border-right: 1px solid rgba(177,211,224,.08); }
.readout-card:last-child { border-right: 0; }
.readout-label { color: #829ba6; font-size: 8px; letter-spacing: .11em; font-weight: 800; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.readout-value { margin-top: 5px; color: #e7f2f4; font-size: clamp(17px, 2vw, 23px); line-height: 1; letter-spacing: -.04em; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: #8da7b1; font-size: 9px; letter-spacing: 0; font-weight: 500; margin-left: 5px; }
.readout-foot { color: #607b86; font-size: 8px; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caption-card { flex: 0 0 auto; padding: 11px 15px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12,29,40,.74); }
.caption-kicker { color: var(--accent); font-size: 8px; letter-spacing: .16em; font-weight: 850; }
.caption-card p { margin: 5px 0 0; color: #b8cbd1; font-size: 11px; line-height: 1.45; max-width: 95%; }
.control-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, rgba(15,37,49,.98), rgba(9,25,35,.98)); padding: 15px 15px 10px; scrollbar-width: thin; scrollbar-color: #294550 transparent; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; }
.panel-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 650; }
.panel-index { color: #58727e; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 13px 0 14px; }
.preset-btn { border: 1px solid var(--line-strong); border-radius: 8px; min-height: 34px; padding: 0 7px; background: rgba(255,255,255,.025); color: #91aab3; font-size: 9px; font-weight: 700; cursor: pointer; transition: .18s ease; }
.preset-btn.active { border-color: rgba(85,214,220,.48); color: #c8f4f4; background: rgba(85,214,220,.09); }
.control-list { display: flex; flex-direction: column; gap: 13px; }
.slider-block { min-width: 0; }
.slider-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.slider-top label { color: #c3d4d9; font-size: 10px; font-weight: 650; }
.slider-value { display: inline-flex; align-items: center; gap: 4px; color: #a9bec6; font-size: 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slider-value b { color: #e6f1f4; font-size: 11px; font-weight: 700; }
input[type="range"] { appearance: none; width: 100%; height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) 0%, rgba(85,214,220,.18) 0%); display: block; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #d9ffff; border: 3px solid #46cbd2; box-shadow: 0 0 0 3px rgba(85,214,220,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d9ffff; border: 3px solid #46cbd2; box-shadow: 0 0 0 3px rgba(85,214,220,.12); }
.range-ends { display: flex; justify-content: space-between; color: #607984; font-size: 8px; margin-top: 5px; }
.threshold-card { margin-top: 16px; padding: 11px 11px 10px; border: 1px solid rgba(85,214,220,.16); border-radius: 10px; background: rgba(85,214,220,.045); }
.threshold-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #a8c0c8; font-size: 8px; letter-spacing: .12em; font-weight: 850; }
.threshold-meter { position: relative; height: 6px; margin: 12px 1px 7px; border-radius: 10px; background: linear-gradient(90deg, rgba(85,214,220,.08), rgba(85,214,220,.22)); overflow: visible; }
.threshold-fill { height: 100%; width: 63.3%; border-radius: inherit; background: linear-gradient(90deg, #398c9b, var(--accent)); box-shadow: 0 0 10px rgba(85,214,220,.25); transition: width .18s ease; }
.threshold-marker { position: absolute; left: 66.666%; top: -4px; height: 14px; width: 2px; border-radius: 2px; background: #e4ffff; box-shadow: 0 0 7px var(--accent); }
.threshold-labels { display: flex; justify-content: space-between; color: #6e8994; font-size: 7px; }
.threshold-status { color: #d0e8eb; font-size: 10px; font-weight: 650; margin-top: 9px; }
.science-panel { margin-top: 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; padding: 11px 1px; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary span:first-child { display: flex; flex-direction: column; gap: 3px; }
.science-panel summary strong { font-size: 12px; font-weight: 650; }
.chevron { color: var(--accent); font-size: 16px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 1px 12px; }
.science-intro { color: #a6bdc5; font-size: 9px; line-height: 1.55; margin: 0 0 10px; }
.science-intro b { color: #dff8f8; }
.equation { padding: 8px 9px; border: 1px solid rgba(177,211,224,.08); border-radius: 8px; background: rgba(0,0,0,.12); margin-top: 6px; display: flex; flex-direction: column; gap: 5px; }
.eq-name { color: #73909a; font-size: 7px; letter-spacing: .13em; font-weight: 800; text-transform: uppercase; }
.equation code { color: #c5e5e8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; white-space: normal; }
.check-card { margin-top: 9px; padding: 9px; border-radius: 8px; background: rgba(85,214,220,.06); border: 1px solid rgba(85,214,220,.14); }
.check-title { color: #b6d8dc; font-size: 7px; font-weight: 850; letter-spacing: .1em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.check-card p { color: #8eaab4; font-size: 8px; line-height: 1.5; margin: 6px 0 8px; }
.check-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.check-values div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.check-values span { color: #6f8d98; font-size: 7px; }
.check-values b { color: #e2f5f6; font-size: 10px; font-variant-numeric: tabular-nums; }
.simplifications { color: #829da7; font-size: 8px; line-height: 1.55; margin: 10px 0 7px; }
.simplifications b { color: #b6cbd1; }
.disclaimer { color: #6c8791; font-size: 8px; font-style: italic; margin: 7px 0 0; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 9px; color: #708b95; font-size: 7px; font-weight: 800; letter-spacing: .13em; }
.quality-state { color: var(--accent); margin-left: 4px; }
.quality-btn { border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; padding: 5px 8px; color: #8ba4ad; font-size: 7px; letter-spacing: .08em; font-weight: 800; cursor: pointer; }
.footerline { min-height: 25px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; color: #536d77; font-size: 7px; letter-spacing: .13em; font-weight: 800; }
.footerline i { display: inline-block; width: 3px; height: 3px; background: var(--accent); border-radius: 50%; margin: 0 5px 1px; }

@media (max-width: 900px) {
  .app-shell { padding: 0 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; gap: 10px; }
  .topbar { min-height: 68px; }
  .readout-card { padding-left: 9px; padding-right: 8px; }
  .readout-label { font-size: 7px; gap: 4px; }
  .readout-label .tag { display: none; }
}
@media (max-width: 650px) {
  body { overflow: hidden; }
  .app-shell { padding: 0 8px; }
  .topbar { min-height: 56px; gap: 7px; }
  .brand-lockup { gap: 8px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 20px; }
  .eyebrow { font-size: 7px; letter-spacing: .13em; }
  h1 { font-size: 13px; max-width: 190px; }
  .top-actions { gap: 4px; }
  .control-btn { min-height: 31px; padding: 0 7px; font-size: 9px; gap: 4px; }
  .control-btn .btn-text { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 5px; min-height: 0; }
  .stage-column { flex: 0 0 43%; min-height: 0; gap: 6px; }
  .stage-card { grid-template-rows: 28px minmax(0,1fr) auto; border-radius: 12px; }
  .stage-head { padding: 0 9px; }
  .stage-label { font-size: 7px; gap: 5px; }
  .stage-sub { font-size: 6px; }
  .stage-time { font-size: 10px; }
  .canvas-note { display: none; }
  .canvas-legend { left: 8px; bottom: 6px; gap: 7px; font-size: 7px; }
  .canvas-legend i { width: 8px; }
  .canvas-note { right: 8px; bottom: 6px; font-size: 7px; max-width: 42%; }
  .readout-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .readout-card { padding: 6px 5px 6px; }
  .readout-label { font-size: 6px; letter-spacing: .07em; }
  .readout-value { font-size: 15px; margin-top: 4px; }
  .readout-value small { font-size: 7px; margin-left: 2px; }
  .readout-foot { display: none; }
  .caption-card { padding: 7px 9px; border-radius: 9px; }
  .caption-kicker { font-size: 6px; }
  .caption-card p { font-size: 8px; line-height: 1.35; margin-top: 3px; }
  .control-panel { flex: 1 1 auto; min-height: 0; padding: 10px 11px 8px; border-radius: 12px; }
  .panel-heading h2 { font-size: 14px; }
  .preset-row { margin: 8px 0 9px; gap: 6px; }
  .preset-btn { min-height: 29px; font-size: 8px; }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 9px; }
  .slider-top { margin-bottom: 5px; align-items: flex-start; flex-direction: column; gap: 3px; }
  .slider-top label { font-size: 8px; }
  .slider-value { font-size: 7px; }
  .slider-value b { font-size: 9px; }
  .slider-value .tag { font-size: 6px; }
  input[type="range"] { height: 3px; }
  input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; }
  .range-ends { font-size: 6px; margin-top: 4px; }
  .threshold-card { margin-top: 9px; padding: 8px; }
  .threshold-top { font-size: 7px; }
  .threshold-meter { margin: 9px 1px 6px; }
  .threshold-labels { font-size: 6px; }
  .threshold-status { font-size: 8px; margin-top: 6px; }
  .science-panel { margin-top: 8px; }
  .science-panel summary { padding: 8px 1px; }
  .science-panel summary strong { font-size: 10px; }
  .science-content { padding-bottom: 8px; }
  .science-intro { font-size: 8px; }
  .equation { padding: 6px 7px; }
  .equation code { font-size: 8px; }
  .footerline { min-height: 17px; font-size: 6px; }
}
@media (max-width: 390px) {
  .stage-column { flex-basis: 42%; }
  .readout-label { font-size: 5.5px; }
  .readout-value { font-size: 14px; }
  .stage-sub { display: none; }
  .control-btn { padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
