/*
 * Reactzy — neon arcade theme. One stylesheet, mobile-first.
 *
 * Breakpoints: base = phones (≥320px) · 640px tablets · 960px two-column desktop · 1440px wide.
 * Short landscape phones get their own rule (max-height: 520px).
 * Performance: one self-hosted variable font (51 KB, preloaded), no images, blur only on the
 * header and dialog. The arena has a fixed aspect ratio and the leaderboard reserves its height,
 * so nothing shifts when data loads (CLS ≈ 0).
 */

@font-face {
  font-family: "Unbounded";
  src: url("../fonts/unbounded-latin.woff2") format("woff2");
  font-weight: 500 900;
  font-display: swap;
}

:root {
  --bg: #06050d;
  --surface: rgba(20, 17, 44, 0.62);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f2ff;
  --text-2: #d6d3ef;
  --muted: #9d99c2;
  --cyan: #00f0ff;
  --pink: #ff2bd6;
  --violet: #8b5cf6;
  --lime: #c4ff3d;
  --amber: #ffcc33;
  --grad: linear-gradient(100deg, var(--cyan), var(--violet) 55%, var(--pink));
  --grad-btn: linear-gradient(100deg, var(--cyan), var(--pink));
  --radius: 22px;
  --display: "Unbounded", system-ui, sans-serif;
  --wrap: min(1240px, 100% - 32px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* component display rules must never beat the hidden attribute */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;                  /* fallback for browsers without overflow: clip */
}
/* Last-resort guard against sideways scrolling on phones. "clip" (unlike "hidden") doesn't create a
   scroll container, so the sticky header keeps working. The real fixes are in the components. */
html, body { overflow-x: clip; }

/* Fixed neon glow + faint grid behind everything (a fixed layer, because background-attachment: fixed is broken on iOS) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(55vmax 55vmax at 5% -15%, rgba(139, 92, 246, 0.28), transparent 60%),
    radial-gradient(45vmax 45vmax at 105% 5%, rgba(255, 43, 214, 0.18), transparent 60%),
    radial-gradient(60vmax 40vmax at 50% 115%, rgba(0, 240, 255, 0.13), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}

/* SVG icons from the inlined sprite (assets/img/icons.svg). They take the text colour unless a tier colour is set. */
.icon { flex: none; width: 1.1em; height: 1.1em; vertical-align: -0.18em; }
.icon-animal { width: 1.35em; height: 1.35em; filter: drop-shadow(0 0 6px currentColor); }
html.no-scroll, html.no-scroll body { overflow: hidden; }

a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: #7ff8ff; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-weight: 700; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
section[id], article[id] { scroll-margin-top: 84px; }   /* anchor links land below the sticky header */

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 5, 13, 0.7);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.site-header .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 20px;
  width: var(--wrap);
  margin: 0 auto;
  padding: 12px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font: 800 1.35rem var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.55)); }

.site-header ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-header nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}
.site-header nav a:hover { color: var(--text); background: var(--surface-2); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font: inherit;
  cursor: pointer;
}
#account-btn {
  margin-left: 4px;
  padding: 6px 14px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.18);
}
#account-btn:hover { background: rgba(0, 240, 255, 0.1); }

/* ---------- Layout ---------- */

main { width: var(--wrap); margin: 0 auto; padding-bottom: 56px; }

.hero { padding: clamp(20px, 5vw, 44px) 0 clamp(16px, 3vw, 28px); text-align: center; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 7.5vw, 4.2rem);
  font-weight: 900;
}
.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(139, 92, 246, 0.45));
}
/* The headline's neon slowly flows */
h1 .gradient-text {
  background: linear-gradient(100deg, var(--cyan), var(--violet), var(--pink), var(--violet), var(--cyan)) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: flow 8s linear infinite;
}
@keyframes flow { to { background-position: 300% 0; } }
.lede { max-width: 560px; margin: 0 auto; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.12rem); }

.layout { display: grid; gap: 20px; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

.card {
  position: relative;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.8);
}

/* ---------- Arena ---------- */

.arena {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;                 /* portrait on phones: more room to play and for the results */
  max-height: calc(100vh - 130px);    /* always fits on screen below the sticky header once centred (game.js scrolls it there) */
  max-height: calc(100svh - 130px);
  min-height: 280px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.5px) 0 0 / 26px 26px,
    radial-gradient(circle at 50% 35%, #1a1544, #0b0a1c 72%);
  box-shadow: 0 30px 90px -30px rgba(139, 92, 246, 0.55);
  cursor: crosshair;
  touch-action: manipulation;          /* no double-tap zoom → no tap delay */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 640px) { .arena { aspect-ratio: 16 / 11; } }

