/* =====================================================================
   CODE GOBLINS — stylesheet
   No webfonts, no CDN, no external anything. Just a very green cave.
   ===================================================================== */

:root {
  --bg: #080A10;
  --bg-2: #0D1119;
  --panel: rgba(20, 26, 38, .82);
  --panel-solid: #141A26;
  --line: rgba(124, 240, 58, .16);
  --line-soft: rgba(255, 255, 255, .08);

  --green: #7CF03A;
  --green-dk: #4BA318;
  --purple: #C77DFF;
  --cyan: #54F2F2;
  --gold: #FFD84D;
  --pink: #FF5CA8;
  --red: #FF4D5E;
  --blue: #4DA6FF;

  --ink: #EAF2E4;
  --ink-dim: #9AA6B8;
  --ink-faint: #828FA6;   /* was #64708A — only 3.5:1 on panels, under WCAG AA */

  --font-display: 'Arial Black', 'Arial Bold', 'Helvetica Neue', system-ui, sans-serif;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --r: 16px;
  --r-lg: 24px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --topbar-h: 64px;
}

/* ------------------------------------------------------------------ */
/* base                                                                */
/* ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* layered cave light */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(1100px 700px at 12% -8%, rgba(124, 240, 58, .17), transparent 60%),
    radial-gradient(900px 620px at 92% 4%, rgba(199, 125, 255, .16), transparent 62%),
    radial-gradient(1000px 800px at 50% 108%, rgba(84, 242, 242, .12), transparent 60%),
    linear-gradient(180deg, #080A10 0%, #0A0E16 45%, #06080D 100%);
}
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: -2;
  pointer-events: none;
  opacity: .5;
  background:
    conic-gradient(from 0deg at 50% 50%,
      rgba(124, 240, 58, .07), rgba(199, 125, 255, .07), rgba(84, 242, 242, .07), rgba(124, 240, 58, .07));
  animation: aurora 34s linear infinite;
}
@keyframes aurora { to { transform: rotate(360deg); } }

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

::selection { background: rgba(124, 240, 58, .32); color: #fff; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1180px, 92vw); margin-inline: auto; }
.dim { color: var(--ink-dim); }
.center { text-align: center; }

h1, h2, h3 { line-height: 1.08; margin: 0 0 .5em; }

/* focus visibility, because kids use keyboards and tablets too */
:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ */
/* wordmark                                                            */
/* ------------------------------------------------------------------ */
.logo {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: -.02em;
  text-transform: uppercase;
  line-height: .92;
  display: inline-block;
}
.logo .l1 { display: block; }
.logo .l2 { display: block; }

.logo-gradient {
  background: linear-gradient(96deg, #B9FF6B 0%, var(--green) 26%, var(--cyan) 55%, var(--purple) 82%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-size: 220% 100%;
  animation: slide-grad 9s ease-in-out infinite;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .55)) drop-shadow(0 0 26px rgba(124, 240, 58, .38));
}
@keyframes slide-grad {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ------------------------------------------------------------------ */
/* top bar                                                             */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(12px, 3vw, 28px);
  background: rgba(8, 10, 16, .78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: -.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; }
.topbar .brand svg { flex: none; }
.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
  flex-wrap: wrap;
}
.topbar nav a {
  color: var(--ink-dim);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 13px;
  border-radius: 10px;
  transition: .16s;
  white-space: nowrap;
}
.topbar nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .07); text-decoration: none; }
.topbar nav a.active { color: #061006; background: var(--green); }
.topbar .spacer { flex: 1; }

.stats { display: flex; gap: 8px; align-items: center; }
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-soft);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-pill.xp { color: var(--green); border-color: rgba(124, 240, 58, .34); }
.stat-pill.gold { color: var(--gold); border-color: rgba(255, 216, 77, .34); }
.stat-pill.rank { color: var(--purple); border-color: rgba(199, 125, 255, .34); }
.stat-pill .ico { font-size: 15px; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  font-size: 17px;
  transition: .16s;
  flex: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, .13); transform: translateY(-2px); }
.icon-btn.off { opacity: .42; }

/* ------------------------------------------------------------------ */
/* buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  --btn-bg: var(--green);
  --btn-ink: #08140A;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border: none;
  border-radius: 14px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--font);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .01em;
  cursor: pointer;
  position: relative;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .45), 0 12px 28px rgba(124, 240, 58, .26);
  transition: transform .12s, box-shadow .12s, filter .12s;
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); text-decoration: none; box-shadow: 0 7px 0 rgba(0, 0, 0, .45), 0 16px 34px rgba(124, 240, 58, .34); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .45), 0 6px 14px rgba(124, 240, 58, .2); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.5); }
.btn.big { padding: 19px 40px; font-size: 20px; border-radius: 17px; }
.btn.purple { --btn-bg: var(--purple); --btn-ink: #170726; box-shadow: 0 5px 0 rgba(0, 0, 0, .45), 0 12px 28px rgba(199, 125, 255, .3); }
.btn.cyan { --btn-bg: var(--cyan); --btn-ink: #052222; box-shadow: 0 5px 0 rgba(0, 0, 0, .45), 0 12px 28px rgba(84, 242, 242, .28); }
.btn.gold { --btn-bg: var(--gold); --btn-ink: #241A00; box-shadow: 0 5px 0 rgba(0, 0, 0, .45), 0 12px 28px rgba(255, 216, 77, .28); }
.btn.ghost {
  background: rgba(255, 255, 255, .07);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255, 255, 255, .14); box-shadow: none; }
.btn.sm { padding: 9px 16px; font-size: 14px; border-radius: 11px; box-shadow: 0 3px 0 rgba(0, 0, 0, .4); }

/* ------------------------------------------------------------------ */
/* goblin art                                                          */
/* ------------------------------------------------------------------ */
.goblin-svg { overflow: visible; display: block; }
.goblin-svg .g-body { transform-origin: 100px 150px; }
.goblin-idle .g-body { animation: bob 3.4s ease-in-out infinite; }
.goblin-idle .g-shadow { animation: shadow-pulse 3.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-7px) rotate(-1.6deg); }
  70% { transform: translateY(-3px) rotate(1.4deg); }
}
@keyframes shadow-pulse {
  0%, 100% { transform: scaleX(1); opacity: .35; }
  35% { transform: scaleX(.86); opacity: .22; }
}
.goblin-idle .g-blink {
  animation: blink 5.4s infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  94%, 96% { transform: scaleY(.08); }
}
.goblin-idle .g-ear-l { animation: ear-l 4.6s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom right; }
.goblin-idle .g-ear-r { animation: ear-r 4.6s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom left; }
@keyframes ear-l { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-11deg); } 86% { transform: rotate(4deg); } }
@keyframes ear-r { 0%, 74%, 100% { transform: rotate(0); } 82% { transform: rotate(11deg); } 90% { transform: rotate(-4deg); } }
.goblin-idle .g-spin { animation: spin-eye 6s linear infinite; }
@keyframes spin-eye { to { transform: rotate(360deg); } }
.goblin-idle .g-glitch-eye { animation: glitch-eye 2.6s steps(1) infinite; }
.goblin-idle .g-glitch-eye2 { animation-delay: .3s; }
@keyframes glitch-eye {
  0%, 88%, 100% { transform: translate(0, 0); opacity: 1; }
  90% { transform: translate(4px, -2px); opacity: .75; }
  93% { transform: translate(-5px, 2px); opacity: 1; }
  96% { transform: translate(2px, 0); opacity: .6; }
}
.goblin-chip { vertical-align: middle; }

