:root {
  color-scheme: dark;
  --bg: #091119;
  --panel: #101b25;
  --panel-2: #14222e;
  --panel-3: #0d1720;
  --line: rgba(167, 193, 203, .14);
  --line-strong: rgba(167, 193, 203, .24);
  --text: #e7f0f2;
  --muted: #8fa3ad;
  --soft: #607783;
  --accent: #65e4c3;
  --accent-dim: rgba(101, 228, 195, .14);
  --accent-glow: rgba(101, 228, 195, .28);
  --radius: 16px;
  --shadow: 0 18px 52px rgba(0,0,0,.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 34% 16%, rgba(42, 86, 88, .16), transparent 43%), var(--bg); }
.embed-mode .app-shell { height: 100%; min-height: 0; }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(9,17,25,.86); position: relative; z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; border: 1px solid rgba(101,228,195,.38); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--accent-dim); transform: rotate(-8deg); }
.brand-mark span { display: block; width: 3px; border-radius: 4px; background: var(--accent); transform: skew(-18deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .58; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .76; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.35; }
.brand-title { margin-top: 3px; font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.top-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .14em; white-space: nowrap; }
.live-dot, .state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.meta-divider { width: 1px; height: 14px; background: var(--line-strong); margin: 0 4px; }
.main-scroll { flex: 1; min-height: 0; overflow: auto; padding: 20px 24px 24px; scrollbar-color: #30434d transparent; scrollbar-width: thin; }
.embed-mode .main-scroll { overflow-y: auto; overflow-x: hidden; }
.workspace { width: min(1600px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 336px; align-items: start; gap: 16px; }
.stage-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-card, .readout-card, .caption-card, .control-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(20,34,46,.96), rgba(13,23,32,.98)); box-shadow: var(--shadow); }
.stage-card { overflow: hidden; }
.stage-head { min-height: 64px; padding: 14px 18px 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stage-head h1 { margin: 4px 0 0; font-size: clamp(16px, 1.65vw, 21px); letter-spacing: -.035em; font-weight: 680; }
.state-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 11px; color: var(--muted); background: rgba(6,14,21,.48); font-size: 9px; font-weight: 800; letter-spacing: .14em; white-space: nowrap; }
.state-chip.active { color: var(--accent); border-color: rgba(101,228,195,.42); background: var(--accent-dim); }
.canvas-wrap { position: relative; height: clamp(340px, 48vw, 510px); min-height: 320px; overflow: hidden; background: #0a151d; border-top: 1px solid rgba(167,193,203,.08); border-bottom: 1px solid rgba(167,193,203,.08); }
#scene { display: block; width: 100%; height: 100%; }
.canvas-overlay { position: absolute; pointer-events: none; display: flex; align-items: center; gap: 7px; }
.overlay-top-left { top: 13px; left: 15px; }
.overlay-top-right { top: 13px; right: 15px; }
.overlay-bottom-left { bottom: 13px; left: 15px; color: #8fa3ad; }
.overlay-bottom-right { bottom: 13px; right: 15px; color: #607783; }
.micro-label { font-size: 8px; font-weight: 800; letter-spacing: .13em; color: #8fa3ad; text-shadow: 0 1px 8px #071018; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.overlay-bottom-left { font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.transport-bar { min-height: 58px; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(9,17,25,.52); }
.transport-actions, .transport-right { display: flex; align-items: center; gap: 7px; }
.control-button, .quality-button, .icon-button { border: 1px solid var(--line-strong); background: rgba(19,32,43,.84); color: #b6c5ca; border-radius: 9px; min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 10px; font-weight: 720; cursor: pointer; transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease; }
.control-button:hover, .quality-button:hover, .icon-button:hover { border-color: rgba(101,228,195,.45); color: var(--text); background: rgba(101,228,195,.08); }
.control-button:active, .preset-button:active { transform: translateY(1px); }
.control-button.primary { color: #061712; border-color: var(--accent); background: var(--accent); min-width: 78px; }
.control-button.primary:hover { background: #8cf1d5; }
.play-icon { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 7px solid currentColor; }
.pause-icon { width: 8px; height: 10px; border-left: 2px solid currentColor; border-right: 2px solid currentColor; }
.step-icon { width: 11px; height: 10px; border-left: 2px solid currentColor; border-right: 2px solid currentColor; position: relative; }
.step-icon::after { content: ""; position: absolute; right: -1px; top: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid currentColor; }
.reset-icon { font-size: 17px; line-height: 1; font-weight: 500; }
.sim-clock { color: #a6b8bf; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sim-clock i { margin-left: 4px; color: #607783; font-style: normal; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.quality-button { min-height: 30px; padding: 0 9px; font-size: 8px; letter-spacing: .1em; }
.icon-button { width: 32px; min-width: 32px; padding: 0; font-size: 16px; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.readout-card { min-width: 0; padding: 12px 13px 11px; border-radius: 13px; box-shadow: none; background: rgba(16,27,37,.82); }
.readout-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; line-height: 1.4; min-height: 23px; }
.class-tag { display: inline-flex; align-items: center; border-radius: 4px; padding: 2px 4px; font-size: 7px; line-height: 1.1; font-weight: 850; letter-spacing: .08em; white-space: nowrap; }
.class-tag.textbook { color: #9fc9bb; background: rgba(101,228,195,.09); border: 1px solid rgba(101,228,195,.17); }
.class-tag.illustrative { color: #9aaeb8; background: rgba(142,166,177,.08); border: 1px solid rgba(142,166,177,.15); }
.class-tag.scaled { color: #8ca9b1; background: rgba(107,145,157,.1); border: 1px solid rgba(107,145,157,.18); }
.readout-value { margin-top: 6px; display: flex; align-items: baseline; gap: 5px; min-width: 0; font-size: clamp(20px, 2.5vw, 28px); font-weight: 620; letter-spacing: -.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { font-size: 10px; font-weight: 650; color: var(--muted); letter-spacing: 0; }
.readout-foot { margin-top: 4px; color: #6f8792; font-size: 9px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caption-card { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; box-shadow: none; background: rgba(16,27,37,.76); }
.caption-symbol { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border: 1px solid rgba(101,228,195,.28); border-radius: 9px; background: var(--accent-dim); color: var(--accent); font-size: 15px; }
.caption-card p { margin: 4px 0 0; color: #c2d0d4; font-size: 11px; line-height: 1.55; }
.control-panel { min-width: 0; padding: 17px 16px 12px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 1px 1px 14px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; font-weight: 670; letter-spacing: -.03em; }
.panel-index { padding-top: 3px; color: #627985; font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.section-label { color: #78909b; font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.preset-block { padding: 12px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: rgba(7,15,22,.42); padding: 8px 8px; cursor: pointer; transition: .2s ease; }
.preset-button:hover, .preset-button.active { border-color: rgba(101,228,195,.42); background: rgba(101,228,195,.07); }
.preset-mark { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; border: 1px solid #78909b; }
.resting-mark { background: #344954; }
.shock-mark { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.preset-button b { display: block; font-size: 9px; font-weight: 750; }
.preset-button small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.controls-list { padding-top: 13px; }
.controls-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; }
.controls-title:not(:first-child) { padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); }
.controls-title span { color: #5e7580; font-size: 8px; }
.slider-control { margin: 0 0 13px; }
.slider-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.slider-heading label { color: #c4d1d5; font-size: 10px; font-weight: 620; }
.slider-heading output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 7px 0 2px; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) 0%, rgba(101,228,195,.24) 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 99px; background: rgba(101,228,195,.3); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; margin-top: -5px; border: 2px solid #081a17; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(101,228,195,.13); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #081a17; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(101,228,195,.13); }
.slider-meta { display: flex; justify-content: space-between; align-items: center; gap: 5px; color: #627985; font-size: 8px; font-variant-numeric: tabular-nums; }
.panel-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 10px; margin-top: 2px; border: 1px solid rgba(101,228,195,.15); border-radius: 9px; background: rgba(101,228,195,.045); color: #91a8b0; font-size: 9px; line-height: 1.5; }
.note-icon { display: inline-grid; place-items: center; width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%; border: 1px solid rgba(101,228,195,.35); color: var(--accent); font-family: Georgia,serif; font-size: 10px; font-style: italic; }
.science-panel { margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #d2dfe2; font-size: 10px; font-weight: 700; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-glyph { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 7px; border-radius: 7px; color: var(--accent); background: var(--accent-dim); font-family: Georgia,serif; font-size: 14px; }
.chevron { color: #78909b; font-size: 17px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 0 13px; }
.science-kicker { margin: 10px 0 8px; color: #78909b; font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.equation { display: flex; flex-direction: column; gap: 4px; padding: 7px 9px; margin: 5px 0; border: 1px solid rgba(167,193,203,.09); border-radius: 7px; background: rgba(5,13,19,.3); }
.equation b { color: #9eb2b9; font-size: 8px; font-weight: 700; }
.equation code { color: #d7e4e6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.science-copy { margin: 7px 0; color: #91a5ad; font-size: 9px; line-height: 1.55; }
.science-copy b { color: #c4d2d6; }
.audit-card { margin-top: 10px; padding: 10px; border: 1px solid rgba(101,228,195,.2); border-radius: 9px; background: rgba(101,228,195,.045); }
.audit-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #8ba4ac; font-size: 8px; font-weight: 850; letter-spacing: .12em; }
.audit-result { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin-top: 8px; color: #b7c9ce; font-size: 9px; }
.audit-result strong { color: var(--accent); font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.audit-result i { margin: 0 5px; color: #607783; font-style: normal; }
.audit-foot { margin-top: 5px; color: #728993; font-size: 8px; line-height: 1.4; }
.citation-line { margin: 10px 0 7px; color: #728893; font-size: 8px; line-height: 1.5; }
.disclaimer { margin: 8px 0 0; color: #8ca0a8; font-size: 8px; line-height: 1.45; }
.panel-footer { display: flex; justify-content: space-between; gap: 8px; padding: 11px 1px 0; color: #536a75; font-size: 7px; font-weight: 800; letter-spacing: .13em; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0,1fr) 360px; } .canvas-wrap { height: min(56vh, 600px); } }
@media (max-width: 1050px) { .workspace { grid-template-columns: minmax(0,1fr) 310px; } .main-scroll { padding: 14px; } .readout-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .canvas-wrap { height: clamp(330px, 48vw, 460px); } }
@media (max-width: 760px) {
  .topbar { height: 60px; flex-basis: 60px; padding: 0 14px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-title { font-size: 12px; }
  .top-meta { gap: 7px; font-size: 7px; letter-spacing: .1em; }
  .top-meta .meta-divider, .top-meta span:last-child { display: none; }
  .main-scroll { padding: 10px 10px 18px; }
  .workspace { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .stage-column { gap: 9px; }
  .stage-head { min-height: 58px; padding: 11px 12px; }
  .stage-head h1 { font-size: 16px; }
  .canvas-wrap { height: clamp(270px, 78vw, 360px); min-height: 260px; }
  .transport-bar { flex-wrap: wrap; min-height: 54px; padding: 8px 9px; }
  .transport-actions, .transport-right { gap: 5px; }
  .control-button { min-height: 32px; padding: 0 9px; font-size: 9px; }
  .quality-button { min-height: 29px; }
  .sim-clock { font-size: 9px; }
  .readout-grid { gap: 7px; }
  .readout-card { padding: 10px 11px; }
  .readout-value { font-size: 23px; }
  .caption-card { padding: 11px 12px; }
  .control-panel { padding: 15px 13px 12px; }
}
@media (max-width: 390px) {
  .canvas-wrap { height: 270px; }
  .overlay-top-left { left: 10px; }
  .overlay-top-right { right: 10px; }
  .micro-label { font-size: 7px; }
  .transport-right { gap: 4px; }
  .sim-clock { font-size: 8px; }
  .quality-button { padding: 0 7px; font-size: 7px; }
  .icon-button { width: 29px; min-width: 29px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (min-width: 761px) and (max-height: 760px) {
  .topbar { height: 60px; flex-basis: 60px; }
  .main-scroll { padding: 12px 16px; }
  .stage-head { min-height: 56px; padding: 10px 16px; }
  .canvas-wrap { height: 330px; min-height: 300px; }
  .transport-bar { min-height: 50px; padding: 7px 12px; }
  .readout-card { padding: 9px 11px; }
  .readout-foot { margin-top: 2px; }
  .caption-card { padding: 10px 13px; }
  .control-panel { max-height: calc(100dvh - 84px); overflow-y: auto; scrollbar-color: #30434d transparent; scrollbar-width: thin; }
}
