/* =========================================================
   The Quest Log — website styles
   Same palette as the HUD (Dracula on pure black). The pixel fonts
   are the ones bundled with the app (fonts/, with their OFL licences).
   ========================================================= */

@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/pressstart2p.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #000000;
  --panel: #0c0d12;
  --panel-2: #14161d;
  --line: #242732;
  --text: #f8f8f2;
  --dim: #9a9fb2;
  --green: #50fa7b;
  --gold: #ffd166;
  --red: #ff5555;
  --cyan: #8be9fd;
  --purple: #bd93f9;

  --pixel: "Press Start 2P", ui-monospace, monospace;
  --term: "VT323", ui-monospace, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: 16px;
  --max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--green); }
a:hover { color: var(--text); }
strong, b { font-weight: 700; }
code, kbd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--green); color: #000; padding: 8px 12px; z-index: 100;
}
.skip:focus { left: 8px; }

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(var(--gutter), calc((100% - var(--max)) / 2));
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--pixel); font-size: 13px; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.brand-mark { color: var(--gold); }
.topnav { display: flex; gap: 22px; font-size: 15px; }
.topnav a { color: var(--dim); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.topnav .topnav-gh { color: var(--green); }
@media (max-width: 720px) {
  .topnav a:not(.topnav-gh):not(.topnav-install) { display: none; }
}

/* ---------- Layout ---------- */
.section, .hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 88px var(--gutter);
}
.section + .section { border-top: 1px solid var(--line); }

.section-title {
  font-family: var(--pixel);
  font-size: clamp(16px, 3.4vw, 24px);
  line-height: 1.5;
  margin: 0 0 20px;
  font-weight: 400;
}
.section-num { color: var(--green); margin-right: 10px; }
.section-lede { color: var(--dim); max-width: 64ch; margin: 0 0 40px; }
.fine { color: var(--dim); font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--pixel); font-size: 12px; line-height: 1;
  padding: 16px 20px;
  color: var(--text); text-decoration: none;
  border: 2px solid var(--text);
  box-shadow: 4px 4px 0 var(--line);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { color: var(--text); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--line); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.btn-primary { background: var(--green); border-color: var(--green); color: #000; box-shadow: 4px 4px 0 #1f6b35; }
.btn-primary:hover { color: #000; box-shadow: 6px 6px 0 #1f6b35; }
.btn-primary:active { box-shadow: 1px 1px 0 #1f6b35; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding-top: 96px;
  padding-bottom: 104px;
}
.eyebrow {
  font-family: var(--pixel); font-size: 11px; color: var(--gold);
  letter-spacing: 0.08em; margin: 0 0 24px;
}
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-title {
  font-family: var(--pixel); font-weight: 400;
  font-size: clamp(30px, 6.4vw, 60px);
  line-height: 1.2;
  margin: 0 0 28px;
  color: var(--green);
  text-shadow: 4px 4px 0 #14502a;
}
.hero-lede { font-size: 20px; color: var(--text); max-width: 34ch; margin: 0 0 36px; }
.hero-lede strong { color: var(--cyan); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 16px; }
.hero-meta { margin: 32px 0 0; font-family: var(--term); font-size: 20px; color: var(--dim); }

.hero-art {
  position: relative;
  aspect-ratio: 1;
  max-width: 420px;
  width: 100%;
  justify-self: center;
  display: grid; place-items: center;
}
.hero-rays {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 209, 102, 0.16) 0 10deg, transparent 10deg 30deg);
  mask: radial-gradient(circle, #000 20%, transparent 68%);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: spin 18s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-chest {
  position: relative;
  width: 58%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 32px rgba(255, 209, 102, 0.35));
  animation: bob 2.4s ease-in-out infinite;
  overflow: visible;
}
.hero-chest .chest-lid {
  transform-origin: 1px 13px;
  animation: lid 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes lid {
  0%, 30%, 100% { transform: rotate(0); }
  50%, 80% { transform: rotate(-14deg) translateY(-1px); }
}

.hero-coins span {
  position: absolute;
  left: 50%; top: 46%;
  color: var(--gold);
  font-size: 22px;
  opacity: 0;
  animation: coin 2.4s ease-out infinite;
}
.hero-coins span:nth-child(1) { --x: -90px; --y: -130px; animation-delay: 0.9s; }
.hero-coins span:nth-child(2) { --x: -40px; --y: -170px; animation-delay: 1.0s; }
.hero-coins span:nth-child(3) { --x: 10px;  --y: -190px; animation-delay: 1.05s; color: var(--cyan); }
.hero-coins span:nth-child(4) { --x: 60px;  --y: -160px; animation-delay: 0.95s; }
.hero-coins span:nth-child(5) { --x: 100px; --y: -120px; animation-delay: 1.1s; color: var(--purple); }
@keyframes coin {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  10% { opacity: 1; }
  60% { opacity: 1; transform: translate(var(--x), var(--y)) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--x) * 1.2), calc(var(--y) + 80px)) scale(0.8); }
}