/* ---- gaze: pupils and face drift toward the pointer ---- */
.goblin-svg .g-pupil,
.goblin-svg .g-face {
  transition: transform .28s cubic-bezier(.25, .8, .35, 1);
  will-change: transform;
}

/* ---- performances ------------------------------------------------- */
.goblin-svg[class*="act-"] .g-body { animation-fill-mode: both; }

.act-hop .g-body { animation: gob-hop .9s cubic-bezier(.3, 1.4, .4, 1); }
@keyframes gob-hop {
  0%, 100% { transform: translateY(0) scaleY(1); }
  18% { transform: translateY(4px) scaleY(.9); }
  46% { transform: translateY(-24px) scaleY(1.08); }
  70% { transform: translateY(3px) scaleY(.94); }
}

.act-bounce .g-body { animation: gob-bounce 1.2s ease-in-out; }
@keyframes gob-bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-11px) rotate(-7deg); }
  50% { transform: translateY(0) rotate(0); }
  75% { transform: translateY(-11px) rotate(7deg); }
}

.act-wiggle .g-body { animation: gob-wiggle 1s ease-in-out; }
@keyframes gob-wiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-9deg); }
  45% { transform: rotate(8deg); }
  70% { transform: rotate(-5deg); }
  88% { transform: rotate(3deg); }
}

.act-lookaround .g-face { animation: gob-look 1.5s ease-in-out; }
.act-lookaround .g-pupil { animation: gob-look 1.5s ease-in-out; }
@keyframes gob-look {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-7px); }
  58% { transform: translateX(7px); }
}

.act-yawn .g-body { animation: gob-yawn 1.5s ease-in-out; }
@keyframes gob-yawn {
  0%, 100% { transform: scale(1) translateY(0); }
  35% { transform: scale(1.07, .93) translateY(3px); }
  60% { transform: scale(.97, 1.06) translateY(-4px); }
}

