/* ------------------------------------------------------------------------
   PokeRoamers marketing site — "Night Launch".
   Dark palette lifted from the game (style.css): bg #10141f, gold #ffd60a,
   pokéball red #e63946, login gradient #1b2a4a → #0e1626 → #251b3a.
   All motion initial-states are set by site.js (gsap.set), so with JS off
   or reduced motion the page is fully readable as-is.
   ------------------------------------------------------------------------ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #10141f;
  --panel: #1a2238;
  --line: #3b4a6b;
  --gold: #ffd60a;
  --red: #e63946;
  --ink: #e8e8e8;
  --muted: #9fb0d0;
}
/* overflow-x: clip (not hidden) kills sideways panning on phones without
   turning html into a scroll container — the marquees are also clipped at
   their own sections, this is the belt-and-braces layer.
   NO scroll-behavior: smooth — it makes even programmatic scrollTop writes
   animate, which fights GSAP's section-snap tween (site.js smooths the one
   nav anchor itself). */
html { overflow-x: clip; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
/* pixel art must scale crisp, always at the browser's nearest-neighbour */
.dex-hero img, .region-badges, #dexRows img, .leader-strip img, #itemMarquee img,
.mini-sil img, .nav-mark img { image-rendering: pixelated; }

/* the persistent Three.js canvas sits behind everything */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
main, footer, #nav { position: relative; z-index: 1; }

/* ---------- loading curtain ---------- */
/* Opaque and painted before any JS; site.js drives the bar and fades it out
   once every image has decoded. The failsafe animation self-hides it after
   14s so a dead script can never brick the page (site.js cancels it). */
#loader {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 22px; opacity: 1; transition: opacity .5s ease;
  animation: loaderFailsafe 14s step-end forwards;
}
#loader.done { opacity: 0; pointer-events: none; }
@keyframes loaderFailsafe { 0%, 99% { opacity: 1; } 100% { opacity: 0; visibility: hidden; pointer-events: none; } }
.loader-ball { animation: loaderBounce 1.1s cubic-bezier(.36, 0, .34, 1) infinite alternate; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .5)); }
@keyframes loaderBounce {
  0% { transform: translateY(-12px) rotate(-8deg); }
  100% { transform: translateY(8px) rotate(8deg); }
}
.loader-bar {
  width: min(240px, 60vw); height: 4px; border-radius: 999px;
  background: rgba(59, 74, 107, .45); overflow: hidden;
}
#loaderFill {
  display: block; width: 0%; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), #ffe14d);
  transition: width .25s ease;
}
.loader-pct {
  color: var(--muted); font-size: 12px; letter-spacing: .28em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ---------- nav ---------- */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 48px) 14px;
  background: linear-gradient(180deg, rgba(16, 20, 31, .85), rgba(16, 20, 31, 0));
}
#nav a { text-decoration: none; color: var(--ink); }
.nav-mark { display: flex; align-items: center; gap: 10px; font-size: 18px; letter-spacing: .04em; }
.nav-mark b { color: var(--gold); }
.nav-play {
  font-weight: 700; font-size: 14px; letter-spacing: .06em;
  padding: 9px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(26, 34, 56, .7); backdrop-filter: blur(8px);
  transition: border-color .2s, background .2s, transform .2s;
}
.nav-play:hover { border-color: var(--gold); background: rgba(37, 27, 58, .8); transform: translateY(-1px); }

/* ---------- shared type ---------- */
section { position: relative; padding: clamp(80px, 12vh, 140px) clamp(16px, 6vw, 72px); }
.kicker {
  color: var(--gold); text-transform: uppercase; font-size: 13px;
  letter-spacing: .32em; font-weight: 700; margin-bottom: 18px;
}
h1 {
  font-size: clamp(44px, 8vw, 104px); line-height: 1.02; font-weight: 800;
  letter-spacing: -.02em;
}
h2 { font-size: clamp(32px, 5vw, 64px); line-height: 1.06; font-weight: 800; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: clamp(16px, 1.6vw, 20px); line-height: 1.6; max-width: 560px; margin-top: 22px; }
/* the manual char-splitter wraps each letter; overflow-clip makes the
   stagger rise out of a "mask" line */
[data-split] .w { display: inline-block; overflow: clip; vertical-align: bottom; }
[data-split] .ch { display: inline-block; will-change: transform; }

.cta {
  display: inline-block; margin-top: 36px; text-decoration: none;
  background: var(--gold); color: #171a21; font-weight: 800; font-size: 17px;
  padding: 16px 34px; border-radius: 999px; letter-spacing: .02em;
  box-shadow: 0 8px 40px rgba(255, 214, 10, .25);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.cta:hover { transform: translateY(-2px) scale(1.02); background: #ffe14d; box-shadow: 0 12px 56px rgba(255, 214, 10, .4); }
.cta-big { font-size: 20px; padding: 20px 44px; }

/* ---------- hero ---------- */
#hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  max-width: 1200px; margin: 0 auto;
}
#hero .sub { max-width: 480px; }
.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid var(--line); border-radius: 999px;
}
.scroll-cue span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--gold);
  animation: cue 1.6s ease-in-out infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- regions (pinned horizontal scrub on desktop) ---------- */
