/* A Walk Through the Ledger: XRPL Education Month */

@font-face {
  font-family: "Bangers";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/bangers-400.woff2?v=1") format("woff2");
}

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fredoka.woff2?v=1") format("woff2");
}

:root {
  --sky-0: #07061a;
  --sky-1: #121033;
  --sky-2: #1c1650;
  --sky-3: #2a2068;
  --purple: #7b3fb8;
  --purple-bright: #c59bff;
  --gold: #f0c14b;
  --gold-soft: #f8e3a1;
  --cream: #f7f1e4;
  --paper: #fff8ea;
  --ink: #16132a;
  --ink-soft: #3a3558;
  --coral: #ff8a7a;
  --teal: #3ec8c8;
  --mint: #8ee3c0;
  --muted: #c9c3de;
  --line: rgba(247, 241, 228, 0.14);
  --shadow: 0 16px 40px rgba(4, 3, 16, 0.45);
  --font-display: "Bangers", "Impact", "Haettenschweiler", "Arial Black", cursive;
  --font-ui: "Fredoka", "Segoe UI", "Trebuchet MS", sans-serif;
  --nav-h: 58px;
  --app-h: 100dvh;
  --pad: clamp(18px, 4vw, 36px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: calc(var(--nav-h) + var(--safe-t) + 14px);
}

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

html {
  background: var(--sky-0);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 10px);
}

body {
  margin: 0;
  padding-top: var(--header-h);
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(123, 63, 184, 0.35), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(62, 200, 200, 0.12), transparent 55%),
    var(--sky-0);
  color: var(--cream);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold); }

button, .btn {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: 8px;
  z-index: 80;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-150%);
}
.skip:focus { transform: none; }

#error-banner {
  position: sticky;
  top: var(--header-h);
  z-index: 60;
  background: #8b1e3f;
  color: #fff;
  padding: 10px var(--pad);
  font-size: 0.95rem;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  padding-top: var(--safe-t);
  background: rgba(7, 6, 26, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--nav-h);
  padding: 6px max(var(--pad), calc(var(--pad) + var(--safe-r))) 6px max(var(--pad), calc(var(--pad) + var(--safe-l)));
}

.brand {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--cream);
  line-height: 1.05;
}
.brand-mark {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: 1.15rem;
  color: var(--gold);
}
.brand-sub { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.04em; }

#site-nav {
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#site-nav::-webkit-scrollbar { display: none; }
#site-nav ul {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0 0 2px;
  width: max-content;
}
#site-nav a {
  display: inline-block;
  padding: 8px 11px;
  min-height: 36px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
#site-nav a[aria-current="true"],
#site-nav a:hover,
#site-nav a:focus-visible {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}


@media (max-width: 768px) {
  html { scroll-padding-top: 10px; }
  body { padding-top: 0; }
  .site-header {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    z-index: 1;
  }
  #error-banner {
    position: static;
    top: auto;
  }
}

/* ---------- Intro video (hero) ---------- */
.hero-with-intro {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-height: 0;
  padding-top: 16px;
}
.hero-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}
.hero-media {
  position: relative;
  z-index: 3;
  isolation: isolate;
  width: 100%;
  margin: 16px 0 8px;
  display: flex;
  justify-content: center;
  transform: none;
}
.intro-reel-frame {
  position: relative;
  z-index: 3;
  isolation: isolate;
  width: 100%;
  max-width: 1120px;
  height: auto;
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #050414;
  box-shadow: var(--shadow);
  transform: none;
}
.intro-reel-frame::before {
  content: "";
  display: block;
  width: 100%;
  padding-top: 56.25%;
}
.intro-reel-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #050414;
  border: 0;
}
.intro-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 16px;
  border: 0;
  background: rgba(5, 4, 20, 0.32);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.intro-play[hidden] { display: none; }