/* the win dance */
.act-cheer .g-body { animation: gob-cheer 1.3s cubic-bezier(.3, 1.3, .4, 1); }
@keyframes gob-cheer {
  0% { transform: translateY(0) rotate(0) scale(1); }
  15% { transform: translateY(6px) scale(1.1, .88); }
  38% { transform: translateY(-34px) rotate(-14deg) scale(.95, 1.12); }
  56% { transform: translateY(-16px) rotate(13deg); }
  74% { transform: translateY(-26px) rotate(-8deg); }
  88% { transform: translateY(4px) scale(1.08, .93); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}

/* jumped-out-of-their-skin */
.act-recoil .g-body { animation: gob-recoil .7s cubic-bezier(.36, .07, .19, .97); }
@keyframes gob-recoil {
  0% { transform: translate(0, 0) scale(1); }
  14% { transform: translate(0, -16px) scale(1.12, .9); }
  32% { transform: translate(-9px, -4px) rotate(-8deg); }
  52% { transform: translate(8px, -2px) rotate(7deg); }
  72% { transform: translate(-5px, 0) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}

.act-nod .g-body { animation: gob-nod .8s ease-in-out; }
@keyframes gob-nod {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(6px) rotate(-4deg); }
  65% { transform: translateY(-2px) rotate(3deg); }
}

.act-panic .g-body { animation: gob-panic .7s linear; }
@keyframes gob-panic {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  10% { transform: translate(-4px, -6px) rotate(-6deg); }
  25% { transform: translate(5px, -9px) rotate(7deg); }
  40% { transform: translate(-6px, -3px) rotate(-8deg); }
  55% { transform: translate(4px, -7px) rotate(5deg); }
  75% { transform: translate(-3px, -2px) rotate(-3deg); }
}

/* leans toward the code while you type */
.act-lean .g-body { animation: gob-lean 1.4s ease-out; }
@keyframes gob-lean {
  0% { transform: translateX(0) rotate(0); }
  30%, 70% { transform: translateX(7px) rotate(5deg) scale(1.04); }
  100% { transform: translateX(0) rotate(0) scale(1); }
}

.act-peek .g-body { animation: gob-peek 1.1s cubic-bezier(.3, 1.3, .4, 1); }
@keyframes gob-peek {
  0% { transform: translateY(48px) scale(.85); opacity: 0; }
  60% { transform: translateY(-7px) scale(1.04); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* an interactive goblin should look interactive */
.goblin-poke { transition: transform .2s cubic-bezier(.2, 1.4, .4, 1); }
.goblin-poke:hover { transform: scale(1.06); }
.goblin-poke:active { transform: scale(.95); }

/* ------------------------------------------------------------------ */
/* hero                                                                */
/* ------------------------------------------------------------------ */
.hero {
  position: relative;
  padding: clamp(40px, 8vh, 96px) 0 clamp(48px, 9vh, 104px);
  text-align: center;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(52px, 13.5vw, 158px);
  letter-spacing: -.045em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.hero h1 .l2 { margin-top: -.09em; }
.hero .tagline {
  font-size: clamp(17px, 2.3vw, 23px);
  color: var(--ink-dim);
  max-width: 660px;
  margin: 22px auto 34px;
  font-weight: 500;
}
.hero .tagline b { color: var(--ink); font-weight: 800; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 22px; font-size: 14px; color: var(--ink-faint); }

/* the goblin lineup under the hero */
.lineup {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(-10px, 1vw, 18px);
  margin-top: 44px;
  flex-wrap: wrap;
}
.lineup .who {
  text-align: center;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3);
  cursor: default;
}
.lineup .who:hover { transform: translateY(-14px) scale(1.07); }
.lineup .who:nth-child(odd) { animation: float-a 5.5s ease-in-out infinite; }
.lineup .who:nth-child(even) { animation: float-b 6.4s ease-in-out infinite; }
/* hold still while someone is trying to poke you — a drifting target is
   genuinely hard for a small child (or anyone) to hit */
.lineup .who:hover,
.lineup .who:focus-within { animation-play-state: paused; }
@keyframes float-a { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float-b { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(4px); } }
.lineup .who {
  position: relative;
  padding-bottom: 26px;
}
.lineup .who .nm {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .02em;
  margin-top: -6px;
}
.lineup .who-link {
  position: absolute;
  left: 50%;
  bottom: -4px;
  translate: -50% 6px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
  padding: 7px 12px;          /* a real tap target, not a 19px sliver */
  border-radius: 9px;
  opacity: 0;
  transition: .24s;
}
/* keyboard users can't hover — show it whenever it's focused */
.lineup .who-link:focus-visible { opacity: 1; translate: -50% 0; }
.lineup .who:hover .who-link,
.lineup .who:focus-within .who-link { opacity: 1; translate: -50% 0; color: var(--cyan); }

/* speech puff when a goblin is poked */
.who-say {
  position: absolute;
  left: 50%;
  bottom: 100%;
  translate: -50% 0;
  max-width: 190px;
  width: max-content;
  padding: 9px 13px;
  border-radius: 13px;
  background: rgba(16, 21, 31, .97);
  border: 1px solid var(--line-soft);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: scale(.8) translateY(10px);
  transform-origin: bottom center;
  pointer-events: none;
  transition: .3s cubic-bezier(.2, 1.5, .35, 1);
  z-index: 5;
}
.who-say.show { opacity: 1; transform: none; }
.who-say::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -6px;
  translate: -50% 0;
  width: 11px; height: 11px;
  background: rgba(16, 21, 31, .97);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  transform: rotate(45deg);
}

/* ------------------------------------------------------------------ */
/* sections & cards                                                    */
/* ------------------------------------------------------------------ */
.section { padding: clamp(48px, 8vh, 92px) 0; }
.section-head { text-align: center; margin-bottom: 44px; }
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5.5vw, 54px);
  text-transform: uppercase;
  letter-spacing: -.03em;
}
.section-head p { color: var(--ink-dim); max-width: 620px; margin: 0 auto; font-size: 17px; }

/* Scoped to .has-js (set by fx.js at load) so a JS failure can never
   leave the page looking empty — without JS everything is simply visible. */
.has-js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .6s cubic-bezier(.2, .8, .3, 1), transform .6s cubic-bezier(.2, .8, .3, 1);
}
.has-js [data-reveal].revealed { opacity: 1; transform: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 26px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.2), border-color .28s, box-shadow .28s;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 220px at var(--mx, 50%) var(--my, 0%), var(--card-glow, rgba(124, 240, 58, .16)), transparent 70%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.card:hover { transform: translateY(-6px); border-color: var(--card-line, rgba(124, 240, 58, .4)); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }

.grid { display: grid; gap: 20px; }
.grid.g3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.g4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* goblin bio card */
.gob-card { text-align: center; }
.gob-card .art { display: flex; justify-content: center; margin-bottom: 10px; }
.gob-card h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 24px;
  letter-spacing: -.02em;
  margin-bottom: 2px;
}
.gob-card .role {
  color: var(--ink-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 800;
  margin-bottom: 12px;
}
.gob-card .blurb { font-size: 15px; color: var(--ink-dim); }
.gob-card .quote {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-soft);
  font-style: italic;
  font-size: 14px;
  color: var(--gold);
}
.gob-meta { text-align: left; margin-top: 14px; font-size: 14px; }
.gob-meta div { margin-bottom: 6px; }
.gob-meta b { color: var(--ink); }

/* feature card */
.feat .ico { font-size: 34px; margin-bottom: 10px; display: block; }
.feat h3 { font-size: 19px; font-weight: 900; }
.feat p { color: var(--ink-dim); font-size: 15px; margin: 0; }

/* ------------------------------------------------------------------ */
/* chapter / quest map                                                 */
/* ------------------------------------------------------------------ */
.map-head {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 26px;
  margin-bottom: 30px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-soft);
}
.map-head .rank-block { flex: 1; min-width: 240px; }
.map-head .rank-name {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 34px);
  text-transform: uppercase;
  letter-spacing: -.02em;
}
.progress {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line-soft);
}
.progress .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 18px rgba(124, 240, 58, .6);
  transition: width .9s cubic-bezier(.2, .9, .3, 1);
  position: relative;
  overflow: hidden;
}
.progress .fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .5) 50%, transparent 80%);
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { to { transform: translateX(220%); } }

