@charset "UTF-8";
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/Inter-Regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/Inter-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/Inter-Bold.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/PublicSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/PublicSans-Bold.woff2") format("woff2"); }
/*
 * Phi₀ web design tokens: navy headings, ink body, electric accent, bronze labels.
 * Every colour is a token, so the dark theme is one block of values.
 */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --panel: #f5f5f5;
  --tint: #f0f3f9;
  --ink: #04233d;
  --heading: #002579;
  --primary: #002579;
  --on-primary: #ffffff;
  --muted: #536071;
  --line: #dce1e8;
  --line-soft: #dce2f0;
  --line-strong: #9aa7b8;
  --accent: #575efe;
  --on-accent: #ffffff;
  --label: #8d6439;
  --danger: #a51c1c;
  --shadow: #04233d26;
  --backdrop: #04233db3;
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #04233d; --surface: #0b2c48; --panel: #0b2c48; --tint: #0a2a46; --ink: #e8edf6; --heading: #f4f6fb;
    --primary: #f4f6fb; --on-primary: #04233d; --muted: #b4c0d4; --line: #21405d; --line-soft: #21405d; --line-strong: #5d7896;
    --accent: #96a0fc; --on-accent: #04233d; --label: #c9a06f; --danger: #ff9b9b; --shadow: #00000059; --backdrop: #010d18cc;
  }
}
:root[data-theme="dark"] {
  --bg: #04233d; --surface: #0b2c48; --panel: #0b2c48; --tint: #0a2a46; --ink: #e8edf6; --heading: #f4f6fb;
  --primary: #f4f6fb; --on-primary: #04233d; --muted: #b4c0d4; --line: #21405d; --line-soft: #21405d; --line-strong: #5d7896;
  --accent: #96a0fc; --on-accent: #04233d; --label: #c9a06f; --danger: #ff9b9b; --shadow: #00000059; --backdrop: #010d18cc;
}
.logo-dark, .theme-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light, :root:not([data-theme="light"]) .theme-moon { display: none; }
  :root:not([data-theme="light"]) .logo-dark, :root:not([data-theme="light"]) .theme-sun { display: block; }
}
:root[data-theme="dark"] .logo-light, :root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .logo-dark, :root[data-theme="dark"] .theme-sun { display: block; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { min-height: 46px; cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .45; }
@media (hover: hover) { button:not(:disabled):hover { filter: brightness(.96); } }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
a { color: inherit; }
p { line-height: 1.6; }
h1, h2, h3, p { margin-top: 0; }
h2 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.04em; }
h3 { font-size: 1rem; }
[hidden] { display: none !important; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 5; background: var(--surface); padding: 12px; }
.skip-link:focus { top: 10px; }
.topbar { max-width: 1440px; margin: auto; min-height: 96px; padding: 16px 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.topbar.compact-bar { min-height: 72px; padding-top: 10px; padding-bottom: 10px; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.text-button { background: transparent; border: 0; padding: 8px; font-size: .85rem; }
.language-button { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 8px 20px; font-size: .85rem; }
.page-shell { max-width: 1344px; padding: 40px 48px 24px; margin: auto; }
.eyebrow { font-size: .65rem; font-weight: 650; letter-spacing: .13em; color: var(--primary); margin-bottom: 16px; display: block; }
.eyebrow.small { font-size: .64rem; margin: 0; }
h1 { font-size: clamp(2.3rem, 4.5vw, 3.8rem); font-weight: 580; line-height: 1.04; letter-spacing: -.065em; margin-bottom: 18px; }
.intro-copy { max-width: 590px; color: var(--muted); font-size: 1rem; margin-bottom: 0; }
.primary-button { background: var(--primary); color: var(--on-primary); border: 0; border-radius: 6px; padding: 14px 22px; font-size: .95rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: space-between; gap: 35px; }
.play-area { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.chip-panel { padding: 28px; background: var(--tint); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.pill { background: var(--surface); padding: 6px 10px; border-radius: 6px; font-size: .62rem; white-space: nowrap; color: var(--muted); }
.pill span { color: var(--primary); margin-right: 5px; }
.chip-tabs { display: flex; gap: 5px; background: var(--tint); padding: 4px; border-radius: 6px; }
.chip-tab { flex: 1; border: 0; background: transparent; border-radius: 6px; font-size: .82rem; padding: 6px 12px; }
.chip-tab.selected { background: var(--surface); box-shadow: 0 1px 3px var(--shadow); font-weight: 650; }
.chip-meta { display: flex; justify-content: space-between; gap: 10px; font-size: .65rem; color: var(--muted); margin-top: 18px; }
.chip-board { width: 100%; display: block; max-height: 390px; }
.coupling { stroke: var(--line-strong); stroke-width: 5; stroke-linecap: round; transition: stroke .15s; }
.edge.connected .coupling { stroke: var(--primary); stroke-width: 8; }
.edge.candidate .coupling { stroke: var(--accent); stroke-dasharray: 2 9; stroke-width: 6; }
.edge.preview .coupling, .edge.highlight .coupling { stroke: var(--accent); stroke-width: 8; stroke-dasharray: none; }
.edge.highlight .coupling { animation: pulse-edge 1.1s ease-in-out infinite alternate; }
@keyframes pulse-edge { from { stroke-width: 6; opacity: .55; } to { stroke-width: 11; opacity: 1; } }
.edge-hit { stroke: transparent; stroke-width: 30; stroke-linecap: round; cursor: pointer; }
.qubit .node { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.interactive .qubit { cursor: pointer; }
@media (hover: hover) { .interactive .qubit:hover .node { stroke: var(--accent); stroke-width: 3; } }
.node-hit { fill: transparent; stroke: none; pointer-events: none; }
@media (pointer: coarse) { .node-hit { pointer-events: all; } }
.qubit.selectable .node { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 5 4; }
.qubit.selected .node { stroke: var(--accent); stroke-width: 5; }
.empty-label { fill: var(--muted); font-size: 24px; font-family: inherit; }
.qubit.occupied .empty-label { display: none; }
.physical-label { fill: var(--muted); font-size: 15px; font-family: inherit; paint-order: stroke; stroke: var(--tint); stroke-width: 5px; stroke-linejoin: round; }
.token { pointer-events: none; }
.token circle { fill: var(--primary); stroke: var(--surface); stroke-width: 3; }
.token text { fill: var(--on-primary); font-size: 24px; font-family: inherit; font-weight: 650; }
.node-legend { margin: 8px 0 0; font-size: .67rem; color: var(--muted); }
.task-panel { padding: 28px; border-left: 1px solid var(--line); }
.task-panel h2 { margin: 14px 0 10px; }
.task-panel > p:not(.game-status) { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.connection-heading { margin: 14px 0 4px; }
.task-panel .hint { font-size: .75rem !important; margin-bottom: 10px; }
.edge-buttons button.preview { border-color: var(--accent); background: var(--tint); }
.move-detail { font-size: .75rem; color: var(--muted); margin: -4px 0 8px; font-variant-numeric: tabular-nums; }
.move-detail span { font-weight: 650; color: var(--ink); margin-right: 4px; }
.edge-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.edge-buttons button { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 9px 12px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.edge-buttons button span { color: var(--primary); margin: 0 4px; }
.game-status { min-height: 1.6em; font-size: .8rem; padding: 8px 0 0; margin: 4px 0 8px; color: var(--muted); }
.game-status.success { color: var(--primary); font-weight: 650; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 6px 0 12px; }
.metrics > div { padding: 8px 0; }
.metrics > div + div { padding-left: 22px; border-left: 1px solid var(--line); }
.metrics span { font-size: .72rem; color: var(--muted); }
.metrics strong { display: block; font-size: 1.5rem; font-weight: 550; margin-top: 2px; }
.metrics small { font-size: .68rem; font-weight: 400; color: var(--muted); margin-left: 9px; }
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.game-actions button { padding: 8px 14px; font-size: .8rem; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; }
.game-actions .reference-button { flex: 1; min-width: 210px; background: var(--primary); color: var(--on-primary); border-color: var(--primary); padding: 8px 16px; gap: 12px; }
.secondary-button { background: var(--surface); color: var(--primary); border: 1px solid var(--primary); border-radius: 6px; padding: 8px 16px; font-size: .82rem; font-weight: 600; }
.result-card { border: 1px solid var(--line); background: var(--tint); border-radius: 10px; padding: 14px 16px; margin: 6px 0 4px; }
.result-card h3 { font-size: 1.05rem; margin-bottom: 8px; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.result-card .check { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .85rem; }
.result-card > p { font-size: .8rem; margin: 6px 0 8px; }
.route-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.route-compare dt { font-size: .68rem; color: var(--muted); }
.route-compare dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 650; }
.chip-compare { font-size: .7rem; color: var(--muted); margin-bottom: 10px; }
.chip-compare ul { list-style: none; display: flex; gap: 6px; padding: 0; margin: 6px 0 0; flex-wrap: wrap; }
.chip-compare li { background: var(--surface); border-radius: 6px; padding: 4px 12px; color: var(--ink); font-size: .75rem; }
.chip-compare li.current { outline: 2px solid var(--primary); }
.chip-compare strong { margin-left: 4px; }
.tour-panel { display: flex; flex-direction: column; }
.tour-panel h2 { font-size: 1.9rem; margin: 6px 0 12px; }
.tour-text { font-size: .95rem; color: var(--muted); max-width: 420px; }
.tour-step { font-size: .75rem; color: var(--accent); font-weight: 650; margin: 18px 0 0; }
.tour-dots { list-style: none; display: flex; gap: 6px; padding: 0; margin: 14px 0 0; }
.tour-dots li { width: 34px; height: 5px; border-radius: 6px; background: var(--line); }
.tour-dots li.done { background: var(--accent); }
.tour-panel .primary-button { align-self: flex-start; margin-top: 18px; }
.tour-chip { justify-content: center; align-items: center; font-size: .82rem; font-weight: 650; min-height: 46px; margin: 0; }
.reference-panel { padding: 16px; background: var(--tint); border-radius: 6px; margin-top: 16px; font-size: .8rem; }
.reference-panel h3 { font-size: .9rem; margin-bottom: 8px; }
.reference-panel p { margin-bottom: 6px; }
.reference-panel ol { margin: 12px 0 0; padding-left: 22px; line-height: 1.6; }
.explanation { padding: 30px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px 35px; }
.explanation > div:first-child { display: flex; gap: 15px; align-items: baseline; }
.section-index { color: var(--primary); font-size: 1.5rem; font-weight: 600; }
.explanation h2 { font-size: 1.2rem; }
.explanation > p { color: var(--muted); margin: 0; font-size: .9rem; }
.route-history, .technical-details { grid-column: 2; font-size: .8rem; }
.route-history h3 { font-size: .8rem; margin-bottom: 8px; }
.route-history p { color: var(--muted); overflow-wrap: anywhere; }
.technical-details summary { cursor: pointer; padding: 12px 0; min-height: 44px; }
.technical-details dl { margin-top: 5px; }
.technical-details dt { font-weight: 650; margin-top: 12px; }
.technical-details dd { margin: 4px 0 0; color: var(--muted); line-height: 1.5; }
footer { padding: 24px 0 0; color: var(--muted); }
footer p { margin-bottom: 5px; font-size: .8rem; }
footer small { font-size: .68rem; display: block; line-height: 1.5; }
.menu-page footer { margin-top: 18px; }
.game-root { padding-top: 14px; padding-bottom: 0; }
.game-root .play-area { align-items: stretch; }
.game-root .chip-panel { padding: 20px 28px; }
.game-root .chip-meta { margin-top: 10px; }
.game-root .chip-board { max-height: 330px; }
.game-root .task-panel { padding: 20px 28px; }
.game-root .task-panel h2 { margin: 8px 0 6px; font-size: 1.45rem; }
.game-intro { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 12px; }
.game-intro .eyebrow { flex-basis: 100%; margin: 0; font-size: .57rem; }
.game-intro h1 { font-size: 1.55rem; letter-spacing: -.04em; margin: 0; }
.game-intro .intro-copy { font-size: .78rem; flex: 1; min-width: 280px; }
.game-root + .shell-footer, .page-shell > .shell-footer { max-width: 1344px; margin: 0 auto; padding: 22px 48px 28px; }
.page-shell > .shell-footer { padding-left: 0; padding-right: 0; }
[data-game-heading]:focus, [data-menu-heading]:focus, main:focus { outline: none; }
[data-game-heading]:focus-visible, [data-menu-heading]:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.menu-button { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 8px 16px; font-size: .82rem; }
.depth-switch { display: flex; align-items: center; gap: 4px; background: var(--tint); border-radius: 6px; padding: 4px; }
.depth-switch button { border: 0; background: transparent; border-radius: 6px; padding: 6px 14px; font-size: .78rem; min-height: 44px; }
.depth-switch button.selected { background: var(--surface); color: var(--primary); font-weight: 650; box-shadow: 0 1px 3px var(--shadow); }
.menu-page { padding-top: 34px; }
.menu-hero { max-width: 820px; margin-bottom: 26px; }
.menu-hero h1 { font-size: clamp(2rem, 3.6vw, 3rem); margin-bottom: 10px; }
.route-notice { background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: .8rem; margin-bottom: 18px; }
.game-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.game-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; }
.game-card.unavailable { background: var(--panel); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-number { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); font-weight: 650; }
.card-icon svg { width: 64px; height: 40px; fill: none; stroke: var(--heading); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.card-icon svg .fill { fill: var(--primary); stroke: var(--primary); }
.card-icon svg .arrow { stroke: var(--accent); }
.game-card h2 { font-size: 1.3rem; margin: 2px 0 0; }
.game-card p { margin: 0; font-size: .85rem; color: var(--muted); }
.card-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .7rem !important; }
.card-meta span + span::before { content: "·"; margin-right: 14px; }
.card-start { align-self: flex-start; margin-top: 8px; text-decoration: none; gap: 20px; padding: 10px 20px; }
.card-unavailable { margin-top: 8px !important; font-size: .78rem !important; }
.card-unavailable strong { color: var(--ink); }
.unavailable-panel, .error-panel { max-width: 760px; padding: 40px 0; }
.unavailable-panel h1 { font-size: 2.2rem; }
a.primary-button { text-decoration: none; }
.access-panel .primary-button { gap: 20px; }
.result-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-area { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.timeline { width: 100%; display: block; margin-top: 10px; }
.timeline .tick { stroke: var(--line); stroke-width: 1; }
.timeline .tick.major { stroke: var(--line-strong); }
.timeline .tick-label { fill: var(--muted); font-size: 11px; font-family: inherit; }
.timeline .row-label { fill: var(--ink); font-size: 14px; font-weight: 650; font-family: inherit; }
.timeline .row-line { stroke: var(--line); }
.timeline .cell { fill: transparent; }
.timeline.interactive .cell { cursor: pointer; }
.timeline.interactive .cell:hover { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.timeline .block rect { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.timeline .block.two-qubit rect { fill: var(--accent); }
.timeline .block text { fill: var(--on-primary); font-size: 15px; font-weight: 700; font-family: inherit; pointer-events: none; }
.timeline .block .block-duration { font-size: 10px; font-weight: 500; }
.timeline.interactive .block { cursor: pointer; }
.timeline .block.selected rect { stroke: var(--accent); stroke-width: 4; }
.timeline .block.conflict rect { fill: var(--danger); stroke: var(--surface); stroke-dasharray: 6 3; }
.op-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.op-card { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 10px; display: grid; gap: 1px; min-height: 44px; }
.op-card strong { font-size: 1rem; }
.op-card span, .op-card small { font-size: .66rem; color: var(--muted); }
.op-card.placed { background: var(--tint); border-color: var(--line); }
.op-card.selected { border: 2px solid var(--accent); }
.op-card.conflict { border-color: var(--danger); background: var(--tint); }
.op-card .op-status { color: var(--ink); }
.step-controls { display: grid; gap: 6px; padding: 10px 12px; background: var(--panel); border-radius: 6px; margin-bottom: 4px; }
.step-title { font-size: .75rem; font-weight: 650; }
.step-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .78rem; }
.step-row button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 12px; font-size: .78rem; min-width: 44px; }
.step-row output { min-width: 58px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.step-row .place-button { padding: 8px 16px; }
.timeline-panel .violations, .timeline-panel .result-card { margin-top: 12px; }
.violations { border: 1px solid var(--danger); background: var(--tint); border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; font-size: .75rem; }
.violations h3 { font-size: .8rem; margin-bottom: 4px; color: var(--danger); }
.violations ul { margin: 0; padding-left: 18px; }
.route-compare.four { grid-template-columns: repeat(2, 1fr); gap: 8px 12px; }
.fine-print { font-size: .66rem !important; color: var(--muted); }
.how-list { padding-left: 22px; font-size: .9rem; line-height: 1.6; color: var(--ink); }
.how-panel .primary-button { margin-top: 10px; }
.deep-dive { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 32px; margin-top: 8px; }
.deep-section h3 { font-size: .9rem; margin-bottom: 6px; color: var(--heading); }
.deep-section p { font-size: .8rem; line-height: 1.65; color: var(--ink); margin-bottom: 6px; }
math { font-size: 1.06em; }
.deep-now { background: var(--tint); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.deep-list { font-size: .78rem; margin: 0; padding-left: 18px; line-height: 1.6; }
.deep-table { border-collapse: collapse; font-size: .78rem; font-variant-numeric: tabular-nums; }
.deep-table th, .deep-table td { border-bottom: 1px solid var(--line); padding: 4px 14px 4px 0; text-align: left; }
.deep-table tr.critical th, .deep-table tr.critical td { color: var(--heading); font-weight: 650; }
.deep-sources { grid-column: 1 / -1; font-size: .7rem; color: var(--muted); margin: 0; }
.lab-body { margin-bottom: 8px; }
.lab-hypotheses h2, .lab-predict h2 { font-size: 1.4rem; margin: 6px 0 12px; }
.lab-hypothesis-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lab-hypothesis { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; display: grid; gap: 8px; }
.lab-hypothesis strong { font-size: 1.1rem; line-height: 1.35; }
.lab-hypothesis span:last-child { font-size: .8rem; color: var(--muted); line-height: 1.5; }
.lab-hypothesis:hover { border-color: var(--primary); }
.lab-predict { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; max-width: 880px; }
.lab-predict h3 { font-size: .95rem; margin: 14px 0 8px; }
.lab-options { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-experiment { display: grid; gap: 12px; }
.lab-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.lab-top h2 { font-size: 1.25rem; margin: 2px 0 0; }
.lab-conditions { background: var(--tint); border-radius: 10px; padding: 12px 16px; }
.lab-groups { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 8px; }
.lab-group { display: grid; gap: 4px; }
.lab-group-title { font-size: .66rem; color: var(--muted); letter-spacing: .04em; }
.lab-group .chip-tab { flex: none; background: var(--surface); border: 1px solid var(--line); min-height: 40px; padding: 6px 12px; font-size: .76rem; }
.lab-group .chip-tab.selected { border-color: var(--primary); color: var(--primary); }
.lab-condition-line { font-size: .75rem; color: var(--muted); margin: 0; }
.lab-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lab-plan { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.lab-plan h3 { font-size: 1rem; margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.plan-letter { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.lab-metrics { margin: 0; display: grid; gap: 4px; }
.lab-metrics > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; font-size: .8rem; }
.lab-metrics dt { color: var(--muted); }
.lab-metrics dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.lab-metrics .better { color: var(--primary); font-size: .68rem; margin-left: 6px; }
.lab-metrics .tie { color: var(--muted); font-size: .68rem; margin-left: 6px; font-weight: 400; }
.lab-note { font-size: .75rem; color: var(--label); background: var(--tint); border-radius: 6px; padding: 6px 10px; margin: 8px 0 0; }
.lab-verdict { background: var(--tint); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.lab-verdict h3 { font-size: .95rem; margin-bottom: 6px; color: var(--primary); }
.lab-verdict p { font-size: .82rem; margin: 0 0 6px; }
.lab-verdict-text { font-weight: 600; }
.lab-glossary { font-size: .75rem; margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.lab-evidence { margin-top: 10px; }
.lab-calibration { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; }
.lab-calibration h3 { font-size: .95rem; color: var(--heading); margin-bottom: 8px; }
.lab-calibration p { font-size: .8rem; line-height: 1.65; margin-bottom: 8px; }
.lab-evidence code { font-size: .68rem; overflow-wrap: anywhere; }
.lab-chip { width: 100%; max-width: 280px; display: block; margin: 4px 0; }
.lab-chip .edge-label { fill: var(--accent); font-size: 15px; font-weight: 650; font-family: inherit; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.lab-chip .lab-node { fill: var(--on-primary); font-size: 16px; font-weight: 650; font-family: inherit; }
.lab-chip .qubit.occupied .node { fill: var(--primary); stroke: var(--primary); }
.hw-start { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; }
.hw-start h2 { font-size: 1.4rem; margin: 6px 0 6px; }
.hw-circuits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hw-circuit { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: grid; gap: 4px; }
.hw-circuit strong { font-size: 1rem; }
.hw-circuit small { font-size: .72rem; color: var(--muted); line-height: 1.45; }
.hw-circuit.selected { border: 2px solid var(--primary); background: var(--tint); }
.hw-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; margin-bottom: 12px; }
.hw-input { padding: 12px 22px; background: var(--tint); }
.hw-input h2, .hw-chips-panel h2, .hw-detail h2 { font-size: 1.05rem; margin: 0; letter-spacing: -.02em; }
.hw-input .panel-heading, .hw-chips-panel .panel-heading, .hw-detail .panel-heading { margin-bottom: 8px; }
.hw-counts { font-size: .74rem; color: var(--ink); margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.hw-input .hint { font-size: .7rem; color: var(--muted); margin: 4px 0 0; }
.hw-question h2 { font-size: 1.2rem !important; }
.hw-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 8px; }
.hw-options button { border: 1px solid var(--primary); background: var(--surface); color: var(--primary); border-radius: 6px; font-weight: 650; font-size: .9rem; }
.hw-direct { color: var(--primary); font-weight: 600; }
.hw-switch { color: var(--primary); font-weight: 600; min-height: 44px; }
.hw-result-panel { padding: 14px 20px !important; display: grid; gap: 10px; align-content: start; }
.hw-result-panel .hw-verdict { margin: 0; }
.hw-result-panel .hw-conditions { flex-direction: column; gap: 4px; margin: 0; padding: 6px 12px; }
.circuit { display: block; width: 100%; height: auto; max-height: 220px; }
.circuit.logical { max-height: 170px; }
.circuit-scroll { overflow-x: auto; max-width: 100%; border-radius: 6px; background: var(--panel); padding: 4px 0; }
.circuit-scroll .circuit.native { width: auto; max-width: none; height: auto; max-height: none; }
.circuit .wire { stroke: var(--line-strong); stroke-width: 1.5; }
.circuit .wire-label { fill: var(--ink); font-size: 13px; font-weight: 600; font-family: inherit; }
.circuit .g-box { fill: var(--on-primary); stroke: var(--heading); stroke-width: 1.5; }
.circuit .g-name { fill: var(--heading); font-size: 12px; font-weight: 700; font-family: inherit; }
.circuit .g-angle { fill: var(--muted); font-size: 9.5px; font-family: inherit; }
.circuit .g-dot { fill: var(--heading); }
.circuit .g-link { stroke: var(--heading); stroke-width: 2; }
.circuit .g-target { fill: var(--on-primary); stroke: var(--heading); stroke-width: 2; }
.hw-chips-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 20px; margin-bottom: 4px; }
.hw-chips { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hw-chip-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.hw-chip-card.best { border: 2px solid var(--primary); background: var(--tint); }
.hw-chip-card.detail { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.hw-chip-card h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; font-size: 1rem; }
.hw-badge { font-size: .62rem; background: var(--primary); color: var(--on-primary); border-radius: 6px; padding: 3px 10px; font-weight: 650; letter-spacing: .02em; }
.hw-chip { width: 100%; display: block; height: 130px; }
.hw-chip .coupling { stroke-width: 6; }
.hw-chip .edge.used .coupling { stroke: var(--heading); stroke-width: 9; }
.hw-chip .qubit.occupied .node { fill: var(--primary); stroke: var(--primary); }
.hw-chip .logical-label { fill: var(--on-primary); font-size: 24px; font-weight: 700; font-family: inherit; }
.hw-chip .physical-label { font-size: 19px; }
.hw-chip .edge-label { fill: var(--accent); font-size: 17px; font-weight: 650; font-family: inherit; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.hw-metrics { margin: 0; display: grid; gap: 2px; }
.hw-metrics > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line); padding: 3px 0; font-size: .78rem; }
.hw-metrics dt { color: var(--muted); }
.hw-metrics dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hw-metrics dd strong { font-size: 1.05rem; }
.hw-metrics dd small { display: block; font-size: .64rem; color: var(--muted); }
.hw-metrics .best dd small { color: var(--primary); font-weight: 650; }
.hw-chip-card .secondary-button { align-self: flex-start; margin-top: 6px; min-height: 44px; }
.hw-chip-card .secondary-button[aria-pressed="true"] { background: var(--tint); }
.hw-note, .hw-missing { font-size: .72rem; color: var(--label); background: var(--tint); border-radius: 6px; padding: 6px 10px; margin: 4px 0 0; }
.hw-missing small { display: block; }
.hw-conditions { display: grid; gap: 14px; background: var(--tint); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.hw-axis { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hw-axis > span, .hw-axis > p { flex-basis: 100%; }
.hw-axis > span { font-size: .8rem; font-weight: 650; }
.hw-axis > p { margin: 0; color: var(--muted); font-size: .75rem; }
.hw-axis button { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-height: 44px; padding: 4px 12px; font-size: .76rem; }
.hw-axis button.selected { border: 2px solid var(--primary); color: var(--primary); font-weight: 650; }
.hw-verdict { background: var(--tint); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; margin-bottom: 10px; }
.hw-verdict p { font-size: .82rem; margin: 0 0 4px; }
.hw-answer { font-weight: 650; color: var(--primary); }
.hw-changed { color: var(--label) !important; }
.hw-source { font-size: .68rem !important; color: var(--muted); margin: 0 !important; }
.hw-fit { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.hw-fit li { font-size: .8rem; line-height: 1.5; }
.hw-fit strong { color: var(--primary); white-space: nowrap; }
.hw-detail { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 22px; margin-top: 16px; }
.hw-detail .pill { white-space: normal; }
.hw-detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
.hw-detail h3 { font-size: .85rem; margin: 6px 0; color: var(--heading); }
.hw-detail .hint { font-size: .7rem; color: var(--muted); margin: 4px 0 8px; }
.hw-layout { font-size: .78rem; font-variant-numeric: tabular-nums; margin: 0; }
.hw-timeline .s-block rect { fill: var(--primary); stroke: var(--surface); stroke-width: 1; }
.hw-timeline .s-block.two-qubit rect { fill: var(--accent); }
.hw-timeline .s-block text { fill: var(--on-primary); font-size: 10px; font-weight: 700; font-family: inherit; }
.hw-timeline .s-link { stroke: var(--heading); stroke-width: 3; }
.hw-timeline .row-label { font-size: 12px; }
.hw-target-model { margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; font-size: .78rem; }
.hw-target-model dt { font-weight: 650; }
.hw-target-model dd { margin: 2px 0 0; color: var(--muted); }
.hw-actions { margin: 18px 0 4px; align-items: center; }
.hw-actions .secondary-button { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.depth-dialog { border: 0; border-radius: 16px; padding: 24px 28px; width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg); color: var(--ink); box-shadow: 0 24px 70px var(--shadow); }
.depth-dialog::backdrop { background: var(--backdrop); }
.depth-dialog-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.depth-dialog-top .eyebrow { margin: 0; }
.depth-dialog h2 { font-size: 1.9rem; margin: 6px 0 6px; letter-spacing: -.04em; }
#depth-dialog-title:focus { outline: none; }
.depth-dialog-intro { color: var(--muted); font-size: .9rem; margin-bottom: 4px; }
.depth-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.depth-option { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.depth-option strong { font-size: 1.35rem; letter-spacing: -.03em; }
.depth-option .depth-what { font-size: .84rem; line-height: 1.55; }
.depth-option .depth-who { font-size: .76rem; line-height: 1.5; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.depth-option .depth-who b { color: var(--ink); }
@media (hover: hover) {
  .depth-options .depth-option:hover { background: var(--tint); border-color: var(--primary); filter: none; }
}
.loading { max-width: 800px; padding: 80px 30px; margin: auto; }
.idle-warning { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: min(90%, 750px); padding: 18px 22px; background: var(--ink); color: var(--on-primary); border: 2px solid var(--surface); border-radius: 10px; box-shadow: 0 5px 25px var(--shadow); font-size: .85rem; line-height: 1.5; z-index: 3; }
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
}
@media (max-width: 1000px) {
  .topbar { padding: 20px 28px; }
  .page-shell { padding: 30px 28px 24px; }
  .chip-panel, .task-panel { padding: 22px; }
  .play-area { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  .hw-top { grid-template-columns: 1fr; }
  .hw-top .task-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .topbar { min-height: 85px; padding: 16px 20px; }
  .page-shell { padding: 28px 20px; }
  .depth-options { grid-template-columns: 1fr; }
  .play-area, .explanation, .game-cards, .schedule-area, .deep-dive, .lab-plans, .lab-hypothesis-list,
  .hw-top, .hw-chips, .hw-circuits, .hw-detail-grid, .hw-target-model { grid-template-columns: 1fr; }
  .op-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-panel { border-left: 0; border-top: 1px solid var(--line); }
  .header-actions { gap: 6px; }
  .text-button { font-size: .72rem; }
  .language-button { padding: 8px 14px; }
  .route-history, .technical-details { grid-column: 1; }
}
/* ---- Components drawn with the Phi₀ web design tokens ---- */
body { background: var(--bg); color: var(--ink); }
h1, h2, h3, .depth-option strong, .lab-hypothesis strong, .hw-circuit strong, .op-card strong, .metrics strong, .primary-button, .secondary-button {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1, h2, h3 { color: var(--heading); }
h1 { font-weight: 600; letter-spacing: -.03em; }
h2 { font-weight: 600; letter-spacing: -.02em; }
h3 { font-weight: 700; }
.brand-logo, .compact-bar .brand-logo { width: auto; height: 44px; border-radius: 0; }
.topbar { border-bottom-color: var(--line); }
/* Buttons: navy primary with the arrow on the right; outlined secondary. */
.primary-button { min-height: 48px; border-radius: 6px; font-weight: 600; }
.secondary-button, .game-actions button, .step-row button, .edge-buttons button, .hw-axis button, .lab-group .chip-tab, .hw-options button {
  background: transparent; color: var(--heading); border: 1px solid var(--heading); border-radius: 6px; font-weight: 600; }
.game-actions .reference-button, .step-row .place-button { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.hw-axis button.selected, .lab-group .chip-tab.selected { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.edge-buttons button.preview { background: var(--tint); border-color: var(--accent); }
.menu-button, .language-button { border-radius: 6px; border-color: var(--line-strong); color: var(--heading); font-weight: 600; }
.text-button { color: var(--heading); font-weight: 600; }
.hw-direct, .hw-switch { color: var(--heading); }
button:disabled { opacity: .4; }
/* Cards: surface, hairline border, no shadow. */
.game-card, .lab-hypothesis, .lab-plan, .hw-start, .hw-chips-panel, .hw-detail, .lab-predict, .lab-calibration, .depth-option, .play-area, .hw-top, .hw-chip-card, .hw-circuit, .op-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
.game-card.unavailable, .chip-panel, .hw-input, .lab-conditions, .hw-conditions, .step-controls { background: var(--panel); }
.chip-panel, .hw-input { border-radius: 0; }
.task-panel { border-left-color: var(--line); }
.lab-hypothesis:hover, .depth-options .depth-option:hover { border-color: var(--heading); background: var(--tint); }
.hw-chip-card.best, .hw-circuit.selected, .op-card.selected { border: 2px solid var(--heading); background: var(--tint); }
.op-card.placed { background: var(--tint); border-color: var(--line-strong); }
.op-card.conflict, .violations { border-color: var(--danger); background: var(--tint); }
.violations h3 { color: var(--danger); }
.result-card, .lab-verdict, .hw-verdict, .reference-panel { background: var(--tint); border: 1px solid var(--line); border-radius: 10px; }
.result-card h3, .lab-verdict h3, .hw-answer, .game-status.success { color: var(--heading); }
.lab-note, .hw-note, .hw-missing, .route-notice, .hw-changed { color: var(--ink) !important; background: var(--tint); border-left: 3px solid var(--label); border-radius: 0 6px 6px 0; }
.hw-changed { background: none; border: 0; }
.deep-now { background: var(--tint); border-left-color: var(--accent); }
.depth-dialog { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; }
.depth-option strong { color: var(--heading); }
/* Upper labels: bronze, capitals, open tracking. */
.eyebrow, .eyebrow.small, .game-intro .eyebrow, .card-number, .lab-group-title, .plan-letter {
  color: var(--label); text-transform: uppercase; font-size: .78rem; font-weight: 700; letter-spacing: .12em; }
.section-index, .tour-step, .lab-metrics .better, .hw-metrics .best dd small { color: var(--accent); }
.pill { background: var(--surface); border: 1px solid var(--line); color: var(--muted); border-radius: 6px; }
.pill span { color: var(--accent); }
.hw-badge { border-radius: 6px; }
/* Depth selector: plain, like the site menu; the selected level carries a navy underline. */
.depth-switch { background: none; border-radius: 0; padding: 0; gap: 4px; }
.depth-switch button { border-radius: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; padding: 6px 12px; }
.depth-switch button.selected { background: none; box-shadow: none; color: var(--heading); border-bottom-color: var(--heading); font-weight: 700; }
.chip-tabs { background: none; padding: 0; gap: 4px; border-bottom: 1px solid var(--line); border-radius: 0; }
.chip-tab { border-radius: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; }
.chip-tab.selected { background: none; box-shadow: none; color: var(--heading); border-bottom-color: var(--heading); font-weight: 700; }
.lab-group .chip-tabs { border-bottom: 0; }
/* Board, circuits and timelines drawn with the same tokens. */
.qubit .node { fill: var(--surface); stroke: var(--line-strong); }
.edge.connected .coupling { stroke: var(--heading); }
.edge.candidate .coupling { stroke: var(--accent); }
.physical-label { fill: var(--muted); stroke: var(--panel); }
.empty-label { fill: var(--line-strong); }
.card-icon svg { stroke: var(--heading); }
.card-icon svg .fill { fill: var(--accent); stroke: var(--accent); }
.card-icon svg .arrow { stroke: var(--label); }
.timeline .block.two-qubit text, .hw-timeline .s-block.two-qubit text { fill: var(--on-accent); }
.circuit-scroll { background: var(--panel); }
.circuit .g-box, .circuit .g-target { fill: var(--surface); }
.lab-chip .edge-label, .hw-chip .edge-label { stroke: var(--surface); }
.lab-chip .lab-node { fill: var(--on-primary); }
.hw-chip .logical-label { fill: var(--on-primary); }
.idle-warning { background: var(--heading); color: var(--bg); border-color: var(--bg); }
a { color: inherit; }
:focus-visible { outline-color: var(--accent); }
/* Theme button: a square icon button, as on the site. */
.theme-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; display: inline-grid; place-items: center; background: transparent; color: var(--heading); border: 1px solid var(--line); border-radius: 6px; }
/* Links back to the site: a thin row above the header, a short row in the footer. */
.site-nav { background: var(--panel); border-bottom: 1px solid var(--line); font-size: .72rem; }
.site-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 20px; }
.site-nav ul { max-width: 1440px; margin: auto; padding: 0 48px; }
.site-nav a, .site-footer a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); text-decoration: none; font-weight: 600; }
.site-nav a:hover, .site-footer a:hover, .site-nav a:focus-visible, .site-footer a:focus-visible { color: var(--heading); text-decoration: underline; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
@media (pointer: coarse) { .site-nav a, .site-footer a { min-height: 44px; } }
/* Grid and flex children must be allowed to shrink, or wide SVG/tables push the page sideways. */
.hw-detail-grid > *, .hw-top > *, .play-area > *, .lab-plans > *, .deep-dive > *, .explanation > * { min-width: 0; }
.deep-section, .lab-evidence, .lab-calibration, .hw-detail { overflow-wrap: anywhere; }
.table-scroll, .deep-section:has(> table) { overflow-x: auto; }
.card-start { min-height: 44px; }
@media (pointer: coarse) {
  .lab-group .chip-tab, .chip-tab, .edge-buttons button, .game-actions button, .step-row button, .secondary-button { min-height: 44px; }
}
@media (max-width: 760px) {
  :root { font-size: 17px; }
  h1 { font-size: clamp(1.7rem, 8vw, 2.3rem); letter-spacing: -.045em; }
  .topbar, .topbar.compact-bar { min-height: 0; padding: 10px 16px; gap: 8px 12px; }
  .brand { gap: 10px; }
  .brand-logo, .compact-bar .brand-logo { width: auto; height: 36px; }
  .header-actions { flex: 1 1 100%; justify-content: flex-end; gap: 6px 8px; }
  .header-actions .menu-button { margin-right: auto; }
  .depth-switch { order: 3; flex: 1 1 100%; }
  .depth-switch button { flex: 1; padding: 6px 4px; text-align: center; }
  .menu-button, .language-button { padding: 8px 14px; }
  .page-shell { padding: 20px 16px; }
  .site-nav ul { padding: 0 16px; gap: 0 16px; }
  .game-root { padding-top: 12px; }
  .game-root + .shell-footer, .page-shell > .shell-footer { padding: 18px 16px 24px; }
  .page-shell > .shell-footer { padding-left: 0; padding-right: 0; }
  .chip-panel, .task-panel, .game-root .chip-panel, .game-root .task-panel { padding: 16px 14px; }
  .game-root .chip-board, .chip-board { max-height: none; }
  .game-card { padding: 16px 18px; }
  .hw-start, .lab-predict, .hw-detail, .lab-hypothesis, .lab-calibration { padding: 16px; }
  .hw-chips-panel, .hw-input { padding: 12px 14px; }
  .lab-top { flex-wrap: wrap; align-items: flex-start; }
  .lab-groups { gap: 10px 14px; }
  .lab-group { min-width: 0; max-width: 100%; }
  .lab-group .chip-tabs, .lab-options { flex-wrap: wrap; }
  .lab-group .chip-tab { white-space: normal; text-align: left; }
  .pill { white-space: normal; }
  .panel-heading { flex-wrap: wrap; }
  .hw-options { grid-template-columns: 1fr; }
  .game-actions .reference-button { min-width: 0; flex-basis: 100%; }
  .game-intro .intro-copy { min-width: 0; flex-basis: 100%; }
  .metrics small { display: block; margin-left: 0; }
  .depth-dialog { padding: 16px; width: calc(100vw - 20px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); border-radius: 10px; }
  .depth-dialog h2 { font-size: 1.45rem; }
  .depth-dialog-intro { font-size: .82rem; }
  .depth-options { gap: 8px; margin-top: 10px; }
  .depth-option { padding: 12px 14px; gap: 4px; }
  .depth-option strong { font-size: 1.15rem; }
  .depth-option .depth-what { font-size: .8rem; line-height: 1.45; }
  .depth-option .depth-who { padding-top: 6px; line-height: 1.4; }
  .idle-warning { bottom: 10px; padding: 12px 14px; }
  /* A 260 ns timeline needs width to be tappable: it scrolls sideways inside its own box. */
  .timeline-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px 6px; }
  .timeline-scroll .timeline { width: 760px; max-width: none; }
  /* Nothing a visitor has to read is below 12 px on a phone. */
  .pill, .chip-meta, .node-legend, .hw-badge,
  .fine-print, .hw-source, .hw-metrics dd small, .lab-metrics .better, .lab-metrics .tie,
  .route-compare dt, .metrics small, .op-card span, .op-card small, .card-meta, .deep-sources, .hw-input .hint, .hw-detail .hint,
  .hw-missing, .hw-note, .depth-option .depth-who, .lab-evidence code, .hw-chip-card small, footer small, .chip-compare, .move-detail,
  .task-panel .hint, .tour-step, .hw-counts, .hw-circuit small { font-size: .72rem !important; }
}
/* Phones held sideways: little height, so the header and the dialog are kept short. */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar, .topbar.compact-bar { min-height: 0; padding: 6px 20px; flex-wrap: nowrap; }
  .brand-logo, .compact-bar .brand-logo { width: auto; height: 30px; }
  .header-actions { flex-wrap: nowrap; gap: 6px; }
  .depth-switch button { padding: 4px 10px; }
  .text-button { font-size: .72rem; padding: 6px; }
  .menu-button, .language-button { padding: 6px 12px; }
  .depth-dialog { padding: 12px 16px; max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .depth-dialog h2 { font-size: 1.2rem; margin: 2px 0; }
  .depth-dialog-intro { font-size: .74rem; margin: 0; }
  .depth-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
  .depth-option { padding: 8px 12px; gap: 3px; }
  .depth-option strong { font-size: 1rem; }
  .depth-option .depth-what { font-size: .72rem; line-height: 1.35; }
  .depth-option .depth-who { font-size: .68rem; line-height: 1.3; padding-top: 4px; }
  .depth-dialog-top .language-button { min-height: 36px; padding: 2px 12px; }
}
@media (min-width: 1600px) and (min-height: 950px) {
  :root { font-size: 20px; }
  .topbar { max-width: 1760px; }
  .page-shell { max-width: 1680px; }
  .game-root .chip-board { max-height: 470px; }
  .page-shell, .game-root + .shell-footer { max-width: 1680px; }
  .brand-logo, .compact-bar .brand-logo { height: 52px; }
}
@media (max-height: 700px) and (min-width: 761px) {
  .topbar { min-height: 72px; padding-top: 8px; padding-bottom: 8px; }
  .brand-logo, .compact-bar .brand-logo { height: 36px; }
  .menu-page { padding-top: 16px; }
  .menu-hero { margin-bottom: 12px; }
  .menu-hero .eyebrow { margin-bottom: 6px; }
  .menu-hero h1 { font-size: 1.7rem; margin-bottom: 4px; }
  .menu-hero .intro-copy { font-size: .78rem; }
  .game-cards { gap: 10px; }
  .game-card { padding: 12px 20px; gap: 3px; }
  .game-card h2 { font-size: 1.1rem; }
  .card-icon svg { height: 30px; }
  .card-start { margin-top: 4px; padding: 6px 18px; }
  .card-unavailable { margin-top: 4px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Trademark sign: small and raised, as on the site. */
sup.tm { font-size: .5em; vertical-align: super; line-height: 0; margin-left: .06em; font-weight: 400; letter-spacing: 0; }
.lab-condition-line .pill { white-space: normal; }