.hero-shout {
  position: absolute; bottom: 8%;
  font-family: var(--pixel); font-size: clamp(16px, 3vw, 22px);
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green), var(--cyan), var(--purple), var(--red));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: rainbow 2s linear infinite, pop 2.4s ease-in-out infinite;
}
@keyframes rainbow { to { background-position: 200% 0; } }
@keyframes pop {
  0%, 45% { transform: scale(0); opacity: 0; }
  55% { transform: scale(1.2); opacity: 1; }
  62%, 90% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 56px; padding-bottom: 72px; }
  .hero-art { max-width: 300px; order: -1; }
}

/* ---------- Origin ---------- */
.origin-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: start; }
.origin p { max-width: 60ch; }
.origin strong { color: var(--cyan); font-weight: 600; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 24px; border-left: 2px dashed var(--line); }
.timeline li { position: relative; padding: 0 0 28px 8px; display: flex; flex-direction: column; }
.timeline li:last-child { padding-bottom: 0; }
.timeline b { font-family: var(--pixel); font-size: 12px; font-weight: 400; margin-bottom: 6px; }
.timeline span:not(.tl-dot) { color: var(--dim); font-size: 15px; }
.tl-dot {
  position: absolute; left: -32px; top: 0;
  width: 14px; height: 14px;
  background: var(--bg); border: 2px solid var(--dim);
}
.tl-now .tl-dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 12px var(--green); }
.tl-now b { color: var(--green); }
.tl-next .tl-dot { border-style: dashed; }
.tl-next b { color: var(--dim); }
@media (max-width: 760px) { .origin-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }

/* ---------- Play ---------- */
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.play-frame { min-width: 0; }
.play-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  border: 2px solid var(--line);
  box-shadow: 0 0 0 6px var(--panel), 0 0 60px rgba(80, 250, 123, 0.08);
  overflow: hidden;
}
/* The iframe stays 600×600 (the real display) and is scaled to fit by site.js */
.play-screen iframe {
  position: absolute; left: 0; top: 0;
  width: 600px; height: 600px;
  border: 0;
  transform-origin: 0 0;
  background: #000;
}
.play-start {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  width: 100%;
  background: rgba(0, 0, 0, 0.72);
  border: 0;
  color: var(--text);
  font-family: var(--pixel); font-size: 14px;
  cursor: pointer;
}
.play-start small { font-family: var(--term); font-size: 20px; color: var(--dim); }
.play-start-icon {
  display: grid; place-items: center;
  width: 72px; height: 72px;
  background: var(--green); color: #000;
  font-size: 24px;
  box-shadow: 4px 4px 0 #1f6b35;
  transition: transform 0.1s;
}
.play-start:hover .play-start-icon { transform: scale(1.08); }
.play-start[hidden] { display: none; }
.play-note { color: var(--dim); font-size: 14px; margin: 16px 0 0; }

.play-side { display: flex; flex-direction: column; gap: 28px; }

.pad {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
}
.pad-label { font-family: var(--pixel); font-size: 10px; color: var(--dim); margin: 0 0 16px; }
.pad-dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 4px;
  justify-content: center;
  margin-bottom: 16px;
}
.pad-up { grid-area: 1 / 2; }
.pad-left { grid-area: 2 / 1; }
.pad-right { grid-area: 2 / 3; }
.pad-down { grid-area: 3 / 2; }
.pad-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pad-btn {
  font-family: var(--pixel); font-size: 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line);
  padding: 12px 8px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
