/* Quantum Physics Lab design system.
   Dark "quantum" theme by default; light theme for projectors via [data-theme="light"].
   Canvas charts read the same custom properties, so --heat-* must stay hex colors. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --nav-h: 60px;
  --maxw: 1320px;

  color-scheme: dark;
  --bg: #06070f;
  --glow-1: rgba(124, 92, 255, 0.2);
  --glow-2: rgba(46, 230, 245, 0.11);
  --surface: rgba(18, 20, 42, 0.72);
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-solid: #0d0f21;
  --border: rgba(148, 160, 255, 0.14);
  --border-strong: rgba(148, 160, 255, 0.3);
  --text: #eef0ff;
  --muted: #a3a9d2;
  --faint: #6c729c;
  --accent: #8b7bff;
  --accent-strong: #a99dff;
  --accent-2: #2ee6f5;
  --accent-text: #080915;
  --grad: linear-gradient(135deg, #8b7bff 0%, #2ee6f5 100%);
  --grid: rgba(148, 160, 255, 0.1);
  --axis: rgba(148, 160, 255, 0.38);
  --exact: #8b7bff;
  --trotter: #ffb454;
  --cursor: rgba(238, 240, 255, 0.45);
  --amp-pos: #2ee6f5;
  --amp-neg: #ff5fa2;
  --marked: #ffb454;
  --error: #ff7a90;
  --heat-0: #10122b;
  --heat-50: #6d5dfc;
  --heat-100: #c4f8ff;
  --heat-empty: #0a0b19;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --star: rgba(255, 255, 255, 0.55);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f6fc;
  --glow-1: rgba(91, 61, 245, 0.1);
  --glow-2: rgba(8, 145, 178, 0.08);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: #eef0f9;
  --surface-solid: #ffffff;
  --border: #dfe2f0;
  --border-strong: #c3c7de;
  --text: #0f1226;
  --muted: #4d5377;
  --faint: #868bab;
  --accent: #5b3df5;
  --accent-strong: #4a2de0;
  --accent-2: #0891b2;
  --accent-text: #ffffff;
  --grad: linear-gradient(135deg, #5b3df5 0%, #0891b2 100%);
  --grid: #e7e9f4;
  --axis: #b6bad3;
  --exact: #5b3df5;
  --trotter: #d9480f;
  --cursor: #868bab;
  --amp-pos: #0891b2;
  --amp-neg: #d6336c;
  --marked: #d97706;
  --error: #c92a2a;
  --heat-0: #f1f2fb;
  --heat-50: #8b7bff;
  --heat-100: #26168a;
  --heat-empty: #fafbff;
  --shadow: 0 14px 40px rgba(40, 44, 90, 0.12);
  --star: transparent;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Pages start with html.is-loading (set in each page's head) so the empty lesson frame never
   flashes while the scripts load; ui/shell.js removes it after the first render. The animation
   reveals the page anyway if the scripts fail. The background stays on body, so no white flash.
   No fade on reveal: visibility must not depend on a transition (hidden tabs freeze them). */
html.is-loading body > * {
  opacity: 0;
  animation: reveal-fallback 0.2s ease 2.5s forwards;
}