#regions { padding: 0; }
.regions-viewport { overflow: hidden; }
#regionsTrack { display: flex; width: 300vw; }
.region {
  position: relative; width: 100vw; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(24px, 5vw, 80px); overflow: hidden;
  padding: 0 clamp(16px, 4vw, 56px);
}
.region:nth-child(even) { flex-direction: row-reverse; } /* Johto: map on the right */
/* the AUTHENTIC in-game region map (FRLG Town Map, gen-2 Pokégear, Emerald
   PokéNav — public/world/<region>-townmap.png) as a framed piece beside the
   card, crisp-pixel upscaled — the map you actually open in the game,
   deliberately NOT a full-screen backdrop (user request) */
.region-map {
  flex: 0 1 auto; width: clamp(280px, 36vw, 640px);
  background: rgba(10, 13, 21, .8); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 14px 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  will-change: transform;
}
.region-map img { width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; }
.region-map figcaption {
  color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  text-align: center; padding-top: 10px;
}
.region[data-region='johto'] .region-map img { animation: johtoNight 9s ease-in-out infinite alternate; }
@keyframes johtoNight {
  0%, 30% { filter: none; }
  100% { filter: brightness(.55) hue-rotate(-18deg) saturate(.8); }
}
.region-card {
  position: relative; z-index: 1; max-width: 620px;
  background: linear-gradient(160deg, rgba(27, 42, 74, .88), rgba(14, 22, 38, .92) 60%, rgba(37, 27, 58, .88));
  border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(28px, 4vw, 48px); margin: 0 clamp(16px, 5vw, 64px);
  backdrop-filter: blur(10px); box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.region-card p { color: var(--muted); line-height: 1.65; margin-top: 16px; font-size: clamp(15px, 1.4vw, 18px); }
.region-badges { margin-top: 24px; width: 256px; height: 32px; }

/* ---------- dex ---------- */
#dex { text-align: center; overflow-x: clip; } /* the marquee rows bleed past the viewport */
#dex .sub { margin-left: auto; margin-right: auto; }
#dexCounter { color: var(--gold); font-variant-numeric: tabular-nums; }
.dex-heroes { display: flex; justify-content: center; gap: clamp(12px, 4vw, 48px); margin-top: 44px; }
.dex-hero {
  background: radial-gradient(circle at 50% 60%, rgba(59, 74, 107, .35), transparent 70%);
  border: none; cursor: pointer; border-radius: 20px; padding: 10px;
  transition: transform .2s;
}
.dex-hero:hover { transform: translateY(-6px) scale(1.06); }
.dex-hero img { width: clamp(96px, 14vw, 160px); height: auto; }
.dex-hero.flash img { animation: shinyFlash .5s ease-out; }
@keyframes shinyFlash {
  0% { filter: brightness(4) drop-shadow(0 0 24px var(--gold)); }
  100% { filter: none; }
}
.dex-hint { color: var(--muted); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; margin-top: 10px; }
#dexRows { margin-top: 56px; display: grid; gap: 18px; }
.dex-row { display: flex; gap: 26px; width: max-content; will-change: transform; }
.dex-row img { width: 64px; height: 64px; opacity: .9; }

/* ---------- battles ---------- */
#battles { text-align: center; max-width: 1400px; margin: 0 auto; }
.shots3d {
  display: flex; justify-content: center; align-items: center; gap: clamp(8px, 2vw, 28px);
  margin-top: 64px; perspective: 1200px;
}
.shot {
  flex: 1 1 0; max-width: 460px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  will-change: transform;
}
.shot-main { max-width: 560px; box-shadow: 0 0 0 1px rgba(255, 214, 10, .35), 0 32px 90px rgba(0, 0, 0, .6); }
.stat-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(24px, 5vw, 80px);
  margin-top: 72px;
}
.stat b { display: block; font-size: clamp(36px, 4.5vw, 60px); color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.leader-strip { display: flex; justify-content: center; gap: clamp(10px, 2vw, 24px); margin-top: 56px; flex-wrap: wrap; }
.leader-strip img { width: 96px; height: 96px; }

/* ---------- together ---------- */
#together .cols {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px); max-width: 1300px; margin: 0 auto; align-items: center;
}
.col-shots { position: relative; }
.tshot {
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55); will-change: transform;
}
.tshot-2 { margin: -18% 0 0 22%; max-width: 78%; box-shadow: 0 0 0 1px rgba(255, 214, 10, .25), 0 24px 80px rgba(0, 0, 0, .6); }
.feat-list { list-style: none; margin-top: 36px; display: grid; gap: 22px; }
.feat-list li { display: flex; gap: 16px; align-items: flex-start; }
.feat-list i { font-style: normal; font-size: 22px; line-height: 1.3; }
.feat-list b { display: block; font-size: 17px; }
.feat-list span { color: var(--muted); font-size: 15px; line-height: 1.55; }