.pad-btn:hover { border-color: var(--dim); }
.pad-btn:active { background: var(--line); transform: translateY(2px); }
.pad-pinch { background: var(--green); border-color: var(--green); color: #000; }
.pad-pinch:hover { border-color: var(--text); }
.pad-pinch:active { background: #36c95f; }
.pad-hint { color: var(--dim); font-size: 14px; margin: 16px 0 0; line-height: 1.5; }
.pad-hint b { color: var(--text); }

.keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 15px; color: var(--dim); }
.keys li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.keys-dev { padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; }
kbd {
  display: inline-block;
  min-width: 28px;
  padding: 2px 7px;
  text-align: center;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 4px;
}
.play-full { font-family: var(--pixel); font-size: 11px; text-decoration: none; }

@media (max-width: 960px) {
  .play-layout { grid-template-columns: minmax(0, 1fr); }
  .play-frame { max-width: 600px; width: 100%; margin: 0 auto; }
  .play-side { max-width: 600px; width: 100%; margin: 0 auto; }
}
/* Touch devices: the keyboard legend doesn't apply */
@media (hover: none) { .keys { display: none; } }

/* ---------- Feature cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 24px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--green); transform: translateY(-3px); }
.card-icon { font-size: 30px; line-height: 1; margin-bottom: 16px; }
.card h3 { font-family: var(--pixel); font-weight: 400; font-size: 12px; line-height: 1.6; margin: 0 0 12px; color: var(--green); }
.card p { margin: 0; color: var(--dim); font-size: 15px; }
.card-gold { border-color: #5a4a22; }
.card-gold h3 { color: var(--gold); }
.card-gold:hover { border-color: var(--gold); }

/* ---------- Loot ---------- */
.r-common   { --r: var(--text); }
.r-uncommon { --r: var(--green); }
.r-rare     { --r: var(--gold); }
.r-epic     { --r: var(--purple); }

.loot-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}
.loot-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--r);
}
.loot-icon {
  grid-row: 1 / 3;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  font-size: 30px;
  background: radial-gradient(circle, color-mix(in srgb, var(--r) 22%, transparent), transparent 70%);
}
.loot-item b { color: var(--r); font-size: 15px; line-height: 1.3; }
.loot-item span:not(.loot-icon) { color: var(--dim); font-size: 13px; line-height: 1.4; }
.loot-item:hover .loot-icon { animation: wiggle 0.4s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-12deg) scale(1.1); } 75% { transform: rotate(12deg) scale(1.1); } }

.rarity-legend { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 24px; font-family: var(--term); font-size: 20px; }
.rarity-legend span { color: var(--r); }