@keyframes reveal-fallback {
  to {
    opacity: 1;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  background:
    radial-gradient(900px 520px at 12% -8%, var(--glow-1), transparent 62%),
    radial-gradient(760px 480px at 92% 4%, var(--glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
}

code,
kbd,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

img,
svg,
canvas {
  max-width: 100%;
}

/* Component display rules (e.g. .btn's inline-flex) would otherwise override the attribute. */
[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.muted {
  color: var(--muted);
}

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Navigation ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad);
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.nav-links a,
.nav-menu-btn {
  font: 500 14px var(--font-sans);
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
}

.nav-links a:hover,
.nav-menu-btn:hover,
.nav-menu-btn[aria-expanded='true'],
.nav-links a[aria-current='page'] {
  color: var(--text);
  background: var(--surface-2);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.theme-switch {
  display: flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.theme-switch button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: 500 13px var(--font-sans);
  cursor: pointer;
}

.theme-switch button:hover {
  color: var(--text);
}

.theme-switch button[aria-pressed='true'] {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

.theme-switch svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--border-strong);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mega {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  box-shadow: var(--shadow);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}

.mega-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  padding-top: 22px;
  padding-bottom: 24px;
}

.mega h3 {
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.mega h3 .ket {
  font-family: var(--mono);
  color: var(--accent-2);
  text-transform: none;
  margin-right: 6px;
  letter-spacing: 0;
}

.mega a,
.mega span.soon-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.mega a:hover {
  background: var(--surface-2);
}

.mega span.soon-link {
  color: var(--faint);
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  align-self: center;
}

.tag.live {
  border-color: color-mix(in srgb, var(--accent-2) 55%, transparent);
  color: var(--accent-2);
}

/* ---------- Buttons and form controls ---------- */

.btn,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 14px var(--font-sans);
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover,
.button:hover {
  border-color: var(--accent);
}

.btn-primary,
.button:not(.secondary) {
  border-color: transparent;
  background: var(--grad);
  color: var(--accent-text);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-primary:hover,
.button:not(.secondary):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 12px;
}

.btn:disabled,
.button:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input[type='text'],
input[type='number'],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
}

select option {
  background: var(--surface-solid);
  color: var(--text);
}

textarea,
#state,
#observable {
  font-family: var(--mono);
  font-size: 13px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
  min-height: 120px;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

.invalid {
  border-color: var(--error) !important;
}

.field {
  display: block;
  margin-top: 14px;
}

.field:first-child,
.row > .field {
  margin-top: 0;
}

.label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

output {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.error {
  margin: 6px 0 0;
  color: var(--error);
  font-size: 13px;
}

/* ---------- Surfaces ---------- */

.panel,
.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card {
  margin: 0;
  padding: 14px 16px 12px;
  min-width: 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 8px;
}

.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.key {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2.5px solid;
  margin-left: 6px;
}

.key:first-child {
  margin-left: 0;
}

.key.exact {
  border-color: var(--exact);
}

.key.trotter {
  border-top-style: dashed;
  border-color: var(--trotter);
}

.key.block {
  height: 10px;
  width: 12px;
  border: 0;
  border-radius: 2px;
  background: var(--exact);
}

.key.block.positive {
  background: var(--amp-pos);
}

.key.block.negative {
  background: var(--amp-neg);
}

.key.outline {
  height: 10px;
  width: 12px;
  border: 2px solid var(--trotter);
  border-radius: 2px;
}

.key.outline.marked {
  border-color: var(--marked);
}

.key.dashed {
  border-top: 2px dashed var(--text);
}

.chart {
  display: block;
  width: 100%;
  height: 220px;
}

.chart.tall {
  height: 260px;
}

.chart.xl {
  height: 360px;
}

.chart.square {
  height: 320px;
}

.chart.clickable {
  cursor: pointer;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------- Landing page ---------- */

.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, var(--star), transparent),
    radial-gradient(1px 1px at 28% 68%, var(--star), transparent),
    radial-gradient(1.5px 1.5px at 44% 14%, var(--star), transparent),
    radial-gradient(1px 1px at 58% 82%, var(--star), transparent),
    radial-gradient(1px 1px at 72% 34%, var(--star), transparent),
    radial-gradient(1.5px 1.5px at 86% 58%, var(--star), transparent),
    radial-gradient(1px 1px at 94% 12%, var(--star), transparent),
    radial-gradient(1px 1px at 6% 88%, var(--star), transparent),
    radial-gradient(1px 1px at 36% 42%, var(--star), transparent),
    radial-gradient(1px 1px at 66% 8%, var(--star), transparent);
  opacity: 0.8;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 32px;
  align-items: center;
  padding-top: 64px;
  padding-bottom: 56px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-2);
}

.pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
}

.hero h1 {
  font-size: clamp(38px, 5.4vw, 64px);
  margin-top: 18px;
}

.hero .lede {
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 580px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 14px;
}

.hero-facts b {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
}

.hero-visual {
  position: relative;
  aspect-ratio: 1;
  max-width: 480px;
  width: 100%;
  justify-self: center;
}

.hero-visual canvas {
  width: 100%;
  height: 100%;
}

.hero-gate {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.hero-gate b {
  color: var(--accent-2);
}

.section {
  padding-top: 64px;
  padding-bottom: 16px;
}

.section-head {
  max-width: 720px;
  margin-bottom: 26px;
}

.section-head h2 {
  font-size: clamp(26px, 3vw, 34px);
}

.section-head p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
}

.primer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.primer-card {
  padding: 22px;
}

.primer-card .symbol {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--accent-2);
}

.primer-card h3 {
  font-size: 19px;
  margin-top: 10px;
}

.primer-card p {
  margin-top: 8px;
  color: var(--muted);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.how-card {
  padding: 22px;
}

.how-card .num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-2);
}

