/* ═══════════════════════════════════════════════════════════════
   HUMANITY — The Continuance
   Design system, scene engine styles, chapter layouts
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #04060c;
  --bg-2: #0a0f1c;
  --ink: #e9edf5;
  --ink-2: rgba(233, 237, 245, 0.64);
  --ink-3: rgba(233, 237, 245, 0.4);
  --ink-4: rgba(233, 237, 245, 0.18);
  --line: rgba(233, 237, 245, 0.1);
  --line-2: rgba(233, 237, 245, 0.2);
  --glass: rgba(8, 12, 22, 0.58);
  --glass-2: rgba(8, 12, 22, 0.78);

  --cyan: #86e6ff;
  --cyan-2: #2fb3d3;
  --cyan-rgb: 134, 230, 255;
  --gold: #f3cd93;
  --gold-2: #e39a44;
  --gold-rgb: 243, 205, 147;
  --violet: #ab9dff;
  --violet-rgb: 171, 157, 255;
  --rose: #ff7d8c;
  --rose-rgb: 255, 125, 140;
  --green: #9ef0c0;

  --font-display: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-body: 'Manrope', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pad-x: clamp(20px, 5vw, 72px);
  --pad-top: clamp(84px, 11vh, 132px);
  --pad-bot: clamp(56px, 9vh, 104px);
  --radius: 16px;
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body { overscroll-behavior: none; }

::selection { background: rgba(var(--cyan-rgb), 0.25); color: #fff; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 300; }
strong { font-weight: 500; }
canvas { display: block; }

/* ───────────────────────── Backgrounds ───────────────────────── */

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.nebula {
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s ease;
  filter: blur(60px) saturate(1.1);
  animation: nebula-drift 90s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
.nebula--deep {
  background:
    radial-gradient(40% 35% at 25% 30%, rgba(30, 60, 120, 0.42), transparent 70%),
    radial-gradient(35% 40% at 75% 65%, rgba(70, 40, 120, 0.30), transparent 70%),
    radial-gradient(30% 30% at 60% 20%, rgba(20, 90, 110, 0.22), transparent 70%);
}
.nebula--warm {
  background:
    radial-gradient(40% 35% at 30% 65%, rgba(160, 90, 30, 0.30), transparent 70%),
    radial-gradient(35% 40% at 70% 30%, rgba(120, 50, 60, 0.26), transparent 70%),
    radial-gradient(30% 30% at 50% 80%, rgba(180, 130, 40, 0.16), transparent 70%);
  animation-delay: -20s;
}
.nebula--cyan {
  background:
    radial-gradient(45% 40% at 70% 40%, rgba(20, 110, 140, 0.34), transparent 70%),
    radial-gradient(35% 40% at 25% 70%, rgba(30, 60, 130, 0.30), transparent 70%),
    radial-gradient(25% 25% at 50% 15%, rgba(80, 200, 220, 0.12), transparent 70%);
  animation-delay: -40s;
}
.nebula--violet {
  background:
    radial-gradient(45% 40% at 40% 40%, rgba(90, 50, 160, 0.34), transparent 70%),
    radial-gradient(35% 40% at 75% 70%, rgba(40, 30, 110, 0.36), transparent 70%),
    radial-gradient(25% 25% at 20% 80%, rgba(180, 80, 140, 0.14), transparent 70%);
  animation-delay: -60s;
}
body[data-tint="deep"] .nebula--deep,
body[data-tint="warm"] .nebula--warm,
body[data-tint="cyan"] .nebula--cyan,
body[data-tint="violet"] .nebula--violet { opacity: 1; }

@keyframes nebula-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.02); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 50%, rgba(2, 4, 10, 0.75) 100%);
}

/* ───────────────────────── Typography ───────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
}
.eyebrow--dim { color: var(--ink-3); letter-spacing: 0.22em; }

.title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(64px, 12vw, 168px);
  line-height: 0.95;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.15em 0 0.2em;
  background: linear-gradient(180deg, #ffffff 0%, #dfe6f5 55%, rgba(200, 215, 240, 0.6) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(134, 230, 255, 0.15);
}

.h2 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(34px, 4.6vw, 62px);
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: #fff;
  text-wrap: balance;
}
.h2--accent {
  font-size: clamp(48px, 8vw, 112px);
  font-style: italic;
  margin: 0.25em 0 0.2em;
  background: linear-gradient(90deg, var(--gold), #fff 50%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(21px, 2.1vw, 29px);
  line-height: 1.38;
  color: #fff;
  text-wrap: balance;
}
.lead em { font-style: normal; color: var(--gold); }
.lead--sm { font-size: clamp(18px, 1.5vw, 22px); color: rgba(255, 255, 255, 0.86); }
.lead--center { text-align: center; }
.lead--em { color: var(--cyan); }

.body {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(14.5px, 1.05vw, 16.5px);
  line-height: 1.68;
  color: var(--ink-2);
  max-width: 54ch;
  text-wrap: pretty;
}
.body--center { text-align: center; margin-inline: auto; }

.note {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  animation: hint-pulse 3s ease-in-out infinite;
}
@keyframes hint-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ───────────────────────── HUD ───────────────────────── */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad-x);
  pointer-events: none;
  mix-blend-mode: normal;
}
.hud > * { pointer-events: auto; }