/* ---------- Controls table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.controls-table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
.controls-table th, .controls-table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.controls-table th { font-family: var(--pixel); font-size: 10px; font-weight: 400; color: var(--dim); background: var(--panel); }
.controls-table tr:last-child td { border-bottom: 0; }
.controls-table td:first-child { color: var(--cyan); white-space: nowrap; }
.controls-table td:nth-child(2) { white-space: nowrap; }

/* ---------- Tech ---------- */
.tech-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.tech-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.tech-list li { padding-left: 24px; position: relative; color: var(--dim); }
.tech-list li::before { content: "◆"; position: absolute; left: 0; color: var(--gold); font-size: 13px; top: 3px; }
.tech-list b { color: var(--text); }
.tech-list code { color: var(--green); font-size: 14px; }
.code { background: var(--panel); border: 1px solid var(--line); padding: 20px; min-width: 0; }
.code-label { margin: 0 0 12px; font-family: var(--term); font-size: 20px; color: var(--dim); }
.code pre { margin: 0; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.c-fn { color: var(--cyan); }
.c-str { color: var(--gold); }
.c-num { color: var(--purple); }
@media (max-width: 860px) { .tech-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- What's next ---------- */
.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.next-list li {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.q-type { font-family: var(--pixel); font-size: 10px; color: var(--cyan); white-space: nowrap; }
.q-main { color: var(--gold); }

/* ---------- Final CTA ---------- */
.final { text-align: center; padding-top: 104px; padding-bottom: 104px; }
.final-shout {
  font-family: var(--pixel); font-size: clamp(20px, 5vw, 40px);
  color: var(--green); margin: 0 0 20px;
  text-shadow: 0 0 24px rgba(80, 250, 123, 0.4);
}
.final-rewards { font-family: var(--pixel); font-size: clamp(13px, 2.4vw, 18px); margin: 0 0 40px; display: flex; gap: 24px; justify-content: center; }
.final-rewards .xp { color: var(--cyan); }
.final-rewards .gold { color: var(--gold); }
.final .hero-cta { justify-content: center; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 32px var(--gutter);
  text-align: center;
  color: var(--dim);
  font-size: 15px;
}
.footer p { margin: 4px 0; }

/* =========================================================
   Hero punchline, the loop, install, progression
   ========================================================= */

.topnav { align-items: center; }
.topnav .topnav-install {
  font-family: var(--pixel); font-size: 10px;
  color: #000; background: var(--green);
  padding: 9px 12px;
  box-shadow: 3px 3px 0 #1f6b35;
}
.topnav .topnav-install:hover { color: #000; background: var(--text); }
@media (max-width: 720px) { .topnav .topnav-gh { display: none; } }

.hero-punch {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--pixel); font-size: clamp(14px, 2.2vw, 20px); line-height: 1.5;
  margin: 0 0 28px;
}
.hero-punch span { opacity: 0; animation: punch-in 0.5s ease-out forwards; }
.hero-punch span:nth-child(1) { animation-delay: 0.2s; }
.hero-punch span:nth-child(2) { animation-delay: 0.7s; }
.hero-punch .hero-punch-hit {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.55);
  animation: punch-in 0.5s ease-out 1.2s forwards, glow 2.4s ease-in-out 1.8s infinite;
}
@keyframes punch-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}
@keyframes glow { 50% { text-shadow: 0 0 32px rgba(255, 209, 102, 0.95); } }
@media (prefers-reduced-motion: reduce) { .hero-punch span { opacity: 1; } }
.hero-lede { font-size: 18px; color: var(--dim); max-width: 44ch; }

/* ---------- The loop ---------- */
.loop-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px;
}
.loop-step {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 28px 24px 24px;
}
/* Arrow between steps */
.loop-step:not(:last-child)::after {
  content: "▶";
  position: absolute; right: -30px; top: 50%;
  transform: translateY(-50%);
  color: var(--green); font-size: 16px;
  animation: nudge 1.2s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translate(4px, -50%); } }
.loop-n {
  position: absolute; top: -14px; left: 20px;
  font-family: var(--pixel); font-size: 12px;
  background: var(--green); color: #000;
  padding: 6px 9px;
}
.loop-step h3 { font-family: var(--pixel); font-weight: 400; font-size: 13px; line-height: 1.5; margin: 20px 0 10px; }
.loop-step p { margin: 0; color: var(--dim); font-size: 15px; }
.loop-step q { color: var(--text); }

/* The picture at the top of each step (same height, so the cards line up) */
.loop-stage {
  position: relative;
  height: 176px;
  margin-top: 8px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.05), transparent 70%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.loop-emoji { position: relative; font-size: 52px; line-height: 1; }

/* Step 1: the mic, with voice rings */
.say-ring {
  position: absolute; left: 50%; top: 50%;
  width: 72px; height: 72px; margin: -36px 0 0 -36px;
  border: 2px solid var(--green);
  border-radius: 50%;
  opacity: 0;
  animation: say-ring 2s ease-out infinite;
}
.say-ring + .say-ring { animation-delay: 1s; }
@keyframes say-ring {
  from { transform: scale(0.7); opacity: 0.9; }
  to { transform: scale(2.2); opacity: 0; }
}

/* Step 2: running, on a scrolling road */
.loop-stage-do .loop-emoji { animation: run-bob 0.4s ease-in-out infinite alternate; }
@keyframes run-bob { to { transform: translateY(-8px); } }
.do-dust {
  position: absolute; left: 0; right: 0; bottom: 42px;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--dim) 0 14px, transparent 14px 30px);
  opacity: 0.5;
  animation: road 0.5s linear infinite;
}
@keyframes road { to { background-position: -30px 0; } }