.how-card h3 {
  font-size: 18px;
  margin-top: 8px;
}

.how-card p {
  margin-top: 8px;
  color: var(--muted);
}

.path-section {
  margin-top: 34px;
}

.path-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.path-head .ket {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent-2);
}

.path-head h3 {
  font-size: 22px;
}

.path-head p {
  color: var(--muted);
  flex-basis: 100%;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

a.topic-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 18%, transparent);
}

.topic-card h4 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.01em;
}

.topic-card p {
  color: var(--muted);
  font-size: 14px;
  flex: 1;
}

.topic-card .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--faint);
}

.topic-card.soon {
  opacity: 0.55;
}

.topic-num {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.topic-icon {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.teacher-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(500px 240px at 0% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    var(--surface);
}

.teacher-band h2 {
  font-size: clamp(24px, 3vw, 30px);
}

.teacher-band ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.teacher-band li {
  display: flex;
  gap: 12px;
  color: var(--muted);
}

.teacher-band li b {
  color: var(--text);
}

.check {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Lesson pages ---------- */

.lesson-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-top: 28px;
  padding-bottom: 18px;
}

.lesson-head h1 {
  font-size: clamp(28px, 3.6vw, 40px);
  margin-top: 6px;
}

.lesson-head .lede {
  margin-top: 8px;
  color: var(--muted);
  max-width: 640px;
  font-size: 16px;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-body {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-bottom: 24px;
}

.guide {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - var(--nav-h) - 32px);
}

.guide-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px;
}

.progress-track {
  height: 4px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 4px;
  transition: width 0.35s ease;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.step {
  border-left: 2px solid var(--border);
  padding: 0 0 4px 16px;
  margin-left: 11px;
  position: relative;
}

.step:last-child {
  padding-bottom: 0;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 14px var(--font-sans);
  padding: 6px 0;
  cursor: pointer;
}

.step-num {
  position: absolute;
  left: -13px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid var(--border-strong);
  font: 600 11px var(--mono);
  color: var(--muted);
}

.step.done .step-num {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.step.current {
  border-left-color: var(--accent);
}

.step.current .step-num {
  background: var(--grad);
  border-color: transparent;
  color: var(--accent-text);
}

.step.current .step-head {
  color: var(--text);
  font-weight: 600;
  font-size: 15.5px;
}

.step-text {
  display: none;
  padding: 2px 0 12px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

.step.current .step-text {
  display: block;
}

.step-text p + p {
  margin-top: 9px;
}

.step-text .warn,
.warn {
  color: var(--marked);
}

.guide-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

.guide-nav .count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
  margin-right: auto;
}

.try-card {
  padding: 16px 18px;
}

.try-card h2 {
  font-size: 14px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.stage {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.stage-caption {
  display: none;
}

.next-lesson {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 32px;
}

.next-lesson a {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.next-lesson a:hover {
  border-color: var(--accent);
}

.next-lesson span {
  font-size: 12.5px;
  color: var(--muted);
}

.next-lesson b {
  font-family: var(--font-display);
  font-size: 18px;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.measure-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.measure-box p {
  flex: 1 1 200px;
  font-size: 14px;
  min-height: 1.5em;
}

.hit {
  color: var(--marked);
  font-weight: 600;
}

/* Present mode: the visual fills the screen, the current step becomes a large caption. */

.present-exit {
  display: none;
}

body.present .site-nav,
body.present .lesson-head,
body.present .guide,
body.present .next-lesson,
body.present .site-footer,
body.present .no-present {
  display: none !important;
}

body.present .lesson-body {
  display: block;
  max-width: none;
  padding-top: 16px;
}

body.present .stage {
  gap: 18px;
}

body.present .stage-caption {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 20px 24px;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.5;
}

body.present .stage-caption h2 {
  font-size: clamp(22px, 2.2vw, 32px);
  margin-bottom: 6px;
}

body.present .stage-caption .caption-text p + p {
  margin-top: 6px;
}

body.present .stage-caption .caption-nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex: none;
}

body.present .card-head h2 {
  font-size: 18px;
}

body.present .chart.xl {
  height: 46vh;
}

body.present .present-exit {
  display: inline-flex;
  position: fixed;
  bottom: 16px;
  right: 18px;
  z-index: 30;
  box-shadow: var(--shadow);
}

/* ---------- Circuit diagram (SVG) ---------- */

.circuit-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.circuit {
  display: block;
  font: 13px var(--font-sans);
}

.circuit .wire {
  stroke: var(--axis);
  stroke-width: 1.5;
}

.circuit .cwire {
  stroke: var(--faint);
  stroke-width: 1.2;
}

.circuit .wire-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.circuit .group-label {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: middle;
}

.circuit .col {
  cursor: pointer;
  outline: none;
}

.circuit .col rect {
  fill: var(--surface-solid);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.circuit .col.oracle rect {
  stroke: var(--marked);
}

.circuit .col.todo {
  opacity: 0.35;
}

.circuit .col.current rect {
  fill: var(--accent);
}

.circuit .col.current.oracle rect {
  fill: var(--marked);
}

.circuit .col:hover rect,
.circuit .col:focus-visible rect {
  stroke-width: 3;
}

.circuit .block-label {
  fill: var(--text);
  text-anchor: middle;
  font-weight: 600;
}

.circuit .col.current .block-label {
  fill: var(--accent-text);
}

.circuit .meter {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
}

.circuit .cursor {
  stroke: var(--accent-2);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.circuit .step-band {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: color-mix(in srgb, var(--accent) 35%, transparent);
  stroke-dasharray: 4 4;
}

.circuit .op {
  cursor: pointer;
  outline: none;
}

.circuit .op.todo {
  opacity: 0.3;
}

.circuit .op .gate {
  fill: var(--surface-solid);
  stroke: var(--accent);
  stroke-width: 1.6;
}

.circuit .op .gate.block {
  stroke: var(--marked);
}

.circuit .op.current .gate {
  fill: var(--accent);
  stroke: var(--accent-strong);
}

.circuit .op.current .gate.block {
  fill: var(--marked);
}

.circuit .op:hover .gate,
.circuit .op:focus-visible .gate {
  stroke-width: 3;
}

.circuit .gate-label {
  fill: var(--text);
  font: 600 14px var(--font-sans);
  text-anchor: middle;
}

.circuit .gate-label.small {
  font-size: 11px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.circuit .op.current .gate-label,
.circuit .op.current .gate-sub {
  fill: var(--accent-text);
}

.circuit .gate-sub {
  fill: var(--muted);
  font: 10px var(--mono);
  text-anchor: middle;
}

/* sits above the gate box, so it keeps its colour when the gate is the current step */
.circuit .gate-sub.cond,
.circuit .op.current .gate-sub.cond {
  fill: var(--marked);
}

.circuit .op.conditional .gate {
  stroke-dasharray: 4 3;
}

.circuit .link,
.circuit .target-plus {
  stroke: var(--text);
  stroke-width: 1.8;
  fill: none;
}

.circuit .ctrl {
  fill: var(--text);
}

.circuit .target {
  fill: var(--surface-solid);
  stroke: var(--text);
  stroke-width: 1.8;
}

.circuit .op.current .ctrl,
.circuit .op.current .link,
.circuit .op.current .target,
.circuit .op.current .target-plus {
  stroke: var(--accent-2);
}

.circuit .op.current .ctrl {
  fill: var(--accent-2);
}

/* State views for circuit lessons */

.state-formula {
  font-family: var(--mono);
  font-size: 17px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
}

.state-formula .label {
  display: inline;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--muted);
  margin-right: 10px;
}

.phase-wheel {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.bloch-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 300px));
  justify-content: center;
  gap: 10px;
}

.bloch-row canvas {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
}

.bloch-hero {
  width: 100%;
  aspect-ratio: 1;
  max-height: 520px;
}

.bits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.bit-chip {
  font-family: var(--mono);
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
}

.bit-chip b {
  color: var(--accent-2);
}

.sampler-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sampler-controls .readout {
  margin-left: auto;
  font-size: 13.5px;
  color: var(--muted);
}

.sampler-controls .readout b {
  color: var(--text);
  font-family: var(--mono);
}

.param-group + .param-group {
  margin-top: 14px;
}

.gate-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.gate-palette button {
  font: 600 14px var(--font-sans);
  padding: 9px 0;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.gate-palette button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.amp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.amp-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.amp-table td:first-child {
  font-family: var(--mono);
}

.prob-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  min-width: 80px;
}

.prob-bar span {
  display: block;
  height: 100%;
  background: var(--grad);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.bit-toggles {
  display: flex;
  gap: 6px;
}

.bit-toggles button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font: 600 18px var(--mono);
  cursor: pointer;
}

.bit-toggles button[aria-pressed='true'] {
  background: var(--grad);
  color: var(--accent-text);
  border-color: transparent;
}

.fn-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}

.fn-cell {
  padding: 8px 6px;
  border-radius: 9px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
}

.fn-cell b {
  display: block;
  font-size: 18px;
  margin-top: 2px;
}

.fn-cell.one {
  border-color: color-mix(in srgb, var(--amp-neg) 60%, transparent);
  background: color-mix(in srgb, var(--amp-neg) 14%, transparent);
}

.verdict {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 15px;
}

.verdict.good {
  border-color: color-mix(in srgb, var(--accent-2) 60%, transparent);
}

.verdict.bad {
  border-color: color-mix(in srgb, var(--marked) 60%, transparent);
}

.post-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 14.5px;
}

.post-steps code {
  color: var(--accent-2);
}

/* Circuit sandbox */

.sb-layout {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-bottom: 24px;
}

.sb-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
}

.sb-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.sb-tool {
  position: relative;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 600 14px var(--font-sans);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.sb-tool:hover {
  border-color: var(--accent);
}

.sb-tool[aria-pressed='true'] {
  background: var(--grad);
  color: var(--accent-text);
  border-color: transparent;
}

.sb-tool small {
  display: block;
  font: 500 9.5px var(--mono);
  opacity: 0.8;
}

.sb-presets {
  display: grid;
  gap: 6px;
}

.sb-presets button {
  text-align: left;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: 500 13.5px var(--font-sans);
  cursor: pointer;
}

.sb-presets button:hover {
  border-color: var(--accent);
}

.sb-qubits {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sb-qubits button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.sb-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.sb-grid {
  display: grid;
  position: relative;
  width: max-content;
}

.sb-colhead {
  height: 26px;
  border: 0;
  background: none;
  color: var(--faint);
  font: 11px var(--mono);
  cursor: pointer;
  border-radius: 6px;
}

.sb-colhead:hover,
.sb-colhead.cursor {
  color: var(--accent-2);
  background: var(--surface-2);
}

.sb-rowlabel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-right: 8px;
  font: 12px var(--mono);
  color: var(--muted);
}

.sb-cell {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 1;
}

.sb-cell::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1.5px solid var(--axis);
}

.sb-cell:hover::after,
.sb-cell.drop::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 9px;
  border: 1.5px dashed var(--accent);
}

.sb-cell:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: -4px;
  border-radius: 10px;
}

.sb-cell.future {
  opacity: 0.35;
}

.sb-cell.selected .sb-gate,
.sb-cell.selected .sb-dot,
.sb-cell.selected .sb-swap {
  box-shadow: 0 0 0 3px var(--accent-2);
}

.sb-gate {
  position: absolute;
  inset: 9px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 8px;
  background: var(--surface-solid);
  border: 1.6px solid var(--accent);
  color: var(--text);
  font: 600 14px var(--font-sans);
  line-height: 1.05;
  z-index: 2;
}

.sb-gate small {
  font: 500 9.5px var(--mono);
  color: var(--muted);
}

.sb-gate.measure {
  border-color: var(--marked);
}

.sb-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--text);
  z-index: 2;
}