.intro-play:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -6px;
}
.intro-play-icon {
  position: relative;
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.intro-play-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 55%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 18px 0 18px 30px;
  border-color: transparent transparent transparent var(--ink);
}
.intro-play-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.hero-with-intro .hero-copy {
  position: relative;
  z-index: 3;
  max-width: none;
  padding-top: 0;
}
.hero-with-intro .hero-copy h1 {
  margin-bottom: 0;
}
.hero-with-intro .hero-copy .lede {
  margin-top: 18px;
}
@media (max-width: 799px) {
  .hero-with-intro {
    padding: 8px max(10px, var(--safe-r)) 20px max(10px, var(--safe-l));
    gap: 0;
  }
  .hero-stage { gap: 16px; max-width: none; }
  .intro-reel-frame {
    width: 100%;
    max-width: none;
    border-radius: 12px;
  }
  .intro-play-icon { width: 80px; height: 80px; }
  .intro-play-icon::before { border-width: 16px 0 16px 26px; }
  .intro-play-label { font-size: 1.05rem; min-height: 44px; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: calc(var(--app-h, 100vh) - var(--nav-h) - var(--safe-t));
  display: flex;
  align-items: center;
  overflow: visible;
  padding: 24px max(var(--pad), calc(var(--pad) + var(--safe-r))) calc(36px + var(--safe-b)) max(var(--pad), calc(var(--pad) + var(--safe-l)));
}
.hero.hero-with-intro {
  min-height: 0;
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 16px;
}
@media (max-width: 799px) {
  .hero.hero-with-intro {
    padding: 12px max(10px, var(--safe-r)) 20px max(10px, var(--safe-l));
  }
}

.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.hero-with-intro .stars,
.hero-with-intro .egg-compass,
.hero-with-intro .constellation {
  z-index: 0;
  pointer-events: none;
}
.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255,255,255,0.8);
  animation: twinkle 3.6s ease-in-out infinite;
}
.star.gold {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(240, 193, 75, 0.9);
  width: 4px;
  height: 4px;
}
.constellation {
  position: absolute;
  inset: 8% 8% auto 8%;
  height: 42%;
  width: auto;
  opacity: 0.55;
}
.constellation line { stroke: rgba(197, 155, 255, 0.45); stroke-width: 1.2; }
.constellation circle { fill: #fff; }

@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 720px;
  padding-bottom: 8px;
}
.kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin: 0 0 10px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.03em;
  font-size: clamp(3rem, 12vw, 6.4rem);
  line-height: 0.92;
  margin: 0 0 14px;
  color: var(--cream);
  text-shadow: 0 6px 0 rgba(0,0,0,0.25);
}
.lede {
  font-size: clamp(1.05rem, 3.4vw, 1.35rem);
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 34em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--cream);
  border-color: rgba(247,241,228,0.35);
}

.hero-cast {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 28px 0 8px;
}
.hero-bear {
  position: absolute;
  right: max(0px, var(--safe-r));
  top: calc(10px + var(--safe-t));
  width: min(36vw, 150px);
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 18px 24px rgba(0,0,0,0.45));
}
.hero-bear img { width: 100%; height: auto; }
@media (min-width: 800px) {
  .hero-bear {
    top: auto;
    bottom: 0;
    width: min(40vw, 300px);
  }
}