/* Neon gradient border: a masked pseudo-element, so it can glow and change colour per state */
.arena::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s, background 0.2s;
}
.arena[data-state="waiting"] { background-color: #0b0a1c; }
.arena[data-state="waiting"]::after { background: linear-gradient(100deg, var(--pink), var(--violet)); opacity: 0.8; }
.arena[data-state="target"]::after { background: var(--lime); opacity: 1; }
.arena[data-state="paused"]::after { background: var(--amber); opacity: 1; }

.hud {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 64px 14px 18px;        /* right side leaves room for the full-screen button */
  color: var(--muted);
  font: 700 0.8rem var(--display);
  letter-spacing: 0.06em;
  pointer-events: none;
}
.hud-round { display: flex; align-items: center; gap: 10px; }
.pips { display: flex; gap: 6px; }
.pips span {
  width: 18px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s, box-shadow 0.2s;
}
.pips .done { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.pips .now { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.hud-last { color: var(--text-2); font-variant-numeric: tabular-nums; }

.fs-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 4;                          /* above the start/results screens */
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6, 5, 13, 0.55);
  color: var(--text-2);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.fs-btn:hover { color: var(--cyan); border-color: rgba(0, 240, 255, 0.5); box-shadow: 0 0 16px rgba(0, 240, 255, 0.25); }

/* Full screen: the native API (:fullscreen) or the iPhone fallback (.is-full) look identical */
.arena:fullscreen { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; border-radius: 0; }
.arena.is-full {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
}
.arena:fullscreen::after, .arena.is-full::after { border-radius: 0; }

.status {
  position: absolute;
  inset: 44% 12px auto;
  margin: 0;
  text-align: center;
  font: 800 clamp(1.05rem, 3.6vw, 1.7rem) var(--display);
  pointer-events: none;
}
.arena[data-state="waiting"] .status { color: var(--pink); text-shadow: 0 0 18px rgba(255, 43, 214, 0.6); animation: breathe 1.2s ease-in-out infinite; }
.arena[data-state="paused"] .status { color: var(--amber); text-shadow: 0 0 18px rgba(255, 204, 51, 0.5); }
@keyframes breathe { 50% { opacity: 0.55; } }

/* The target appears instantly (any fade-in would be added to the player's time). Only the
   decorative ring animates, and it ignores pointer events so the hit area never changes size. */
.target {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: clamp(64px, 13vmin, 104px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 15%, var(--lime) 17% 40%, rgba(196, 255, 61, 0.18) 42% 60%, var(--lime) 62% 70%, transparent 72%);
  box-shadow: 0 0 26px var(--lime), 0 0 70px rgba(196, 255, 61, 0.55);
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.target::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid var(--lime);
  border-radius: 50%;
  pointer-events: none;
  animation: ring 0.8s ease-out infinite;
}
@keyframes ring {
  from { transform: scale(0.85); opacity: 0.9; }
  to { transform: scale(1.55); opacity: 0; }
}

/* Hit effects, animated by Motion in game.js: a shockwave ring + the time floating up.
   Centred with the `translate` property, because Motion writes `transform`. */
.pop, .burst {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  translate: -50% -50%;
  pointer-events: none;
}
.pop { font: 800 clamp(1.1rem, 3vw, 1.5rem) var(--display); white-space: nowrap; }
.burst { width: 90px; height: 90px; border: 3px solid currentColor; border-radius: 50%; box-shadow: 0 0 24px currentColor, inset 0 0 18px currentColor; }
.fast { color: var(--lime); }
.ok { color: var(--cyan); }
.slow { color: var(--pink); }
.pop.fast, .pop.ok, .pop.slow { text-shadow: 0 0 14px currentColor; }

/* ---------- Overlay screens ---------- */

.screen, .interstitial {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 52px 20px 24px;
  text-align: center;
}
/* If the results don't fit (tiny phones), scroll inside the arena. Auto margins centre the content
   without clipping its top, which justify-content: center would do when it overflows. */
.screen { justify-content: flex-start; overflow-y: auto; scrollbar-width: thin; }
.screen > :first-child { margin-top: auto; }
.screen > :last-child { margin-bottom: auto; }
.screen p { margin: 0; }
/* After the game the HUD has nothing left to say: hide it and give its space to the results */
.arena[data-state="done"] .hud { visibility: hidden; }
.arena[data-state="done"] .screen { padding-top: 22px; }
.screen-title { font: 900 clamp(2.2rem, 8vw, 3.6rem) var(--display); }
.screen-text { max-width: 380px; color: var(--text-2); }
.screen-hint { color: var(--muted); font-size: 0.85rem; }
.screen-kicker { color: var(--muted); font: 700 0.75rem var(--display); letter-spacing: 0.16em; text-transform: uppercase; }
.hl-lime { color: var(--lime); font-weight: 700; text-shadow: 0 0 12px rgba(196, 255, 61, 0.5); }

/* Results: reflex animal first, then the number, then the goal + tip */
.rank-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font: 900 clamp(1.9rem, 7vw, 3rem) var(--display);
  line-height: 1.1;
}
.rank-icon {
  flex: none;
  width: 1.5em;
  height: 1.5em;
  color: var(--lime);
  filter: drop-shadow(0 0 14px currentColor);
}
.result-ms {
  font: 900 clamp(2rem, 7vw, 3rem) var(--display);
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.result-ms small { font-size: 0.4em; color: var(--muted); }
.rank-line { max-width: 440px; color: var(--text-2); }
.rank-goal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px !important;
  padding: 5px 14px;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 999px;
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}
.rank-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  max-width: 460px;
  padding: 10px 14px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.5;
}
.tip-icon { width: 1.25em; height: 1.25em; margin-top: 0.1em; color: var(--amber); filter: drop-shadow(0 0 6px rgba(255, 204, 51, 0.6)); }

