/* MARVEL SNAP in-game headline face (Comicraft CCUltimatum Bold Italic),
   the same source the game and the twitch-linking site use. */
@font-face {
  font-family: 'CCUltimatum';
  src: url('fonts/CCUltimatum-BoldItalic.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Anton + Roboto are self-hosted (latin subset) rather than loaded from Google
   Fonts: inside a Discord Activity the CSP blocks any origin that is not a
   configured URL mapping, so a <link> to fonts.googleapis.com fails with
   blocked:csp and both faces silently fall back. */
@font-face {
  font-family: 'Anton';
  src: url('fonts/Anton-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  /* Variable file: one asset covers 400-900. */
  font-family: 'Roboto';
  src: url('fonts/Roboto-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font-display: 'CCUltimatum', 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Roboto', 'Segoe UI', system-ui, sans-serif;

  /* Vampire = RED (new Outbreak palette), Zombie = green, Survivor = grey. */
  --vamp: #ff4d6a;
  --vamp-dark: #8e0000;
  --vamp-glow: #ff6b85;
  --zomb: #b9cd5d;
  --zomb-dark: #29500c;
  --zomb-glow: #cde06a;
  --surv: #aaaaaa;
  --surv-dark: #484848;
  --surv-glow: #d0d0d0;

  --bg: #0a0710;
  --panel: rgba(21, 14, 34, 0.82);
  --panel-border: #2c1f42;
  --red: #ed1d24;
  --text: #f1eafc;
  --muted: #a294bb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #050308;
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Split faction backdrop: vampire (left) vs zombie (right) ---- */
.bg-split { position: fixed; inset: 0; z-index: -2; }
.bg-half { position: absolute; top: 0; bottom: 0; width: 52%; background-size: cover; background-position: center; }
.bg-zomb { left: 0; background-image: url('assets/bg-zombie.jpg'); -webkit-mask-image: linear-gradient(90deg, #000 72%, transparent); mask-image: linear-gradient(90deg, #000 72%, transparent); }
.bg-vamp { right: 0; background-image: url('assets/bg-vampire.jpg'); -webkit-mask-image: linear-gradient(270deg, #000 72%, transparent); mask-image: linear-gradient(270deg, #000 72%, transparent); }
.bg-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(5,3,8,0.35) 0%, rgba(5,3,8,0.6) 55%, rgba(5,3,8,0.82) 100%),
    linear-gradient(180deg, rgba(5,3,8,0.5) 0%, rgba(5,3,8,0.25) 40%, rgba(5,3,8,0.8) 100%);
}

.app { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; position: relative; z-index: 1; }

header { text-align: center; margin-bottom: 30px; position: relative; }
/* Big, bold event characters, symmetric about the header center — each anchored
   the same distance from center so the zombie sits behind ZOMBIES exactly like
   the vampire sits behind VAMPIRES. */
.header-char {
  position: absolute; top: -30px; width: clamp(460px, 52vw, 880px); height: auto; z-index: 0;
  opacity: 1; pointer-events: none; filter: drop-shadow(0 16px 44px rgba(0,0,0,0.8));
}
.char-left  { right: 50%; margin-right: 30px; }
.char-right { left: 50%; margin-left: 30px; transform: scaleX(-1); }
header > *:not(.header-char):not(.mist):not(.eye-glow) { position: relative; z-index: 1; }

/* ---- Glowing eyes: screen-blended radial hotspots pinned to each
   character's eyes (percent coords of the art box, so they track the
   responsive size). The vampire art is mirrored, so its overlay is too. ---- */
.eye-glow {
  position: absolute; top: -30px; width: clamp(460px, 52vw, 880px);
  z-index: 0; pointer-events: none; mix-blend-mode: screen;
  animation: eye-pulse 2.6s ease-in-out infinite alternate;
}
.eyes-zombie {
  right: 50%; margin-right: 30px; aspect-ratio: 1100 / 960;
  background:
    radial-gradient(circle at 48.5% 33.5%,
      rgba(240,255,140,0.95) 0%, rgba(196,255,70,0.55) 1.6%,
      rgba(150,220,40,0.22) 4%, transparent 8%);
}
.eyes-vampire {
  left: 50%; margin-left: 30px; transform: scaleX(-1); aspect-ratio: 1101 / 1099;
  background:
    radial-gradient(circle at 50.4% 25.9%,
      rgba(255,110,120,0.95) 0%, rgba(255,45,75,0.55) 1.4%,
      rgba(255,30,60,0.2) 3.4%, transparent 6.5%),
    radial-gradient(circle at 54.6% 25.7%,
      rgba(255,110,120,0.95) 0%, rgba(255,45,75,0.55) 1.4%,
      rgba(255,30,60,0.2) 3.4%, transparent 6.5%);
}
@keyframes eye-pulse {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .eye-glow { animation: none; opacity: 0.8; }
}

/* ---- Faction smoke rising from behind the header characters. Six wisps
   per side, each its own size/lane/speed/sway (inline CSS vars), blurred
   radial puffs that climb, drift sideways, swell and dissipate — a
   continuous smoke stream. Tints match the map's shading endpoints. ---- */
.mist {
  position: absolute; top: -30px; width: clamp(460px, 52vw, 880px); height: 110%;
  z-index: 0; pointer-events: none;
}
.mist-left  { right: 50%; margin-right: 30px; }
.mist-right { left: 50%; margin-left: 30px; }
.mist i {
  position: absolute; bottom: 0; left: var(--x);
  width: var(--w); height: var(--h);
  border-radius: 50% 50% 42% 42% / 62% 62% 30% 30%;
  filter: blur(12px); opacity: 0; will-change: transform, opacity;
  transform-origin: 50% 100%;
  animation: steam-rise var(--d) linear infinite;
  animation-delay: var(--dl);
}
.mist-left i {
  background:
    radial-gradient(48% 30% at 50% 88%, rgba(63,125,31,0.75), transparent 74%),
    radial-gradient(38% 42% at 46% 55%, rgba(63,125,31,0.5), transparent 72%),
    radial-gradient(30% 46% at 56% 22%, rgba(63,125,31,0.3), transparent 70%);
}
.mist-right i {
  background:
    radial-gradient(48% 30% at 50% 88%, rgba(214,31,61,0.75), transparent 74%),
    radial-gradient(38% 42% at 46% 55%, rgba(214,31,61,0.5), transparent 72%),
    radial-gradient(30% 46% at 56% 22%, rgba(214,31,61,0.3), transparent 70%);
}
@keyframes steam-rise {
  0% {
    transform: translate(0, 26%) scaleY(0.45) scaleX(0.9) skewX(0deg) rotate(0deg);
    opacity: 0;
  }
  14% { opacity: 0.85; }
  40% {
    transform: translate(calc(var(--sw) * 0.35), -26%) scaleY(0.95) scaleX(0.8)
      skewX(calc(var(--bend) * 0.6)) rotate(calc(var(--bend) * 0.4));
    opacity: 0.6;
  }
  70% {
    transform: translate(calc(var(--sw) * 0.75), -62%) scaleY(1.25) scaleX(0.62)
      skewX(var(--bend)) rotate(calc(var(--bend) * 0.8));
    opacity: 0.34;
  }
  100% {
    transform: translate(var(--sw), -100%) scaleY(1.5) scaleX(0.5)
      skewX(calc(var(--bend) * -0.5)) rotate(var(--bend));
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mist i { animation: none; opacity: 0.3; transform: none; }
}
}
.logo { width: 220px; height: auto; margin-bottom: 6px; filter: drop-shadow(0 6px 16px rgba(0,0,0,0.65)); }
.eyebrow { letter-spacing: 4px; font-size: 12px; color: var(--red); font-weight: 700; margin-bottom: 6px; }
/* Season wordmark, replacing the built-up CSS type. Sized by width at each
   breakpoint the old font-size steps used, so the header keeps its rhythm. */
h1.title-logo { margin: 0; line-height: 0; }
h1.title-logo img {
  display: block;
  width: 460px; max-width: 88%;
  height: auto; margin: 0 auto;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.7));
}
.subtitle { color: var(--muted); letter-spacing: 3px; font-size: 13px; margin-top: 8px; text-transform: uppercase; }
.freshness { color: var(--muted); font-size: 11px; letter-spacing: 1px; margin-top: 6px; }
.timeline { margin: 14px auto 2px; max-width: 620px; }
.tl-row { display: flex; align-items: center; gap: 14px; }
.tl-end {
  font-size: 12px; letter-spacing: 2px; color: #cfd6ee; white-space: nowrap;
  text-transform: uppercase; font-weight: 700;
}
.timeline input[type="range"] {
  flex: 1; height: 22px; cursor: pointer; accent-color: var(--vamp);
  -webkit-appearance: none; appearance: none; background: transparent;
}
.timeline input[type="range"]::-webkit-slider-runnable-track {
  /* 50% thicker; passed days reveal a per-day growth gradient (green =
     zombies out-grew vampires that day, red = the reverse), the road ahead
     stays dark until the scrubber passes it */
  height: 9px; border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0) 0 var(--p, 0%), rgba(30,28,46,0.92) var(--p, 0%) 100%),
    var(--daygrad, rgba(120,130,180,0.35));
}
.timeline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -4.5px;
  border-radius: 50%; background-color: var(--vamp);
  border: 2px solid #fff; background-position: center; background-repeat: no-repeat;
  transition: border-radius 0.3s ease, width 0.3s ease, background-color 0.3s ease;
}
/* auto-play: the thumb becomes a fast-forward pill, then eases back */
.timeline input[type="range"].playing::-webkit-slider-thumb {
  width: 26px; border-radius: 6px; background-color: #1d1530;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffe9a8'%3E%3Cpath d='M4 5v14l8-7zM13 5v14l8-7z'/%3E%3C/svg%3E");
  background-size: 14px 14px;
}
.timeline input[type="range"]::-moz-range-track {
  height: 9px; border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0) 0 var(--p, 0%), rgba(30,28,46,0.92) var(--p, 0%) 100%),
    var(--daygrad, rgba(120,130,180,0.35));
}
.timeline input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background-color: var(--vamp);
  border: 2px solid #fff; transition: border-radius 0.3s ease, width 0.3s ease;
}
.timeline input[type="range"].playing::-moz-range-thumb {
  width: 26px; border-radius: 6px; background-color: #1d1530;
}
.tl-current {
  margin-top: 4px; text-align: center; font-size: 13px; letter-spacing: 2px;
  color: #dfe4f5; font-variant-numeric: tabular-nums; font-weight: 800;
}