/* ---------- Step 3: the hit ----------
   One 5s loop. Every piece runs on the same clock (--hit), with its moments
   at the same percentages:
     0–4%   QUEST COMPLETE slams in (flash + shake)
     32–38% the chest drops and lands
     42–50% it rattles
     52%    it bursts open: big flash, rays, beams, coins
     56–62% the epic item rises out
     64%    JACKPOT!!
     94%+   everything fades, then it starts again                        */
.loop-step-hit { --hit: 5s; border-color: #5a4a22; animation: hit-glow var(--hit) ease-out infinite; }
.loop-step-hit .loop-n { background: var(--gold); }
.loop-step-hit h3 { color: var(--gold); }
@keyframes hit-glow {
  0%, 51% { box-shadow: 0 0 0 rgba(189, 147, 249, 0); border-color: #5a4a22; }
  54% { box-shadow: 0 0 48px rgba(189, 147, 249, 0.55); border-color: var(--purple); }
  90% { box-shadow: 0 0 24px rgba(189, 147, 249, 0.25); border-color: var(--purple); }
  100% { box-shadow: 0 0 0 rgba(189, 147, 249, 0); border-color: #5a4a22; }
}

.hit { animation: hit-shake var(--hit) linear infinite; }
@keyframes hit-shake {
  0%, 2.4%, 36%, 38.8%, 51.6%, 55%, 100% { transform: none; }
  1% { transform: translate(-4px, 2px); }
  1.8% { transform: translate(3px, -2px); }
  37% { transform: translateY(5px); }
  38% { transform: translateY(-2px); }
  52.2% { transform: translate(-6px, 3px); }
  53% { transform: translate(6px, -3px); }
  53.8% { transform: translate(-4px, 2px); }
  54.4% { transform: translate(3px, 0); }
}

/* QUEST COMPLETE + rewards */
.hit-complete {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  animation: hit-complete var(--hit) ease-out infinite;
}
.hit-title { font-family: var(--pixel); font-size: 15px; color: var(--green); text-shadow: 0 0 16px rgba(80, 250, 123, 0.8); }
.hit-rewards { font-family: var(--pixel); font-size: 13px; display: flex; gap: 16px; }
.hit-rewards .xp { color: var(--cyan); font-weight: 400; }
.hit-rewards .gold { color: var(--gold); font-weight: 400; }
@keyframes hit-complete {
  0% { opacity: 0; transform: scale(2.6); }
  4% { opacity: 1; transform: scale(0.94); }
  6% { transform: scale(1.06); }
  8%, 28% { opacity: 1; transform: scale(1); }
  33%, 100% { opacity: 0; transform: translateY(-24px) scale(0.9); }
}

/* The chest */
.hit-chest {
  position: absolute; left: 50%; bottom: 16px;
  width: 72px; margin-left: -36px;
  overflow: visible;
  opacity: 0;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 0 14px rgba(255, 209, 102, 0.4));
  animation: hit-chest var(--hit) ease-in infinite;
}
@keyframes hit-chest {
  0%, 31% { opacity: 0; transform: translateY(-190px); }
  32% { opacity: 1; transform: translateY(-190px); }
  37% { opacity: 1; transform: translateY(0) scale(1.18, 0.78); }
  39% { transform: translateY(-6px) scale(0.94, 1.08); }
  41% { transform: none; }
  43% { transform: rotate(-8deg); }
  45% { transform: rotate(8deg); }
  47% { transform: rotate(-8deg); }
  49% { transform: rotate(6deg); }
  51% { transform: scale(0.92, 1.06); }
  53% { transform: scale(1.14, 0.9); }
  56%, 93% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: none; }
}
.hit-lid {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: hit-lid var(--hit) ease-out infinite;
}
@keyframes hit-lid {
  0%, 51.5% { transform: none; }
  54% { transform: rotate(-36deg) translate(-2px, -3px); }
  57%, 94% { transform: rotate(-26deg) translate(-2px, -2px); }
  100% { transform: none; }
}

/* Light rays turning behind everything */
.hit-rays {
  position: absolute; left: 50%; bottom: 44px;
  width: 340px; height: 340px; margin: 0 0 -170px -170px;
  opacity: 0;
  animation: hit-rays var(--hit) ease-out infinite;
}
.hit-rays::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(189, 147, 249, 0.45) 0 9deg, transparent 9deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 10%, transparent 62%);
  mask: radial-gradient(circle, #000 10%, transparent 62%);
  animation: spin 6s linear infinite;
}
@keyframes hit-rays {
  0%, 51.5% { opacity: 0; transform: scale(0.3); }
  55% { opacity: 1; transform: scale(1.1); }
  60%, 92% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

/* A fan of beams out of the open lid */
.hit-beams { position: absolute; left: 50%; bottom: 50px; width: 0; height: 0; }
.hit-beams span {
  position: absolute; bottom: 0; left: -9px;
  width: 18px; height: 170px;
  transform-origin: 50% 100%;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(189, 147, 249, 0.7) 35%, transparent);
  opacity: 0;
  animation: hit-beam var(--hit) ease-out infinite;
}
@keyframes hit-beam {
  0%, 51.5% { opacity: 0; transform: rotate(var(--a)) scaleY(0); }
  55% { opacity: 1; transform: rotate(var(--a)) scaleY(1.15); }
  62% { opacity: 0.75; transform: rotate(var(--a)) scaleY(1); }
  80%, 100% { opacity: 0; transform: rotate(var(--a)) scaleY(1); }
}

