/* ============================================================
   Cosmic Cadets — theme
   Deep-space dark UI, glassy cards, neon glow accents.
   Design tokens live in css/tokens.css (source of truth).
   The :root block below is a BRIDGE: it maps this file's
   legacy var names onto the Cosmic Cadets tokens, so existing
   usages recolor without a sweeping rename. New code should
   reference the --color-* / --glow-* / --space-* tokens directly.
   ============================================================ */

:root {
  /* surfaces */
  --bg: var(--color-space-bot);
  --bg-2: var(--color-space-top);
  --card: var(--color-card);
  --card-strong: rgba(255, 255, 255, 0.12);
  --border: var(--color-line);
  --text: var(--color-ink);
  --text-dim: var(--color-muted);

  /* accents — remapped to Cosmic Cadets neon palette + semantics */
  --green: var(--color-cyan);    /* primary action / "done" */
  --blue: var(--color-cyan);
  --violet: var(--color-violet); /* locked / secondary */
  --pink: var(--color-pink);     /* current / active */
  --gold: var(--color-lime);     /* XP / stars */
  --orange: var(--color-orange); /* streak / boss */
  --danger: #ff6b81;
  /* dark ink for text sitting on bright accents (cyan/lime/orange) */
  --on-accent: #06222A;
  --accent-grad: linear-gradient(100deg, var(--color-cyan), var(--color-violet) 58%, var(--color-pink));

  /* radius — map to token scale */
  --radius: var(--radius-lg);
  /* --radius-sm is defined in tokens.css (14px) */
  --font-head: var(--font-display);
  /* --font-body is defined in tokens.css */
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* elevation: glow is the signature; gray drop-shadows are gone */
  --shadow: var(--shadow-card);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-space) fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- animated sky ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow-veil {
  position: absolute;
  width: 90vw;
  height: 42vh;
  top: -12vh;
  filter: blur(70px);
  opacity: 0.32;
  border-radius: 50%;
  animation: drift 16s ease-in-out infinite alternate;
}
.glow-veil-1 { left: -15vw; background: radial-gradient(ellipse, var(--green), transparent 65%); }
.glow-veil-2 { left: 25vw; background: radial-gradient(ellipse, var(--blue), transparent 65%); animation-delay: -5s; animation-duration: 21s; }
.glow-veil-3 { left: 55vw; background: radial-gradient(ellipse, var(--violet), transparent 65%); animation-delay: -10s; animation-duration: 26s; }
@keyframes drift {
  from { transform: translateX(-6vw) skewX(-8deg) scaleY(1); }
  to   { transform: translateX(6vw)  skewX(8deg)  scaleY(1.25); }
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.9; } }

/* ---------- Nova mascot (glowing robot) ---------- */
.nova-bot {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.18em;
  filter: drop-shadow(0 0 5px rgba(61, 224, 224, 0.55));
}
.nova-bot .nb-head { fill: #0c1a2a; stroke: var(--color-cyan); stroke-width: 2.4; }
.nova-bot .nb-screen { fill: #06222a; }
.nova-bot .nb-eye { fill: var(--color-cyan); }
.nova-bot .nb-smile { fill: none; stroke: var(--color-cyan); stroke-width: 2.6; stroke-linecap: round; }
.nova-bot .nb-stroke { stroke: var(--color-cyan); stroke-width: 2.4; stroke-linecap: round; }
.nova-bot .nb-fill { fill: var(--color-cyan); }
/* gentle eye-pulse — disabled under reduced-motion (see Motion section) */
.nova-bot .nb-eye { animation: nova-blink 4.5s ease-in-out infinite; }
@keyframes nova-blink { 0%, 92%, 100% { opacity: 1; } 96% { opacity: 0.25; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(12, 8, 36, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap;
}
.brand-icon { font-size: 1.5rem; }
.brand em {
  font-style: normal;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  transition: 0.2s;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--card-strong); }
.nav a.active { color: var(--on-accent); background: var(--accent-grad); }
.stats { display: flex; gap: 8px; margin-left: auto; }
.pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
}
.pill-xp b { color: var(--gold); }
.pill-streak b { color: var(--orange); }
.pill.bump { animation: bump 0.5s ease; }
@keyframes bump { 30% { transform: scale(1.25); } }

/* ---------- bottom tab bar (Cosmic Cadets nav) ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(12, 8, 36, 0.82);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-line);
}
.tabbar a {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  text-decoration: none;
  color: var(--color-muted);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.2px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.tabbar .tab-ico { font-size: 1.3rem; line-height: 1; }
.tabbar a:hover { color: var(--color-ink); background: var(--color-card); }
.tabbar a.active { color: var(--color-cyan); }
.tabbar a.active .tab-ico { filter: drop-shadow(0 0 9px rgba(61, 224, 224, 0.75)); }

/* ---------- layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 28px 20px calc(96px + env(safe-area-inset-bottom)); }
.footer {
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
  font-size: 0.9rem;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; }

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

/* ---------- home / hero ---------- */
.hero { text-align: center; padding: 30px 10px 14px; }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); margin: 0 0 8px; }
.hero p.sub { color: var(--text-dim); font-size: 1.15rem; max-width: 620px; margin: 0 auto; }
.hero .fox { font-size: 3.2rem; display: inline-block; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-9px) rotate(-4deg); } }