.debug-bar { margin-top: 10px; display: flex; align-items: center; gap: 12px; justify-content: center; }
#refresh-btn {
  background: #1c1230; color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 6px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
  letter-spacing: 0.5px; transition: border-color 0.15s, opacity 0.15s;
}
#refresh-btn:hover:not(:disabled) { border-color: var(--vamp); }
#refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.refresh-status { font-size: 11px; letter-spacing: 0.5px; }
.refresh-status.ok { color: var(--zomb-glow); }
.refresh-status.err { color: var(--red); }
.refresh-status.busy { color: var(--muted); }

/* ---- Global three-way bar ---- */
.global-bar { margin: 26px auto 0; max-width: 920px; }
.faction-stats { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.global-stat { flex: 1; text-align: center; }
.global-stat .stat-label {
  font-size: 12px; letter-spacing: 2px; color: #dfe4f5; margin-bottom: 2px;
  font-weight: 800;
}
.global-stat .stat-pct {
  font-family: var(--font-display); font-size: 40px; line-height: 1.05; letter-spacing: 1px;
  /* tabular digits + a HARD-fixed box (wide enough for "100.0%") so the
     number is fully anchored: the box never grows, never recenters */
  font-variant-numeric: tabular-nums;
  width: 8ch; display: block; margin: 0 auto; text-align: center;
}
.surv-stat .stat-pct { color: var(--surv-glow); }
.vamp-stat .stat-pct { color: var(--vamp-glow); text-shadow: 0 0 18px rgba(255,77,106,0.45); }
.zomb-stat .stat-pct { color: var(--zomb-glow); text-shadow: 0 0 18px rgba(185,205,93,0.4); }

.stack-bar {
  height: 30px; border-radius: 15px; overflow: hidden; display: flex;
  border: 1px solid var(--panel-border); background: #100a1a;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}
.seg { height: 100%; position: relative; transition: width 0.6s ease, filter 0.25s ease; min-width: 2px; }
.seg-zomb, .seg-vamp { cursor: pointer; }
.seg-zomb:hover, .seg-vamp:hover, .seg.focused { filter: brightness(1.45) saturate(1.2); }
/* glossy vertical-gradient fills matching the designer swatches */
.seg-surv { background: linear-gradient(180deg, var(--surv-dark), var(--surv) 50%, var(--surv-dark)); }
.seg-vamp { background: linear-gradient(180deg, var(--vamp-dark), #ff5576 50%, var(--vamp-dark)); }
.seg-zomb { background: linear-gradient(180deg, var(--zomb-dark), #b9cd5d 50%, var(--zomb-dark)); }
.seg + .seg { border-left: 1px solid rgba(0,0,0,0.5); }

section { margin-top: 40px; }
section h2 {
  font-family: var(--font-display);
  font-size: 18px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted);
  margin-bottom: 16px;
}
.map-section { display: flex; gap: 20px; align-items: flex-start; position: relative; z-index: 30; }
#map-wrap {
  flex: 1; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 10px; position: relative; backdrop-filter: blur(3px);
}
#map { width: 100%; height: auto; display: block; }
/* Region masses. No stroke: the six shapes are dissolved outlines with no
   internal borders, and an outline would only re-imply boundaries. */
.region { stroke: none; cursor: pointer; transition: filter 0.12s; }
.region.hl { filter: brightness(1.5); }
/* Before anyone in a region is infected there is nothing to hover: no pointer
   cursor, and the highlight is suppressed in app.js. */
.region.no-data { cursor: default; }
.region.no-data.hl { filter: none; }

.legend { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 12px; font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.legend-gradient { width: 160px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--zomb), #35304a, var(--vamp)); }

/* ---- Country spotlight: floating pop-up over the map, only while hovering.
   Features the winning faction's character big + full colour with its bg;
   the losing faction goes small + greyscale. ---- */
.spot-pop {
  position: absolute; z-index: 20; width: 250px; pointer-events: none;
  border: 1px solid var(--panel-border); border-radius: 12px; overflow: hidden;
  background: #0c0716; box-shadow: 0 14px 40px rgba(0,0,0,0.7);
  opacity: 0; transition: opacity 0.12s ease;
}
.spot-pop.show { opacity: 1; }
.spot-pop[hidden] { display: none; }
.spot-pop.dom-vamp { border-color: rgba(255,77,106,0.7); }
.spot-pop.dom-zomb { border-color: rgba(185,205,93,0.7); }
.spot-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0.55; filter: saturate(1.1);
}
.spot-inner {
  position: relative; z-index: 2; padding: 12px 14px 14px;
  background: linear-gradient(180deg, rgba(8,4,14,0.78) 0%, rgba(8,4,14,0.5) 45%, rgba(8,4,14,0.9) 100%);
}
.spot-country {
  font-family: var(--font-display); font-size: 18px; text-align: center; line-height: 1.1;
  letter-spacing: 1px; color: var(--text); text-shadow: 0 2px 10px rgba(0,0,0,0.85);
}
.spot-stage {
  position: relative; height: 150px; margin: 8px 0;
  display: flex; align-items: center; justify-content: center;
}
/* status badge (BITTEN / INFECTED) sized to the winning faction */
.spot-status {
  max-width: 96%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.55));
}

.spot-percents { display: flex; justify-content: space-between; align-items: baseline; }
.spot-p { font-size: 12px; color: var(--muted); }
.spot-p b { font-family: var(--font-display); font-size: 24px; }
.spot-p-zomb b { color: var(--zomb-glow); }
.spot-p-vamp b { color: var(--vamp-glow); }
.spot-pop.dom-zomb .spot-p-vamp b, .spot-pop.dom-vamp .spot-p-zomb b { color: var(--muted); opacity: 0.7; }
.spot-bar { height: 10px; border-radius: 5px; overflow: hidden; display: flex; margin-top: 7px; background: #100a1a; border: 1px solid var(--panel-border); }
.spot-bar-fill { height: 100%; transition: width 0.25s; }
.spot-bar-zomb { background: linear-gradient(180deg, var(--zomb-dark), var(--zomb) 55%, var(--zomb-dark)); }
.spot-bar-vamp { background: linear-gradient(180deg, var(--vamp-dark), #ff5576 55%, var(--vamp-dark)); }

/* ---- Leaderboards with faction frame + character ---- */
.leaderboard-section { display: flex; gap: 20px; }
.board {
  flex: 1; position: relative; border-radius: 14px;
  padding: 22px 24px 20px;
  background: rgba(9, 5, 16, 0.78);
  backdrop-filter: blur(3px);
  border: 2px solid;
}
/* clean faction-colored border + outer/inner glow (no frame art) */
.zomb-board {
  border-color: var(--zomb);
  box-shadow: 0 0 22px rgba(185, 205, 93, 0.4), inset 0 0 32px rgba(185, 205, 93, 0.07);
}
.vamp-board {
  border-color: var(--vamp);
  box-shadow: 0 0 22px rgba(255, 77, 106, 0.4), inset 0 0 32px rgba(255, 77, 106, 0.07);
}
.board h2 {
  border-left-color: transparent; padding-left: 0; position: relative; z-index: 2;
  font-size: 20px; margin-top: 0;
}
.vamp-board h2 { color: var(--vamp-glow); }
.zomb-board h2 { color: var(--zomb-glow); }

table { width: 100%; border-collapse: collapse; position: relative; z-index: 2; }
td { padding: 9px 6px; border-bottom: 1px solid #221a35; font-size: 14px; }
tr:last-child td { border-bottom: none; }
.rank-cell { width: 38px; font-size: 16px; text-align: center; }
.name-cell { font-weight: 700; }
.id-tag { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 8px; }
.infect-cell { text-align: right; font-family: var(--font-display); font-size: 19px; letter-spacing: 0.5px; }
.vamp-row .infect-cell { color: var(--vamp-glow); }
.zomb-row .infect-cell { color: var(--zomb-glow); }


.loading, .error-banner { text-align: center; color: var(--muted); padding: 40px; letter-spacing: 1px; }
.error-banner { color: var(--red); }

@media (max-width: 800px) {
  h1.title-logo img { width: 360px; }
  .map-section, .leaderboard-section { flex-direction: column; }
  #hotspots { flex: none; width: 100%; }
  /* narrow screens: zombies + vampires side by side, SURVIVORS below */
  .faction-stats { flex-wrap: wrap; }
  .zomb-stat, .vamp-stat { flex: 1 1 40%; }
  .surv-stat { flex: 1 1 100%; order: 3; }
  .bg-half { width: 100%; opacity: 0.5; }
  .header-char { display: none; }
}

/* ---- perf: dots render on one canvas overlaid on the map svg ---- */
#map-wrap { position: relative; }
#dot-canvas { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; }
.spot-pop { z-index: 50; }

/* ---- vertical "day of the infection" control (demo), pinned left ---- */
.sim-day[hidden] { display: none; } /* author display:flex beats the hidden attr otherwise */
.sim-day {
  position: fixed; left: 16px; top: 50%; transform: translateY(-50%);
  z-index: 60; display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 14px 10px; border-radius: 12px;
  background: rgba(12,9,20,0.82); border: 1px solid rgba(120,130,180,0.35);
}
.sim-day-title { font-size: 10px; letter-spacing: 3px; color: var(--muted); font-weight: 700; }
.sim-day-val {
  font-size: 13px; letter-spacing: 1px; color: #ffe9a8; font-weight: 700;
  font-variant-numeric: tabular-nums; min-width: 44px; text-align: center;
}
#sim-slider {
  writing-mode: vertical-lr; direction: rtl; /* day 1 at the bottom */
  height: 34vh; min-height: 180px; width: 22px; cursor: pointer;
  accent-color: var(--vamp);
}
@media (max-width: 900px) { .sim-day { display: none; } }

/* popup faction headers */
.spot-side { font-size: 10px; letter-spacing: 1.5px; font-weight: 800; }
.side-z { color: var(--zomb-glow); }
.side-v { color: var(--vamp-glow); }

/* ==== Phone layouts ====
   Breakpoints keyed to the top handsets' logical viewports:
   - 430x932  iPhone Pro Max (19.5:9)
   - 412x915  Pixel 9 / Galaxy S25 (20:9)
   - 393x852  iPhone 16/17 (19.5:9)
   - 360x800  compact Androids (20:9)
   One column, vertical scrolling only; key art returns at phone scale. */
@media (max-width: 480px) {
  html, body { overflow-x: hidden; }
  .app { padding: 12px 10px 36px; }
  .logo { width: 148px; margin-bottom: 4px; }
  h1.title-logo img { width: 268px; }
  /* the characters flank the title at phone scale (hidden on tablets) */
  .header-char { display: block; width: clamp(170px, 58vw, 270px); top: -4px; }
  .char-left { margin-right: 6px; }
  .char-right { margin-left: 6px; }
  .mist, .eye-glow { width: clamp(170px, 58vw, 270px); top: -4px; }
  .mist-left, .eyes-zombie { margin-right: 6px; }
  .mist-right, .eyes-vampire { margin-left: 6px; }
  .mist i { filter: blur(7px); }
  .global-bar { margin-top: 6px; }
  .faction-stats { gap: 8px; margin-bottom: 8px; }
  .global-stat .stat-label { font-size: 10px; letter-spacing: 1px; }
  .global-stat .stat-pct { font-size: 24px; width: 7ch; }
  .timeline { max-width: none; margin: 10px 2px 0; }
  .tl-row { gap: 8px; }
  .tl-end { font-size: 9px; letter-spacing: 1px; }
  .tl-current { font-size: 11px; letter-spacing: 1px; }
  .timeline input[type="range"]::-webkit-slider-thumb {
    width: 22px; height: 22px; margin-top: -6.5px;
  }
  .timeline input[type="range"].playing::-webkit-slider-thumb { width: 30px; }
  #map-wrap h2, .map-section h2 { font-size: 16px; }
  /* map panel centered on the screen */
  .map-section { justify-content: center; }
  #map-wrap { width: 100%; max-width: 100%; margin-left: auto; margin-right: auto; }
  #map { margin: 0 auto; }
  .legend { font-size: 10px; gap: 8px; }
  .legend-gradient { width: 84px; }
  .spot-pop { width: 205px; }
}
/* ultra-tall 20:9 handsets (Pixel/Galaxy/compact Androids): use the extra
   height — a touch more breathing room around the meter and map */
@media (max-width: 480px) and (max-aspect-ratio: 9/19) {
  .global-bar { margin-top: 10px; }
  .timeline { margin-top: 14px; }
  #map-wrap { margin-top: 10px; }
}
/* 393px and 360px classes */
@media (max-width: 400px) {
  h1.title-logo img { width: 240px; }
  .global-stat .stat-pct { font-size: 21px; }
  .logo { width: 132px; }
}
@media (max-width: 365px) {
  h1.title-logo img { width: 212px; }
  .global-stat .stat-pct { font-size: 19px; }
  .logo { width: 118px; }
  .header-char, .mist, .eye-glow { width: clamp(150px, 56vw, 210px); }
}

/* ==== Staged load: the SNAP logo + ZOMBIES VS VAMPIRES paint immediately;
   everything else stays out until the data + map are ready, then "bloops"
   in with a springy pop (body.revealed flips the switch). ==== */
body:not(.revealed) .bloop { opacity: 0; transform: scale(0.9); }
body:not(.revealed) .eye-glow { opacity: 0 !important; }
body:not(.revealed) .bg-split { opacity: 0; }
.bg-split { transition: opacity 1.1s ease; }
body.revealed .bloop {
  animation: bloop-in 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--bd, 0ms);
  opacity: 0;
}
@keyframes bloop-in {
  0%   { opacity: 0; transform: scale(0.9); }
  62%  { opacity: 1; transform: scale(1.035); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.revealed) .bloop { opacity: 1; transform: none; }
  body.revealed .bloop { animation: none; opacity: 1; transform: none; }
}