.hud__brand {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.3s, text-shadow 0.3s;
}
.hud__brand:hover { color: #fff; text-shadow: 0 0 24px rgba(var(--cyan-rgb), 0.6); }

.hud__chapter {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
}
.hud__act {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hud__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.8);
  transition: opacity 0.5s;
}

.hud__actions { display: flex; gap: 10px; }

.hud__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.hud__btn:hover { border-color: rgba(var(--cyan-rgb), 0.6); color: #fff; box-shadow: 0 0 24px rgba(var(--cyan-rgb), 0.15); }

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; transition: height 0.3s; }
.hud__btn[aria-pressed="true"] .eq i { animation: eq-bounce 0.9s ease-in-out infinite; }
.hud__btn[aria-pressed="true"] .eq i:nth-child(2) { animation-delay: -0.2s; }
.hud__btn[aria-pressed="true"] .eq i:nth-child(3) { animation-delay: -0.5s; }
.hud__btn[aria-pressed="true"] .eq i:nth-child(4) { animation-delay: -0.7s; }
.hud__btn[aria-pressed="true"] { color: var(--cyan); border-color: rgba(var(--cyan-rgb), 0.4); }
@keyframes eq-bounce { 0%, 100% { height: 3px; } 50% { height: 12px; } }

.burger { display: inline-flex; flex-direction: column; gap: 4px; }
.burger i { width: 16px; height: 1px; background: currentColor; transition: transform 0.4s var(--ease); }
body.menu-open .burger i:first-child { transform: translateY(2.5px) rotate(45deg); }
body.menu-open .burger i:last-child { transform: translateY(-2.5px) rotate(-45deg); }

/* ───────────────────────── Dots ───────────────────────── */

.dots {
  position: fixed;
  right: clamp(14px, 2.2vw, 30px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dot {
  position: relative;
  width: 22px;
  height: 14px;
  display: grid;
  place-items: center;
}
.dot::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-4);
  transition: transform 0.4s var(--ease), background 0.4s, box-shadow 0.4s;
}
.dot--act-start { margin-top: 10px; }
.dot:hover::before { background: var(--ink-2); transform: scale(1.5); }
.dot.is-active::before { background: #fff; transform: scale(1.8); box-shadow: 0 0 12px rgba(255, 255, 255, 0.8); }
.dot__label {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.dot:hover .dot__label { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ───────────────────────── Scroll hint ───────────────────────── */

.scroll-hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.8s;
  pointer-events: none;
}
.scroll-hint.is-visible { opacity: 1; }
.scroll-hint i {
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  background-size: 100% 200%;
  animation: hint-line 2.2s linear infinite;
}
@keyframes hint-line { 0% { background-position: 0 -36px; } 100% { background-position: 0 36px; } }

/* ───────────────────────── Menu ───────────────────────── */

.menu {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(4, 6, 12, 0.86);
  backdrop-filter: blur(30px) saturate(1.2);
  -webkit-backdrop-filter: blur(30px) saturate(1.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s;
  overflow-y: auto;
}
body.menu-open .menu { opacity: 1; visibility: visible; transition-delay: 0s; }
.menu__inner {
  min-height: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--pad-top) var(--pad-x) var(--pad-bot);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.menu__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1;
}
.menu__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px 40px;
}
.menu__act { display: flex; flex-direction: column; gap: 6px; }
.menu__act-name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.menu__item {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-2);
  text-align: left;
  transition: color 0.3s, padding-left 0.4s var(--ease);
  opacity: 0;
  transform: translateY(10px);
}
body.menu-open .menu__item { opacity: 1; transform: none; transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), color 0.3s, padding-left 0.4s var(--ease); transition-delay: calc(var(--i, 0) * 40ms); }
.menu__item:hover, .menu__item.is-active { color: #fff; padding-left: 8px; }
.menu__item i { font-family: var(--font-mono); font-style: normal; font-size: 10px; letter-spacing: 0.2em; color: var(--ink-3); min-width: 20px; }
.menu__foot { margin-top: auto; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; padding-top: 24px; }

/* ───────────────────────── Cursor ───────────────────────── */

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s, width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease), border-color 0.25s, background 0.25s;
  will-change: transform;
}
.cursor.is-on { opacity: 1; }
.cursor.is-hover {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-color: rgba(var(--cyan-rgb), 0.8);
  background: rgba(var(--cyan-rgb), 0.08);
}
.cursor.is-down { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ───────────────────────── Scenes ───────────────────────── */

#deck { position: relative; z-index: 2; }

.scene {
  position: fixed;
  inset: 0;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.025);
  filter: blur(10px);
  transition: opacity 1s var(--ease), transform 1.1s var(--ease), filter 1s var(--ease), visibility 0s linear 1.05s;
}
.scene.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  filter: none;
  z-index: 3;
  transition-delay: 0s;
}
.scene.is-leaving {
  opacity: 0;
  transform: scale(0.985);
  filter: blur(10px);
  z-index: 2;
  visibility: visible;
  transition: opacity 0.75s var(--ease), transform 0.9s var(--ease), filter 0.75s var(--ease), visibility 0s linear 0.9s;
}