.progress-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 26px auto 30px;
  max-width: 720px;
  padding: 16px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.progress-banner .level-name { font-family: var(--font-head); font-weight: 700; white-space: nowrap; }
.progress-track {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-grad);
  box-shadow: 0 0 14px rgba(76, 201, 255, 0.55);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- journey map (home) ---------- */
.hero.compact { padding: 16px 10px 2px; }
.hero.compact h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.hero.compact p.sub { font-size: 1.02rem; }

.journey {
  position: relative;
  max-width: 440px;
  margin: 6px auto 0;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 14px 0 24px;
}
.journey::before {
  content: "";
  position: absolute;
  top: 44px; bottom: 44px; left: 50%;
  border-left: 3px dashed rgba(255, 255, 255, 0.16);
  transform: translateX(-50%);
}
.node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 56%;
  text-decoration: none;
  color: var(--color-ink);
}
.node:nth-child(odd) { align-self: flex-start; }
.node:nth-child(even) { align-self: flex-end; flex-direction: row-reverse; text-align: right; }
.node-disc {
  position: relative;
  flex: none;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.7rem; font-weight: 700;
  font-family: var(--font-head);
  background: var(--color-card-solid);
  border: 2px solid var(--color-line);
  color: var(--color-ink);
  transition: transform 0.15s;
}
.node:hover .node-disc { transform: scale(1.06); }
.node-label { display: flex; flex-direction: column; gap: 3px; }
.nl-name { font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.nl-meta { font-size: 0.8rem; color: var(--color-muted); font-weight: 700; }

.node-done .node-disc { background: var(--color-cyan); color: var(--on-accent); border-color: var(--color-cyan); box-shadow: var(--glow-cyan); }

.node-current .node-disc {
  width: 80px; height: 80px;
  background: var(--color-pink); color: var(--on-accent);
  border-color: var(--color-pink);
  box-shadow: var(--glow-pink);
}
.node-current .nl-meta {
  display: inline-block;
  background: var(--color-pink); color: var(--on-accent);
  padding: 2px 10px; border-radius: var(--radius-pill);
  font-weight: 800;
}
.node-current .node-disc::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--color-pink);
  animation: node-pulse 1.8s ease-out infinite;
}
@keyframes node-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.7); opacity: 0; }
}
.node-boss .node-disc {
  width: 80px; height: 80px;
  background: linear-gradient(160deg, var(--color-orange), #ff6a3d);
  color: var(--on-accent);
  border-color: var(--color-orange);
  box-shadow: var(--glow-orange);
}
.node-boss.node-done .node-disc { background: var(--color-cyan); border-color: var(--color-cyan); box-shadow: var(--glow-cyan); }
/* Locked (paid) worlds — dimmed, no glow, a 🔒 disc; tapping opens the paywall. */
.node-locked { opacity: 0.62; }
.node-locked .node-disc { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.18); box-shadow: none; filter: grayscale(0.4); }
.node-locked:hover { opacity: 0.85; }
.node-nova { position: absolute; top: -18px; font-size: 1.9rem; z-index: 3; pointer-events: none; }
.node:nth-child(odd) .node-nova { left: 18px; }
.node:nth-child(even) .node-nova { right: 18px; }

/* ---------- world map ---------- */
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}
.world-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.world-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--wcolor, var(--accent-grad));
}
.world-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow);
}
.world-card .emoji { font-size: 2.3rem; }
.world-card h3 { margin: 8px 0 2px; font-size: 1.35rem; }
.world-card .tagline { color: var(--text-dim); font-size: 0.95rem; min-height: 44px; }
.world-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
  font-weight: 700;
}
.world-card .meta .done-tag { color: var(--green); }
.world-card.locked { opacity: 0.55; filter: saturate(0.4); }
.world-card.locked:hover { transform: none; box-shadow: none; }
.mini-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.09); overflow: hidden; margin-top: 10px; }
.mini-fill { height: 100%; background: var(--wcolor, var(--accent-grad)); border-radius: 999px; }

/* ---------- world page (lesson list) ---------- */
.world-header { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.world-header .emoji { font-size: 3rem; }
.world-header h1 { margin: 0; font-size: 2.1rem; }
.world-header p { margin: 2px 0 0; color: var(--text-dim); }
.back-link { color: var(--text-dim); text-decoration: none; font-weight: 700; display: inline-block; margin-bottom: 14px; }
.back-link:hover { color: var(--text); }

.lesson-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.lesson-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: 0.18s;
}
.lesson-row:hover { background: var(--card-strong); transform: translateX(5px); }
.lesson-row .check {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 2px solid var(--border);
  color: var(--text-dim);
  font-size: 0.95rem;
}
.lesson-row.done .check { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.lesson-row .l-title { font-weight: 800; font-family: var(--font-head); font-size: 1.08rem; }
.lesson-row .l-type { color: var(--text-dim); font-size: 0.85rem; }
.lesson-row .l-xp { margin-left: auto; color: var(--gold); font-weight: 800; font-size: 0.9rem; white-space: nowrap; }

/* ---------- lesson page ---------- */
.lesson-head { margin-bottom: 18px; }
.lesson-head h1 { font-size: 1.9rem; margin: 6px 0 10px; }
.lesson-head .crumbs { color: var(--text-dim); font-size: 0.92rem; }
.lesson-head .crumbs a { color: var(--text-dim); }
.lesson-head .eyebrow { margin-bottom: 2px; }
.eyebrow-link { color: var(--color-cyan); text-decoration: none; }
.lesson-progress {
  height: 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  max-width: 420px;
}
.lp-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-cyan);
  box-shadow: var(--glow-cyan);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.learn-card, .editor-card, .challenge-card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
}
.learn-card h3 { margin-top: 1.4em; }
.learn-card h3:first-child { margin-top: 0; }
.learn-card code, .challenge-card code, p code, li code {
  font-family: var(--font-mono);
  background: rgba(76, 201, 255, 0.13);
  color: var(--blue);
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.88em;
}
.codebox {
  position: relative;
  background: #0d1330;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  color: #d7e3ff;
}
.codebox .try-btn {
  position: absolute;
  top: 8px; right: 8px;
}
.fox-tip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(43, 240, 168, 0.08);
  border: 1px solid rgba(43, 240, 168, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 16px 0 4px;
}
.fox-tip .f { font-size: 1.6rem; }
.fox-tip p { margin: 0; font-size: 0.96rem; }