.sb-oplus {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 1.8px solid var(--text);
  background:
    linear-gradient(var(--text), var(--text)) center / 1.8px 100% no-repeat,
    linear-gradient(var(--text), var(--text)) center / 100% 1.8px no-repeat,
    var(--surface-solid);
  z-index: 2;
}

.sb-cell.selected .sb-oplus {
  box-shadow: 0 0 0 3px var(--accent-2);
}

.sb-swap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 22px var(--font-sans);
  color: var(--text);
  z-index: 2;
}

.sb-link {
  position: relative;
  pointer-events: none;
  z-index: 1;
}

.sb-link::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 27px;
  bottom: 27px;
  border-left: 1.8px solid var(--text);
}

.sb-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--grad);
  color: var(--accent-text);
  font: 600 14px var(--font-sans);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.sb-warn {
  color: var(--marked);
  font-size: 13px;
  margin-top: 6px;
}

@media (max-width: 1080px) {
  .sb-layout {
    grid-template-columns: 1fr;
  }

  .sb-side {
    position: static;
  }
}

/* BB84 photon table */

.table-scroll {
  overflow-x: auto;
}

.bb84-table {
  border-collapse: separate;
  border-spacing: 3px;
  font-family: var(--mono);
  font-size: 14px;
}

.bb84-table th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface-solid);
  text-align: left;
  font: 600 12.5px var(--font-sans);
  color: var(--muted);
  padding: 4px 12px 4px 2px;
  white-space: nowrap;
}