/* ---------- Chapters ---------- */
.chapter {
  position: relative;
  padding: 72px max(var(--pad), calc(var(--pad) + var(--safe-r))) 72px max(var(--pad), calc(var(--pad) + var(--safe-l)));
  border-top: 1px solid var(--line);
}
.chapter-inner { max-width: 1080px; margin: 0 auto; }
.chapter h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.03em;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 0.98;
  margin: 0 0 8px;
  color: var(--cream);
}
.chapter-num {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.chapter-lead {
  font-size: 1.12rem;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 38em;
}

.chapter-paper {
  background:
    linear-gradient(180deg, rgba(255,248,234,0.04), transparent 40%),
    var(--sky-1);
}
.chapter-gold { background: linear-gradient(180deg, #1a1433, #24180e 80%); }
.chapter-teal { background: linear-gradient(180deg, #10182c, #0e2430); }
.chapter-cream {
  background: var(--paper);
  color: var(--ink);
}
.chapter-cream h2 { color: var(--ink); }
.chapter-cream .chapter-lead { color: var(--ink-soft); }

.scene {
  display: grid;
  gap: 22px;
}
@media (min-width: 840px) {
  .scene { grid-template-columns: 1fr 1fr; align-items: start; }
  .scene .lesson, .scene .interactive, .scene .portal { grid-column: 2; }
  .scene .cast { grid-column: 1; grid-row: 1 / span 6; }
}

.cast {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.speech {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 10px;
  align-items: start;
}
.speech .fig { grid-row: 1 / span 2; }
.bubble {
  background: var(--paper);
  color: var(--ink);
  border-radius: 18px 18px 18px 6px;
  padding: 12px 14px;
  font-size: 1.02rem;
  line-height: 1.45;
  box-shadow: var(--shadow);
  position: relative;
}
.chapter-cream .bubble {
  background: #fff;
  border: 2px solid rgba(22, 19, 42, 0.08);
  box-shadow: 0 8px 20px rgba(22, 19, 42, 0.08);
}
.bubble strong { color: var(--purple); }
.who {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  padding-left: 4px;
}
.chapter-cream .who { color: var(--purple); }

.lesson, .interactive, .card {
  background: rgba(255, 248, 234, 0.06);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 20px 18px;
}
.chapter-cream .lesson,
.chapter-cream .interactive,
.chapter-cream .card {
  background: #fff;
  border-color: rgba(22,19,42,0.08);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(22,19,42,0.06);
}
.lesson h3, .interactive h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}
.lesson p, .interactive p, .card p { margin: 0 0 10px; }
.lesson p:last-child, .interactive p:last-child { margin-bottom: 0; }
.fact {
  border-left: 3px solid var(--gold);
  padding: 8px 0 8px 12px;
  color: var(--gold-soft);
  font-size: 0.98rem;
  margin: 12px 0 0;
}
.chapter-cream .fact { color: var(--ink-soft); }

/* ---------- Stick figures ---------- */
.fig {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 92px;
  flex: 0 0 auto;
}
.fig-name {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: -4px;
}
.chapter-cream .fig-name { color: var(--ink-soft); }
.stick {
  width: 92px;
  height: auto;
  overflow: visible;
  display: block;
}
.stick line, .stick .torso {
  stroke: #16132a;
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.stick .head circle:first-child {
  stroke: #16132a;
  stroke-width: 3;
}

.stick .arm-l, .stick .arm-r, .stick .leg-l, .stick .leg-r {
  transform-box: view-box;
}
.stick .arm-l, .stick .arm-r { transform-origin: 40px 54px; }
.stick .leg-l, .stick .leg-r { transform-origin: 40px 80px; }
.stick-pip .leg-l, .stick-pip .leg-r { transform-origin: 40px 70px; }
.stick-pip .arm-l, .stick-pip .arm-r { transform-origin: 40px 48px; }

.pose-wave .arm-r { animation: wave 1.6s ease-in-out infinite; }
.pose-jump { animation: hop 1.2s ease-in-out infinite; }
.pose-walk .leg-l { animation: stride 0.7s ease-in-out infinite; }
.pose-walk .leg-r { animation: stride 0.7s ease-in-out infinite reverse; }
.pose-walk .arm-l { animation: stride 0.7s ease-in-out infinite reverse; }
.pose-walk .arm-r { animation: stride 0.7s ease-in-out infinite; }

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-14deg); }
}
@keyframes stride {
  0%, 100% { transform: rotate(16deg); }
  50% { transform: rotate(-16deg); }
}
@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-cast .fig { width: 96px; }
.hero-cast .stick { width: 96px; }
.hero-copy { padding-top: 12px; }
@media (min-width: 800px) {
  .hero-copy { max-width: 680px; padding-right: 24px; }
}

/* ---------- Interactives ---------- */
#agree-game { text-align: center; }
.validators {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 12px;
}
.validators button {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(247,241,228,0.16);
  border-radius: 16px;
  padding: 6px 4px 8px;
  min-width: 76px;
  color: inherit;
}
.validators button[aria-pressed="true"] {
  border-color: var(--mint);
  background: rgba(142, 227, 192, 0.12);
}
.validators .fig, .validators .stick { width: 72px; }
#agree-status { min-height: 3em; margin: 0 0 10px; }
#agree-game.is-agreed #agree-status { color: var(--mint); font-weight: 600; }

.spark-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#fee-spark {
  width: 92px;
  height: 92px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff6c8, var(--gold) 40%, #e08a1e 75%);
  box-shadow: 0 0 0 6px rgba(240,193,75,0.25), 0 10px 24px rgba(0,0,0,0.3);
  position: relative;
}
#fee-spark .spark-core {
  font-size: 1.6rem;
  line-height: 92px;
}
#fee-spark.is-burned {
  animation: burn 1.1s ease forwards;
}
@keyframes burn {
  0% { transform: scale(1); opacity: 1; }
  70% { transform: scale(0.3); opacity: 0.5; filter: blur(2px); }
  100% { transform: scale(0.05); opacity: 0; }
}
#fee-spark-note { text-align: center; min-height: 2.6em; margin: 0; }