/* Just-in-time glossary: tap any known word/symbol to see what it means.
   Terms live inline in the lesson prose and in example code boxes. */
.gloss-term {
  cursor: pointer;
  border-radius: 4px;
  border-bottom: 1.5px dotted rgba(76, 201, 255, 0.55);
  padding: 0 1px;
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.codebox .gloss-term { color: #8ad4ff; border-bottom-color: rgba(138, 212, 255, 0.5); }
.gloss-term:hover,
.gloss-term.gloss-open { background: rgba(76, 201, 255, 0.20); }
/* inline <code> chips that became terms keep their chip look, just add the hint */
code.gloss-term { border-bottom: 1.5px dotted rgba(76, 201, 255, 0.7); }

.gloss-pop {
  position: fixed;
  z-index: 3000;
  max-width: 300px;
  background: #131a3a; /* opaque so lesson text never bleeds through the card */
  border: 1px solid rgba(76, 201, 255, 0.45);
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.7), 0 0 22px rgba(76, 201, 255, 0.12);
  animation: gloss-pop-in 0.14s ease-out;
}
@keyframes gloss-pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.gloss-pop-x {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.gloss-pop-x:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.gloss-pop-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--blue);
  font-size: 1.02rem;
  margin: 0 26px 6px 0;
}
.gloss-pop-short { font-size: 0.95rem; line-height: 1.45; color: var(--text); margin-bottom: 10px; }
.gloss-pop-ex {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #d7e3ff;
  background: #0d1330;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  white-space: pre-wrap;
}
/* "Tap to learn" chip shown under a console error — a gentle way out of a block. */
.err-tip {
  display: inline-block;
  margin: 6px 0 2px;
  padding: 4px 12px;
  border: 1px solid rgba(76, 201, 255, 0.5);
  border-radius: var(--radius-pill);
  background: rgba(76, 201, 255, 0.10);
  color: #8ad4ff;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
}
.err-tip:hover, .err-tip.gloss-open { background: rgba(76, 201, 255, 0.22); }