/* Coin explosion */
.hit-coins span {
  position: absolute; left: 50%; bottom: 44px;
  margin-left: -8px;
  font-size: 16px; line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 8px currentColor;
  opacity: 0;
  animation: hit-coin var(--hit) cubic-bezier(0.2, 0.8, 0.4, 1) infinite;
}
@keyframes hit-coin {
  0%, 51.9% { opacity: 0; transform: translate(0, 0) scale(0.3); }
  52% { opacity: 1; transform: translate(0, 0) scale(0.5); }
  64% { opacity: 1; transform: translate(var(--x), var(--y)) scale(1.1) rotate(180deg); }
  80% { opacity: 0; transform: translate(calc(var(--x) * 1.15), calc(var(--y) + 90px)) scale(0.8) rotate(360deg); }
  100% { opacity: 0; }
}

/* The prize, with a spinning halo */
.hit-item {
  position: absolute; left: 50%; bottom: 58px;
  width: 64px; height: 64px; margin-left: -32px;
  display: grid; place-items: center;
  opacity: 0;
  animation: hit-item var(--hit) ease-out infinite;
}
.hit-item::before {
  content: "";
  position: absolute; inset: -18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--purple), transparent 25%, var(--cyan), transparent 50%, var(--purple), transparent 75%, var(--cyan));
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 32%, transparent 70%);
  mask: radial-gradient(circle, transparent 30%, #000 32%, transparent 70%);
  animation: spin 2s linear infinite;
}
.hit-item span { position: relative; font-size: 40px; line-height: 1; filter: drop-shadow(0 0 10px rgba(189, 147, 249, 0.9)); }
@keyframes hit-item {
  0%, 55% { opacity: 0; transform: translateY(40px) scale(0.2); }
  60% { opacity: 1; transform: translateY(-34px) scale(1.3); }
  64% { transform: translateY(-24px) scale(1); }
  79% { transform: translateY(-30px) scale(1); }
  93% { opacity: 1; transform: translateY(-24px) scale(1); }
  100% { opacity: 0; transform: translateY(-24px) scale(1); }
}

/* JACKPOT!! */
.hit-shout {
  position: absolute; left: 0; right: 0; top: 12px;
  text-align: center;
  font-family: var(--pixel); font-size: 20px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green), var(--cyan), var(--purple), var(--red));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(2px 2px 0 #000) drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
  opacity: 0;
  animation: rainbow 1s linear infinite, hit-shout var(--hit) ease-out infinite;
}
@keyframes hit-shout {
  0%, 63% { opacity: 0; transform: scale(0) rotate(-8deg); }
  67% { opacity: 1; transform: scale(1.4) rotate(4deg); }
  70% { transform: scale(0.95) rotate(-2deg); }
  73%, 92% { opacity: 1; transform: scale(1) rotate(0); }
  97%, 100% { opacity: 0; transform: scale(1.1); }
}