.ledger-stage {
  perspective: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#ledger-flip {
  width: min(100%, 260px);
  height: 170px;
  position: relative;
}
.page {
  position: absolute;
  inset: 0;
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px 14px 14px 6px;
  box-shadow: 8px 10px 0 rgba(0,0,0,0.18), 0 0 0 1px rgba(22,19,42,0.08);
  padding: 16px 18px;
  font-weight: 700;
}
.page small { display: block; font-weight: 500; color: var(--ink-soft); margin-top: 8px; }
.page-back { transform: translate(10px, 10px) rotate(-3deg); opacity: 0.7; }
#ledger-flip.is-flipping .page-front {
  animation: pageflip 0.8s ease;
}
@keyframes pageflip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(-80deg); }
  100% { transform: rotateY(0); }
}

.riddle-q {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 12px;
}
#riddle-answer {
  background: rgba(240, 193, 75, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0 0;
}
.ticket-egg {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  border: 1px dashed rgba(22,19,42,0.25);
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: rgba(22,19,42,0.38);
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(22,19,42,0.05) 8px 9px);
}

.locker-tag {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
}

/* ---------- Portals / explore ---------- */
.portal, .explore-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, rgba(255,248,234,0.09), rgba(255,248,234,0.03));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 18px 16px;
  min-height: 48px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.portal:hover, .explore-card:hover,