.bb84-table td {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 30px;
  text-align: center;
  border-radius: 7px;
  background: var(--surface-2);
  white-space: nowrap;
}

.bb84-table td.badbit {
  font-size: 11px;
}

.bb84-table tr.head td {
  background: none;
  color: var(--faint);
  font-size: 11px;
}

.bb84-table td.photon {
  font-size: 17px;
  color: var(--accent-2);
}

.bb84-table td.eve,
.bb84-table td.photon.eve {
  color: var(--marked);
}

.bb84-table td.eve-miss {
  color: var(--marked);
  box-shadow: inset 0 0 0 1.5px var(--marked);
}

.bb84-table td.agree {
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent-2) 60%, transparent);
}

.bb84-table td.keybit {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 600;
}

.bb84-table td.badbit {
  background: color-mix(in srgb, var(--amp-neg) 35%, transparent);
  font-weight: 600;
}

.bb84-table td.dim {
  opacity: 0.35;
}

.key-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.key-line .label {
  width: 44px;
  margin: 0;
}

.key-bits {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.18em;
  word-break: break-all;
}

.bit-error {
  color: var(--amp-neg);
  font-weight: 700;
}

/* ---------- Hamiltonian Playground (tool layout) ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 24px 24px;
  align-items: start;
}

.controls {
  padding: 18px;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
}

.preset-desc {
  margin-top: 8px;
}

.syntax {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.syntax summary {
  cursor: pointer;
  color: var(--accent-strong);
  width: fit-content;
}

.syntax ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.syntax li {
  margin: 3px 0;
}

.stats {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  display: grid;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.viz {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.playback [data-scrub] {
  flex: 1;
  min-width: 0;
}

.playback {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  position: sticky;
  top: calc(var(--nav-h) + 12px);
  z-index: 2;
}

#play {
  min-width: 82px;
}

/* Numeric results, e.g. shooting vs matrix levels */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  text-align: right;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  text-align: right;
  font-family: var(--mono);
  padding: 5px 8px;
  border-bottom: 1px solid var(--grid);
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
  font-family: inherit;
}