/* ------------------------------------------------------------------ */
/* the trail — chapters strung along a winding path                    */
/* ------------------------------------------------------------------ */
.trail { position: relative; padding-left: 0; }
.trail::before {
  content: '';
  position: absolute;
  left: 45px;
  top: 40px;
  bottom: 60px;
  width: 4px;
  border-radius: 4px;
  background: repeating-linear-gradient(180deg,
    rgba(255, 255, 255, .16) 0 12px, transparent 12px 24px);
}
/* the lit part of the trail, as far as the player has walked */
.trail::after {
  content: '';
  position: absolute;
  left: 45px;
  top: 40px;
  width: 4px;
  height: var(--trail, 0%);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--green), var(--cyan), var(--purple));
  box-shadow: 0 0 18px rgba(124, 240, 58, .55);
  transition: height 1.2s cubic-bezier(.2, .9, .3, 1);
}

.chapter {
  margin-bottom: 34px;
  position: relative;
  padding-left: 108px;
}
.station {
  position: absolute;
  left: 0;
  top: 8px;
  width: 94px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.station .ring {
  width: 78px; height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, var(--ch-tint, rgba(124, 240, 58, .3)), rgba(10, 13, 20, .96));
  border: 3px solid var(--ch-line, rgba(124, 240, 58, .5));
  box-shadow: 0 0 0 6px rgba(8, 10, 16, .9), 0 8px 26px rgba(0, 0, 0, .5);
  transition: transform .3s cubic-bezier(.2, 1.3, .4, 1), box-shadow .3s;
}
.station .ring svg { width: 60px; height: 60px; }
.station:hover .ring { transform: scale(1.09) rotate(-4deg); }
.chapter.locked .station .ring { filter: grayscale(1) brightness(.55); }
.chapter.complete .station .ring {
  box-shadow: 0 0 0 6px rgba(8, 10, 16, .9), 0 0 30px var(--ch-line, rgba(124, 240, 58, .6));
  animation: station-glow 3.4s ease-in-out infinite;
}
@keyframes station-glow {
  0%, 100% { box-shadow: 0 0 0 6px rgba(8, 10, 16, .9), 0 0 22px var(--ch-line, rgba(124, 240, 58, .5)); }
  50% { box-shadow: 0 0 0 6px rgba(8, 10, 16, .9), 0 0 44px var(--ch-line, rgba(124, 240, 58, .85)); }
}
.station .st-num {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ink-faint);
}
.station .st-tick {
  position: absolute;
  top: -4px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: #06120A;
  display: grid; place-items: center;
  font-weight: 900;
  font-size: 14px;
  border: 3px solid var(--bg);
}

@media (max-width: 720px) {
  .trail::before, .trail::after { left: 27px; }
  .chapter { padding-left: 68px; }
  .station { width: 58px; }
  .station .ring { width: 54px; height: 54px; border-width: 2px; }
  .station .ring svg { width: 40px; height: 40px; }
  .station .st-tick { width: 20px; height: 20px; font-size: 11px; right: -2px; }
}
.chapter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(120deg, var(--ch-tint, rgba(124, 240, 58, .2)), transparent 65%), var(--panel-solid);
  border: 1px solid var(--line-soft);
  border-bottom: none;
  flex-wrap: wrap;
}
.chapter-bar .num {
  font-family: var(--font-display);
  font-size: 34px;
  opacity: .3;
  line-height: 1;
}
.chapter-bar h2 {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 28px);
  text-transform: uppercase;
  letter-spacing: -.02em;
  margin: 0;
}
.chapter-bar .sub { font-size: 14px; color: var(--ink-dim); }
.chapter-bar .cbadge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  font-size: 13px;
  font-weight: 800;
}
.chapter-bar .cbadge.got { background: rgba(255, 216, 77, .18); color: var(--gold); border: 1px solid rgba(255, 216, 77, .4); }

.quest-list {
  border: 1px solid var(--line-soft);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: rgba(13, 17, 25, .7);
  overflow: hidden;
}
.quest {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 22px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  text-decoration: none;
  color: inherit;
  transition: background .18s, padding-left .18s;
  position: relative;
}
.quest:first-child { border-top: none; }
.quest:hover { background: rgba(124, 240, 58, .09); padding-left: 28px; text-decoration: none; }
.quest.locked { opacity: .42; pointer-events: none; }
.quest.done { background: rgba(124, 240, 58, .05); }

.quest .node {
  width: 42px; height: 42px;
  flex: none;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  background: rgba(255, 255, 255, .07);
  border: 2px solid var(--line-soft);
}
.quest.done .node { background: var(--green); color: #061006; border-color: var(--green); box-shadow: 0 0 18px rgba(124, 240, 58, .5); }
.quest.next .node { border-color: var(--cyan); color: var(--cyan); animation: pulse-node 1.9s infinite; }
@keyframes pulse-node {
  0%, 100% { box-shadow: 0 0 0 0 rgba(84, 242, 242, .55); }
  70% { box-shadow: 0 0 0 12px rgba(84, 242, 242, 0); }
}
.quest .info { flex: 1; min-width: 0; }
.quest .t { font-weight: 800; font-size: 16px; }
.quest .c { font-size: 13px; color: var(--ink-faint); }
.quest .xp-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quest .boss-tag {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  padding: 4px 9px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  color: #1A0710;
  text-transform: uppercase;
}

/* badge shelf */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.badge-item {
  text-align: center;
  padding: 18px 12px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line-soft);
  transition: .22s;
}
.badge-item .bi { font-size: 34px; display: block; margin-bottom: 6px; filter: grayscale(1) brightness(.5); }
.badge-item .bn { font-weight: 800; font-size: 14px; color: var(--ink-faint); }
.badge-item .bd { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.badge-item.owned { background: rgba(255, 216, 77, .1); border-color: rgba(255, 216, 77, .38); }
.badge-item.owned .bi { filter: none; animation: badge-bob 3s ease-in-out infinite; }
.badge-item.owned .bn { color: var(--gold); }
.badge-item.owned .bd { color: var(--ink-dim); }
.badge-item.owned:hover { transform: translateY(-5px) scale(1.04); }
@keyframes badge-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }

/* ------------------------------------------------------------------ */
/* lesson layout                                                       */
/* ------------------------------------------------------------------ */
.lesson-shell {
  display: grid;
  grid-template-columns: minmax(330px, 30%) 1fr;
  gap: 18px;
  padding: 18px clamp(12px, 2.5vw, 26px) 26px;
  align-items: start;
}
@media (max-width: 940px) {
  .lesson-shell { grid-template-columns: 1fr; padding-top: 10px; }

  /* one panel at a time on a phone — no more endless scrolling between
     the instructions and the code box */
  /* .lesson-shell prefix so this beats the base `.lesson-tabs{display:none}`
     that is declared further down the file */
  .lesson-shell .lesson-tabs {
    display: flex;
    gap: 7px;
    position: sticky;
    top: calc(var(--topbar-h) + 46px);
    z-index: 35;
    padding: 8px 0;
    background: linear-gradient(180deg, var(--bg) 65%, transparent);
  }
  .lesson-tabs button {
    flex: 1;
    padding: 12px 10px;
    border-radius: 12px;
    border: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, .05);
    color: var(--ink-dim);
    font-family: inherit;
    font-weight: 800;
    font-size: 14.5px;
    cursor: pointer;
    transition: .18s;
  }
  .lesson-tabs button.active {
    background: var(--green);
    color: #06120A;
    border-color: var(--green);
    box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
  }
  .lesson-shell[data-tab="story"] #code-panel { display: none; }
  .lesson-shell[data-tab="code"] #story-panel { display: none; }

  .rail-ch { display: none; }
  .rail-dots { margin-left: 0; }
  .run-btn { flex: 1; min-width: 0; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}
.panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, .03);
}
.panel-head h2 {
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0;
  color: var(--ink-dim);
}
.panel-body { padding: 20px; }

/* story side */
.quest-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.6vw, 34px);
  text-transform: uppercase;
  letter-spacing: -.028em;
  margin: 0;
}
.quest-crumb {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 4px;
}
.speech {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: start;
  margin: 18px 0;
}
.speech .art { position: relative; }
.bubble {
  position: relative;
  background: linear-gradient(150deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  min-height: 60px;
}
.bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 26px;
  width: 16px; height: 16px;
  background: rgba(255, 255, 255, .09);
  border-left: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  transform: rotate(45deg);
}
.bubble .who {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
  color: var(--goblin-color, var(--green));
}
.bubble .say.typing::after {
  content: '▌';
  animation: caret .7s steps(1) infinite;
  color: var(--green);
}
@keyframes caret { 50% { opacity: 0; } }

.task-box {
  background: rgba(84, 242, 242, .07);
  border: 1px solid rgba(84, 242, 242, .26);
  border-radius: var(--r);
  padding: 15px 17px;
  font-size: 15px;
}
.task-box .lbl {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 7px;
}
.task-box code, .bubble code, .hint-box code, .verdict code {
  font-family: var(--mono);
  font-size: .92em;
  background: rgba(0, 0, 0, .42);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--green);
  word-break: break-word;
}
.task-box pre {
  font-family: var(--mono);
  background: rgba(0, 0, 0, .42);
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--green);
  margin: 8px 0 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.expect-box { margin-top: 14px; }
.expect-box .lbl {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 800;
  margin-bottom: 6px;
}
.expect-box pre {
  font-family: var(--mono);
  font-size: 13px;
  background: rgba(0, 0, 0, .38);
  border: 1px dashed var(--line-soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-dim);
  max-height: 190px;
  overflow: auto;
}