.portal:focus-visible, .explore-card:focus-visible {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.chapter-cream .portal {
  background: #fff;
  color: var(--ink);
  border-color: rgba(22,19,42,0.1);
  box-shadow: 0 10px 24px rgba(22,19,42,0.06);
}
.portal-kind, .explore-card .kind {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--gold);
  border-radius: 999px;
  padding: 3px 8px;
  margin-bottom: 8px;
}
.portal strong, .explore-card strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.portal > span:not(.portal-kind):not(.portal-go),
.explore-card > span:not(.kind):not(.go) { display: block; }
.portal-go, .explore-card .go {
  display: block;
  margin-top: 10px;
  font-weight: 700;
  color: var(--gold);
}
.chapter-cream .portal-go { color: #6a2f9b; }

.cameo {
  display: grid;
  gap: 14px;
  align-items: center;
  background: rgba(255,248,234,0.06);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  margin-top: 8px;
}
.cameo img {
  width: 100%;
  border-radius: 14px;
}
.cameo p { margin: 0; }
@media (min-width: 640px) {
  .cameo { grid-template-columns: 180px 1fr; }
}

.explore-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .explore-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1020px) {
  .explore-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

/* ---------- Quiz ---------- */
.q {
  margin: 0 0 18px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}
.q:last-of-type { border-bottom: 0; }
.q h3 { margin: 0 0 10px; font-size: 1.08rem; }
.q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.q-options button {
  text-align: left;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(247,241,228,0.2);
  background: rgba(255,255,255,0.04);
  color: inherit;
  font-size: 1rem;
}
.q-options button.is-right {
  border-color: var(--mint);
  background: rgba(142, 227, 192, 0.16);
}
.q-options button.is-wrong {
  border-color: var(--coral);
  background: rgba(255, 138, 122, 0.12);
}
.q-options button:disabled { opacity: 0.95; }
.q-feedback { margin: 10px 0 0; font-weight: 600; }
#quiz-result {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: var(--gold-soft);
  min-height: 1.5em;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 36px max(var(--pad), calc(var(--pad) + var(--safe-r))) calc(28px + var(--safe-b)) max(var(--pad), calc(var(--pad) + var(--safe-l)));
  border-top: 1px solid var(--line);
  background: #050414;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer .inner { max-width: 1080px; margin: 0 auto; }
.site-footer p { margin: 0 0 10px; }
.site-footer a { color: var(--gold-soft); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .star, .pose-wave .arm-r, .pose-walk .leg-l, .pose-walk .leg-r, .pose-walk .arm-l, .pose-walk .arm-r, .pose-jump,
  #fee-spark.is-burned, #ledger-flip.is-flipping .page-front {
    animation: none !important;
  }
}

/* iPhone home-indicator breathing room for last chapter */
.chapter:last-of-type { padding-bottom: calc(48px + var(--safe-b)); }


@media (max-width: 799px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
    padding-top: 8px;
  }
  .hero-bear {
    position: relative;
    top: auto;
    right: auto;
    width: 132px;
    align-self: flex-end;
    margin: 0 0 -36px;
    z-index: 1;
    order: -1;
  }
  .hero-copy { z-index: 2; }
  .hero h1 { font-size: clamp(2.7rem, 13vw, 3.6rem); }
  .hero-actions .btn { width: 100%; }
}

@media (max-width: 799px) and (max-height: 720px) {
  .hero-bear { width: 110px; margin-bottom: -28px; }
}

/* Stick-figure name aliases (Sol / Luna / Gaia) */
.stick-sol .arm-l, .stick-sol .arm-r { transform-origin: 40px 54px; }
.stick-luna .arm-l, .stick-luna .arm-r { transform-origin: 40px 54px; }
.stick-gaia .leg-l, .stick-gaia .leg-r { transform-origin: 40px 70px; }
.stick-gaia .arm-l, .stick-gaia .arm-r { transform-origin: 40px 48px; }

/* ---------- Quiet Easter eggs & Buzz the bee ---------- */
.egg-compass {
  position: absolute;
  right: 7%;
  top: 6%;
  width: min(22vw, 150px);
  height: auto;
  opacity: 0.16;
  color: #f8e3a1;
  pointer-events: none;
  z-index: 0;
}
.egg-compass path,
.egg-compass circle { stroke: currentColor; fill: none; }
.egg-compass .egg-g {
  fill: currentColor;
  stroke: none;
  font-family: "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
}

.bumblebee {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 84px;
  flex: 0 0 auto;
  animation: bee-hover 2.2s ease-in-out infinite;
}
.bee-svg { width: 84px; height: auto; display: block; overflow: visible; }
.bee-svg .wing-l,
.bee-svg .wing-r {
  transform-box: fill-box;
  transform-origin: center;
  animation: wing-flap 0.28s ease-in-out infinite;
}
.bee-svg .wing-r { animation-direction: reverse; }
.hero-cast .bumblebee { width: 80px; margin-left: 2px; }
.hero-cast .bee-svg { width: 80px; }