/* ---------- endgame ---------- */
#endgame { text-align: center; max-width: 1300px; margin: 0 auto; overflow-x: clip; } /* the item marquee bleeds too */
#itemMarquee { display: flex; gap: 34px; width: max-content; margin-bottom: 64px; opacity: .8; will-change: transform; }
#itemMarquee img { width: 40px; height: 40px; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-top: 52px; text-align: left;
}
.card {
  background: linear-gradient(160deg, rgba(27, 42, 74, .55), rgba(14, 22, 38, .75));
  border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(255, 214, 10, .5); }
.card img { width: 32px; height: 32px; image-rendering: pixelated; margin-bottom: 12px; }
.card b { display: block; margin-bottom: 6px; font-size: 16px; }
.card span { color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ---------- minigames ---------- */
#minigames { text-align: center; max-width: 1100px; margin: 0 auto; }
.mini-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 52px; }
.mini {
  background: rgba(14, 22, 38, .7); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px 22px;
}
.mini-sil img { margin: 0 auto 14px; width: 96px; height: 96px; filter: brightness(0); transition: filter .35s; }
.mini:hover .mini-sil img { filter: none; }
.mini b { display: block; font-size: 18px; color: var(--gold); }
.mini span { display: block; color: var(--muted); font-size: 14px; margin-top: 8px; line-height: 1.55; }

/* ---------- cta / footer ---------- */
#cta { text-align: center; min-height: 90vh; display: flex; flex-direction: column; justify-content: center; align-items: center; }
#cta .sub { margin-left: auto; margin-right: auto; }
footer {
  border-top: 1px solid rgba(59, 74, 107, .5); padding: 36px clamp(16px, 6vw, 72px) 44px;
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: center;
  background: rgba(10, 13, 21, .8);
}
footer p { color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 640px; }
footer a { color: var(--gold); text-decoration: none; font-weight: 700; font-size: 14px; letter-spacing: .06em; }

/* on touch screens hover can't reveal the minigame silhouettes — site.js
   toggles .lit on tap instead */
.mini.lit .mini-sil img { filter: none; }

/* ---------- small screens: vertical regions, calmer layout ---------- */
@media (max-width: 820px) {
  section { padding-left: 20px; padding-right: 20px; }
  #hero { padding-bottom: 96px; } /* keep the CTA clear of the scroll cue */
  #hero .sub { font-size: 16px; }
  /* the particle ball sits behind the hero and CTA copy on phones (site.js
     shrinks and raises it) — ground the text against the dots */
  #hero h1, #hero .sub, #hero .kicker,
  #cta h2, #cta .sub { text-shadow: 0 2px 18px rgba(16, 20, 31, .95), 0 0 6px rgba(16, 20, 31, .8); }
  /* muted blue-grey drowns in the ball's white hemisphere — go brighter here */
  #hero .sub, #cta .sub { color: #cdd7ec; }
  #regionsTrack { display: block; width: 100%; }
  .region, .region:nth-child(even) {
    width: 100%; min-height: 88vh; flex-direction: column; justify-content: center;
    gap: 26px; padding: 48px clamp(16px, 4vw, 56px);
  }
  .region-map { width: min(86vw, 420px); }
  .region-card { margin: 0; }
  .region-badges { width: 192px; height: 24px; }
  #together .cols { grid-template-columns: 1fr; }
  .shots3d { flex-direction: column; align-items: center; gap: 18px; perspective: none; }
  /* flex: 1 1 0 collapses to zero height in an auto-height COLUMN flex —
     the shots must size themselves from their aspect ratio here */
  .shot { flex: 0 0 auto; width: min(92vw, 560px); max-width: none; }
  .tshot-2 { margin: -10% 0 0 12%; max-width: 84%; } /* gentler overlap than desktop's -18% */
  .leader-strip img { width: 64px; height: 64px; }
  .dex-row img { width: 48px; height: 48px; }
  .dex-row { gap: 18px; }
  #dexRows { margin-top: 40px; }
  .stat-row { gap: 28px; margin-top: 56px; }
  .stat { min-width: 120px; }
  .card { padding: 18px; }
  .cta { padding: 15px 30px; }
  .cta-big { font-size: 18px; padding: 18px 38px; }
  footer { padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px)); text-align: center; justify-content: center; }
}

/* PUBLIC_MODE landing: families the public server doesn't carry (see
   site.js) — screenshots, the item marquee and the two disabled minigames */
/* the minigame CARDS stay — since the client-rendered rounds all three run
   on public servers too — only their mon-sprite art hides */
.public-mode .shot,
.public-mode .tshot,
.public-mode #itemMarquee,
.public-mode #dexRows,
.public-mode .dex-hero,
.public-mode .mini-sil { display: none; }