.hint-box {
  margin-top: 14px;
  background: rgba(255, 216, 77, .08);
  border: 1px solid rgba(255, 216, 77, .3);
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: 14.5px;
}
.hint-box .lbl {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.concept-chip {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(199, 125, 255, .16);
  border: 1px solid rgba(199, 125, 255, .34);
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
  font-family: var(--mono);
}

/* ------------------------------------------------------------------ */
/* quest rail                                                          */
/* ------------------------------------------------------------------ */
.quest-rail {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  background: rgba(8, 10, 16, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.rail-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px clamp(12px, 2.5vw, 26px);
  max-width: 1400px;
  margin-inline: auto;
}
.rail-nav {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .07);
  color: var(--ink);
  font-weight: 900;
  flex: none;
  text-decoration: none;
}
.rail-nav:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
.rail-nav.ghost { opacity: .22; pointer-events: none; }
.rail-ch {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--goblin-color, var(--green));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}
.rail-dots { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.rail-dot {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-soft);
  color: var(--ink-dim);
  text-decoration: none;
  transition: .16s;
}
.rail-dot:hover { transform: translateY(-2px); text-decoration: none; color: var(--ink); }
.rail-dot.done { background: rgba(124, 240, 58, .8); color: #06120A; border-color: var(--green); }
.rail-dot.here {
  background: var(--cyan); color: #052222; border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(84, 242, 242, .6);
  transform: scale(1.12);
}
.rail-dot.locked { opacity: .3; pointer-events: none; }

/* ------------------------------------------------------------------ */
/* mobile view tabs                                                    */
/* ------------------------------------------------------------------ */
.lesson-tabs { display: none; }
.tab-badge { display: none; }
.tab-badge.err, .tab-badge.ok {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: middle;
}
.tab-badge.err { background: var(--red); box-shadow: 0 0 9px var(--red); }
.tab-badge.ok { background: var(--green); box-shadow: 0 0 9px var(--green); }

/* ------------------------------------------------------------------ */
/* live editor status                                                  */
/* ------------------------------------------------------------------ */
.editor-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px 4px;
  font-size: 13px;
  color: var(--ink-faint);
  font-family: var(--mono);
}
.editor-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-faint);
  flex: none;
  transition: .25s;
}
.editor-status.ok { color: var(--green); }
.editor-status.ok .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.editor-status.warn { color: #FFB98A; }
.editor-status.warn .dot { background: #FF9F6B; box-shadow: 0 0 10px #FF9F6B; }
.editor-status .msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.out-label {
  font-size: 11px;
  letter-spacing: .16em;
  font-weight: 900;
  color: var(--ink-faint);
  margin-bottom: 7px;
}
.run-btn { min-width: 168px; }

/* ------------------------------------------------------------------ */
/* the Fix Goblin card                                                 */
/* ------------------------------------------------------------------ */
.fix-card {
  margin-top: 13px;
  border-radius: var(--r);
  border: 1px solid rgba(84, 242, 242, .42);
  background: linear-gradient(150deg, rgba(84, 242, 242, .13), rgba(20, 26, 38, .9));
  padding: 15px 17px;
  opacity: 0;
  transform: translateY(12px) scale(.97);
  transition: .38s cubic-bezier(.2, 1.3, .35, 1);
}
.fix-card.in { opacity: 1; transform: none; }
.fix-card.dismissed { opacity: 0; transform: translateY(-8px); }
.fix-card.applied { border-color: rgba(124, 240, 58, .55); background: linear-gradient(150deg, rgba(124, 240, 58, .14), rgba(20, 26, 38, .9)); }
.fix-head { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.fix-head svg { flex: none; animation: fix-peer 2.4s ease-in-out infinite; }
@keyframes fix-peer {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-3px); }
}
.fix-kicker { font-size: 11px; letter-spacing: .13em; font-weight: 900; color: var(--cyan); text-transform: uppercase; }
.fix-label { font-family: var(--font-display); font-size: 16px; letter-spacing: -.01em; }
.fix-why { font-size: 14.5px; color: var(--ink-dim); margin-bottom: 11px; }
.fix-why code { font-family: var(--mono); background: rgba(0, 0, 0, .45); padding: 2px 6px; border-radius: 5px; color: var(--green); }
.fix-diff { font-family: var(--mono); font-size: 13px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-soft); }
.fix-diff .dl { display: flex; gap: 10px; padding: 6px 11px; align-items: baseline; }
.fix-diff .dl .n { color: var(--ink-faint); font-size: 11px; min-width: 16px; flex: none; }
.fix-diff .dl code { white-space: pre-wrap; word-break: break-word; }
.fix-diff .before { background: rgba(255, 77, 94, .13); color: #FFC2C8; text-decoration: line-through; text-decoration-color: rgba(255, 77, 94, .6); }
.fix-diff .after { background: rgba(124, 240, 58, .13); color: #D6F5C8; }
.fix-note { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; }
.fix-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 13px; }
.fix-done { font-weight: 800; color: var(--green); font-size: 14.5px; }

.replay-btn {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 13px;
  padding: 0 5px;
  border-radius: 5px;
}
.replay-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .1); }
.win-say { display: flex; gap: 12px; align-items: center; margin-top: 6px; font-size: 15px; }
.replay-note { font-size: 13px; color: var(--ink-faint); margin-top: 10px; }
.side-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.xp-tag { color: var(--green); font-weight: 800; font-size: 13px; }

/* ------------------------------------------------------------------ */
/* editor                                                              */
/* ------------------------------------------------------------------ */
.editor {
  display: flex;
  background: #0A0D14;
  border-radius: var(--r);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.65;
  position: relative;
}
.editor-gutter {
  flex: none;
  width: 46px;
  padding: 14px 0;
  background: rgba(0, 0, 0, .38);
  color: var(--ink-faint);
  text-align: right;
  user-select: none;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
}
.editor-gutter .ln { padding-right: 11px; font-size: 12.5px; line-height: 1.65; height: calc(14.5px * 1.65); }
.editor-gutter .ln-error {
  color: #fff;
  background: var(--red);
  font-weight: 900;
  border-radius: 4px 0 0 4px;
}
.editor-area { position: relative; flex: 1; min-width: 0; }
.editor-hl, .editor-input {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
  border: none;
  letter-spacing: normal;
}
.editor-hl {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--ink);
  overflow: hidden;
}
.editor-hl code { font: inherit; }
.editor-input {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100%;
  background: transparent;
  color: transparent;
  caret-color: var(--green);
  resize: none;
  outline: none;
}
.editor-input::selection { background: rgba(124, 240, 58, .3); }
.editor.tall .editor-input, .editor.tall .editor-hl { min-height: 420px; }
.editor .editor-input, .editor .editor-hl { min-height: 300px; }