[data-reveal] { opacity: 0; }
.scene.is-active [data-reveal] {
  animation: rise 1.15s var(--ease) both;
  animation-delay: var(--d, 0s);
}
.scene.is-leaving [data-reveal] { opacity: 1; animation: none; }
@keyframes rise {
  0% { opacity: 0; transform: translateY(26px); filter: blur(8px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}

.scene__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.scene__canvas--interactive { cursor: crosshair; }

.scene__inner {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--pad-top) var(--pad-x) var(--pad-bot);
  display: grid;
  align-items: start;
  align-items: safe center;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.scene__inner::-webkit-scrollbar { display: none; }
.scene__inner--pass { pointer-events: none; }
.scene__inner--pass > * { pointer-events: auto; }

.scene--center .scene__inner { justify-items: center; text-align: center; }
.scene--center .body { margin-inline: auto; }

.scene--split .scene__inner {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 4.5vw, 80px);
}
.scene__text { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.scene__text .h2 { margin-bottom: 4px; }
.scene__visual { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.scene--overlay .scene__inner { grid-template-columns: minmax(0, 480px) 1fr; align-items: start; }
.scene__text--glass {
  padding: 26px 28px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.scene--stack .scene__inner { grid-template-rows: auto minmax(auto, 1fr) auto; gap: 20px; align-items: start; }
.scene--stack .scene__inner > .panel { align-self: stretch; }
.scene--stack .scene__inner > .tree { align-self: start; }
.stack__head { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.stack__head--center { align-items: center; text-align: center; margin-inline: auto; }
.stack__head .body { max-width: 72ch; }
.stack__foot { max-width: 92ch; }

/* ───────────────────────── Components ───────────────────────── */

.panel {
  position: relative;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.panel::before, .panel::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: rgba(var(--cyan-rgb), 0.35);
  border-style: solid;
  pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; border-top-left-radius: 4px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; border-bottom-right-radius: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  padding: 0 30px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink);
  transition: transform 0.4s var(--ease-out), border-color 0.3s, box-shadow 0.3s, background 0.3s, color 0.3s, opacity 0.3s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(var(--cyan-rgb), 0.7); box-shadow: 0 0 30px rgba(var(--cyan-rgb), 0.18); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn--primary { background: #fff; color: #05070d; border-color: #fff; }
.btn--primary:hover { background: #fff; box-shadow: 0 0 40px rgba(255, 255, 255, 0.35); }
.btn--ghost { background: transparent; }
.btn--sm { height: 40px; padding: 0 20px; font-size: 10.5px; }
.btn[disabled] { opacity: 0.35; pointer-events: none; }

.actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, rgba(var(--cyan-rgb), 0.9) 0, rgba(var(--cyan-rgb), 0.9) var(--fill, 0%), var(--line-2) var(--fill, 0%), var(--line-2) 100%);
  border-radius: 2px;
}
.range::-moz-range-track { height: 2px; background: var(--line-2); border-radius: 2px; }
.range::-moz-range-progress { height: 2px; background: rgba(var(--cyan-rgb), 0.9); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 18px rgba(var(--cyan-rgb), 0.8);
  transition: transform 0.2s var(--ease);
}
.range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 18px rgba(var(--cyan-rgb), 0.8);
}
.range:hover::-webkit-slider-thumb, .range:active::-webkit-slider-thumb { transform: scale(1.25); }
.range__ticks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--ink-3); margin-top: -4px; }

.meter { position: relative; height: 3px; width: 100%; background: var(--line); border-radius: 2px; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--cyan-2), var(--cyan)); border-radius: 2px; transition: width 0.3s; }

.badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(var(--gold-rgb), 0.35);
  color: var(--gold);
  background: rgba(var(--gold-rgb), 0.06);
}

/* ───────────────────────── Title ───────────────────────── */

.title-block { display: flex; flex-direction: column; align-items: center; gap: 22px; max-width: 900px; }
.title-block .note { max-width: 60ch; text-align: center; }

.orb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(70vw, 70vh);
  height: min(70vw, 70vh);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.orb__core {
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, rgba(255, 255, 255, 0.16), rgba(var(--cyan-rgb), 0.12) 40%, rgba(var(--violet-rgb), 0.06) 65%, transparent 72%);
  filter: blur(6px);
  animation: orb-breathe 9s ease-in-out infinite;
}
.orb__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  animation: orb-spin 60s linear infinite;
}
.orb__ring::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px 2px rgba(var(--cyan-rgb), 0.9);
}
.orb__ring--2 { inset: 12%; animation-duration: 42s; animation-direction: reverse; border-color: rgba(var(--cyan-rgb), 0.12); }
.orb__ring--2::before { background: var(--gold); box-shadow: 0 0 14px 2px rgba(var(--gold-rgb), 0.9); }
.orb__ring--3 { inset: -14%; animation-duration: 90s; border-color: rgba(255, 255, 255, 0.05); border-style: dashed; }
.orb__ring--3::before { display: none; }
@keyframes orb-breathe { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.1); opacity: 1; } }
@keyframes orb-spin { to { transform: rotate(360deg); } }

/* ───────────────────────── You Were Made ───────────────────────── */

.narration { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 820px; }
.narration .lead { font-size: clamp(22px, 2.4vw, 32px); }
.scene--made .scene__canvas { opacity: 0.9; }

/* ───────────────────────── The Laws ───────────────────────── */