/* editor */
.editor-card { padding: 0; overflow: hidden; }
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.editor-toolbar .dot { width: 11px; height: 11px; border-radius: 50%; }
.editor-toolbar .title { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-dim); margin-right: auto; }
.CodeMirror {
  height: auto;
  min-height: 180px;
  background: #0d1330 !important;
  color: #e6edff !important;
  font-family: var(--font-mono) !important;
  font-size: 15px !important;
  line-height: 1.65 !important;
  padding: 8px 4px;
}
.CodeMirror-gutters { background: #0a0f28 !important; border-right: 1px solid var(--border) !important; }
.CodeMirror-linenumber { color: #4a5685 !important; }
.CodeMirror-cursor { border-left: 2px solid var(--green) !important; }
.cm-keyword { color: #c792ea !important; }
.cm-string { color: #9ce8b5 !important; }
.cm-number { color: #ffd166 !important; }
.cm-comment { color: #5d6a99 !important; font-style: italic; }
.cm-builtin, .cm-def { color: #4cc9ff !important; }
.cm-operator { color: #89b4ff !important; }
/* editor helpers: current line + bracket matching */
.CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.045) !important; }
.CodeMirror-matchingbracket {
  color: var(--gold) !important;
  font-weight: 800;
  border-bottom: 2px solid var(--gold);
}
.CodeMirror-nonmatchingbracket { color: var(--danger) !important; font-weight: 800; }

.run-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* console + turtle */
.console {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  background: #060a1c;
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  min-height: 54px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c4ffe3;
}
.console .err { color: var(--danger); }
.console .sys { color: #5d6a99; font-style: italic; }
.console-input-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.console-input-row input {
  flex: 1;
  background: #101736;
  color: var(--text);
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  outline: none;
}
#turtle-wrap {
  display: none;
  justify-content: center;
  background: #060a1c;
  border-top: 1px solid var(--border);
  padding: 14px;
}
#turtle-canvas { border-radius: 12px; overflow: hidden; background: #0d1330; }

/* challenge */
.challenge-card { border-color: rgba(255, 209, 102, 0.4); }
.challenge-card h3 { margin: 0 0 8px; color: var(--gold); }
.challenge-status { font-weight: 800; margin-top: 12px; }
.challenge-status.pass { color: var(--green); }
.challenge-status.wait { color: var(--text-dim); }
details.hint {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}
details.hint summary { cursor: pointer; font-weight: 800; color: var(--blue); }
details.hint p { margin: 10px 0 4px; }

.lesson-nav { display: flex; justify-content: space-between; margin-top: 26px; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--border);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  border: none;
  box-shadow: var(--glow-cyan);
}
.btn-run { background: var(--green); color: var(--on-accent); border: none; }
.btn-small { padding: 5px 13px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- quiz ---------- */
.quiz-q { margin-bottom: 22px; }
.quiz-q .q-text { font-weight: 800; font-size: 1.07rem; margin-bottom: 10px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  cursor: pointer;
  transition: 0.15s;
}
.quiz-opt:hover { background: var(--card-strong); }
.quiz-opt.correct { background: rgba(43, 240, 168, 0.18); border-color: var(--green); }
.quiz-opt.wrong { background: rgba(255, 107, 129, 0.15); border-color: var(--danger); }
.quiz-why { font-size: 0.93rem; color: var(--text-dim); margin: 8px 2px 0; display: none; }

/* ---------- Nova's Notebook (readings) ---------- */
.read-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.read-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.read-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent-grad); }
.read-card:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.3); box-shadow: var(--shadow); }
.read-card .r-icon { font-size: 2rem; }
.read-card .r-tag { display: block; margin-top: 8px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--violet); }
.read-card h3 { margin: 4px 0 12px; font-size: 1.12rem; }
.read-card .r-meta { display: flex; justify-content: space-between; align-items: center; color: var(--text-dim); font-size: 0.85rem; font-weight: 700; }
.read-card .r-meta .r-xp { color: var(--gold); }
.read-card .r-meta .done-tag { color: var(--green); }
.read-card.read { border-color: rgba(43, 240, 168, 0.45); }

.r-tagline { color: var(--violet); font-weight: 800; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

/* shelves (sections in the Read hub) */
.shelf { margin-top: 32px; }
.shelf-head { display: flex; align-items: center; gap: 10px; font-size: 1.45rem; margin: 0 0 2px; }
.shelf-blurb { color: var(--text-dim); margin: 0 0 14px; font-size: 0.96rem; }
.read-card .r-meta { gap: 8px; }
.r-level { font-weight: 800; font-size: 0.76rem; color: var(--text-dim); }
.r-level.deeper { color: var(--violet); }
.reading-body p { font-size: 1.06rem; }
.read-more {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.95rem;
}
.read-more a { color: var(--violet); }

/* "Read first" card on world pages */
.read-firstcard {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 6px 0 2px;
  transition: 0.18s;
}
.read-firstcard:hover { background: rgba(167, 139, 250, 0.16); transform: translateX(4px); }
.read-firstcard .rf-icon { font-size: 1.8rem; flex: none; }
.read-firstcard .rf-sub { color: var(--text-dim); font-size: 0.85rem; font-weight: 700; }
.read-firstcard .rf-go { margin-left: auto; font-size: 1.3rem; color: var(--violet); }
.read-firstcard.read { border-color: rgba(43, 240, 168, 0.4); background: rgba(43, 240, 168, 0.07); }

/* ---------- badges ---------- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.badge-card {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 14px;
}
.badge-card .b-icon { font-size: 2.8rem; }
.badge-card h3 { margin: 10px 0 4px; font-size: 1.05rem; }
.badge-card p { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.badge-card { position: relative; }
.badge-card.locked { opacity: 0.45; filter: grayscale(0.7); }
.badge-card.earned { border-color: var(--color-lime); box-shadow: var(--glow-lime); background: rgba(182, 242, 92, 0.07); }
.badge-card .b-flag { position: absolute; top: 10px; right: 12px; font-size: 1rem; }

/* ---------- eyebrow label (mission/section kicker) ---------- */
.eyebrow {
  font-family: var(--font-body);
  font-weight: var(--weight-body-x);
  font-size: var(--text-label);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 4px;
}

/* ---------- cadet profile ---------- */
.cadet-head { text-align: center; padding: 14px 10px 4px; }
.cadet-head h1 { margin: 4px 0 10px; font-size: 1.8rem; }
.cadet-avatar {
  width: 116px; height: 116px;
  margin: 0 auto 14px;
  border-radius: 50%;
  padding: 6px;
  background: conic-gradient(var(--color-cyan) calc(var(--ring, 0) * 1%), var(--color-line) 0);
  box-shadow: var(--glow-cyan);
}
.cadet-avatar-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--color-card-solid);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.4rem;
}
.rank-pill {
  display: inline-block;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-card);
  border: 1px solid var(--color-line);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
}
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}
.stat-tile {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: 18px 12px;
  text-align: center;
}
.stat-tile.wide { margin-top: 12px; }
.st-num { display: block; font-family: var(--font-head); font-weight: 700; font-size: 2rem; line-height: 1; }
.st-lbl { display: block; margin-top: 6px; color: var(--color-muted); font-size: 0.8rem; font-weight: 700; }
.st-orange { color: var(--color-orange); }
.st-lime { color: var(--color-lime); }
.st-cyan { color: var(--color-cyan); }
.st-pink { color: var(--color-pink); }
.cadet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}