/* White flash: small on QUEST COMPLETE, huge when the chest opens */
.hit-flash {
  position: absolute; inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  animation: hit-flash var(--hit) ease-out infinite;
}
@keyframes hit-flash {
  0% { opacity: 0; }
  1.5% { opacity: 0.45; }
  8%, 51.9% { opacity: 0; }
  52.3% { opacity: 0.9; }
  60%, 100% { opacity: 0; }
}

/* Reduced motion: no loop, just the QUEST COMPLETE card */
@media (prefers-reduced-motion: reduce) {
  .hit-complete { opacity: 1; }
}

.loop-again {
  margin: 28px 0 0;
  text-align: center;
  font-family: var(--term); font-size: 24px; color: var(--green);
}

.senses {
  list-style: none; margin: 48px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.senses li {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 0 0;
  border-top: 2px solid var(--line);
  color: var(--dim); font-size: 14px;
}
.senses span { font-size: 24px; }
.senses b { color: var(--text); font-size: 15px; }
.senses li:nth-child(1) { border-color: var(--cyan); }
.senses li:nth-child(2) { border-color: var(--purple); }
.senses li:nth-child(3) { border-color: var(--gold); }
.senses li:nth-child(4) { border-color: var(--green); }

@media (max-width: 860px) {
  .loop-steps { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .loop-step:not(:last-child)::after {
    content: "▼"; right: auto; left: 50%; top: auto; bottom: -30px;
    transform: translateX(-50%); animation: none;
  }
  .senses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Install ---------- */
.install-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.install-step {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 24px;
}
.install-n {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  font-family: var(--pixel); font-size: 16px;
  color: var(--green);
  border: 2px solid var(--green);
}
.install-step-go .install-n { background: var(--green); color: #000; }
.install-step h3 { font-family: var(--pixel); font-weight: 400; font-size: 13px; line-height: 1.5; margin: 4px 0 12px; }
.install-step p { margin: 0 0 10px; color: var(--dim); font-size: 15px; }
.install-step p:last-child { margin-bottom: 0; }
.install-step b { color: var(--text); }
.install-step .path { font-family: var(--term); font-size: 21px; line-height: 1.35; color: var(--cyan); }
.path i { font-style: normal; color: var(--dim); margin: 0 4px; }
.install-step .path b { color: var(--gold); font-weight: 400; }
.install-step .step-note { font-size: 13px; }

.url-box {
  display: flex; align-items: stretch;
  border: 2px solid var(--green);
  margin-top: 4px;
  max-width: 440px;
}
.url-box code {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  font-size: 16px; color: var(--green);
  overflow-wrap: anywhere;
  -webkit-user-select: all; user-select: all;
}
.url-copy {
  font-family: var(--pixel); font-size: 10px;
  padding: 0 16px;
  background: var(--green); color: #000;
  border: 0; cursor: pointer;
  white-space: nowrap;
}
.url-copy:hover { background: var(--text); }

.needs { background: var(--panel-2); border: 1px solid var(--line); padding: 24px; }
.needs-label { font-family: var(--pixel); font-size: 10px; color: var(--gold); margin: 0 0 16px; }
.needs ul { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; font-size: 15px; }
.needs li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.needs small { color: var(--dim); }
.needs-note { color: var(--dim); font-size: 14px; margin: 0 0 10px; }
@media (max-width: 860px) { .install-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) {
  .install-step { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .url-box code { font-size: 13px; padding: 12px 10px; }
  .url-copy { padding: 0 12px; }
}

/* ---------- Progression ---------- */
.xp-show { max-width: 640px; margin: 0 0 40px; }
.xp-show-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.xp-show-lv { font-family: var(--pixel); font-size: 13px; }
.xp-show-lv b { font-weight: 400; color: var(--green); }
.xp-show-lv span { color: var(--dim); font-size: 10px; margin-left: 8px; }
.xp-show-up {
  font-family: var(--pixel); font-size: 13px; color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.7);
  opacity: 0;
  animation: lvl-up 4s ease-out infinite;
}
.xp-show-bar { height: 16px; background: var(--panel-2); border: 2px solid var(--line); overflow: hidden; }
.xp-show-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 16px rgba(80, 250, 123, 0.6);
  animation: xp-fill 4s steps(8) infinite;
}
@keyframes xp-fill { 0% { width: 8%; } 70% { width: 100%; } 72%, 100% { width: 0; } }
@keyframes lvl-up {
  0%, 68% { opacity: 0; transform: scale(0.6); }
  72% { opacity: 1; transform: scale(1.25); }
  78%, 94% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; }
}

.ladder {
  list-style: none; margin: 0 0 48px; padding: 0;
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px;
}
.ladder li {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 10px;
  background: var(--panel);
  border-bottom: 3px solid var(--green);
  font-size: 14px;
  opacity: calc(0.45 + var(--i, 0) * 0.08);
}
.ladder b { font-family: var(--pixel); font-size: 9px; font-weight: 400; color: var(--dim); }
.ladder li:nth-child(2) { --i: 1; }
.ladder li:nth-child(3) { --i: 2; }
.ladder li:nth-child(4) { --i: 3; }
.ladder li:nth-child(5) { --i: 4; }
.ladder li:nth-child(6) { --i: 5; }
.ladder li:nth-child(7) { --i: 6; }
.ladder li:nth-child(8) { --i: 7; }
.ladder .ladder-top {
  border-color: var(--purple);
  color: var(--purple);
  box-shadow: 0 0 20px rgba(189, 147, 249, 0.3);
  font-weight: 700;
}
@media (max-width: 860px) { .ladder { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px 16px; }
.prog { padding: 20px 0 0; border-top: 1px solid var(--line); }
.prog-icon { font-size: 28px; }
.prog h3 { font-family: var(--pixel); font-weight: 400; font-size: 12px; margin: 10px 0 8px; color: var(--gold); }
.prog p { margin: 0; color: var(--dim); font-size: 15px; }
.prog q { color: var(--text); }

/* ---------- Borked Reality ---------- */
.hero-by {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 20px;
  color: var(--dim); font-size: 15px; text-decoration: none;
}
.hero-by img { border-radius: 6px; }
.hero-by b { color: var(--text); }
.hero-by:hover b { color: var(--green); }

.studio {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 40px; align-items: center;
}
.studio-logo img {
  display: block;
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--purple), -6px -6px 0 rgba(80, 250, 123, 0.5);
  transition: transform 0.15s;
}
.studio-logo:hover img { transform: rotate(-3deg) scale(1.04); animation: bork 0.3s steps(2) 2; }
@keyframes bork {
  0% { box-shadow: 6px 6px 0 var(--purple), -6px -6px 0 rgba(80, 250, 123, 0.5); }
  50% { box-shadow: -8px 4px 0 var(--purple), 8px -4px 0 rgba(80, 250, 123, 0.7); }
}
.studio-label { font-family: var(--pixel); font-size: 10px; color: var(--dim); margin: 0 0 8px; }
.studio-title { font-family: var(--pixel); font-weight: 400; font-size: clamp(18px, 3.4vw, 26px); margin: 0 0 10px; }
.studio-tag { font-family: var(--term); font-size: 24px; color: var(--purple); margin: 0 0 12px; }
.studio-copy > p:not([class]) { color: var(--dim); max-width: 60ch; margin: 0 0 24px; }
.studio-links { display: flex; flex-wrap: wrap; gap: 16px; }
.btn-discord { border-color: #5865f2; background: #5865f2; box-shadow: 4px 4px 0 #2f3790; }
.btn-discord:hover { box-shadow: 6px 6px 0 #2f3790; }
@media (max-width: 640px) {
  .studio { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .studio-logo img { width: 112px; height: 112px; }
}

.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin-bottom: 12px; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover { color: var(--green); }

/* ---------- Final CTA ---------- */
.final-label { font-family: var(--pixel); font-size: 11px; color: var(--gold); margin: 0 0 16px; }
.final .final-shout { line-height: 1.4; }