@keyframes bee-hover {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}
@keyframes wing-flap {
  0%, 100% { transform: rotate(10deg) scaleY(1); }
  50% { transform: rotate(-18deg) scaleY(0.72); }
}

.bee-with-hive {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 92px;
}
.beehive-svg {
  width: 56px;
  height: auto;
  margin-top: -6px;
  display: block;
}

.pillars {
  position: absolute;
  inset: 24px 0 auto;
  height: 160px;
  pointer-events: none;
  opacity: 0.13;
  z-index: 0;
}
.pillars svg {
  width: 100%;
  height: 160px;
  display: block;
}
#notebook .chapter-inner { position: relative; z-index: 1; }

.egg-euclid-wrap {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 0;
  opacity: 0.32;
}
.egg-euclid { width: 88px; height: auto; color: #5a4a20; }
.chapter-cream .egg-euclid { color: #4a3d1c; }

.egg-tools-wrap {
  display: flex;
  justify-content: flex-start;
  margin: 12px 0 0;
  opacity: 0.4;
}
.egg-tools { width: 132px; height: auto; color: var(--gold-soft); }

.ashlar-pair {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin: 12px 0 2px;
  opacity: 0.55;
}
.ashlar-pair svg { width: 64px; height: auto; color: #5a4a20; }
.ashlar-cap {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(22,19,42,0.45);
  text-align: center;
  margin-top: 2px;
}

.watcher-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin: 0 0 4px;
  position: relative;
}
.egg-eye {
  width: 42px;
  height: auto;
  color: var(--gold-soft);
  opacity: 0.55;
  flex: 0 0 auto;
  transform: translateY(4px);
}
.egg-eye-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.mosaic-pavement {
  height: 22px;
  margin: 14px 0 8px;
  border-radius: 6px;
  background-color: rgba(247,241,228,0.06);
  background-image:
    linear-gradient(45deg, rgba(8,6,20,0.55) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(8,6,20,0.55) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(247,241,228,0.28) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(247,241,228,0.28) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  opacity: 0.42;
  pointer-events: none;
}

.egg-steps-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 0;
  opacity: 0.28;
}
.egg-steps { width: min(100%, 260px); height: auto; color: var(--gold-soft); }

.east-sun {
  position: absolute;
  right: max(12px, var(--safe-r));
  top: 28px;
  width: 86px;
  opacity: 0.2;
  pointer-events: none;
  color: var(--gold);
}
#pages { position: relative; }
#pages .chapter-inner { position: relative; z-index: 1; }

.egg-acacia {
  width: 36px;
  height: auto;
  display: block;
  margin: 0 0 12px;
  opacity: 0.7;
}

@media (max-width: 839px) {
  .pillars { height: 72px; opacity: 0.1; inset: 8px 0 auto; }
  .pillars svg { height: 72px; }
  .egg-compass { width: 92px; top: 22%; left: 6%; right: auto; opacity: 0.2; }
  .east-sun { width: 64px; opacity: 0.16; }
}

@media (prefers-reduced-motion: reduce) {
  .bumblebee, .bee-svg .wing-l, .bee-svg .wing-r {
    animation: none !important;
  }
}

.speech .bumblebee,
.speech .bee-with-hive { grid-row: 1 / span 2; }

/* ---------- Arcade ---------- */
.arcade-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin-top: 8px;
}
@media (min-width: 700px) {
  .arcade-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.arcade-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,248,234,0.09), rgba(255,248,234,0.03));
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.arcade-card:hover,
.arcade-card:focus-within {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.arcade-thumb {
  display: block;
  background: #050414;
}
.arcade-thumb img {
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 358;
  object-fit: cover;
  object-position: top center;
}
.arcade-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  flex: 1 1 auto;
}
.arcade-body h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}
.arcade-body p {
  margin: 0;
  color: var(--muted);
  flex: 1 1 auto;
}
.arcade-body .btn { width: 100%; }

