:root {
  color-scheme: dark;
  --bg: #080e17;
  --panel: #101a27;
  --panel-2: #0c1521;
  --panel-3: #132131;
  --line: rgba(158, 184, 207, .13);
  --line-strong: rgba(158, 184, 207, .23);
  --text: #e9f0f6;
  --muted: #93a5b6;
  --dim: #65788b;
  --accent: #7ce7d4;
  --accent-soft: rgba(124, 231, 212, .12);
  --accent-line: rgba(124, 231, 212, .36);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; 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 37% -22%, rgba(32, 65, 83, .25), transparent 47%), var(--bg); }
body.embed-mode .app-shell { height: 100%; min-height: 0; }
.topbar { height: 72px; flex: 0 0 72px; display: flex; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(8, 14, 23, .94); }
.brand-mark { width: 28px; height: 28px; position: relative; display: flex; align-items: center; justify-content: center; border: 1px solid var(--accent-line); border-radius: 50%; transform: rotate(-25deg); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 21px; height: 8px; border: 1px solid var(--accent); border-radius: 50%; opacity: .72; }
.brand-mark::after { transform: rotate(62deg); }
.brand-mark span { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker, .caption-label, .quality-row > span, .check-heading, .footer-bar { font-size: 9px; font-weight: 750; letter-spacing: .16em; color: var(--muted); }
.eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
h1 { margin: 3px 0 0; font-size: 19px; line-height: 1.15; letter-spacing: -.035em; font-weight: 650; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .13em; font-weight: 750; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(124, 231, 212, .7); }
.live-dot.paused { background: #718092; box-shadow: none; }
.icon-button { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; background: rgba(124, 231, 212, .07); border: 1px solid var(--accent-line); border-radius: 8px; color: var(--accent); font-size: 11px; font-weight: 650; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.icon-button:hover { background: rgba(124, 231, 212, .14); border-color: var(--accent); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 364px; gap: 14px; padding: 14px; }
.stage-card { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17, 29, 43, .96), rgba(9, 17, 27, .98)); overflow: hidden; }
.stage-heading { flex: 0 0 auto; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.section-kicker { color: var(--accent); font-size: 9px; }
.stage-title { margin-top: 4px; color: #dce7ef; font-size: 14px; font-weight: 600; letter-spacing: -.015em; }
.projection-tag { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.projection-icon { color: var(--accent); font-size: 14px; }
.canvas-wrap { position: relative; flex: 1 1 auto; min-height: 260px; overflow: hidden; background: radial-gradient(ellipse at 50% 45%, rgba(24, 48, 66, .38), rgba(9, 17, 27, .12) 56%, transparent 80%); }
#simCanvas { display: block; width: 100%; height: 100%; animation: canvas-arrive 1.1s cubic-bezier(.2,.75,.25,1) both; }
@keyframes canvas-arrive { from { opacity: .35; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }
.canvas-hud { position: absolute; top: 13px; z-index: 2; color: rgba(177, 198, 214, .6); font-size: 8px; font-weight: 750; letter-spacing: .13em; pointer-events: none; }
.hud-left { left: 17px; display: flex; align-items: center; gap: 7px; }
.hud-right { right: 17px; }
.hud-dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; opacity: .85; }
.canvas-bottom-note { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; color: rgba(158, 184, 207, .52); font-size: 7px; font-weight: 750; letter-spacing: .15em; white-space: nowrap; pointer-events: none; }
.note-line { width: 22px; height: 1px; background: rgba(124, 231, 212, .25); }
.stage-caption { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px; min-height: 72px; padding: 13px 18px 14px; border-top: 1px solid var(--line); background: rgba(5, 11, 18, .35); }
.caption-symbol { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.caption-label { color: var(--accent); font-size: 8px; }
.stage-caption p { margin: 4px 0 0; color: #b7c5d1; font-size: 11px; line-height: 1.48; max-width: 760px; }
.control-panel { min-height: 0; overflow-y: auto; padding: 2px 2px 4px 0; scrollbar-width: thin; scrollbar-color: rgba(124, 231, 212, .25) transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(124, 231, 212, .25); border-radius: 5px; }
.readout-section, .controls-section, .check-card, .science-panel { border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(150deg, rgba(17, 29, 43, .94), rgba(12, 21, 33, .96)); }
.readout-section, .controls-section { padding: 14px; margin-bottom: 10px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.textbook-chip, .input-chip, .check-tag { padding: 4px 6px; border-radius: 4px; font-size: 7px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.textbook-chip { color: var(--accent); background: var(--accent-soft); }
.input-chip { color: #aab9c7; background: rgba(153, 174, 195, .09); }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; min-height: 75px; padding: 9px 10px 8px; border: 1px solid rgba(160, 185, 208, .1); border-radius: 8px; background: rgba(4, 11, 18, .38); }
.readout-label { color: var(--muted); font-size: 9px; font-weight: 600; }
.readout-value { margin-top: 5px; color: #f0f5f8; font-size: 21px; line-height: 1.05; font-weight: 650; letter-spacing: -.045em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.readout-value small { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 550; letter-spacing: 0; }
.readout-foot { margin-top: 5px; color: var(--dim); font-size: 8px; line-height: 1.3; }
.accent-readout { border-color: rgba(124, 231, 212, .2); background: linear-gradient(130deg, rgba(124, 231, 212, .08), rgba(4, 11, 18, .38)); }
.accent-readout .readout-value { color: var(--accent); }
.controls-section { padding-bottom: 12px; }
.control-block { margin: 0 0 12px; }
.control-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.control-label-row label { color: #d2dce5; font-size: 10px; font-weight: 600; }
.control-label-row output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 5px 0 0; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) 0%, rgba(124, 231, 212, .2) 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(124, 231, 212, .22); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 8px; }
.toggle-row { padding: 9px 0 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.switch-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.switch-copy { display: flex; flex-direction: column; gap: 3px; }
.switch-copy strong { color: #d2dce5; font-size: 10px; font-weight: 600; }
.switch-copy small { color: var(--dim); font-size: 8px; }
.switch { position: relative; width: 32px; height: 18px; flex: 0 0 32px; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: absolute; inset: 0; border: 1px solid rgba(159, 181, 201, .3); border-radius: 12px; background: #1a2938; transition: background .18s ease, border-color .18s ease; }
.switch-track::after { content: ""; position: absolute; width: 10px; height: 10px; top: 3px; left: 3px; border-radius: 50%; background: #8798a8; transition: transform .18s ease, background .18s ease; }
.switch input:checked + .switch-track { border-color: var(--accent-line); background: rgba(124, 231, 212, .22); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: var(--accent); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 10px 0; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: rgba(4, 11, 18, .3); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover, .preset-button.active { border-color: var(--accent-line); background: rgba(124, 231, 212, .07); }
.preset-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 6px; background: rgba(124, 231, 212, .09); color: var(--accent); font-size: 14px; }
.preset-button strong, .preset-button small { display: block; }
.preset-button strong { color: #d5e0e8; font-size: 9px; font-weight: 650; white-space: nowrap; }
.preset-button small { margin-top: 3px; color: var(--dim); font-size: 7px; white-space: nowrap; }
.transport-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; }
.transport-row button { height: 32px; border-radius: 7px; font-size: 8px; font-weight: 800; letter-spacing: .08em; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.transport-primary { display: flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid var(--accent); background: var(--accent); color: #08201e; }
.transport-primary:hover { background: #a0f5e7; }
.transport-primary span:first-child { font-size: 12px; }
.transport-secondary { border: 1px solid var(--line-strong); background: rgba(4, 11, 18, .25); color: #b4c2cf; }
.transport-secondary:hover { border-color: var(--accent-line); color: var(--accent); }
.quality-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.quality-row > span { color: var(--dim); font-size: 7px; }
.segmented { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: rgba(4, 11, 18, .38); }
.segmented button { padding: 4px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--dim); font-size: 7px; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.check-card { margin-bottom: 10px; padding: 12px 13px 10px; background: linear-gradient(145deg, rgba(15, 28, 39, .96), rgba(8, 17, 26, .96)); }
.check-heading { display: flex; align-items: center; gap: 7px; color: #c4d2de; font-size: 8px; }
.check-icon { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: 10px; }
.check-tag { margin-left: auto; color: var(--accent); background: var(--accent-soft); }
.check-equation { margin: 9px 0 8px; color: #d9e5ed; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.check-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.check-results div { display: flex; flex-direction: column; gap: 4px; padding: 7px 6px; border-radius: 6px; background: rgba(3, 9, 15, .35); }
.check-results span { color: var(--dim); font-size: 8px; }
.check-results strong { color: #e3edf3; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-results .check-diff { color: var(--accent); }
.check-foot { margin-top: 7px; color: var(--dim); font-size: 8px; }
.science-panel { margin-bottom: 4px; overflow: hidden; }
.science-panel summary { display: flex; align-items: center; gap: 8px; padding: 12px 13px; color: #d6e1e9; font-size: 9px; font-weight: 800; letter-spacing: .13em; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-summary-icon { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.summary-chevron { margin-left: auto; color: var(--muted); font-size: 15px; transition: transform .18s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 13px 13px; border-top: 1px solid var(--line); color: #aebdca; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 10px 0; }
.science-content strong { color: #dce7ee; font-weight: 650; }
.science-intro { color: #c4d1dc; }
.equation-block { display: flex; flex-direction: column; gap: 4px; padding: 8px 9px; margin: 7px 0; border-left: 2px solid var(--accent-line); background: rgba(3, 9, 15, .35); }
.equation-label { color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .13em; }
.equation-block code { color: #e1edf3; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.science-disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #7f91a1; font-style: italic; }
.footer-bar { height: 24px; flex: 0 0 24px; display: flex; justify-content: space-between; align-items: center; padding: 0 17px; color: #5d7082; font-size: 7px; letter-spacing: .13em; }
.footer-sep { padding: 0 5px; color: var(--accent); opacity: .7; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; padding: 16px; } .readout-value { font-size: 23px; } }
@media (max-width: 900px) {
  body.embed-mode { overflow: hidden; }
  .topbar { height: 60px; flex-basis: 60px; padding: 0 14px; }
  h1 { font-size: 17px; }
  .eyebrow { font-size: 7px; }
  .workspace { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
  .stage-card { flex: 0 0 47%; min-height: 280px; }
  .canvas-wrap { min-height: 190px; }
  .control-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 1px; }
  .footer-bar { display: none; }
}
@media (max-width: 520px) {
  .topbar { height: 56px; flex-basis: 56px; gap: 9px; padding: 0 11px; }
  .brand-mark { width: 25px; height: 25px; flex: 0 0 25px; }
  .eyebrow { font-size: 6.5px; letter-spacing: .11em; }
  h1 { font-size: 16px; }
  .topbar-right { gap: 9px; }
  .live-indicator { font-size: 7px; gap: 5px; }
  .icon-button { width: 33px; height: 32px; padding: 0; justify-content: center; }
  .icon-button span { display: none; }
  .workspace { padding: 8px; gap: 8px; }
  .stage-card { flex-basis: 43%; min-height: 270px; }
  .stage-heading { min-height: 52px; padding: 9px 12px; }
  .stage-title { font-size: 12px; }
  .projection-tag { padding: 6px; font-size: 6px; gap: 4px; }
  .canvas-hud { top: 9px; font-size: 6px; }
  .hud-left { left: 10px; }
  .hud-right { right: 10px; }
  .canvas-bottom-note { bottom: 8px; font-size: 6px; gap: 5px; }
  .note-line { width: 12px; }
  .stage-caption { min-height: 61px; padding: 9px 11px; gap: 8px; }
  .caption-symbol { width: 23px; height: 23px; flex-basis: 23px; font-size: 13px; }
  .caption-label { font-size: 7px; }
  .stage-caption p { font-size: 9px; line-height: 1.35; }
  .readout-section, .controls-section { padding: 11px; margin-bottom: 8px; }
  .panel-heading { margin-bottom: 9px; }
  .readout-card { min-height: 65px; padding: 7px 8px; }
  .readout-label { font-size: 8px; }
  .readout-value { font-size: 18px; margin-top: 4px; }
  .readout-foot { font-size: 7px; margin-top: 4px; }
  .control-block { margin-bottom: 9px; }
  .control-label-row label { font-size: 9px; }
  .control-label-row output { font-size: 9px; }
  .preset-button { padding: 7px 6px; gap: 6px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 6.5px; }
  .transport-row button { height: 30px; font-size: 7px; }
  .check-card { padding: 10px; margin-bottom: 8px; }
  .science-panel summary { padding: 10px; }
}
@media (max-height: 700px) and (min-width: 901px) {
  .topbar { height: 58px; flex-basis: 58px; }
  .workspace { padding: 9px; gap: 9px; }
  .stage-heading { min-height: 52px; }
  .stage-caption { min-height: 60px; padding: 9px 14px; }
  .readout-section, .controls-section { padding: 10px; margin-bottom: 7px; }
  .readout-card { min-height: 65px; }
  .readout-value { font-size: 18px; }
  .control-block { margin-bottom: 8px; }
  .footer-bar { height: 20px; flex-basis: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
