:root {
  --bg: #060a14; --panel: #0b1224; --panel-2: #0e1730; --line: #1c2745; --line-2: #2a3760;
  --text: #e4eaff; --muted: #8592b5; --faint: #56638a;
  --alice: #5fe0ee; --bob: #ffb65c; --quantum: #b59bff; --classic: #ff7d6e;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 85% -10%, #1b1846 0%, transparent 60%),
    radial-gradient(700px 420px at -5% 30%, #0b2a3a 0%, transparent 65%),
    var(--bg);
  min-height: 100vh; overflow-x: hidden;
}
button, a, input { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--quantum); outline-offset: 4px; }
.shell { width: min(1240px, calc(100% - 96px)); margin: auto; }

/* Header */
.topbar { height: 92px; display: flex; align-items: center; gap: 25px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; font-size: 38px; font-weight: 750; letter-spacing: -2px; }
.brand svg { width: 38px; height: 38px; fill: none; stroke-width: 3; }
.brand .ring-a { stroke: var(--alice); } .brand .ring-b { stroke: var(--bob); }
.brand svg circle { transition: transform .5s; transform-origin: 20px 20px; }
.brand:hover .ring-a { transform: translateX(2px); } .brand:hover .ring-b { transform: translateX(-2px); }
.brand-dot { color: var(--quantum); }
.brand-caption { font: 9px/1.65 var(--mono); letter-spacing: 1.6px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 24px; }
.top-right { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 9px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--alice); box-shadow: 0 0 10px var(--alice); }
.edition { font: 10px var(--mono); margin-left: 26px; color: var(--faint); }