/* ---------- Validated series ---------- */
.episode-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin-top: 8px;
  justify-items: center;
}
@media (min-width: 860px) {
  .episode-grid:has(.episode-card:nth-child(2)) {
    grid-template-columns: 1fr 1fr;
    justify-items: stretch;
  }
}
.episode-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,248,234,0.09), rgba(255,248,234,0.03));
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.episode-player {
  display: flex;
  justify-content: center;
  background: #050414;
}
.episode-player video {
  width: 100%;
  max-width: 420px;
  max-height: min(72vh, 720px);
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #050414;
  display: block;
}
.episode-body {
  padding: 14px 16px 18px;
}
.episode-date {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.episode-body h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  line-height: 1.2;
}
.episode-body p {
  margin: 0;
  color: var(--muted);
}
.catalog-empty {
  margin: 8px 0 0;
  color: var(--muted);
}
.catalog-status[hidden] { display: none; }

#arcade,
#validated { position: relative; }
#arcade .chapter-inner,
#validated .chapter-inner { position: relative; z-index: 1; }
#arcade .mosaic-pavement { margin: 4px 0 18px; }
#validated .egg-tools-wrap {
  justify-content: flex-end;
  opacity: 0.28;
  margin: 0 0 10px;
}

/* ---------- Start Here page ---------- */
body.start-here .hero {
  min-height: 0;
  padding: 28px 0 36px;
}
body.start-here .hero-copy { max-width: 720px; }
.start-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--muted);
}
.start-crumb a {
  color: var(--gold-soft);
  text-decoration: none;
}
.start-crumb a:hover,
.start-crumb a:focus-visible { text-decoration: underline; }
.start-guide .chapter-inner { max-width: 760px; }
.start-steps {
  display: grid;
  gap: 18px;
  margin: 8px 0 0;
}
.start-step {
  background: rgba(255, 248, 234, 0.06);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 20px 18px;
}
.chapter-cream .start-step {
  background: #fff;
  border-color: rgba(22, 19, 42, 0.08);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(22, 19, 42, 0.06);
}
.start-step .step-num {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.chapter-cream .start-step .step-num { color: #8a5a00; }
.start-step h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  line-height: 1.25;
}
.start-step p { margin: 0 0 10px; }
.start-step p:last-child { margin-bottom: 0; }
.start-basics {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
}
@media (min-width: 700px) {
  .start-basics { grid-template-columns: 1fr 1fr; }
}
.start-basics .lesson { margin: 0; }
.start-next { margin-top: 8px; }
.start-next .explore-grid { margin-top: 16px; }
#site-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}


/* Sky lab: lesson, challenge, quiz */
.sky-crumb { margin: 0 0 10px; }
.lab-hero-cast { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.lab-hero-cast .fig, .lab-hero-cast .bumblebee { width: 72px; }
.trident-mark { width: 54px; height: auto; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35)); }
.lab-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.lab-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lab-steps li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
  background: rgba(255,248,234,0.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.chapter-cream .lab-steps li { background: #fffdf8; border-color: rgba(22,19,42,0.12); }
.lab-steps .step-num {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: #1a1208;
  font-weight: 700; font-size: 18px;
}
.lab-steps p { margin: 0; }
.lab-steps a { color: var(--gold-soft); }
.chapter-cream .lab-steps a { color: #6a2f9b; }

.tx-status {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(142,227,192,0.12);
  color: var(--mint);
  font-weight: 600;
}
.tx-status.is-wait { background: rgba(240,193,75,0.12); color: var(--gold-soft); }
.tx-status.is-fail { background: rgba(255,138,122,0.12); color: var(--coral); }
.chapter-cream .tx-status { color: #0e5c3a; background: #e8f7ee; border-color: #b7e0c6; }
.chapter-cream .tx-status.is-wait { color: #6a4a00; background: #fff3d0; border-color: #e6d08a; }
.chapter-cream .tx-status.is-fail { color: #8a2a1c; background: #ffe8e3; border-color: #f3b4aa; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid .field.span-2 { grid-column: 1 / -1; }
}
.field {
  background: rgba(255,248,234,0.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 0;
}
.chapter-cream .field { background: #fffdf8; border-color: rgba(22,19,42,0.12); }
.field .k {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
  font-weight: 700;
}
.chapter-cream .field .k { color: #8a5a00; }
.field .v {
  display: block;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--cream);
}
.chapter-cream .field .v { color: var(--ink); }
.field .why { display: block; margin-top: 8px; color: var(--muted); font-size: 15px; }
.chapter-cream .field .why { color: var(--ink-soft); }
.mono { font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace; font-size: 13px; }

.memo-block {
  background: #0b0a1c;
  color: #e8f8d8;
  border-radius: 16px;
  padding: 14px 16px;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  overflow-x: auto;
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  border: 1px solid rgba(240,193,75,0.3);
}
.chapter-cream .memo-block { background: #16132a; }
.memo-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.copy-btn, .btn.small, a.btn.small {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  border: 0;
}
.copy-btn {
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid rgba(240,193,75,0.45);
  border-radius: 999px;
  font-weight: 700;
  font-family: inherit;
}
.copy-btn:hover, .copy-btn:focus-visible { background: rgba(240,193,75,0.12); }
.chapter-cream .copy-btn { color: #6a2f9b; border-color: rgba(106,47,155,0.35); }

.planet-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0 0;
  width: 100%;
  max-width: 100%;
}
.planet-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: 14px;
}
.planet-table th, .planet-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.planet-table th { color: var(--gold); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.chapter-cream .planet-table th { color: #8a5a00; }
.chapter-cream .planet-table td { color: var(--ink); }
.planet-table .rx { color: var(--coral); font-weight: 700; }

.callout {
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  margin: 16px 0 0;
  background: rgba(240,193,75,0.08);
  border-radius: 0 14px 14px 0;
}
.callout strong { color: var(--gold-soft); }
.chapter-cream .callout strong { color: #6a4a00; }
.callout.danger { border-left-color: var(--coral); background: rgba(255,138,122,0.1); }
.lab-links { margin-top: 8px; }

.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rules li {
  background: rgba(255,248,234,0.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.chapter-cream .rules li { background: #fffdf8; border-color: rgba(22,19,42,0.12); }
.rules .rule-k { display: block; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.chapter-cream .rules .rule-k { color: #8a5a00; }

.countdown {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
.countdown .tick {
  min-width: 72px;
  text-align: center;
  background: rgba(255,248,234,0.08);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
}
.countdown b { display: block; font-size: 22px; color: var(--gold); }
.countdown span { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

#sky-quiz .q { margin: 0 0 22px; }
#sky-quiz .q h3 { margin: 0 0 10px; font-size: 18px; line-height: 1.35; }
#sky-quiz .q-options { display: grid; gap: 8px; }
#sky-quiz .q-options button {
  min-height: 48px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.35;
  width: 100%;
}
#sky-quiz-progress, #sky-quiz-result {
  font-weight: 700;
  margin: 0 0 16px;
}
#sky-quiz-result { font-size: 18px; }
#sky-quiz-reset { margin-top: 8px; }

@media (max-width: 430px) {
  .lab-steps li { grid-template-columns: 36px 1fr; padding: 12px; }
  .lab-steps .step-num { width: 36px; height: 36px; font-size: 16px; }
  .field .v { font-size: 15px; }
  .planet-table { font-size: 13px; min-width: 420px; }
  .hero h1 { font-size: 34px; }
}