.law { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.law__head { display: flex; align-items: baseline; gap: 14px; }
.law__num { font-family: var(--font-display); font-size: 44px; line-height: 1; color: var(--gold); }
.law__name { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-2); }
.law.is-switching .law__head, .law.is-switching .lead, .law.is-switching .body, .law.is-switching .note { animation: rise 0.7s var(--ease) both; }
.law.is-switching .lead { animation-delay: 0.08s; }
.law.is-switching .body { animation-delay: 0.16s; }
.law.is-switching .note { animation-delay: 0.24s; }

.glyph-frame { aspect-ratio: 16 / 10; overflow: hidden; }
.glyph-frame canvas { width: 100%; height: 100%; }

.law-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.law-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 22, 0.35);
  text-align: left;
  transition: border-color 0.3s, background 0.3s, transform 0.3s var(--ease);
}
.law-tab i { font-family: var(--font-display); font-style: normal; font-size: 22px; line-height: 1; color: var(--ink-2); transition: color 0.3s; }
.law-tab span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.law-tab:hover { border-color: var(--line-2); transform: translateY(-2px); }
.law-tab.is-active { border-color: rgba(var(--gold-rgb), 0.5); background: rgba(var(--gold-rgb), 0.07); }
.law-tab.is-active i { color: var(--gold); }
.law-tab.is-active span { color: var(--ink-2); }

/* ───────────────────────── The Journey ───────────────────────── */