/* Intro */
.intro { padding: 48px 0 34px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { font: 10px var(--mono); letter-spacing: 1.4px; color: var(--muted); display: flex; gap: 10px; align-items: center; margin: 0 0 14px; }
.eyebrow > span { width: 6px; height: 6px; border-radius: 50%; background: var(--quantum); box-shadow: 0 0 8px var(--quantum); }
h1 { font-size: clamp(34px, 4.6vw, 62px); line-height: 1.08; letter-spacing: -2.6px; font-weight: 650; margin: 0; position: relative; width: fit-content; }
h1 span { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--quantum); }
h1 svg { position: absolute; right: 0; bottom: -14px; width: 46%; height: 16px; fill: none; stroke: var(--alice); stroke-width: 1.6; opacity: .55; }
.intro-copy { font-size: 14px; line-height: 1.75; color: var(--muted); margin: 26px 0 0; max-width: 640px; }
.jump { display: inline-flex; gap: 12px; align-items: center; white-space: nowrap; min-height: 48px; padding: 12px 20px; border-radius: 30px; border: 1px solid var(--line-2); color: var(--text); text-decoration: none; font-size: 13px; background: #0e1730aa; transition: border-color .18s, background .18s; }
.jump span { color: var(--quantum); font-size: 20px; }
.jump:hover { border-color: var(--quantum); background: #1a1840; }

/* Experiment cards */
.experiment-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.experiment { position: relative; display: flex; align-items: center; gap: 14px; text-align: left; min-height: 76px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: #0b1224cc; }
.experiment:hover { border-color: var(--line-2); background: var(--panel-2); }
.experiment[aria-current=true] { border-color: var(--quantum); background: linear-gradient(120deg, #1b1741, #0e1730); box-shadow: 0 0 0 1px #b59bff33, 0 10px 30px -18px var(--quantum); }
.experiment-number { position: absolute; top: 9px; right: 12px; font: 9px var(--mono); color: var(--faint); letter-spacing: 1px; }
.experiment.star .experiment-number::after { content: " ★"; color: var(--quantum); }
.experiment-symbol { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; font: 22px var(--serif); color: var(--quantum); background: #16193a; border: 1px solid #2b2b5e; }
.experiment strong { display: block; font-size: 13px; font-weight: 600; }
.experiment small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Lab */
.lab { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; grid-template-areas: "stage panel" "explain panel"; background: #0a1020e6; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stage-column { grid-area: stage; min-width: 0; padding: 24px 24px 0; }
.explain { grid-area: explain; margin: 0 24px 24px; }
.stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.stage-heading .eyebrow { font-size: 9px; margin-bottom: 8px; letter-spacing: 1px; }
h2 { font-size: 25px; font-weight: 620; letter-spacing: -.6px; line-height: 1.2; margin: 0; }
.experiment-badge { font: 8px var(--mono); letter-spacing: 1px; border: 1px solid var(--line-2); border-radius: 4px; padding: 6px 7px; color: var(--muted); white-space: nowrap; }
.canvas-wrap { position: relative; height: 440px; border-radius: 12px; overflow: hidden; background: #070b16; border: 1px solid #141d38; }
canvas { display: block; width: 100%; height: 100%; }
.scene-top, .scene-bottom { position: absolute; left: 18px; right: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.scene-top { top: 14px; font: 9px var(--mono); letter-spacing: 1px; color: var(--muted); }
.scene-mode { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 8px; }
.scene-mode i { width: 6px; height: 6px; border-radius: 50%; background: var(--alice); }
.scene-bottom { bottom: 10px; font-size: 11px; color: var(--muted); }
#scene-hint { line-height: 1.4; }
.pause { pointer-events: auto; min-height: 44px; min-width: 104px; padding: 6px 14px; border-radius: 8px; background: #121b36; border: 1px solid var(--line-2); color: var(--text); font-size: 13px; }
.pause span { font-size: 11px; margin-left: 5px; }
.pause:hover { border-color: var(--quantum); }
.readouts { display: grid; grid-template-columns: repeat(3, 1fr); padding: 20px 0 22px; }
.readout { padding: 0 16px; border-right: 1px solid var(--line); min-width: 0; }
.readout:first-child { padding-left: 0; } .readout:last-child { border: none; }
.readout small { display: block; font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.readout strong { font: 500 20px var(--mono); letter-spacing: -.6px; }
.readout strong span { font: 11px var(--sans); letter-spacing: 0; color: var(--muted); margin-left: 5px; }

/* Controls */
.control-panel { grid-area: panel; border-left: 1px solid var(--line); padding: 24px; background: #0c1328; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading h3 { margin: 0; font-size: 17px; font-weight: 620; display: flex; gap: 10px; align-items: center; }
.panel-heading h3 span { color: var(--quantum); font-size: 20px; }
.reset { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; font-size: 20px; line-height: 1; }
.reset:hover { border-color: var(--quantum); }
.description { font-size: 13px; color: var(--muted); line-height: 1.65; margin: 10px 0 18px; }
.control { margin-bottom: 10px; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.control-label label { font-weight: 500; }
.control-label output { font: 11px var(--mono); color: var(--quantum); background: #1b1741; border-radius: 4px; padding: 4px 7px; white-space: nowrap; }
input[type=range] { width: 100%; height: 40px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; display: block; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--quantum) 0 var(--progress), #222d4f var(--progress) 100%); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--quantum) 0 var(--progress), #222d4f var(--progress) 100%); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 4px solid var(--quantum); box-shadow: 0 0 12px #b59bff88; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 4px solid var(--quantum); }
.range-limits { display: flex; justify-content: space-between; font: 9px var(--mono); color: var(--faint); margin-top: -6px; }
.switch { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin: 8px 0 4px; border-radius: 10px; border: 1px solid var(--line-2); background: #0f1731; text-align: left; font-size: 13px; }
.switch i { position: relative; flex-shrink: 0; width: 40px; height: 22px; border-radius: 11px; background: #26304f; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch[aria-checked=true] { border-color: var(--quantum); background: #1b1741; }
.switch[aria-checked=true] i { background: var(--quantum); }
.switch[aria-checked=true] i::after { transform: translateX(18px); background: #fff; }
.switch:hover { border-color: var(--quantum); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.action { flex: 1 1 auto; min-height: 46px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #111a35; font-size: 13px; font-weight: 550; }
.action:hover { border-color: var(--quantum); }
.action.primary { background: var(--quantum); border-color: var(--quantum); color: #120c2b; }
.action.primary:hover { background: #c9b6ff; }
.action:active { transform: translateY(1px); }
.small-label { font: 9px var(--mono); letter-spacing: 1.1px; color: var(--muted); }
.presets-wrap { margin-top: 22px; }
.presets-wrap .small-label { margin: 0 0 9px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { min-height: 44px; padding: 8px 12px; border-radius: 8px; border: 1px dashed var(--line-2); background: transparent; font-size: 12px; color: var(--text); }
.preset:hover { border-color: var(--alice); border-style: solid; }
.formula-box { padding-top: 16px; border-top: 1px dashed var(--line-2); }
.explain p { max-width: 720px; }
.formula { font-family: var(--serif); font-size: 19px; line-height: 1.5; margin-top: 8px; color: var(--alice); overflow-wrap: anywhere; }
.formula-box p { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 8px 0 0; }

/* Challenge and footer */
.discovery { display: flex; align-items: center; gap: 18px; margin-top: 16px; padding: 18px 22px; border-radius: 12px; border: 1px solid #2b2b5e; background: linear-gradient(100deg, #17163a, #0b1224); }
.discovery-icon { flex-shrink: 0; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font: 24px var(--serif); color: var(--bob); border: 1px solid #5c4526; }
.discovery .small-label { color: var(--bob); }
.discovery p { font-size: 13px; line-height: 1.65; margin: 6px 0 0; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 24px 0 32px; font-size: 11px; line-height: 1.6; color: var(--muted); }
footer strong { color: var(--text); font-weight: 500; }
footer a { color: var(--alice); text-decoration: none; border-bottom: 1px solid #5fe0ee55; }
footer a:hover { border-color: var(--alice); }
.pause[hidden] { display: none; }
#visited { font: 9px var(--mono); white-space: nowrap; }
.skip { position: fixed; top: 10px; left: 20px; z-index: 10; padding: 12px; background: var(--text); color: var(--bg); }
.skip:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1050px) {
  .shell { width: calc(100% - 48px); }
  .lab { grid-template-columns: minmax(0, 1fr) 280px; }
  .control-panel { padding: 20px 18px; }
  .stage-column { padding: 20px 18px 0; }
  .experiment { padding: 12px 14px; gap: 10px; }
  .experiment-symbol { width: 36px; height: 36px; font-size: 19px; }
  .readout { padding: 0 10px; } .readout strong { font-size: 17px; }
  .topbar { height: 80px; } .edition { display: none; }
  .wide-only { display: none; }
}
@media (max-width: 860px) {
  .lab { grid-template-columns: 1fr; grid-template-areas: "stage" "panel" "explain"; }
  .explain { margin: 0 18px 22px; padding-top: 18px; }
  .control-panel { border-left: none; border-top: 1px solid var(--line); }
  .top-right { display: none; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .topbar { height: 72px; gap: 16px; }
  .brand { font-size: 32px; } .brand svg { width: 32px; height: 32px; }
  .brand-caption { font-size: 8px; padding-left: 16px; letter-spacing: 1px; }
  .intro { padding: 30px 0 26px; flex-direction: column; align-items: flex-start; gap: 22px; }
  .eyebrow { font-size: 9px; letter-spacing: 1px; }
  h1 { font-size: 38px; letter-spacing: -1.8px; }
  h1 span { display: block; }
  h1 svg { width: 80%; left: 0; }
  .intro-copy { font-size: 13px; margin-top: 24px; }
  .experiment-list { grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 16px; }
  .experiment { display: block; min-height: 108px; padding: 12px; }
  .experiment-symbol { width: 32px; height: 32px; font-size: 18px; margin-bottom: 10px; }
  .experiment strong { font-size: 12px; } .experiment small { font-size: 10px; line-height: 1.4; }
  .stage-column { padding: 16px 12px 0; }
  .stage-heading { margin-bottom: 14px; }
  h2 { font-size: 21px; }
  .experiment-badge { display: none; }
  .canvas-wrap { height: 440px; }
  .scene-top, .scene-bottom { left: 12px; right: 12px; }
  .scene-bottom { font-size: 10px; }
  #scene-hint { max-width: 60%; }
  .readouts { padding: 16px 0 18px; }
  .readout { padding: 0 8px; } .readout small { font-size: 9px; } .readout strong { font-size: 15px; }
  .readout strong span { display: block; margin: 3px 0 0; font-size: 10px; }
  .explain { margin: 0 16px 20px; }
  .control-panel { padding: 20px 16px; }
  .discovery { padding: 16px; align-items: flex-start; gap: 12px; }
  .discovery-icon { width: 36px; height: 36px; font-size: 19px; }
  footer { flex-direction: column; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