/* ---------- widgets (AI demos) ---------- */
.widget-stage {
  background: #0d1330;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 14px 0;
}
.widget-stage canvas { display: block; margin: 0 auto; border-radius: 10px; max-width: 100%; }
.widget-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.widget-controls .btn.selected { outline: 3px solid var(--blue); }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.word-chip {
  background: rgba(76, 201, 255, 0.14);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  cursor: pointer;
  font-size: 1rem;
  transition: 0.15s;
}
.word-chip:hover { background: rgba(76, 201, 255, 0.3); transform: translateY(-2px); }
.story-out {
  background: #060a1c;
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 60px;
  font-size: 1.05rem;
  line-height: 1.7;
}
.widget-stage textarea {
  width: 100%;
  min-height: 110px;
  background: #060a1c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  resize: vertical;
}
.knn-legend { display: flex; gap: 18px; justify-content: center; margin-top: 10px; color: var(--text-dim); font-size: 0.9rem; }

/* Robot Eyes pixel grid */
.pixel-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  max-width: 420px;
  margin: 0 auto;
  user-select: none;
  touch-action: none;
}
.pixel-cell {
  aspect-ratio: 1;
  background: #131b3f;
  border-radius: 3px;
  cursor: crosshair;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: transparent;
  transition: background 0.08s;
}
.pixel-cell.on { background: var(--green); box-shadow: 0 0 6px rgba(43, 240, 168, 0.5); }
.pixel-cell.num { color: var(--text-dim); background: #131b3f; box-shadow: none; }
.pixel-cell.num.on { color: var(--on-accent); background: var(--green); }

/* Animal guesser */
.ag-input {
  width: 100%;
  background: #060a1c;
  color: var(--text);
  border: 1px solid var(--blue);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
}
.brain-tree, .brain-tree ul { list-style: none; padding-left: 22px; margin: 4px 0; border-left: 1px dashed rgba(255,255,255,0.18); }
.brain-tree { border-left: none; padding-left: 0; margin-top: 14px; }
.brain-tree .bt-q { color: var(--blue); font-weight: 700; }
.brain-tree .bt-leaf { color: var(--green); font-weight: 700; }

/* ---------- certificate ---------- */
.certificate {
  background: linear-gradient(160deg, #101736, #0d1330);
  border: 3px solid;
  border-image: linear-gradient(100deg, var(--green), var(--blue), var(--violet)) 1;
  padding: 50px 40px;
  text-align: center;
  margin: 24px 0;
}
.certificate h1 { font-size: 2.4rem; margin: 10px 0; }
.certificate .cert-name { font-size: 2rem; color: var(--gold); font-family: var(--font-head); }

/* ---------- toast & confetti ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  background: #131b3f;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  box-shadow: var(--shadow);
  z-index: 100;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(30px); pointer-events: none; }
.toast-fox { font-size: 1.4rem; }
#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 99; }

/* ---------- parent guide ---------- */
.panel h2 { margin-top: 0; }
.panel a { color: var(--blue); }
.resource-list li { margin-bottom: 10px; }

/* ---------- Nova AI tutor ---------- */
.nova-fab {
  position: fixed;
  right: 22px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  background: var(--accent-grad);
  color: var(--on-accent);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  box-shadow: var(--glow-cyan);
  animation: novaPulse 3.5s ease-in-out infinite;
  transition: transform 0.15s;
}
.nova-fab:hover { transform: translateY(-2px) scale(1.03); }
.nova-fab-fox { font-size: 1.5rem; }
@keyframes novaPulse {
  0%, 100% { box-shadow: 0 0 22px rgba(61, 224, 224, 0.45); }
  50% { box-shadow: 0 0 34px rgba(255, 92, 203, 0.6); }
}
.nova-fab-open .nova-fab-label { display: none; }

.nova-panel {
  position: fixed;
  right: 22px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 121;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: #0d1330;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}
.nova-panel.hidden { opacity: 0; transform: translateY(20px) scale(0.98); pointer-events: none; }

.nova-head {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: var(--accent-grad);
  color: var(--on-accent);
}
.nova-head-title { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; }
.nova-head-title small { font-weight: 600; opacity: 0.7; font-size: 0.72rem; display: block; }
.nova-head-actions { margin-left: auto; display: flex; gap: 4px; }
.nova-icon {
  border: none;
  background: rgba(7, 18, 43, 0.12);
  color: var(--on-accent);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.nova-icon:hover { background: rgba(7, 18, 43, 0.25); }

.nova-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nova-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.nova-bubble code {
  font-family: var(--font-mono);
  background: rgba(76, 201, 255, 0.16);
  color: var(--blue);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.85em;
}
.nova-bubble pre {
  background: #060a1c;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.nova-bubble pre code { background: none; color: #c4ffe3; padding: 0; }
.nova-nova { align-self: flex-start; background: var(--card-strong); border: 1px solid var(--border); border-top-left-radius: 4px; }
.nova-user { align-self: flex-end; background: rgba(76, 201, 255, 0.16); border: 1px solid rgba(76, 201, 255, 0.3); border-top-right-radius: 4px; }
.nova-error { border-color: var(--danger); }

.nova-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.nova-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: novaBlink 1.2s infinite; }
.nova-typing i:nth-child(2) { animation-delay: 0.2s; }
.nova-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes novaBlink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.nova-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.nova-chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}
.nova-chip:hover { background: var(--card-strong); transform: translateY(-1px); }

.nova-input {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.nova-input textarea {
  flex: 1;
  resize: none;
  background: #060a1c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  max-height: 120px;
}
.nova-input textarea:focus { border-color: var(--blue); }
.nova-send {
  border: none;
  background: var(--green);
  color: var(--on-accent);
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  flex: none;
}
.nova-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* settings modal */
.nova-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(5, 8, 20, 0.7);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.nova-modal {
  width: 480px;
  max-width: 100%;
  background: #101736;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.nova-modal h3 { margin: 0 0 12px; }
.nova-firstrun {
  background: rgba(43, 240, 168, 0.1);
  border: 1px solid rgba(43, 240, 168, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.nova-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.nova-presets-label { font-size: 0.82rem; color: var(--text-dim); font-weight: 700; margin-right: 2px; }
.nova-preset {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}
.nova-preset:hover { background: var(--card-strong); }
.nova-preset.on { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; }
.nova-modal label { display: block; font-weight: 700; font-size: 0.88rem; margin-top: 14px; }
.nova-modal input {
  width: 100%;
  margin-top: 6px;
  background: #060a1c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
}
.nova-modal input:focus { border-color: var(--blue); }
.nova-hint { font-size: 0.82rem; color: var(--text-dim); margin: 14px 0 0; line-height: 1.6; }
.nova-hint code { font-family: var(--font-mono); background: rgba(76,201,255,0.13); color: var(--blue); padding: 1px 5px; border-radius: 5px; }
.nova-hint a { color: var(--blue); }
.nova-modal-status { min-height: 20px; font-size: 0.86rem; margin-top: 12px; font-weight: 700; }
.nova-modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }

@media (max-width: 760px) {
  .nova-panel { width: calc(100vw - 24px); height: auto; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .nova-fab { right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .brand-name { font-size: 1.05rem; }
  body { font-size: 16px; }
}

@media print {
  .sky, .topbar, .tabbar, .footer, .toast, .nova-fab, .lesson-nav, .btn { display: none !important; }
  body { background: white; color: black; }
  .certificate { border: 3px solid #333; color: #111; background: white; }
  .certificate .grad-text, .certificate .cert-name { color: #1a6b54 !important; -webkit-text-fill-color: #1a6b54; }
}

/* ---------- motion ---------- */
/* earned badges scale in with a gentle overshoot when the grid renders */
.badge-card.earned { animation: badge-pop 0.5s var(--ease-out, ease-out) both; }
@keyframes badge-pop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

/* Respect reduced-motion: keep the UI calm, show end-states, no looping motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .glow-veil { animation: none; }
  .node-current .node-disc::after { display: none; }
  .nova-bot .nb-eye { animation: none; }
  .m8-ball.shaking, .sb-float, .pod-crown { animation: none !important; }
  .pod-bar { transition-duration: 0.001ms !important; }
}

/* ============================================================
   Mission Stage — animated scenes built from print() output
   ============================================================ */
.stage-card {
  display: flex;
  justify-content: center;
  background: #0d1330;
  border-top: 1px solid var(--border);
  padding: 18px;
}
.stage-card.hidden { display: none; }
.scene { width: 100%; max-width: 460px; }

/* ---- magic8: a shake-and-reveal 8-ball ---- */
.scene-magic8 { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 6px 0; }
.m8-ball {
  position: relative;
  width: 168px; height: 168px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3f5c, #0a0c18 70%);
  box-shadow: inset -8px -10px 26px rgba(0,0,0,.6), 0 12px 26px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.m8-eight {
  width: 64px; height: 64px; border-radius: 50%;
  background: #fff; color: #111;
  font: 800 30px/64px var(--font-display, sans-serif); text-align: center;
  transition: opacity .3s;
}
.m8-window {
  position: absolute; width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, #2b6cff, #0a1a55);
  clip-path: polygon(50% 10%, 92% 86%, 8% 86%);
  opacity: 0; transform: scale(.55); transition: opacity .45s, transform .45s;
}
.m8-answer {
  color: #e7f3ff; font: 700 13px/1.25 var(--font-body, sans-serif);
  text-align: center; padding: 0 6px; max-width: 86px; transform: translateY(12px);
}
.m8-ball.revealed .m8-eight { opacity: 0; }
.m8-ball.revealed .m8-window { opacity: 1; transform: scale(1); }
.m8-ball.shaking { animation: m8-shake .12s linear infinite; }
@keyframes m8-shake {
  0%,100% { transform: translate(0,0) rotate(0); }
  25% { transform: translate(-4px,2px) rotate(-3deg); }
  50% { transform: translate(3px,-3px) rotate(2deg); }
  75% { transform: translate(-2px,3px) rotate(-1deg); }
}

/* ---- podium: scoreboard bars that grow to score ---- */
.scene-podium { width: 100%; }
.pod-bars { display: flex; align-items: flex-end; justify-content: center; gap: 14px; height: 210px; padding: 6px 4px 0; }
.pod-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 0 1 72px; height: 100%; }
.pod-crown { height: 22px; font-size: 18px; animation: crown-bob 1.5s ease-in-out infinite; }
.pod-score { font: 800 15px var(--font-display, sans-serif); color: var(--color-ink, #fff); margin-bottom: 4px; }
.pod-bar {
  width: 46px; height: 0; border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, var(--color-cyan, #3DE0E0), var(--color-violet, #8C7CFF));
  box-shadow: 0 0 16px rgba(61,224,224,.4);
  transition: height .8s cubic-bezier(.2,.8,.2,1);
}
.pod-col:first-child .pod-bar { background: linear-gradient(180deg, #ffd76b, #ff9f45); box-shadow: 0 0 18px rgba(255,159,69,.5); }
.pod-name { margin-top: 8px; font: 700 12px var(--font-body, sans-serif); color: var(--color-muted, #A99FD6); text-align: center; max-width: 84px; word-break: break-word; }
@keyframes crown-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ---- storybook: typewriter story page with floating emoji ---- */
.scene-storybook {
  position: relative; width: 100%;
  background: linear-gradient(180deg, #241a4f, #1a1340);
  border: 1px solid var(--color-line, rgba(255,255,255,.12));
  border-radius: var(--radius-lg, 18px);
  padding: 22px 22px 26px; overflow: hidden;
}
.sb-title { margin: 0 0 10px; color: var(--color-lime, #B6F25C); font: 800 18px var(--font-display, sans-serif); text-align: center; }
.sb-text { margin: 0; color: #f0f0f7; font: 500 15px/1.7 var(--font-body, sans-serif); white-space: pre-wrap; min-height: 3em; }
.sb-deco { position: absolute; inset: 0; pointer-events: none; }
.sb-float { position: absolute; bottom: -22px; font-size: 20px; opacity: 0; animation: sb-rise 4.2s ease-in forwards; }
@keyframes sb-rise {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: .9; }
  100% { transform: translateY(-185px); opacity: 0; }
}

/* ---- dice: faces with pips + total ---- */
.scene-dice { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; }
.dice-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.die {
  width: 76px; height: 76px; padding: 10px; border-radius: 16px;
  background: linear-gradient(150deg, #ffffff, #d7dcf0);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,.15), 0 8px 18px rgba(0,0,0,.4);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px;
  animation: die-roll .5s cubic-bezier(.2,.8,.2,1) both;
}
.die .pip { width: 100%; height: 100%; border-radius: 50%; background: transparent; }
.die .pip.on { background: radial-gradient(circle at 35% 30%, #3a3f5c, #0a0c18); }
.dice-total { color: var(--color-ink, #fff); font: 700 15px var(--font-body, sans-serif); }
.dice-total b { color: var(--color-lime, #B6F25C); font-size: 20px; }
@keyframes die-roll {
  0% { transform: rotate(-180deg) scale(.4); opacity: 0; }
  100% { transform: rotate(0) scale(1); opacity: 1; }
}

/* ---- rps: robot vs you + verdict banner ---- */
.scene-rps { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 6px 0; }
.rps-hands { display: flex; align-items: center; gap: 22px; }
.rps-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rps-hand { font-size: 54px; line-height: 1; animation: rps-bounce .5s ease both; }
.rps-who { font: 700 12px var(--font-body, sans-serif); color: var(--color-muted, #A99FD6); }
.rps-vs { font: 800 16px var(--font-display, sans-serif); color: var(--color-muted, #A99FD6); }
.rps-banner { font: 800 20px var(--font-display, sans-serif); padding: 8px 22px; border-radius: var(--radius-pill, 999px); animation: rps-pop .4s ease both .25s; }
.rps-banner.win { color: #08231a; background: var(--color-lime, #B6F25C); }
.rps-banner.lose { color: #fff; background: var(--color-pink, #FF5CCB); }
.rps-banner.tie { color: var(--color-ink, #fff); background: rgba(255,255,255,.12); }
@keyframes rps-bounce { 0% { transform: translateY(-14px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes rps-pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---- chat: stack of bot speech bubbles ---- */
.scene-chat { width: 100%; }
.chat-head { display: flex; align-items: center; gap: 8px; font: 800 14px var(--font-display, sans-serif); color: var(--color-cyan, #3DE0E0); margin-bottom: 10px; }
.chat-head .chat-ico { font-size: 18px; }
.chat-stream { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.chat-bubble {
  max-width: 85%; padding: 9px 14px;
  background: var(--color-card-solid, #251B58);
  border: 1px solid var(--color-line, rgba(255,255,255,.12));
  border-radius: 6px 16px 16px 16px;
  color: #f0f0f7; font: 500 14px/1.4 var(--font-body, sans-serif);
  animation: bubble-in .35s ease both;
}
.chat-bubble.bot { align-self: flex-start; }
.chat-bubble.user {
  align-self: flex-end;
  background: var(--color-cyan, #3DE0E0); color: #07232a;
  border-color: transparent; border-radius: 16px 16px 6px 16px;
}
@keyframes bubble-in { 0% { transform: translateY(8px) scale(.96); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }

/* ---- theater: generic prettified output panel ---- */
.scene-theater {
  position: relative; width: 100%;
  background: linear-gradient(180deg, #101736, #0a0e22);
  border: 1px solid var(--color-line, rgba(255,255,255,.12));
  border-radius: var(--radius-lg, 18px);
  padding: 16px 18px 20px; overflow: hidden;
}
.th-head { display: flex; align-items: center; gap: 8px; font: 800 13px var(--font-display, sans-serif); color: var(--color-cyan, #3DE0E0); margin-bottom: 8px; }
.th-head .nova-bot { width: 22px; height: 22px; }
.th-text { margin: 0; color: #d8ffe9; font: 500 15px/1.6 var(--font-mono, monospace); white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
.th-deco { position: absolute; inset: 0; pointer-events: none; }

/* theater "stat card" layout (auto-detected label:value output) */
.th-rows { display: flex; flex-direction: column; gap: 8px; }
.th-row { display: grid; grid-template-columns: minmax(72px, 30%) 1fr auto; align-items: center; gap: 10px; }
.th-label { color: var(--color-muted, #A99FD6); font: 700 13px var(--font-body, sans-serif); text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-track { height: 12px; border-radius: var(--radius-pill, 999px); background: rgba(255,255,255,.08); overflow: hidden; }
.th-bar {
  display: block; height: 100%; width: 0; border-radius: var(--radius-pill, 999px);
  background: linear-gradient(90deg, var(--color-cyan, #3DE0E0), var(--color-violet, #8C7CFF));
  transition: width .7s cubic-bezier(.2,.8,.2,1);
}
.th-spacer { height: 1px; }
.th-val { color: var(--color-ink, #fff); font: 800 14px var(--font-mono, monospace); justify-self: end; }

@media (prefers-reduced-motion: reduce) {
  .die, .rps-hand, .rps-banner, .chat-bubble { animation: none !important; }
  .th-bar { transition-duration: 0.001ms !important; }
}

/* ═══════════════════ Flight Plan (study plan / timeline) ═══════════════════ */

/* Entry CTA on the Journey (home) screen */
.plan-cta {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 18px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: border-color var(--dur-tap) var(--ease-out), transform var(--dur-tap) var(--ease-out);
}
.plan-cta:hover { border-color: var(--color-cyan); transform: translateY(-1px); }
.plan-cta .pc-ico { font-size: 1.7rem; }
.plan-cta .pc-body { flex: 1; line-height: 1.3; }
.plan-cta .pc-sub { color: var(--text-dim); font-size: 0.85rem; font-weight: 700; }
.plan-cta .pc-go { color: var(--color-cyan); font-size: 1.3rem; font-weight: 800; }

/* Pace picker */
.pace-prompt { margin: 4px 0 10px; color: var(--text-dim); font-weight: 700; font-size: 0.92rem; }
.pace-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .pace-picker { grid-template-columns: 1fr; } }
.pace-pill {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 12px 14px; cursor: pointer;
  background: rgba(255,255,255,0.04); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-body); transition: border-color var(--dur-tap) var(--ease-out), background var(--dur-tap) var(--ease-out);
}
.pace-pill:hover { border-color: var(--color-violet); }
.pace-pill.selected { border-color: var(--color-cyan); background: rgba(61,224,224,0.10); box-shadow: var(--glow-cyan); }
.pace-pill .pp-emoji { font-size: 1.4rem; }
.pace-pill .pp-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.pace-pill .pp-rhythm { color: var(--color-cyan); font-weight: 800; font-size: 0.8rem; }
.pace-pill .pp-blurb { color: var(--text-dim); font-size: 0.82rem; font-weight: 600; line-height: 1.25; }
.timeline-line { margin: 14px 0 0; font-size: 1rem; line-height: 1.4; }
.timeline-line b { color: var(--color-lime); }

/* Mission cards */
.mission-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.mission-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 16px 12px; box-shadow: var(--shadow);
}
.mission-card.current { border-color: var(--color-pink); box-shadow: var(--glow-pink); }
.mission-card.done { opacity: 0.85; }
.mc-head { display: flex; align-items: flex-start; gap: 12px; }
.mc-emoji { font-size: 1.9rem; line-height: 1; }
.mc-title { flex: 1; }
.mc-title h3 { margin: 0 0 3px; font-size: 1.15rem; }
.mc-blurb { margin: 0; color: var(--text-dim); font-size: 0.9rem; line-height: 1.35; }
.mc-time { text-align: right; color: var(--color-lime); font-weight: 800; font-size: 0.9rem; white-space: nowrap; }
.mc-time .mc-frac { color: var(--text-dim); font-weight: 700; font-size: 0.82rem; }
.mc-flag { font-size: 0.72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.mc-flag.here { background: var(--color-pink); color: #2a0a22; }
.mc-flag.done { background: rgba(61,224,224,0.18); color: var(--color-cyan); }
.mc-kid { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 8px 10px;
  background: rgba(140,124,255,0.10); border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text); }
.mc-kid .nova-bot { width: 26px; height: 26px; flex: 0 0 auto; }

/* World rows inside a mission */
.pw-list { display: flex; flex-direction: column; gap: 6px; }
.pw-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); text-decoration: none; color: var(--text);
  background: rgba(255,255,255,0.03); transition: background var(--dur-tap) var(--ease-out);
}
.pw-row:hover { background: rgba(255,255,255,0.08); }
.pw-row.done .pw-name { color: var(--text-dim); }
.pw-emoji { font-size: 1.2rem; width: 1.6rem; text-align: center; }
.pw-body { flex: 1; min-width: 0; }
.pw-name { font-weight: 700; font-size: 0.95rem; }
.pw-row .mini-track { margin-top: 6px; }
.pw-meta { color: var(--text-dim); font-weight: 700; font-size: 0.8rem; white-space: nowrap; }

/* Parent handoff card + guide pace table */
.plan-parent p { margin: 0 0 10px; }
.pace-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.92rem; }
.pace-table th, .pace-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.pace-table th { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