.result-rounds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 4px;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}
.result-rounds li {
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.82rem;
}
.result-rounds .best { border-color: rgba(196, 255, 61, 0.6); color: var(--lime); }
.result-rounds .worst { border-color: rgba(255, 43, 214, 0.5); color: var(--pink); }
.result-save { min-height: 1.6em; color: var(--muted); font-size: 0.95rem; }
.screen-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }

.interstitial { background: rgba(6, 5, 13, 0.92); }
.countdown-ring {
  display: grid;
  place-items: center;
  width: clamp(120px, 30vmin, 170px);
  aspect-ratio: 1;
  margin: 10px 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), var(--pink), var(--violet), var(--cyan));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 1.2s linear infinite;
}
.countdown-wrap { position: relative; display: grid; place-items: center; }
.countdown-wrap .countdown { position: absolute; }
.countdown { margin: 0; font: 900 clamp(3rem, 12vw, 4.6rem) var(--display); line-height: 1; }
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: 700 0.9rem var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover { border-color: rgba(0, 240, 255, 0.5); color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary {
  border: 0;
  background: var(--grad-btn);
  color: #0b0716;
  box-shadow: 0 0 22px rgba(0, 240, 255, 0.35), 0 0 46px rgba(255, 43, 214, 0.25);
}
.btn-primary:hover { color: #0b0716; transform: translateY(-1px); box-shadow: 0 0 30px rgba(0, 240, 255, 0.5), 0 0 60px rgba(255, 43, 214, 0.35); }
.btn-xl { margin-top: 14px; padding: 17px 46px; font-size: 1.1rem; }

/* ---------- Leaderboard ---------- */

.leaderboard h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 1.05rem; }
.icon-trophy { width: 1.3em; height: 1.3em; color: var(--amber); filter: drop-shadow(0 0 8px rgba(255, 204, 51, 0.6)); }

.lb-list {
  min-height: calc(10 * 2.75rem);       /* reserve 10 rows: no layout shift when data arrives */
  margin: 0;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}
.lb-list li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  height: 2.75rem;
  padding: 0 10px;
  border-radius: 12px;
}
.lb-list li:nth-child(odd):not(.lb-empty) { background: rgba(255, 255, 255, 0.03); }
.lb-rank {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font: 700 0.75rem var(--display);
}
.rank-1 .lb-rank { background: #ffcc33; color: #1a1300; box-shadow: 0 0 14px rgba(255, 204, 51, 0.7); }
.rank-2 .lb-rank { background: #dfe4ff; color: #12142a; box-shadow: 0 0 12px rgba(223, 228, 255, 0.5); }
.rank-3 .lb-rank { background: #ff9a5c; color: #2a1000; box-shadow: 0 0 12px rgba(255, 154, 92, 0.55); }
.lb-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.lb-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-rank .icon-animal { margin: 0 4px 0 8px; }
.rank-cell { display: flex; align-items: center; gap: 12px; }   /* inside the td: a flex td stops behaving like a table cell */
.rank-range { white-space: nowrap; }
.rank-cell .icon-animal { width: 1.8em; height: 1.8em; }
.lb-ms { color: var(--cyan); font-weight: 700; }
.lb-list .is-me { background: rgba(0, 240, 255, 0.1) !important; box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.4); }
.lb-empty { display: block !important; height: auto !important; padding: 8px 10px !important; color: var(--muted); }
.my-rank { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }

/* ---------- Content: home article, guides, about, privacy ---------- */

.prose { max-width: 820px; margin: 28px auto 0; color: var(--text-2); }   /* centred reading column on every page */
.prose h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 4.5vw, 2.4rem); color: var(--text); }
.prose h2 { margin: 1.7em 0 0.5em; font-size: clamp(1.1rem, 2.6vw, 1.3rem); color: var(--text); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.3em 0 0.3em; font-size: 1rem; color: var(--text); }
.prose strong { color: var(--text); }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--pink); }
.prose code { font: 0.9em ui-monospace, monospace; color: var(--lime); overflow-wrap: anywhere; }
.prose a { overflow-wrap: anywhere; }   /* long URLs wrap instead of pushing the page wider */
.article { margin-top: 20px; }
/* Content-page header (About, Privacy, guides): centred title block, divided from the body */
.article > .crumbs, .article > h1, .article > .meta { text-align: center; }
.article > h1 { margin-bottom: 10px; }
.article > h1:first-child, .article > .meta { padding-bottom: 18px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.article > h1:has(+ .meta) { padding-bottom: 0; margin-bottom: 8px; border-bottom: 0; }
.meta, .crumbs { margin: 0 0 1.4em; color: var(--muted); font-size: 0.88rem; }
.crumbs { margin-bottom: 10px; }
.crumbs a { font-weight: 700; text-decoration: none; }
.crumbs a::before { content: "← "; }
.sources { font-size: 0.84rem; color: var(--muted); }
.warn { color: var(--amber); }

table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.95rem; }
caption { padding-bottom: 8px; color: var(--muted); font-size: 0.85rem; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 700; font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
/* Tables scroll inside their own box if they ever can't fit, instead of widening the whole page */
.table-scroll { margin: 14px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { margin: 0; }
@media (max-width: 480px) {
  th, td { padding: 8px 7px; }
  th { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }   /* capitals + spacing are too wide for 3 columns */
  table { font-size: 0.9rem; }
}
tbody tr:first-child td:first-child { color: var(--lime); font-weight: 700; }

kbd {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: 0.85em ui-monospace, monospace;
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.guide-list li {
  position: relative;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.guide-list li:hover { border-color: rgba(0, 240, 255, 0.45); box-shadow: 0 0 26px -6px rgba(0, 240, 255, 0.35); transform: translateY(-2px); }
.guide-list a { color: var(--text); font: 700 1rem/1.35 var(--display); text-decoration: none; }
.guide-list a::after { content: ""; position: absolute; inset: 0; }   /* whole card is clickable */
.guide-list p { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }

.guides-index { margin-top: 20px; }
.page-head { padding: clamp(20px, 5vw, 40px) 0 8px; text-align: center; }
.page-head h1 { font-size: clamp(1.8rem, 6vw, 3rem); }
.page-head .lede { margin: 0 auto; }

.cta { max-width: 820px; margin: 22px auto 0; text-align: center; overflow: hidden; }
.cta::before {
  content: "";
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 120%;
  background: radial-gradient(closest-side, rgba(139, 92, 246, 0.35), transparent);
  pointer-events: none;
}
.cta h2 { position: relative; margin: 0 0 6px; font-size: clamp(1.3rem, 4vw, 1.8rem); }
.cta p { position: relative; margin: 0 0 18px; color: var(--muted); }
.cta .btn { position: relative; }

.more-guides { max-width: 820px; margin: 36px auto 0; }
.more-guides h2 { font-size: 1.1rem; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 16px 36px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-bottom: 10px; }
.site-footer nav a { color: var(--text-2); text-decoration: none; }
.site-footer nav a:hover { color: var(--cyan); }
.site-footer p { margin: 0; }

/* ---------- Auth dialog ---------- */

.auth-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius);
  background: rgba(16, 13, 36, 0.92);
  color: var(--text);
  box-shadow: 0 0 60px -10px rgba(139, 92, 246, 0.6);
}
.auth-dialog::backdrop { background: rgba(3, 2, 8, 0.7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.auth-dialog form { position: relative; display: grid; gap: 14px; padding: 28px 24px 24px; }
.auth-dialog h2 { margin: 0 0 4px; font-size: 1.4rem; }
.auth-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.auth-dialog input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
}
.auth-dialog input:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2); }
.form-error { margin: 0; color: var(--pink); font-size: 0.9rem; }
.form-error:empty { display: none; }
.auth-switch, .auth-legal { margin: 0; color: var(--muted); font-size: 0.88rem; text-align: center; }
.auth-legal { font-size: 0.78rem; }
.dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { color: var(--text); }

/* ---------- Responsive edges ---------- */

/* Phones: the header wraps to two rows, so let it scroll away instead of pinning it over the game */
@media (max-width: 640px) {
  .site-header { position: static; }
  section[id], article[id] { scroll-margin-top: 12px; }
  /* compact results so they fit the arena */
  .arena[data-state="done"] .screen { gap: 5px; padding: 18px 14px; }
  .rank-title { font-size: 1.75rem; }
  .rank-line { font-size: 0.92rem; }
  .rank-tip { padding: 8px 12px; font-size: 0.84rem; }
  .result-rounds { gap: 5px; margin: 8px 0 2px; }
  .result-rounds li { padding: 2px 8px; font-size: 0.76rem; }
  .screen-actions { margin-top: 8px; }
}

/* Small phones */
@media (max-width: 380px) {
  .arena { aspect-ratio: 2 / 3; }      /* taller, so the full results (and buttons) still fit */
  /* …and a shorter header + hero, so the Play button is on screen without scrolling */
  .site-header nav li:first-child { display: none; }   /* "Play": the arena is right below anyway */
  .hero { padding: 14px 0 12px; }
  .hero .kicker { display: none; }
  .lede { font-size: 0.95rem; }
  .rank-line { display: none; }        /* the animal, goal and tip already say it */
  .site-header nav a { padding: 5px 8px; font-size: 0.85rem; }
  .brand { font-size: 1.15rem; }
  .brand-mark { width: 28px; height: 28px; }
  .pips span { width: 12px; }
  .btn-xl { padding: 15px 36px; }
}

/* Landscape phones: every pixel of height goes to the arena */
@media (max-height: 520px) and (orientation: landscape) {
  .site-header { position: static; }
  .hero { padding: 12px 0; }
  .hero .kicker, .hero .lede { display: none; }
  h1 { font-size: 1.6rem; margin: 0; }
  .arena { max-height: calc(100svh - 24px); min-height: 240px; }
  .screen-title { font-size: 1.8rem; }
  .btn-xl { margin-top: 6px; padding: 12px 34px; }
}

/* Wide screens */
@media (min-width: 1440px) {
  :root { --wrap: min(1320px, 100% - 64px); }
  .layout { grid-template-columns: minmax(0, 1fr) 380px; }
}

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

/* ---------- Share page (/u/name) ---------- */

.share-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  margin: clamp(20px, 5vw, 48px) auto 0;
  padding: clamp(28px, 6vw, 48px) clamp(20px, 5vw, 44px);
  text-align: center;
}
.share-card .kicker { margin: 0; gap: 8px; }
.share-card h1 { margin: 6px 0 0; font-size: clamp(1.4rem, 5vw, 2.1rem); }
.share-badge {
  --size: clamp(96px, 26vw, 128px);    /* explicit width AND height: aspect-ratio alone let the icon stretch it into an oval */
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), transparent 70%);
  box-shadow: 0 0 0 1px var(--line), 0 0 60px -10px currentColor;
}
.share-icon { width: 62%; height: 62%; filter: drop-shadow(0 0 16px currentColor); }
.share-ms {
  margin: 4px 0 0;
  font: 900 clamp(3.2rem, 14vw, 5.5rem) var(--display);
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.share-ms small { font-size: 0.32em; color: var(--muted); }
.share-rank { margin: 0; font: 700 1rem var(--display); color: var(--text-2); }
.share-line { max-width: 440px; margin: 0 0 10px; color: var(--text-2); }
.share-meta { max-width: 460px; margin: 14px 0 0 !important; line-height: 1.6; }
.share-meta a { white-space: nowrap; }
@media (max-width: 480px) {
  .share-card .btn-xl { padding: 15px 24px; font-size: 0.98rem; }
}

/* Login dialog: why it opened */
.auth-hint { margin: -6px 0 0; color: var(--text-2); font-size: 0.92rem; }

/* Leaderboard names link to share pages */
a.lb-name { color: inherit; text-decoration: none; }
a.lb-name:hover span { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