/* python token colours */
.tk-comment { color: #7A899F; font-style: italic; }  /* was #5C6B7F (3.58:1) — kids read the "change this" hints in comments */
.tk-string { color: #FFD84D; }
.tk-fslot { color: #FF9BD2; background: rgba(255, 92, 168, .12); border-radius: 3px; }
.tk-kw { color: #FF6FB5; font-weight: 700; }
.tk-builtin { color: #54F2F2; }
.tk-num { color: #B9FF6B; }
.tk-def { color: #7CF03A; font-weight: 700; }
.tk-call { color: #C77DFF; }
.tk-op { color: #FF9F6B; }
.tk-bracket { color: #8FA3BD; }
.tk-punc { color: #8FA3BD; }

/* editor toolbar */
.run-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .03);
  flex-wrap: wrap;
}
.run-bar .grow { flex: 1; }
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid var(--line-soft);
  color: var(--ink-dim);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* console output                                                      */
/* ------------------------------------------------------------------ */
.console {
  background: #06080C;
  border-radius: var(--r);
  border: 1px solid var(--line-soft);
  min-height: 130px;
  max-height: 320px;
  overflow: auto;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.console .placeholder { color: var(--ink-faint); font-style: italic; }
.console .out-line { color: #D6F5C8; }
.console .out-line.new { animation: line-in .28s ease-out backwards; }
@keyframes line-in { from { opacity: 0; transform: translateX(-9px); } }

/* These are HTML cards living inside a `white-space: pre-wrap` console.
   Without this they inherit pre-wrap and every newline + indent in the
   template markup renders as visible whitespace. */
.err-box, .fix-card { white-space: normal; }

.err-box {
  border-radius: 12px;
  border: 1px solid rgba(255, 77, 94, .45);
  background: rgba(255, 77, 94, .1);
  padding: 13px 15px;
  margin-top: 10px;
}
.err-box .et {
  font-family: var(--font-display);
  text-transform: uppercase;
  color: var(--red);
  font-size: 14px;
  letter-spacing: .05em;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.err-box .em { color: #FFD7DB; font-size: 14px; font-family: var(--font); }
.err-box .eh {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed rgba(255, 77, 94, .3);
  color: var(--ink-dim);
  font-size: 13.5px;
  font-family: var(--font);
}
.err-box .eline {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border-radius: 5px;
  padding: 1px 8px;
  font-size: 12px;
  font-family: var(--mono);
}

/* verdict */
.verdict {
  margin-top: 14px;
  border-radius: var(--r);
  padding: 16px 18px;
  font-size: 15px;
  display: none;
}
.verdict.show { display: block; animation: pop-in .42s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes pop-in { from { opacity: 0; transform: scale(.93) translateY(9px); } }
.verdict.win {
  background: linear-gradient(135deg, rgba(124, 240, 58, .2), rgba(84, 242, 242, .12));
  border: 1px solid rgba(124, 240, 58, .5);
}
.verdict.lose {
  background: rgba(255, 159, 107, .1);
  border: 1px solid rgba(255, 159, 107, .38);
}
.verdict .vt {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 21px;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.verdict.win .vt { color: var(--green); }
.verdict.lose .vt { color: #FFB98A; }
.verdict .rewards { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.reward-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line-soft);
  animation: pop-in .4s cubic-bezier(.2, 1.6, .4, 1) backwards;
}
.reward-pill.xp { color: var(--green); }
.reward-pill.gold { color: var(--gold); }
.reward-pill.bonus { color: var(--cyan); }
.verdict .next-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ------------------------------------------------------------------ */
/* floating fx                                                         */
/* ------------------------------------------------------------------ */
.fx-burst-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
}
.fx-float {
  position: fixed;
  z-index: 950;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--green);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .6), 0 0 22px rgba(124, 240, 58, .8);
  transform: translate(-50%, -50%);
  animation: float-up 1.5s cubic-bezier(.2, .8, .3, 1) forwards;
}
.fx-float.gold { color: var(--gold); text-shadow: 0 3px 0 rgba(0, 0, 0, .6), 0 0 22px rgba(255, 216, 77, .8); }
.fx-float.cyan { color: var(--cyan); }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  22% { opacity: 1; transform: translate(-50%, -110%) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -280%) scale(1); }
}

.fx-spark {
  position: fixed;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 890;
  background: hsl(var(--hue, 138) 95% 68%);
  box-shadow: 0 0 12px hsl(var(--hue, 138) 95% 60%);
  transform: translate(-50%, -50%);
  animation: spark 700ms ease-out forwards;
}
@keyframes spark {
  0% { opacity: .95; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + 26px)) scale(0); }
}

.fx-shake { animation: shakey .55s cubic-bezier(.36, .07, .19, .97); }
@keyframes shakey {
  10%, 90% { transform: translateX(calc(-2px * var(--shake, 1))); }
  20%, 80% { transform: translateX(calc(4px * var(--shake, 1))); }
  30%, 50%, 70% { transform: translateX(calc(-7px * var(--shake, 1))); }
  40%, 60% { transform: translateX(calc(7px * var(--shake, 1))); }
}

.fx-toasts {
  position: fixed;
  top: 78px;
  right: 18px;
  z-index: 960;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, 92vw);
}
.fx-toast {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 15px 18px;
  border-radius: var(--r);
  background: rgba(16, 21, 31, .96);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(40px) scale(.94);
  transition: .42s cubic-bezier(.2, 1.3, .35, 1);
}
.fx-toast.in { opacity: 1; transform: none; }
.fx-toast.badge { border-color: rgba(255, 216, 77, .55); background: linear-gradient(135deg, rgba(48, 38, 10, .97), rgba(16, 21, 31, .97)); }
.fx-toast.rank { border-color: rgba(199, 125, 255, .55); background: linear-gradient(135deg, rgba(38, 18, 52, .97), rgba(16, 21, 31, .97)); }
.fx-badge-icon { font-size: 36px; animation: badge-bob 2.4s ease-in-out infinite; flex: none; }
.fx-toast-kicker { font-size: 10px; letter-spacing: .18em; font-weight: 900; color: var(--gold); }
.fx-toast-title { font-family: var(--font-display); font-size: 17px; text-transform: uppercase; }
.fx-toast-sub { font-size: 13px; color: var(--ink-dim); }

/* ------------------------------------------------------------------ */
/* playground                                                          */
/* ------------------------------------------------------------------ */
.pg-shell {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 33%);
  gap: 18px;
  padding: 18px clamp(12px, 2.5vw, 26px) 26px;
  align-items: start;
}
@media (max-width: 940px) { .pg-shell { grid-template-columns: 1fr; } }
.snippet {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 9px;
  transition: .17s;
  font-family: inherit;
}
.snippet:hover { background: rgba(124, 240, 58, .12); border-color: rgba(124, 240, 58, .4); transform: translateX(5px); }
.snippet .st { font-weight: 800; font-size: 14.5px; }
.snippet .sd { font-size: 12.5px; color: var(--ink-dim); }

/* ------------------------------------------------------------------ */
/* footer                                                              */
/* ------------------------------------------------------------------ */
.footer {
  border-top: 1px solid var(--line-soft);
  padding: 34px 0 44px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
  margin-top: 40px;
}
.footer .fl { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
/* footer links were 22px tall — too small a target for a seven-year-old */
.footer .fl a {
  padding: 9px 12px;
  border-radius: 9px;
  transition: background .16s, color .16s;
}
.footer .fl a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }

/* ------------------------------------------------------------------ */
/* modal                                                               */
/* ------------------------------------------------------------------ */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, .8);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  z-index: 970;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-back.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(520px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  transform: scale(.94) translateY(14px);
  transition: transform .3s cubic-bezier(.2, 1.3, .35, 1);
  max-height: 86vh;
  overflow: auto;
}
.modal-back.open .modal { transform: none; }
.modal h2 { font-family: var(--font-display); text-transform: uppercase; font-size: 25px; }

/* ------------------------------------------------------------------ */
/* chapter-complete celebration                                        */
/* ------------------------------------------------------------------ */
.cheer-back {
  position: fixed;
  inset: 0;
  z-index: 975;
  display: grid;
  place-items: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 42%, rgba(20, 34, 16, .82), rgba(4, 6, 10, .95));
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  opacity: 0;
  transition: opacity .4s;
}
.cheer-back.open { opacity: 1; }
.cheer-card {
  text-align: center;
  max-width: min(560px, 100%);
  transform: scale(.86) translateY(24px);
  transition: transform .55s cubic-bezier(.2, 1.5, .35, 1);
}
.cheer-back.open .cheer-card { transform: none; }
.cheer-rays {
  position: absolute;
  width: min(120vw, 900px);
  aspect-ratio: 1;
  left: 50%; top: 42%;
  translate: -50% -50%;
  /* repeating-, not plain conic- — otherwise it's one giant wedge */
  background: repeating-conic-gradient(from 0deg,
    rgba(255, 216, 77, .13) 0deg 7deg, transparent 7deg 22deg);
  mask-image: radial-gradient(circle, #000 12%, transparent 68%);
  -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 68%);
  animation: rays 26s linear infinite;
  pointer-events: none;
}
@keyframes rays { to { transform: rotate(360deg); } }
.cheer-goblin { display: flex; justify-content: center; margin-bottom: 6px; position: relative; z-index: 2; }
.cheer-kicker {
  font-size: 12px;
  letter-spacing: .22em;
  font-weight: 900;
  color: var(--gold);
  text-transform: uppercase;
}
.cheer-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 7vw, 62px);
  text-transform: uppercase;
  letter-spacing: -.035em;
  line-height: .98;
  margin: 4px 0 10px;
}
.cheer-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border-radius: 999px;
  background: rgba(255, 216, 77, .14);
  border: 1px solid rgba(255, 216, 77, .45);
  margin: 10px 0 18px;
}
.cheer-badge .bi { font-size: 34px; animation: badge-bob 2.4s ease-in-out infinite; flex: none; }
.cheer-badge .bn { display: block; font-family: var(--font-display); text-transform: uppercase; font-size: 17px; line-height: 1.15; }
.cheer-badge .bd { display: block; font-size: 13px; color: var(--ink-dim); margin-top: 2px; }
.cheer-quote { font-style: italic; color: var(--ink-dim); margin-bottom: 20px; font-size: 16px; }
.cheer-actions { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 2; }
.cheer-stats { display: flex; gap: 22px; justify-content: center; margin: 16px 0 6px; }
.cheer-stats div { font-family: var(--font-display); font-size: 26px; }
.cheer-stats span { display: block; font-family: var(--font); font-size: 11px; letter-spacing: .14em; color: var(--ink-faint); font-weight: 800; }

/* ------------------------------------------------------------------ */
/* misc                                                                */
/* ------------------------------------------------------------------ */
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.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-link {
  position: absolute; left: 12px; top: -70px; z-index: 999;
  background: var(--green); color: #06120A; padding: 11px 18px;
  border-radius: 0 0 10px 10px; font-weight: 900; transition: top .2s;
}
.skip-link:focus { top: 0; }

/* the goblin portrait must never outgrow its column */
.speech .art svg { width: 100%; height: auto; }

@media (max-width: 720px) {
  .topbar { height: auto; padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .topbar .brand { font-size: 17px; }
  .topbar nav { order: 3; width: 100%; justify-content: center; gap: 2px; margin-left: 0; }
  .topbar nav a { padding: 6px 11px; font-size: 13px; }
  .stats { gap: 6px; }
  .stat-pill { padding: 5px 10px; font-size: 13px; }
  .lineup { gap: 4px; }
  .speech { grid-template-columns: 72px 1fr; gap: 10px; }
  .editor .editor-input, .editor .editor-hl { min-height: 210px; }
  .panel-body { padding: 16px; }
  .btn { padding: 12px 20px; font-size: 15px; }
  .btn.big { padding: 16px 26px; font-size: 17px; }
}
@media (max-width: 540px) {
  .stat-pill.rank { display: none; }          /* rank names are long; it lives on the map */
  .topbar .brand span { display: none; }      /* the goblin head is the logo */
  .editor-gutter { width: 38px; }
  /* keep all four nav links on a single row */
  .topbar nav a { padding: 6px 9px; font-size: 12.5px; }
  .topbar nav { gap: 0; }
  .lesson-tabs button { font-size: 13.5px; padding: 11px 8px; }
  .rail-dot { width: 30px; height: 30px; font-size: 11px; }
}

/* Very narrow phones: let long buttons wrap rather than push the page
   sideways. "Go and meet them properly" was 361px wide in a 320px window. */
@media (max-width: 420px) {
  .btn, .btn.big { white-space: normal; }
  .btn.big { padding: 15px 22px; font-size: 16px; }
  .hero-cta .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  body::after { animation: none; }
}

/* dossier quote flashes when its goblin is poked */
.dossier-quote { transition: background .35s, transform .35s; }
.dossier-quote.flash {
  background: rgba(255, 216, 77, .2) !important;
  transform: scale(1.02);
}