.clock {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
}

.speed select,
.inline-select select,
.playback select {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
}

.colorbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.ramp {
  width: 140px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--heat-0), var(--heat-50), var(--heat-100));
  border: 1px solid var(--border);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 13.5px;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  justify-content: space-between;
}

.footer-grid p {
  max-width: 620px;
}

.footer-links {
  display: flex;
  gap: 18px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .hero-grid,
  .teacher-band {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    max-width: 380px;
  }

  .lesson-body,
  .layout {
    grid-template-columns: 1fr;
  }

  .guide,
  .controls {
    position: static;
    max-height: none;
  }

  /* On one column: the explanation, then the visual it describes, then the controls. */
  .lesson-body .guide {
    display: contents;
  }

  .lesson-body .guide-card {
    order: 1;
  }

  .lesson-body .stage {
    order: 2;
  }

  .lesson-body #try-slot,
  .lesson-body .guide > .try-card {
    order: 3;
  }

  .steps {
    max-height: 340px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .mega-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .primer,
  .how-grid {
    grid-template-columns: 1fr;
  }

  .nav-links a {
    display: none;
  }
}

@media (max-width: 520px) {
  .container,
  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-name,
  .theme-switch span {
    display: none;
  }

  .theme-switch button {
    padding: 7px 9px;
  }

  .mega-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    padding-top: 36px;
  }

  .teacher-band {
    padding: 22px;
  }

  .playback {
    flex-wrap: wrap;
  }

  #scrub {
    order: 3;
    flex-basis: 100%;
  }

  .keys {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .button,
  .topic-card,
  .progress-fill {
    transition: none;
  }

  a.topic-card:hover,
  .btn-primary:hover {
    transform: none;
  }
}

/* CHSH game: the last round */
.chsh-round {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}

.chsh-player {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.chsh-player h3 {
  font-size: 15px;
}

.chsh-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.chsh-chip b {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--text);
}

.chsh-chip.answer b {
  color: var(--accent-2);
}

.chsh-mid {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.chsh-rule {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.chsh-verdict {
  font-weight: 700;
  font-size: 18px;
  padding: 4px 14px;
  border-radius: 999px;
}

.chsh-verdict.win {
  color: #05060d;
  background: var(--amp-pos);
}

.chsh-verdict.lose {
  color: #05060d;
  background: var(--amp-neg);
}

@media (max-width: 560px) {
  .chsh-round {
    grid-template-columns: 1fr;
  }
}
