:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0d1421;
  --panel-2: #101a2a;
  --line: rgba(150, 181, 210, .14);
  --line-strong: rgba(150, 181, 210, .24);
  --text: #e8f1fa;
  --muted: #91a3b8;
  --faint: #62748b;
  --accent: #73e4e2;
  --accent-soft: rgba(115, 228, 226, .13);
  --gold: #e8c48a;
  --blue: #a4c8ff;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(ellipse at 52% -30%, rgba(45, 83, 112, .22), transparent 48%), var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(1520px, 100%); margin: 0 auto; padding: 20px 24px 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; min-height: 52px; }
.identity { display: flex; align-items: center; gap: 13px; min-width: 0; }
.orbit-mark { width: 34px; height: 34px; position: relative; flex: 0 0 34px; border: 1px solid rgba(115,228,226,.45); border-radius: 50%; transform: rotate(-25deg); }
.orbit-mark:before { content: ""; position: absolute; width: 42px; height: 15px; border: 1px solid var(--accent); border-radius: 50%; left: -5px; top: 8px; opacity: .7; }
.orbit-mark span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); left: 13px; top: 13px; box-shadow: 0 0 12px rgba(115,228,226,.7); }
.orbit-mark i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); top: 2px; right: 2px; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 9px; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 3px 0 0; font-size: clamp(17px, 2vw, 23px); line-height: 1.2; letter-spacing: -.035em; font-weight: 690; }
h1 span { color: #9aadc1; font-weight: 480; }
.top-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.seed-chip, .live-indicator { font-size: 9px; letter-spacing: .1em; font-weight: 750; color: #a6b6c8; border: 1px solid var(--line); border-radius: 99px; padding: 7px 10px; white-space: nowrap; }
.live-indicator { color: var(--accent); display: flex; align-items: center; gap: 7px; }
.live-indicator i, .foot-pulse { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(115,228,226,.7); }
.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 16px; }
.visual-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-card, .control-card, .readout-card, .caption-panel, .science-panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(16,26,42,.97), rgba(10,16,27,.98)); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.16); }
.stage-card { overflow: hidden; }
.stage-heading { min-height: 54px; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.stage-heading strong { display: block; font-size: 12px; font-weight: 620; margin-top: 3px; color: #dce9f4; }
.stage-clock { text-align: right; }
.stage-clock span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .14em; font-weight: 750; }
.stage-clock strong { font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; }
.canvas-wrap { position: relative; height: clamp(350px, 53vh, 560px); min-height: 340px; background: #060c17; overflow: hidden; }
#scene { display: block; width: 100%; height: 100%; outline: none; }
.canvas-chip { position: absolute; top: 12px; z-index: 2; border: 1px solid rgba(156,190,220,.16); background: rgba(7,13,23,.72); backdrop-filter: blur(8px); border-radius: 99px; color: #93a8be; font-size: 8px; letter-spacing: .12em; font-weight: 750; padding: 7px 9px; pointer-events: none; }
.chip-left { left: 12px; display: flex; align-items: center; gap: 7px; }
.chip-right { right: 12px; }
.chip-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.canvas-legend { position: absolute; bottom: 11px; left: 13px; display: flex; flex-wrap: wrap; gap: 12px; color: #9badc0; font-size: 9px; background: rgba(7,13,23,.72); border: 1px solid rgba(156,190,220,.13); padding: 7px 10px; border-radius: 8px; backdrop-filter: blur(8px); pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 6px; }
.canvas-legend i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; }
.legend-prom { background: var(--gold); box-shadow: 0 0 8px rgba(232,196,138,.5); }
.legend-ring { background: var(--accent); box-shadow: 0 0 8px rgba(115,228,226,.5); }
.legend-pand { background: var(--blue); box-shadow: 0 0 8px rgba(164,200,255,.5); }
.readout-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.readout-card { min-width: 0; padding: 12px 13px 11px; border-radius: 12px; }
.readout-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: #a2b3c5; font-size: 8px; font-weight: 750; letter-spacing: .08em; }
.source-tag { display: inline-block; border-radius: 4px; font-size: 7px; padding: 3px 4px; letter-spacing: .08em; }
.source-tag.textbook { color: #a9c9f1; background: rgba(122,164,220,.12); }
.source-tag.illustrative { color: #c0b0e6; background: rgba(173,145,222,.12); }
.source-tag.scaled { color: #8ce2df; background: rgba(115,228,226,.12); }
.readout-value { margin-top: 8px; font-size: clamp(20px, 2.3vw, 27px); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; font-weight: 620; white-space: nowrap; }
.readout-value small { color: #8296ad; font-size: 11px; font-weight: 500; letter-spacing: 0; margin-left: 5px; }
.readout-note { color: var(--faint); font-size: 9px; margin-top: 7px; }
.caption-panel { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; }
.caption-icon { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 25px; color: var(--accent); background: var(--accent-soft); font-size: 13px; }
.caption-panel p { color: #b3c2d2; font-size: 11px; line-height: 1.5; margin: 4px 0 0; }
.control-card { padding: 16px; }
.control-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.control-head h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.03em; }
.fixed-step-tag { border: 1px solid var(--line); color: #8ca2b8; border-radius: 6px; font-size: 9px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.preset-button { display: flex; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; background: rgba(255,255,255,.018); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; min-width: 0; }
.preset-button:hover { border-color: rgba(115,228,226,.42); transform: translateY(-1px); }
.preset-button.active { background: var(--accent-soft); border-color: rgba(115,228,226,.38); }
.preset-button b { display: block; font-size: 9px; line-height: 1.2; font-weight: 650; white-space: nowrap; }
.preset-button small { display: block; font-size: 8px; color: var(--faint); margin-top: 4px; white-space: nowrap; }
.preset-glyph { width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 23px; background: rgba(255,255,255,.055); font-size: 14px; }
.quiet-glyph { color: var(--accent); }
.strong-glyph { color: var(--gold); }
.control-list { display: flex; flex-direction: column; gap: 14px; }
.control-item { min-width: 0; }
.control-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.control-title label { font-size: 10px; color: #c6d3e0; font-weight: 600; }
.control-title output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 4px; border-radius: 10px; background: linear-gradient(90deg, rgba(115,228,226,.72), rgba(115,228,226,.22)); outline: none; display: block; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #d9fffc; border: 3px solid #3c9f9d; box-shadow: 0 0 0 3px rgba(115,228,226,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d9fffc; border: 3px solid #3c9f9d; box-shadow: 0 0 0 3px rgba(115,228,226,.12); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.range-ends { display: flex; justify-content: space-between; margin-top: 6px; color: #63758a; font-size: 8px; font-variant-numeric: tabular-nums; }
.control-help { color: #71849a; font-size: 8px; line-height: 1.35; margin: 5px 0 0; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 15px; margin-top: 15px; border-top: 1px solid var(--line); }
.toggle-button { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.018); border-radius: 8px; padding: 8px; color: #91a4b9; cursor: pointer; font-size: 9px; }
.toggle-button .toggle-icon { color: #6d8298; font-size: 14px; }
.toggle-button i { width: 20px; height: 11px; margin-left: auto; border-radius: 20px; background: #263449; position: relative; flex: 0 0 20px; }
.toggle-button i:after { content: ""; position: absolute; width: 7px; height: 7px; top: 2px; left: 2px; background: #8da0b5; border-radius: 50%; transition: transform .18s ease; }
.toggle-button.is-on { border-color: rgba(115,228,226,.25); color: #d1e1ed; }
.toggle-button.is-on .toggle-icon { color: var(--accent); }
.toggle-button.is-on i { background: rgba(115,228,226,.35); }
.toggle-button.is-on i:after { transform: translateX(9px); background: #d5fffa; }
.transport-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 7px; margin-top: 13px; }
.transport, .screenshot-button { border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.025); padding: 10px 7px; cursor: pointer; font-size: 10px; font-weight: 620; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.transport:hover, .screenshot-button:hover { border-color: rgba(115,228,226,.45); background: rgba(115,228,226,.07); }
.transport:active, .screenshot-button:active { transform: translateY(1px); }
.transport.primary { background: var(--accent); border-color: var(--accent); color: #071719; }
.transport.primary:hover { background: #9af2ed; }
#play-icon { font-size: 12px; margin-right: 3px; }
.screenshot-button { width: 100%; margin-top: 8px; color: #9eb2c7; font-size: 9px; }
.screenshot-button span { color: var(--accent); margin-right: 5px; }
.control-foot { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: #687c92; font-size: 8px; }
.control-foot .foot-pulse { width: 5px; height: 5px; }
.science-panel { margin-top: 16px; overflow: hidden; }
.science-panel summary { list-style: none; display: flex; align-items: center; gap: 11px; padding: 14px 16px; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-symbol { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; background: rgba(115,228,226,.1); color: var(--accent); font-size: 16px; }
.science-panel summary b { display: block; font-size: 11px; }
.science-panel summary small { display: block; color: var(--faint); font-size: 9px; margin-top: 3px; }
.summary-chevron { margin-left: auto; color: #8094aa; font-size: 17px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 17px 18px 14px; }
.science-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.science-grid h3 { margin: 0 0 11px; font-size: 11px; color: #dce8f3; }
.equation-title { color: #8ea4ba; font-size: 9px; margin: 10px 0 5px; }
.equation { color: #d7e9f4; background: rgba(115,228,226,.045); border: 1px solid rgba(115,228,226,.12); border-radius: 7px; padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.science-copy, .science-list { color: #8ea2b8; font-size: 9px; line-height: 1.55; }
.science-copy { margin: 10px 0 0; }
.science-list { padding-left: 16px; margin: 0; }
.science-list li { margin-bottom: 6px; }
.science-list b { color: #c4d4e2; }
.limits-heading { margin-top: 15px !important; }
.disclaimer { color: #8aa2b5; font-size: 9px; font-style: italic; margin: 10px 0 0; }
.audit-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; border-top: 1px solid var(--line); margin-top: 17px; padding-top: 13px; }
.audit-row > div:first-child b { display: block; margin-top: 4px; font-size: 10px; }
.audit-row > div:first-child small { display: block; color: #74899f; font-size: 8px; margin-top: 4px; }
.audit-values { display: flex; gap: 16px; flex-shrink: 0; }
.audit-values span { display: flex; flex-direction: column; gap: 4px; }
.audit-values small { color: #70869c; font-size: 7px; letter-spacing: .12em; font-weight: 750; }
.audit-values b { color: #d9e8f3; font-size: 10px; font-variant-numeric: tabular-nums; }
#audit-error { color: var(--accent); }
.constants-note { color: #61768c; font-size: 8px; margin-top: 12px; }
.footer-line { display: flex; justify-content: space-between; color: #53677e; font-size: 8px; letter-spacing: .13em; font-weight: 700; padding: 13px 2px 0; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 1050px) {
  .app-shell { padding: 16px; }
  .main-grid { grid-template-columns: minmax(0,1fr) 310px; gap: 12px; }
  .canvas-wrap { height: clamp(330px, 49vh, 500px); }
  .control-card { padding: 13px; }
  .preset-button { padding: 8px 6px; gap: 6px; }
  .preset-button b { font-size: 8px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 12px; }
  .topbar { align-items: flex-start; margin-bottom: 12px; }
  .top-meta { gap: 6px; }
  .seed-chip { display: none; }
  .live-indicator { font-size: 8px; padding: 6px 8px; }
  h1 { font-size: 17px; }
  h1 span { display: block; font-size: 12px; margin-top: 2px; }
  .main-grid { display: flex; flex-direction: column; gap: 12px; }
  .visual-column, .control-card { width: 100%; }
  .canvas-wrap { height: clamp(280px, 47vh, 430px); min-height: 270px; }
  .readout-grid { gap: 7px; }
  .readout-card { padding: 10px 9px; }
  .readout-label { font-size: 7px; gap: 4px; }
  .source-tag { font-size: 6px; }
  .readout-value { font-size: clamp(17px, 5vw, 23px); }
  .readout-value small { font-size: 9px; }
  .readout-note { font-size: 8px; }
  .caption-panel { padding: 11px; }
  .science-grid { grid-template-columns: 1fr; gap: 18px; }
  .audit-row { align-items: flex-start; flex-direction: column; }
  .audit-values { width: 100%; justify-content: space-between; }
}
@media (max-width: 420px) {
  .identity { gap: 9px; }
  .orbit-mark { transform: scale(.88) rotate(-25deg); margin-left: -2px; margin-right: -2px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 15px; }
  h1 span { font-size: 11px; }
  .stage-heading { padding: 9px 11px; }
  .stage-heading strong { font-size: 10px; }
  .canvas-wrap { min-height: 260px; }
  .canvas-chip { top: 8px; font-size: 7px; padding: 6px 7px; }
  .chip-left { left: 8px; }
  .chip-right { right: 8px; }
  .canvas-legend { bottom: 8px; left: 8px; gap: 8px; font-size: 8px; padding: 6px 7px; }
  .readout-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .readout-label { display: block; min-height: 24px; line-height: 1.3; }
  .readout-label .source-tag { margin-top: 3px; }
  .readout-value { font-size: 17px; }
  .readout-note { line-height: 1.25; }
  .preset-button { gap: 5px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .preset-glyph { width: 19px; height: 19px; flex-basis: 19px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; display: flex; flex-direction: column; padding-top: 10px; padding-bottom: 8px; overflow-y: auto; overflow-x: hidden; }
body.embed-mode .topbar { flex: 0 0 auto; margin-bottom: 10px; }
body.embed-mode .main-grid { flex: 0 0 auto; height: calc(100% - 140px); min-height: 0; }
body.embed-mode .visual-column { min-height: 0; height: 100%; }
body.embed-mode .stage-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.embed-mode .canvas-wrap { flex: 1 1 auto; min-height: 0; height: auto; }
body.embed-mode .readout-grid { flex: 0 0 auto; }
body.embed-mode .caption-panel { flex: 0 0 auto; }
body.embed-mode .control-card { min-height: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain; }
body.embed-mode .control-item .control-help { display: none; }
body.embed-mode .science-panel { flex: 0 0 auto; margin-top: 10px; }
body.embed-mode .footer-line { display: none; }
@media (max-width: 760px) {
  body.embed-mode .app-shell { padding: 8px; }
  body.embed-mode .topbar { min-height: 45px; margin-bottom: 8px; }
  body.embed-mode .main-grid { display: flex; flex-direction: column; gap: 8px; height: calc(100% - 126px); }
  body.embed-mode .visual-column { flex: 0 0 43%; height: 43%; gap: 7px; }
  body.embed-mode .stage-card { flex: 1 1 auto; }
  body.embed-mode .stage-heading { min-height: 39px; padding: 6px 10px; }
  body.embed-mode .canvas-wrap { min-height: 0; }
  body.embed-mode .readout-grid { display: none; }
  body.embed-mode .caption-panel { display: none; }
  body.embed-mode .control-card { flex: 1 1 auto; height: auto; min-height: 0; padding: 11px; }
  body.embed-mode .control-head { margin-bottom: 8px; }
  body.embed-mode .preset-row { margin-bottom: 10px; }
  body.embed-mode .control-list { gap: 10px; }
  body.embed-mode .control-item .control-help { display: none; }
  body.embed-mode .toggle-row { margin-top: 10px; padding-top: 10px; }
  body.embed-mode .transport-row { margin-top: 9px; }
  body.embed-mode .science-panel { display: block; }
}