.journey-frame { aspect-ratio: 16 / 11; overflow: hidden; display: flex; flex-direction: column; }
.journey-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.journey-caption {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(4, 6, 12, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.journey-caption .body { font-size: 13.5px; max-width: none; }
.journey-launch { position: absolute; top: 18px; right: 18px; }

.dose { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.dose__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dose__years { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); letter-spacing: 0.04em; }
.dose__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dose__grid > div { display: flex; flex-direction: column; gap: 4px; }
.dose__grid strong { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: #fff; }
#dose-verdict[data-level="0"] { color: var(--green); }
#dose-verdict[data-level="1"] { color: var(--gold); }
#dose-verdict[data-level="2"] { color: #ffb070; }
#dose-verdict[data-level="3"] { color: var(--rose); }
.dose__bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.dose__bar i { display: block; height: 100%; width: 10%; border-radius: 2px; background: linear-gradient(90deg, var(--green), var(--gold) 45%, var(--rose)); transition: width 0.25s; }

/* ───────────────────────── The Vent ───────────────────────── */

.vent-hud {
  position: absolute;
  right: var(--pad-x);
  bottom: var(--pad-bot);
  z-index: 2;
  display: flex;
  align-items: flex-end;
  gap: 28px;
}
.vent-hud > div { display: flex; flex-direction: column; gap: 4px; }
.vent-hud strong { font-family: var(--font-mono); font-size: 22px; font-weight: 400; color: #fff; }
.vent-hud .hint { margin-bottom: 4px; }

/* ───────────────────────── The Plan ───────────────────────── */

.plan { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 1fr auto; clip-path: inset(-1px round var(--radius)); }
.plan__toolkit { grid-row: 1 / span 2; display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 14px 0; }
.tool {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 12px;
  align-items: center;
  padding: 10px 18px;
  transition: background 0.4s;
}
.tool + .tool { border-top: 1px solid var(--line); }
.tool__icon { grid-row: 1 / span 2; width: 44px; height: 44px; }
.tool__icon svg { width: 100%; height: 100%; overflow: visible; }
.tool__icon path, .tool__icon circle, .tool__icon line, .tool__icon polyline { fill: none; stroke: var(--ink-3); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.6s, filter 0.6s; }
.tool__name { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); transition: color 0.4s; }
.tool__state { font-family: var(--font-body); font-size: 12px; color: var(--ink-3); transition: color 0.4s; }
.tool.is-dormant .tool__icon { animation: tool-pulse 3s ease-in-out infinite; }
.tool.is-on { background: rgba(var(--gold-rgb), 0.06); }
.tool.is-on .tool__icon path, .tool.is-on .tool__icon circle, .tool.is-on .tool__icon line, .tool.is-on .tool__icon polyline { stroke: var(--gold); filter: drop-shadow(0 0 6px rgba(var(--gold-rgb), 0.8)); }
.tool.is-on .tool__name { color: #fff; }
.tool.is-on .tool__state { color: var(--gold); }
@keyframes tool-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.plan__stage { position: relative; min-height: 260px; }
.plan__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan__readout { position: absolute; left: 24px; top: 20px; right: 24px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.plan__time { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--cyan); }
.plan__readout .lead { max-width: 30ch; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }

.plan__timeline { padding: 8px 24px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.plan__marks { position: relative; height: 40px; }
.plan__mark {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.3s;
}
.plan__mark::after { content: ''; width: 1px; height: 22px; background: var(--ink-4); }
.plan__mark--alt::after { height: 8px; }
.plan__mark--first { transform: translateX(0); align-items: flex-start; }
.plan__mark--last { transform: translateX(-100%); align-items: flex-end; }
.plan__mark:hover, .plan__mark.is-past { color: var(--ink-2); }
.plan__mark.is-past::after { background: var(--cyan); }
.plan__foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.plan__o2 { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; max-width: 420px; }
.plan__o2 .meter { flex: 1; }
.plan__o2 .meter i { background: linear-gradient(90deg, var(--gold-2), var(--cyan)); }

/* ───────────────────────── The Signature ───────────────────────── */

.codon { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.codon__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.codon__legend { display: inline-flex; align-items: center; gap: 6px 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-3); }
.codon__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.codon__swatch--hydro { background: #e6a15c; }
.codon__swatch--polar { background: #5fc9e8; }
.codon__swatch--stop { background: #2a2f3d; border: 1px solid var(--line-2); }
.codon__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  aspect-ratio: 1;
  max-height: 44vh;
  margin-inline: auto;
  width: 100%;
  max-width: 44vh;
}
.codon__cell {
  position: relative;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: clamp(7px, 0.75vw, 10px);
  letter-spacing: 0.04em;
  color: rgba(0, 0, 0, 0.6);
  background: var(--cell, #555);
  transition: background 0.5s, transform 0.3s var(--ease), box-shadow 0.3s;
  cursor: default;
  user-select: none;
}
.codon__cell.is-stop { color: var(--ink-3); border: 1px solid var(--line-2); background: #151925; }
.codon__cell:hover { transform: scale(1.12); z-index: 2; box-shadow: 0 0 18px rgba(255, 255, 255, 0.35); }
.codon__cell.is-flipping { animation: flip 0.55s var(--ease); }
.codon__block { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; }
@keyframes flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.codon__tip { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); min-height: 18px; text-align: center; }
.codon__tip b { color: #fff; font-weight: 500; }
.codon__controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.codon__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.codon__stats > div { display: flex; flex-direction: column; gap: 3px; }
.codon__stats strong { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: #fff; }
.codon__hist { width: 100%; height: 64px; }

/* ───────────────────────── The Reader ───────────────────────── */

.reader__after { opacity: 0; transform: translateY(10px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); color: var(--cyan); }
.reader__after.is-on { opacity: 1; transform: none; }
.reader-hud {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 2 * var(--pad-x)));
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 22px 12px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.reader-hud__row { display: flex; justify-content: space-between; align-items: baseline; }
.reader-hud__state { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--cyan); }
.reader-hud__marks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-top: -6px; }
.reader-hud__mark--threshold { color: var(--gold); }
.reader-hud__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* ───────────────────────── Three Things ───────────────────────── */

.scene--ledger .scene__inner { grid-template-rows: auto auto; align-content: start; align-content: safe center; gap: 30px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; width: 100%; max-width: 1180px; perspective: 1400px; }
.card {
  position: relative;
  min-height: 300px;
  border-radius: var(--radius);
  text-align: left;
  transform-style: preserve-3d;
  transition: transform 0.9s var(--ease);
  display: block;
}
.card__index, .card__title, .card__front, .card__back { backface-visibility: hidden; }
.card__front, .card__back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card__front {
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  background-image: radial-gradient(60% 50% at 50% 30%, rgba(var(--cyan-rgb), 0.08), transparent 70%);
}
.card__index { position: absolute; top: 22px; left: 22px; z-index: 2; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--ink-3); }
.card__title { position: absolute; top: 44px; left: 22px; right: 22px; z-index: 2; font-family: var(--font-display); font-size: 30px; line-height: 1; color: #fff; }
.card__back { transform: rotateY(180deg); justify-content: center; border-color: rgba(var(--cyan-rgb), 0.3); }
.card__quote { font-family: var(--font-display); font-style: italic; font-size: 24px; line-height: 1.2; color: var(--gold); }
.card__text { font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.card:hover .card__front { border-color: var(--line-2); box-shadow: 0 0 30px rgba(var(--cyan-rgb), 0.12); }
.card.is-open { transform: rotateY(180deg); }
.card.is-open .card__index, .card.is-open .card__title { opacity: 0; }
.card--dark .card__back { background: rgba(2, 3, 6, 0.9); border-color: var(--line); }
.card--dark .card__quote { color: var(--ink-3); }
.card__spectrum { display: flex; align-items: flex-end; gap: 4px; height: 44px; }
.card__spectrum i { flex: 1; background: linear-gradient(180deg, var(--cyan), rgba(var(--cyan-rgb), 0.2)); border-radius: 2px 2px 0 0; height: var(--h, 40%); transform-origin: bottom; animation: bar-grow 0.9s var(--ease) both; animation-delay: calc(var(--i) * 60ms); position: relative; }
.card__spectrum i::after { content: attr(data-el); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-family: var(--font-mono); font-size: 8px; color: var(--ink-3); }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ───────────────────────── The Launch ───────────────────────── */

.launch-hud {
  position: absolute;
  right: var(--pad-x);
  bottom: var(--pad-bot);
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 10px 26px;
  align-items: end;
}
.launch-hud__stat { display: flex; flex-direction: column; gap: 4px; }
.launch-hud__stat strong { font-family: var(--font-mono); font-size: 22px; font-weight: 400; color: #fff; font-variant-numeric: tabular-nums; }
.launch-hud__stat--lost strong { color: var(--ink-3); }
.launch-hud__stat--div strong { color: var(--gold); }
.launch-hud__stat--exc strong { color: var(--cyan); }
.launch-hud .hint { grid-column: 1 / -1; }

/* ───────────────────────── The Tree ───────────────────────── */

.tree { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); clip-path: inset(-1px round var(--radius)); }
.tree__chart { position: relative; padding: 26px 26px 20px; border-right: 1px solid var(--line); min-height: 380px; }
.tree__axis { position: absolute; left: 26px; right: 26px; bottom: 26px; height: 1px; background: var(--line-2); }
.tree__tick { position: absolute; bottom: -22px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--ink-3); white-space: nowrap; }
.tree__tick::before { content: ''; position: absolute; left: 50%; top: -10px; width: 1px; height: 6px; background: var(--ink-4); }
.tree__tick:first-child { transform: none; }
.tree__tick:first-child::before { left: 0; }
.tree__tick:last-child { transform: translateX(-100%); }
.tree__tick:last-child::before { left: auto; right: 0; }
.tree__row { position: absolute; left: 26px; right: 26px; height: 40px; }
.tree__life { position: absolute; top: 18px; height: 3px; border-radius: 2px; background: rgba(233, 237, 245, 0.12); }
.tree__life--alive::after { content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); animation: hint-pulse 2s ease-in-out infinite; }
.tree__era { position: absolute; top: 17px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(var(--cyan-rgb), 0.9), rgba(var(--cyan-rgb), 0.15)); }
.tree__era--open { background: linear-gradient(90deg, rgba(var(--cyan-rgb), 0.9), rgba(var(--cyan-rgb), 0.35)); }
.tree__node {
  position: absolute;
  top: 8px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.tree__node::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; transition: background 0.3s; }
.tree__node:hover { transform: scale(1.2); }
.tree__node.is-active { border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.6); }
.tree__node.is-active::before { background: var(--gold); }
.tree__label { position: absolute; top: -8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.tree__label small { display: block; letter-spacing: 0.06em; text-transform: none; color: var(--ink-3); font-size: 9.5px; margin-top: 2px; }
.tree__link { position: absolute; width: 1px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05)); }
.tree__legend { position: absolute; right: 26px; top: 18px; display: flex; gap: 16px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--ink-3); }
.tree__legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.tree__detail { padding: 26px 26px; display: flex; flex-direction: column; gap: 12px; }
.tree__detail .h3 { font-family: var(--font-display); font-size: 34px; line-height: 1; color: #fff; }
.tree__meta { display: flex; gap: 14px; flex-wrap: wrap; }
.tree__theme { font-family: var(--font-display); font-style: italic; font-size: 20px; color: var(--gold); }
.tree__detail.is-switching > * { animation: rise 0.6s var(--ease) both; }
.tree__detail.is-switching > *:nth-child(2) { animation-delay: 0.06s; }
.tree__detail.is-switching > *:nth-child(3) { animation-delay: 0.12s; }
.tree__detail.is-switching > *:nth-child(4) { animation-delay: 0.18s; }

/* ───────────────────────── Humanity's Theorem ───────────────────────── */

.grammar { display: flex; flex-direction: column; overflow: hidden; }
.grammar canvas { width: 100%; aspect-ratio: 16 / 10; }
.grammar__hud { padding: 16px 22px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.grammar__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.grammar__gen { font-family: var(--font-mono); font-size: 14px; color: var(--gold); }
.grammar__row strong { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: #fff; }

/* ───────────────────────── The Federation ───────────────────────── */

.fed-hud {
  position: absolute;
  right: var(--pad-x);
  bottom: 28px;
  width: min(440px, calc(100% - 2 * var(--pad-x)));
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px 16px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.fed-hud__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fed-hud__stats > div { display: flex; flex-direction: column; gap: 3px; }
.fed-hud__stats strong { font-family: var(--font-mono); font-size: 18px; font-weight: 400; color: #fff; font-variant-numeric: tabular-nums; }
.fed-hud__ceil { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; border-top: 1px solid var(--line); }
.fed-hud__limit { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--violet); }
.fed-hud__time { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding-top: 6px; }

/* ───────────────────────── Under the Floor ───────────────────────── */

.scene--floor .scene__inner { grid-template-rows: auto auto auto auto; align-content: start; align-content: safe center; gap: 22px; }
.cmb { position: relative; width: min(860px, 100%); aspect-ratio: 2 / 1; }
.cmb canvas { width: 100%; height: 100%; cursor: crosshair; }
.cmb__overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cmb__words {
  font-family: var(--font-mono);
  font-size: clamp(14px, 2.4vw, 26px);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(var(--violet-rgb), 0.8);
  opacity: 0;
  transition: opacity 2s var(--ease), letter-spacing 2s var(--ease);
  text-align: center;
  padding: 0 20px;
}
.cmb.is-decoded .cmb__words { opacity: 1; letter-spacing: 0.32em; }
.cmb__hud { position: absolute; left: 0; right: 0; bottom: -22px; display: flex; justify-content: space-between; }
.floor__after { max-width: 760px; text-align: center; opacity: 0; transform: translateY(12px); transition: opacity 1.4s var(--ease), transform 1.4s var(--ease); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.floor__after.is-on { opacity: 1; transform: none; }
.floor__after [data-reveal] { animation: none !important; opacity: 1; }
.scene--floor .hint { transition: opacity 0.6s; }
.scene--floor .hint.is-hidden { opacity: 0; animation: none; }
.scene--floor .cmb { margin-bottom: 18px; }

/* ───────────────────────── The Vehicle ───────────────────────── */

.scene--vehicle .scene__inner { grid-template-rows: auto 1fr; align-content: start; }
.vehicle { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 22px; width: 100%; height: 100%; padding-bottom: 8px; }
.vehicle__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 26px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: 560px;
  text-align: center;
}
.vehicle__pair { display: flex; gap: 12px; align-items: baseline; font-size: 14px; }
.vehicle__k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); min-width: 90px; text-align: right; }
.vehicle__pair strong { color: #fff; font-weight: 400; font-size: 15px; }
.vehicle__label.is-switching > * { animation: rise 0.6s var(--ease) both; }
.vehicle__controls { display: flex; gap: 10px; }

/* ───────────────────────── The Ladder ───────────────────────── */

.ladder { display: flex; flex-direction: column-reverse; gap: 10px; padding: 10px 0; }
.rung {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 22, 0.35);
  text-align: left;
  transition: border-color 0.4s, background 0.4s, transform 0.4s var(--ease), opacity 0.4s;
  margin-left: calc(var(--i) * 18px);
}
.rung i { font-family: var(--font-display); font-style: normal; font-size: 26px; color: var(--ink-3); transition: color 0.4s; }
.rung span { font-family: var(--font-display); font-size: 19px; line-height: 1.25; color: var(--ink-2); transition: color 0.4s, text-decoration-color 0.6s; text-decoration: line-through; text-decoration-color: transparent; }
.rung:hover { border-color: var(--line-2); transform: translateX(4px); }
.rung.is-current { border-color: rgba(var(--gold-rgb), 0.55); background: rgba(var(--gold-rgb), 0.07); }
.rung.is-current i, .rung.is-current span { color: #fff; }
.rung.is-passed span { color: var(--ink-3); text-decoration-color: rgba(var(--rose-rgb), 0.7); }
.rung.is-passed i { color: var(--ink-4); }
.rung.is-locked { opacity: 0.4; }
.rung--top { border-style: dashed; border-color: rgba(var(--violet-rgb), 0.4); background: transparent; }
.rung--top i { color: var(--violet); }
.rung--top span { text-decoration: none; }
.rung--top.is-current { border-color: var(--violet); background: rgba(var(--violet-rgb), 0.08); box-shadow: 0 0 40px rgba(var(--violet-rgb), 0.2); }
.ladder__current { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; min-height: 120px; }
.ladder__current .lead { color: var(--gold); }
.ladder__current.is-switching > * { animation: rise 0.6s var(--ease) both; }

/* ───────────────────────── Doubt ───────────────────────── */

.scene--doubt .scene__inner { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.doubt__list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.doubt__item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 19px;
  transition: background 0.3s, color 0.3s, padding-left 0.3s var(--ease);
}
.doubt__item i { font-family: var(--font-mono); font-style: normal; font-size: 10px; letter-spacing: 0.1em; color: var(--ink-3); }
.doubt__item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.doubt__item.is-active { background: rgba(var(--cyan-rgb), 0.08); color: #fff; padding-left: 18px; }
.doubt__item.is-active i { color: var(--cyan); }
.doubt__panel { padding: 26px 28px; display: flex; flex-direction: column; gap: 14px; min-height: 340px; }
.doubt__claim { color: var(--ink-2); }
.doubt__response { font-size: clamp(14.5px, 1.05vw, 16.5px); line-height: 1.7; color: #fff; min-height: 140px; }
.doubt__response .caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: -0.2em; background: var(--cyan); margin-left: 2px; animation: caret 0.9s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* ───────────────────────── What Stays Open ───────────────────────── */

.scene--questions .scene__inner { grid-template-rows: auto 1fr auto; align-content: space-between; justify-items: center; }
.questions__top { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.questions__card {
  align-self: center;
  width: min(560px, 100%);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0.55;
  transition: opacity 0.5s, transform 0.5s var(--ease);
  text-align: center;
  align-items: center;
}
.questions__card.is-on { opacity: 1; transform: translateY(-4px); }
.questions__title { font-family: var(--font-display); font-size: 28px; line-height: 1.1; color: #fff; min-height: 1em; }
.questions__end { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }

/* ───────────────────────── Theory page ───────────────────────── */

.doc { overflow-y: auto; }

/* ───────────────────────── Responsive ───────────────────────── */

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card { min-height: 240px; }
  .plan { grid-template-columns: 180px 1fr; }
  .tree { grid-template-columns: 1fr; }
  .tree__chart { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* Collapsible text panels for the overlay chapters on small screens */
.glass-toggle { display: none; }

@media (max-width: 900px) {
  :root { --pad-top: 88px; --pad-bot: 40px; }
  .scene--overlay .scene__text--glass { padding: 16px 18px 14px; gap: 8px; }
  .scene--overlay .scene__text--glass .h2 { font-size: clamp(30px, 8.5vw, 42px); margin-bottom: 0; }
  .scene--overlay .scene__text--glass .lead { font-size: 17px; }
  .scene--overlay .scene__text--glass > .body:not(.reader__after),
  .scene--overlay .scene__text--glass > .badges,
  .scene--overlay .scene__text--glass > .note { display: none; }
  .scene--overlay .scene__text--glass.is-expanded > .body,
  .scene--overlay .scene__text--glass.is-expanded > .note { display: block; }
  .scene--overlay .scene__text--glass.is-expanded > .badges { display: flex; }
  .scene--overlay .scene__text--glass.is-expanded { max-height: 66vh; overflow-y: auto; scrollbar-width: none; }
  .scene--overlay .scene__text--glass .reader__after:not(.is-on) { display: none; }
  .glass-toggle {
    display: inline-flex; align-self: flex-start; align-items: center; height: 32px; padding: 0 14px; margin-top: 2px;
    border: 1px solid var(--line-2); border-radius: 999px; font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-2);
  }
  .glass-toggle::after { content: ''; width: 5px; height: 5px; margin-left: 10px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 0.3s var(--ease); }
  .is-expanded .glass-toggle::after { transform: translateY(2px) rotate(-135deg); }
  .vent-hud { flex-wrap: wrap; gap: 10px 24px; }
  .vent-hud .hint { flex-basis: 100%; margin: 0; }
  .hud__chapter { display: none; }
  .hud__btn-label { display: none; }
  .hud__btn { padding: 0 12px; }
  .dots { display: none; }
  .scene__inner { align-items: start; align-content: start; align-content: safe center; }
  .scene--stack .scene__inner { grid-template-rows: auto auto auto; align-content: start; }
  .scene--stack .scene__inner > .panel { align-self: start; }
  .plan__mark { font-size: 0; gap: 0; }
  .plan__mark::after { height: 12px; }
  .plan__mark--alt::after { height: 6px; }
  .plan__marks { height: 16px; }
  .scene--split .scene__inner, .scene--overlay .scene__inner, .scene--doubt .scene__inner { grid-template-columns: 1fr; gap: 24px; }
  .scene--overlay .scene__inner { padding-bottom: 250px; }
  .scene__text--glass { padding: 20px; }
  .law-tabs { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .law-tab span { display: none; }
  .law-tab { align-items: center; padding: 10px 6px; }
  .plan { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .plan__toolkit { grid-row: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .tool { grid-template-columns: 32px 1fr; padding: 8px 10px; min-width: 150px; }
  .tool + .tool { border-top: 0; border-left: 1px solid var(--line); }
  .tool__icon { width: 32px; height: 32px; }
  .plan__stage { min-height: 200px; }
  .codon__grid { max-width: 100%; max-height: none; }
  .vent-hud, .launch-hud { left: var(--pad-x); right: var(--pad-x); bottom: 20px; justify-content: space-between; }
  .launch-hud { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .launch-hud__stat strong, .vent-hud strong { font-size: 18px; }
  .reader-hud { bottom: 16px; padding: 12px 16px 10px; }
  .reader-hud__marks span:nth-child(even) { display: none; }
  .fed-hud { left: var(--pad-x); right: var(--pad-x); width: auto; bottom: 16px; gap: 10px; padding: 14px 16px 12px; }
  .fed-hud__ceil { display: none; }
  .fed-hud__time { grid-template-columns: 1fr; gap: 6px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { min-height: 220px; }
  .card__title { font-size: 24px; }
  .scene--ledger .scene__inner { align-content: start; }
  .ladder { padding: 0; }
  .rung { margin-left: calc(var(--i) * 8px); padding: 12px 14px; }
  .rung span { font-size: 16px; }
  .doubt__list { max-height: none; }
  .doubt__panel { min-height: 0; }
  .questions__card { position: relative; }
  .cmb__hud { flex-direction: column; gap: 2px; bottom: -54px; }
  .scene--floor .scene__inner { gap: 24px; align-content: start; }
  .scene--floor .cmb { margin-bottom: 52px; }
  .scene--floor .floor__after:not(.is-on) { display: none; }
  .scene--ledger .scene__inner, .scene--questions .scene__inner, .scene--vehicle .scene__inner { align-content: start; }
  .vehicle__label { padding: 14px 16px; }
  .vehicle__pair { flex-direction: column; gap: 2px; align-items: center; }
  .vehicle__k { text-align: center; }
}

@media (max-width: 560px) {
  .title { font-size: clamp(40px, 12.5vw, 96px); letter-spacing: 0.06em; }
  .title-block { max-width: 100%; }
  .title-block .eyebrow { font-size: 10px; letter-spacing: 0.22em; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 200px; }
  .dose__grid, .codon__stats, .fed-hud__stats { grid-template-columns: 1fr 1fr; }
  .law-tabs { gap: 4px; }
  .journey-launch { top: 12px; right: 12px; }
  .journey-caption { left: 12px; right: 12px; bottom: 12px; }
  .questions__end .actions { flex-direction: column; }
  .tree__tick:nth-child(2) { display: none; }
  .tree__label small { display: none; }
}

@media (max-height: 700px) and (min-width: 900px) {
  :root { --pad-top: 72px; --pad-bot: 40px; }
  .scene__text { gap: 12px; }
  .body { font-size: 14px; line-height: 1.55; }
  .lead { font-size: 20px; }
}

/* ───────────────────────── Reduced motion ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.2s !important; }
  .scene { filter: none; transform: none; }
  [data-reveal] { opacity: 1; }
  .nebula { animation: none; }
}
