/* ============================================================
   WILDKIN — "Neon Saturday Morning"
   90s Memphis / synthwave / Lisa-Frank saturation, executed with
   modern polish. Loud enough for an 8-year-old, legible enough
   for a grandparent, readable in direct sun (body.outdoor).
   ============================================================ */

@font-face {
  font-family: 'Titan One';
  src: url('../fonts/titan-one.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/nunito-var.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --grape: #1a0b2e;
  --indigo: #16213e;
  --magenta: #ff2e97;
  --cyan: #00f0ff;
  --lime: #aaff00;
  --yellow: #ffe600;
  --purple: #b14aff;
  --orange: #ff8a00;
  --gold: #ffd700;
  --ink: #1a0b2e;
  --cream: #fff4e0;
  --text: #f5f1ff;
  --muted: #b9b0d6;

  --glass: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.16);

  --display: 'Titan One', 'Comic Sans MS', cursive;
  --body: 'Nunito', system-ui, sans-serif;

  --r-lg: 26px;
  --r-pill: 999px;
  --shadow-pop: 0 6px 0;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; overscroll-behavior: none; }
/* kids wave the phone: kill double-tap zoom + pull-to-refresh on game
   screens (scrollable panels keep pan-y via the body default) */
body { touch-action: pan-y; }
.screen[data-screen="hunt"], .screen[data-screen="ar"], .screen[data-screen="scan"] { touch-action: none; }

body {
  font-family: var(--body);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(177, 74, 255, 0.35), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(0, 240, 255, 0.22), transparent 55%),
    radial-gradient(700px 500px at 110% 80%, rgba(255, 46, 151, 0.18), transparent 50%),
    linear-gradient(160deg, var(--grape), var(--indigo));
  background-attachment: fixed;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Memphis confetti backdrop ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.confetti i {
  position: absolute;
  display: block;
  opacity: 0.5;
  animation: drift 14s ease-in-out infinite alternate;
}
.confetti .tri {
  width: 0; height: 0;
  border-left: 11px solid transparent; border-right: 11px solid transparent;
  border-bottom: 19px solid var(--c, var(--cyan));
}
.confetti .dot { width: 13px; height: 13px; border-radius: 50%; background: var(--c, var(--magenta)); }
.confetti .zig {
  width: 34px; height: 12px; background: none;
  border-bottom: 4px solid var(--c, var(--yellow));
  clip-path: polygon(0 100%, 17% 0, 33% 100%, 50% 0, 67% 100%, 83% 0, 100% 100%, 100% 100%, 0 100%);
  background: var(--c, var(--yellow));
}
.confetti .ring { width: 18px; height: 18px; border-radius: 50%; border: 4px solid var(--c, var(--lime)); }
@keyframes drift {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(22px, -30px) rotate(40deg); }
}

/* ---------- screens & layout ---------- */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
}
.screen[hidden] { display: none; }
.screen--has-nav { padding-bottom: calc(86px + var(--safe-b)); }

.panel { padding: 18px 18px 30px; max-width: 560px; margin: 0 auto; width: 100%; }
.panel--center { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }

.stack { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 360px; margin: 0 auto; }
.center { text-align: center; }
.muted { color: var(--muted); font-weight: 600; }

/* ---------- type ---------- */
.h-display {
  font-family: var(--display);
  font-size: clamp(1.7rem, 6.5vw, 2.4rem);
  letter-spacing: 0.02em;
  line-height: 1.06;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.h-display em { font-style: normal; color: var(--lime); text-shadow: 0 0 18px rgba(170, 255, 0, 0.6), 0 3px 0 rgba(0,0,0,0.35); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: var(--r-pill);
  min-height: 58px;
  padding: 12px 28px;
  cursor: pointer;
  box-shadow: var(--shadow-pop) var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.btn--primary {
  background: linear-gradient(135deg, var(--magenta), var(--orange));
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  box-shadow: var(--shadow-pop) #8f1257, 0 0 28px rgba(255, 46, 151, 0.45);
}
.btn--primary:active { box-shadow: 0 1px 0 #8f1257; }
.btn--secondary {
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  box-shadow: var(--shadow-pop) #0a7a85, 0 0 24px rgba(0, 240, 255, 0.35);
}
.btn--secondary:active { box-shadow: 0 1px 0 #0a7a85; }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: none;
}
.btn--xl { min-height: 68px; font-size: 1.25rem; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.chip {
  font-family: var(--body); font-weight: 800; font-size: 0.85rem;
  color: var(--text);
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: var(--r-pill);
  padding: 8px 14px;
  min-height: 40px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}
.chip--dark { background: rgba(10, 5, 25, 0.65); }
.chip.is-on { background: var(--yellow); color: var(--ink); border-color: var(--ink); }

/* ---------- badges (rarity stickers) ---------- */
.badge {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 3px solid #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  display: inline-block;
}
.badge--common    { background: #6e6788; color: #fff; }
.badge--rare      { background: var(--cyan); color: var(--ink); }
.badge--epic      { background: var(--purple); color: #fff; }
.badge--legendary {
  background: linear-gradient(110deg, #ffd700, #fff3b0 30%, #ffd700 55%, #ffb700);
  background-size: 220% 100%;
  color: var(--ink);
  animation: holo 2.2s linear infinite;
}
@keyframes holo { to { background-position: -220% 0; } }

/* ============ SPLASH ============ */
.screen--splash { justify-content: center; overflow: hidden; }
.splash__grid {
  position: absolute; left: -20%; right: -20%; bottom: -6%;
  height: 42%;
  background:
    linear-gradient(transparent 0%, rgba(177, 74, 255, 0.25) 100%),
    repeating-linear-gradient(90deg, rgba(0, 240, 255, 0.35) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(0deg, rgba(0, 240, 255, 0.35) 0 2px, transparent 2px 38px);
  transform: perspective(380px) rotateX(58deg);
  transform-origin: bottom;
  mask-image: linear-gradient(transparent, #000 35%);
  -webkit-mask-image: linear-gradient(transparent, #000 35%);
}
.splash__inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 32px 22px 56px;
  text-align: center;
}
.splash__kicker {
  font-weight: 900; letter-spacing: 0.22em; text-transform: uppercase;
  font-size: 0.74rem; color: var(--cyan);
}
.logo {
  font-family: var(--display);
  font-size: clamp(3.4rem, 17vw, 5.6rem);
  line-height: 0.95;
  color: #fff;
  text-shadow:
    0 0 24px rgba(255, 46, 151, 0.55),
    4px 4px 0 var(--magenta),
    8px 8px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-2deg);
}
.logo span {
  display: block;
  color: var(--yellow);
  text-shadow:
    0 0 24px rgba(255, 230, 0, 0.55),
    4px 4px 0 var(--purple),
    8px 8px 0 rgba(0, 0, 0, 0.4);
}
.splash__tag { font-size: 1.15rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.splash__kinrow { display: flex; gap: 2px; margin: 4px 0 14px; }
.splash__kinrow img {
  width: 64px; height: 64px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.4));
  animation: bob 2.6s ease-in-out infinite;
}
.splash__kinrow img:nth-child(2) { animation-delay: 0.4s; }
.splash__kinrow img:nth-child(3) { animation-delay: 0.8s; width: 78px; height: 78px; margin-top: -10px; }
.splash__kinrow img:nth-child(4) { animation-delay: 1.2s; }
.splash__kinrow img:nth-child(5) { animation-delay: 1.6s; }
@keyframes bob { 50% { transform: translateY(-9px); } }

/* ============ PERMISSIONS ============ */
.perm-list { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 420px; }
.perm {
  display: flex; align-items: center; gap: 14px;
  text-align: left;
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  min-height: 72px;
  color: var(--text);
  font-family: var(--body);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s;
}
.perm__emoji { font-size: 1.9rem; }
.perm__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.perm__body strong { font-size: 1.05rem; font-weight: 900; }
.perm__body span { color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.perm__state {
  font-family: var(--display); font-size: 0.8rem;
  color: var(--yellow);
}
.perm.is-granted { border-color: var(--lime); }
.perm.is-granted .perm__state { color: var(--lime); }
.perm.is-denied  { border-color: var(--magenta); }
.perm.is-denied .perm__state  { color: var(--magenta); }
.perm__note { font-size: 0.8rem; }

/* Location recovery panel — only surfaces when the browser has actually
 * refused, so it is allowed to be loud. It is the one screen that can
 * un-brick the app for a player who tapped "Block". */
.geofix {
  width: 100%; max-width: 420px;
  text-align: left;
  background: var(--glass);
  border: 2px solid var(--magenta);
  border-radius: var(--r-lg);
  padding: 16px 18px 18px;
  margin-top: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.geofix__title {
  font-family: var(--display); font-size: 1.1rem;
  color: var(--magenta);
  margin: 0 0 6px;
}
.geofix__lede { font-size: 0.9rem; font-weight: 600; margin: 0 0 12px; }
.geofix__steps {
  margin: 0 0 12px; padding-left: 22px;
  display: flex; flex-direction: column; gap: 9px;
  font-size: 0.92rem; font-weight: 600; line-height: 1.4;
}
.geofix__steps li::marker { color: var(--lime); font-weight: 900; }
.geofix__steps b { color: var(--lime); font-weight: 900; }
.geofix__also { font-size: 0.78rem; line-height: 1.45; margin: 0 0 14px; }
.geofix__also b { color: var(--muted); font-weight: 900; }
.geofix [data-geofix-retry] { width: 100%; }

/* ============ HOME ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 6px;
  max-width: 560px; margin: 0 auto; width: 100%;
}
.topbar--overlay { position: absolute; top: var(--safe-t); left: 0; right: 0; z-index: 500; }
.topbar__logo { font-family: var(--display); font-size: 1.3rem; text-shadow: 2px 2px 0 var(--magenta); }
.topbar__logo span { color: var(--yellow); }

.hero-card {
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.home-invite { width: 100%; margin-top: 14px; font-size: 0.95rem; min-height: 50px; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border-radius: var(--r-lg);
  border: 3px solid var(--ink);
  padding: 18px 16px;
  min-height: 128px;
  font-family: var(--body);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-pop) var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
  text-align: left;
}
.tile:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.tile__emoji { font-size: 1.7rem; }
.tile__label { font-family: var(--display); font-size: 1.25rem; }
.tile__sub { font-size: 0.78rem; font-weight: 800; opacity: 0.75; }
.tile--hunt  { background: linear-gradient(140deg, var(--magenta), var(--orange)); color: #fff; }
.tile--hunt .tile__sub { opacity: 0.9; }
.tile--hide  { background: linear-gradient(140deg, var(--cyan), var(--lime)); }
.tile--book  { background: linear-gradient(140deg, var(--yellow), var(--orange)); }
.tile--score { background: linear-gradient(140deg, var(--purple), var(--magenta)); color: #fff; }
.tile--score .tile__sub { opacity: 0.9; }

/* ============ HUNT ============ */
.screen--hunt { align-items: center; justify-content: center; overflow: hidden; }
.hunt__pulse {
  position: absolute; left: 50%; top: 46%;
  width: 0; height: 0;
  pointer-events: none;
}
.hunt__pulse::before, .hunt__pulse::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: min(92vmin, 560px); height: min(92vmin, 560px);
  margin-left: calc(min(92vmin, 560px) / -2);
  margin-top: calc(min(92vmin, 560px) / -2);
  border-radius: 50%;
  border: 3px solid var(--band, var(--cyan));
  box-shadow: 0 0 18px var(--band, var(--cyan)), inset 0 0 18px var(--band, var(--cyan));
  animation: sonar var(--rate, 1.6s) ease-out infinite;
}
.hunt__pulse::after { animation-delay: calc(var(--rate, 1.6s) / 2); }
@keyframes sonar {
  from { transform: scale(0.04); opacity: 0.9; }
  to   { transform: scale(1); opacity: 0; }
}
.hunt__inner {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  text-align: center; padding: 20px;
}
.hunt__hint { font-weight: 800; color: var(--muted); font-size: 1rem; }
.hunt__band {
  font-family: var(--display);
  font-size: clamp(3rem, 15vw, 4.6rem);
  color: var(--band, var(--cyan));
  text-shadow: 0 0 30px var(--band, var(--cyan)), 0 4px 0 rgba(0, 0, 0, 0.45);
  min-height: 1.2em;
}
.gauge { display: flex; gap: 6px; }
.gauge__seg {
  width: 36px; height: 16px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.3s, box-shadow 0.3s;
}
/* 7 segments, one per band above FREEZING — colors walk the band ramp */
.gauge__seg.is-lit[data-seg="cold"]     { background: #3ac0ff; box-shadow: 0 0 14px #3ac0ff; }
.gauge__seg.is-lit[data-seg="chilly"]   { background: #5b8cff; box-shadow: 0 0 14px #5b8cff; }
.gauge__seg.is-lit[data-seg="cool"]     { background: #ffe600; box-shadow: 0 0 14px #ffe600; }
.gauge__seg.is-lit[data-seg="warm"]     { background: #ffc400; box-shadow: 0 0 14px #ffc400; }
.gauge__seg.is-lit[data-seg="hot"]      { background: #ff8a00; box-shadow: 0 0 14px #ff8a00; }
.gauge__seg.is-lit[data-seg="blazing"]  { background: #ff5a4d; box-shadow: 0 0 14px #ff5a4d; }
.gauge__seg.is-lit[data-seg="fire"]     { background: #ff2e97; box-shadow: 0 0 18px #ff2e97; }
.hunt__gps { font-size: 0.78rem; min-height: 1em; }
.hunt__raise { animation: shake 0.7s ease-in-out infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(-1.5deg) scale(1); }
  50% { transform: rotate(1.5deg) scale(1.04); }
}

/* ============ AR ============ */
.screen--ar { background: #000; }
.ar__video, .ar__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ar__canvas--3d[hidden] { display: none; } /* opt-in WebGL layer under the 2D overlay */
.ar__video { object-fit: cover; }
.ar__top {
  position: absolute; top: calc(12px + var(--safe-t)); left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.ar__coach {
  position: absolute; left: 16px; right: 16px; bottom: calc(26px + var(--safe-b));
  text-align: center; font-weight: 900; font-size: 1.02rem;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

/* ============ REVEAL ============ */
.screen--reveal { align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.reveal__inner { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; position: relative; }
.reveal__caught {
  font-family: var(--display);
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  color: var(--lime);
  text-shadow: 0 0 26px rgba(170, 255, 0, 0.6), 0 4px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-3deg);
}
.reveal-card {
  width: min(64vw, 280px);
  aspect-ratio: 3 / 4;
  position: relative;
  perspective: 900px;
}
.reveal-card__face {
  position: absolute; inset: 0;
  border-radius: 22px;
  border: 4px solid #fff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.reveal-card__back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.07) 0 14px, transparent 14px 28px),
    linear-gradient(150deg, var(--purple), var(--magenta));
  animation: cardshake 0.5s ease-in-out 2;
}
.reveal-card__q {
  font-family: var(--display); font-size: 6rem; color: #fff;
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.3);
}
.reveal-card__front {
  background: linear-gradient(160deg, #241040, #16213e);
  transform: rotateY(180deg);
  flex-direction: column; gap: 6px; padding: 14px;
}
.reveal-card__front img { width: 82%; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45)); }
.reveal-card.is-flipped .reveal-card__back  { transform: rotateY(180deg); transition: transform 0.7s cubic-bezier(0.3, 1.4, 0.4, 1); }
.reveal-card.is-flipped .reveal-card__front { transform: rotateY(360deg); transition: transform 0.7s cubic-bezier(0.3, 1.4, 0.4, 1); }
.reveal-card--legendary .reveal-card__front {
  border-color: var(--gold);
  box-shadow: 0 0 44px rgba(255, 215, 0, 0.55), 0 14px 40px rgba(0, 0, 0, 0.5);
}
/* SUPER-LEGENDARY (difficulty 5): the rarest catch — a neon gold-to-magenta
 * halo with a slow pulse on top of the legendary glow. */
.reveal-card--super .reveal-card__front {
  border-color: var(--gold);
  box-shadow:
    0 0 60px rgba(255, 215, 0, 0.75),
    0 0 110px rgba(255, 46, 151, 0.45),
    0 14px 40px rgba(0, 0, 0, 0.5);
  animation: superpulse 1.4s ease-in-out infinite;
}
@keyframes superpulse {
  0%, 100% {
    box-shadow:
      0 0 60px rgba(255, 215, 0, 0.75),
      0 0 110px rgba(255, 46, 151, 0.45),
      0 14px 40px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow:
      0 0 90px rgba(255, 215, 0, 0.95),
      0 0 150px rgba(0, 240, 255, 0.55),
      0 14px 40px rgba(0, 0, 0, 0.5);
  }
}
@keyframes cardshake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-4deg) translateX(-4px); }
  75% { transform: rotate(4deg) translateX(4px); }
}
.reveal__points { font-family: var(--display); font-size: 1.5rem; color: var(--yellow); text-shadow: 0 2px 0 rgba(0,0,0,0.4); }

.reveal__confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.reveal__confetti i {
  position: absolute; top: -20px;
  width: 10px; height: 16px;
  background: var(--c, var(--magenta));
  animation: fall var(--d, 2.6s) linear var(--delay, 0s) infinite;
}
@keyframes fall {
  from { transform: translateY(-30px) rotate(0); }
  to   { transform: translateY(110vh) rotate(720deg); }
}

/* ============ COLLECTION ============ */
.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.album__slot {
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: 18px;
  padding: 10px 8px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.album__slot img { width: 100%; max-width: 96px; }
.album__slot.is-caught { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.12); }
.album__slot.is-caught.is-legendary {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.35), inset 0 0 18px rgba(255, 215, 0, 0.12);
}
.album__name { font-weight: 900; font-size: 0.82rem; }
.album__slot:not(.is-caught) .album__name { color: var(--muted); }
.album .badge { font-size: 0.58rem; padding: 3px 9px; border-width: 2px; }
/* difficulty chip — Lv 1..5, presentation only (from kin.difficulty) */
.album__diff {
  align-self: flex-end;
  margin-top: -4px;
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--bg, #0b0f1a);
  background: linear-gradient(135deg, var(--cyan, #00f0ff), var(--magenta, #ff2e97));
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.album__slot:not(.is-caught) .album__diff { opacity: 0.55; }
/* tap-to-play: caught portraits get a pointer + gentle press feedback;
 * uncaught silhouettes are never given this class, so they stay inert */
.album__portrait--play { cursor: pointer; transition: transform 0.08s ease; }
.album__portrait--play:active { transform: scale(0.94); }
/* 🎵 birdsong chip — same chip skin as the topbar, shrunk to fit the slot */
.album__songchip {
  font-size: 0.85rem;
  padding: 4px 10px;
  min-height: 28px;
}

/* ============ PLACER ============ */
.screen--placer { padding: 0; }
.placer__map { position: absolute; inset: 0; z-index: 1; background: #0c0a1f; }
.kin-pin { position: relative; }
.kin-pin img { width: 52px; height: 52px; filter: drop-shadow(0 4px 5px rgba(0,0,0,0.5)); }
.kin-pin__ring {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 3px solid var(--ring, #fff);
  animation: pinpulse 1.8s ease-out infinite;
}
.kin-pin--caught { opacity: 0.45; filter: grayscale(0.8); }
.kin-pin--caught .kin-pin__ring { display: none; }
.range-label { font: 700 11px/1 'Nunito', sans-serif; color: #fff; text-align: center; pointer-events: none; opacity: 0.9; text-shadow: 0 0 3px #000, 0 1px 2px #000; }
@keyframes pinpulse {
  from { transform: scale(0.8); opacity: 1; }
  to   { transform: scale(1.5); opacity: 0; }
}
.popup-remove { font-family: var(--body); font-weight: 800; margin-top: 4px; cursor: pointer; }

.picker {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 5, 25, 0.72);
  display: flex; align-items: flex-end;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.picker[hidden] { display: none; }
.picker__sheet {
  background: linear-gradient(170deg, #2a1650, var(--grape));
  border-top: 3px solid var(--card-border);
  border-radius: 26px 26px 0 0;
  width: 100%;
  max-height: 78dvh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + var(--safe-b));
  display: flex; flex-direction: column; gap: 14px;
}
.picker__title { font-family: var(--display); text-align: center; }
.picker__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.picker__kin {
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text); font-family: var(--body); cursor: pointer;
}
.picker__kin img { width: 64px; height: 64px; }
.picker__kin.is-hidden-already { outline: 2px dashed var(--cyan); }
.picker__name { font-weight: 900; font-size: 0.78rem; }
.picker__kin .badge { font-size: 0.5rem; padding: 2px 8px; border-width: 2px; }

/* ============ SCOREBOARD ============ */
.scores { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.scores li {
  display: flex; align-items: center; gap: 14px;
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  font-weight: 900; font-size: 1.05rem;
}
.scores li:first-child { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 215, 0, 0.3); }
.scores .pos { font-family: var(--display); color: var(--yellow); width: 1.6em; }
.scores .pts { margin-left: auto; font-family: var(--display); color: var(--cyan); }

/* ============ NAV ============ */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  display: flex; justify-content: space-around;
  background: rgba(14, 7, 32, 0.88);
  border-top: 2px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 4px calc(8px + var(--safe-b));
}
.nav[hidden] { display: none; }
.nav__btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none;
  color: var(--muted);
  font-family: var(--body); font-weight: 800; font-size: 0.68rem;
  min-width: 60px; min-height: 52px;
  border-radius: 14px;
  cursor: pointer;
}
.nav__btn span { font-size: 1.35rem; }
.nav__btn.is-active { color: var(--yellow); background: rgba(255, 230, 0, 0.1); }

/* ============ ROOM / PLAY TOGETHER ============ */
.field { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 360px; text-align: left; }
.field__label { font-weight: 900; font-size: 0.85rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.field__input {
  font-family: var(--body); font-weight: 800; font-size: 1.15rem;
  color: var(--text);
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 56px;
  outline: none;
  width: 100%;
}
.field__input:focus { border-color: var(--cyan); }
.field__input--code {
  font-family: var(--display); font-size: 1.5rem; letter-spacing: 0.35em;
  text-transform: uppercase; text-align: center;
}
.role-row { display: flex; gap: 10px; }
.role-row .chip { min-height: 48px; font-size: 0.95rem; }
.join-row { display: flex; gap: 10px; }
.join-row .field__input--code { flex: 1; min-width: 0; }
.room-error { color: var(--magenta); font-weight: 800; min-height: 1.2em; }
.bigcode {
  font-family: var(--display);
  font-size: clamp(4rem, 22vw, 6.5rem);
  letter-spacing: 0.18em;
  color: var(--yellow);
  text-shadow: 0 0 30px rgba(255, 230, 0, 0.5), 5px 5px 0 var(--purple), 9px 9px 0 rgba(0,0,0,0.4);
  transform: rotate(-2deg);
  margin: 10px 0;
}
/* QR join card — deliberately WHITE on the neon screen: phone cameras need
 * a light background and a quiet zone around the modules to lock on. */
.qrcard {
  background: #fff;
  border-radius: 20px;
  padding: 18px 18px 10px;
  width: min(240px, 64vw);
  margin: 2px auto 0;
  box-shadow: 0 0 0 3px var(--card-border), 7px 7px 0 rgba(0, 0, 0, 0.35);
  transform: rotate(1.5deg);
}
.qrcard__img { display: block; width: 100%; image-rendering: pixelated; }
.qrcard__caption {
  font-family: var(--body); font-weight: 900; font-size: 0.85rem;
  color: #1a0b2e; text-align: center; margin: 8px 0 2px;
}
.topbar__right { display: flex; gap: 8px; align-items: center; }

/* ============ FAMILY SETUP ============ */
.fam-list { display: flex; flex-direction: column; gap: 10px; }
.fam-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: 18px;
  padding: 10px 12px;
}
.fam-row__avatar { width: 56px; height: 56px; flex: none; }
.fam-row__mid { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.fam-row__name {
  font-family: var(--body); font-weight: 900; font-size: 1.02rem;
  color: var(--text);
  background: none; border: none; border-bottom: 2px dashed rgba(255,255,255,0.25);
  outline: none; width: 100%; padding: 2px 0;
}
.fam-row__name:focus { border-bottom-color: var(--cyan); }
.fam-row__badge { cursor: pointer; }
.fam-row__photo {
  font-size: 1.6rem; cursor: pointer;
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed var(--card-border);
  border-radius: 14px;
}
.fam-hatch { margin-top: 4px; }

/* ---- hatch-a-bird: egg rows + hatch screen ---- */
.fam-row--egg {
  opacity: 0.85;
  border-color: var(--yellow);
  animation: eggpulse 2.2s ease-in-out infinite;
}
@keyframes eggpulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 230, 0, 0); }
  50% { box-shadow: 0 0 14px rgba(255, 230, 0, 0.35); }
}
.fam-row__avatar--egg {
  width: 56px; height: 56px; flex: none;
  display: grid; place-items: center;
  font-size: 1.8rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}
.egg-progress {
  display: block;
  height: 6px; margin-top: 6px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 3px;
  overflow: hidden;
}
.egg-progress__fill {
  display: block; height: 100%;
  background: var(--yellow);
  border-radius: 3px;
  transition: width 1.2s ease;
}

.hatch-preview {
  width: 160px; height: 160px;
  margin: 6px auto 14px;
  border-radius: var(--r-lg);
  background: var(--glass);
  border: 2px dashed var(--card-border);
  display: grid; place-items: center;
  font-size: 4rem;
  overflow: hidden;
}
.hatch-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hatch-buttons { display: flex; gap: 10px; margin-bottom: 14px; }
.hatch-buttons .btn { flex: 1; text-align: center; }

.hatch-name {
  display: block; width: 100%;
  font-family: var(--body); font-weight: 900; font-size: 1.05rem;
  color: var(--text);
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  outline: none;
}
.hatch-name:focus { border-color: var(--cyan); }

.hatch-roles { display: flex; gap: 8px; margin-bottom: 18px; justify-content: center; }
.hatch-roles .chip.is-on { background: var(--yellow); color: var(--ink); border-color: var(--ink); }

/* ============ SPECTATOR (hunter dots + capture feed) ============ */
.hunter-dot { position: relative; }
.hunter-dot__pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(170, 255, 0, 0.35), 0 0 12px var(--lime);
  animation: hunterpulse 1.4s ease-out infinite;
}
@keyframes hunterpulse { 50% { box-shadow: 0 0 0 9px rgba(170, 255, 0, 0.12), 0 0 12px var(--lime); } }
.hunter-dot__name {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-family: var(--body); font-weight: 900; font-size: 0.72rem;
  color: #fff; background: rgba(10, 5, 25, 0.8);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.feed {
  position: absolute; left: 12px; right: 12px; bottom: calc(176px + var(--safe-b));
  z-index: 600;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.feed__toast {
  background: rgba(14, 7, 32, 0.92);
  border: 2px solid var(--lime);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800; font-size: 0.95rem;
  box-shadow: 0 0 18px rgba(170, 255, 0, 0.25);
  animation: toastin 0.3s ease-out;
  transition: opacity 0.6s, transform 0.6s;
}
.feed__toast.is-out { opacity: 0; transform: translateY(8px); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } }

/* ============ OFFLINE (hunt pack) ============ */
/* same .chip skin as the topbar chips, parked above the bottom nav */
.offline-chip {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + var(--safe-b));
  z-index: 900;
  cursor: default; white-space: nowrap;
  background: rgba(14, 7, 32, 0.92);
  border-color: var(--yellow); color: var(--yellow);
  box-shadow: 0 0 14px rgba(255, 230, 0, 0.22);
}
.offline-chip[hidden] { display: none; }
/* reconnect "shared sighting" toasts — fixed so they land on any screen */
.feed--sync {
  position: fixed; top: calc(14px + var(--safe-t)); bottom: auto;
  z-index: 901;
}

/* ============ SHINY ============ */
.reveal__shiny {
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--cyan);
  text-shadow: 0 0 16px var(--cyan), 0 2px 0 rgba(0,0,0,0.4);
  animation: holo 1.6s linear infinite;
}
.reveal-card--shiny .reveal-card__front {
  border-color: var(--cyan);
  box-shadow: 0 0 44px rgba(0, 240, 255, 0.55), 0 14px 40px rgba(0, 0, 0, 0.5);
}
.reveal-card--shiny .reveal-card__front img { filter: drop-shadow(0 0 14px rgba(0, 240, 255, 0.8)); }

/* ============ HUNT CYCLE (armbar / clock / game over) ============ */
.armbar {
  position: absolute; left: 12px; right: 12px;
  bottom: calc(96px + var(--safe-b));
  z-index: 650;
  display: flex; gap: 10px; align-items: center;
  background: rgba(14, 7, 32, 0.92);
  border: 2px solid var(--card-border);
  border-radius: 18px;
  padding: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.armbar[hidden] { display: none; }
.armbar__select {
  flex: 1;
  font-family: var(--body); font-weight: 800; font-size: 1rem;
  color: var(--text);
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  min-height: 52px;
}
.armbar__select option { color: var(--ink); }
.armbar__go { min-height: 52px; padding: 8px 18px; font-size: 0.95rem; flex: none; }
.armbar--live { justify-content: center; gap: 14px; }
.armbar__clock {
  font-family: var(--display); font-size: 1.6rem; color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.5);
}
.armbar__msg { font-weight: 800; color: var(--muted); }
.home-flag { font-size: 1.7rem; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6)); }

.hunt__clock {
  font-family: var(--display); font-size: 1.6rem;
  color: var(--yellow);
  border: 2px solid rgba(255, 230, 0, 0.5);
  border-radius: 999px;
  padding: 6px 22px;
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.45);
}
.hunt__clock.is-urgent {
  color: var(--magenta); border-color: var(--magenta);
  animation: shake 0.6s ease-in-out infinite;
}
.hunt__clock[hidden] { display: none; }

.gameover__title {
  font-family: var(--display);
  font-size: clamp(2.6rem, 13vw, 4rem);
  color: var(--lime);
  text-shadow: 0 0 28px rgba(170, 255, 0, 0.55), 0 4px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-2deg);
}
.gameover__title.is-lost { color: var(--magenta); text-shadow: 0 0 28px rgba(255, 46, 151, 0.55), 0 4px 0 rgba(0, 0, 0, 0.4); }
.gameover__sub { font-weight: 800; font-size: 1.05rem; color: var(--text); max-width: 320px; }
.scores--final { width: 100%; max-width: 360px; }

/* ============ BOARD (revealed Kin map) ============ */
.board__hint {
  position: absolute; left: 12px; right: 12px;
  bottom: calc(96px + var(--safe-b));
  z-index: 600;
  text-align: center;
  font-weight: 800; font-size: 0.9rem;
  color: var(--text);
  background: rgba(14, 7, 32, 0.92);
  border: 2px solid var(--card-border);
  border-radius: 18px;
  padding: 12px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.kin-pin--revealed img { animation: bob 2.2s ease-in-out infinite; }
.hunter-dot--me .hunter-dot__pulse {
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.35), 0 0 12px var(--cyan);
}
.hunter-dot--me .hunter-dot__name { color: var(--cyan); }

/* ============ AR BEAM HUD ============ */
.ar__beams {
  position: absolute; left: 50%; top: calc(76px + var(--safe-t));
  transform: translateX(-50%) rotate(-1.5deg);
  max-width: 92%;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-align: center;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: var(--r-pill);
  padding: 10px 20px;
  box-shadow: var(--shadow-pop) var(--ink), 0 0 22px rgba(255, 230, 0, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ar__beams[hidden] { display: none; }
.ar__beams.is-full {
  background: var(--lime);
  box-shadow: var(--shadow-pop) var(--ink), 0 0 28px rgba(170, 255, 0, 0.65);
  animation: shake 0.5s ease-in-out infinite;
}

/* ============ TEAM (one family, one score) ============ */
.team-hero {
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.team-hero__label {
  font-weight: 900; letter-spacing: 0.22em; text-transform: uppercase;
  font-size: 0.74rem; color: var(--cyan);
}
.team-hero__score {
  font-family: var(--display);
  font-size: clamp(3.6rem, 18vw, 5rem);
  line-height: 1.05;
  color: var(--yellow);
  text-shadow: 0 0 26px rgba(255, 230, 0, 0.5), 4px 4px 0 var(--purple), 7px 7px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-2deg);
}
.team-hero__progress { font-family: var(--display); font-size: 1rem; color: var(--lime); text-shadow: 0 2px 0 rgba(0,0,0,0.35); margin-top: 6px; }
.team-hero__breakdown { color: var(--muted); font-weight: 700; font-size: 0.82rem; margin-top: 4px; }
.team-hero--final { width: 100%; max-width: 360px; padding: 16px 18px; margin-bottom: 0; }
.team-hero--final .team-hero__score { font-size: clamp(2.8rem, 14vw, 4rem); }

.contrib {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 18px;
}
.contrib li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 0.85rem; font-weight: 700;
  color: var(--muted);
  padding: 4px 10px;
}
.contrib__name { font-weight: 900; color: var(--text); }
.contrib__empty { justify-content: center; }
.contrib--final { width: 100%; max-width: 360px; margin-bottom: 0; }
.contrib--final li { padding: 2px 10px; }

.gameover__record {
  font-weight: 900; font-size: 0.95rem; color: var(--muted); margin-top: 6px;
}
.gameover__record.is-record {
  font-family: var(--display);
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.6), 0 2px 0 rgba(0, 0, 0, 0.4);
  animation: shake 0.7s ease-in-out infinite;
}

.book {
  background: var(--glass);
  border: 2px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.book__title { font-family: var(--display); font-size: 1.05rem; margin-bottom: 10px; }
.book__bests { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.book__best {
  font-family: var(--display); font-size: 0.78rem;
  color: var(--ink);
  background: linear-gradient(110deg, #ffd700, #fff3b0 30%, #ffd700 55%, #ffb700);
  background-size: 220% 100%;
  border: 2px solid #fff;
  border-radius: var(--r-pill);
  padding: 6px 14px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  animation: holo 2.2s linear infinite;
}
.book__empty { color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.book__list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.book__list li {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 0.85rem; font-weight: 700; color: var(--muted);
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
  padding: 7px 2px 0;
}
.book__date { font-weight: 900; color: var(--text); width: 4.4em; flex: none; }
.book__meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book__score { font-family: var(--display); color: var(--cyan); }

/* ============ POCKET MODE (screen in pocket, ears do the hunting) ============ */
.pocket {
  position: fixed; inset: 0; z-index: 4000;
  background: #000; /* pure black — OLED pixels stay off */
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(40px + var(--safe-b));
}
.pocket[hidden] { display: none; }
.pocket__hint {
  color: #3a3a3a; font-weight: 800; font-size: 0.85rem; letter-spacing: 0.05em;
  animation: pocketfade 4s ease forwards; /* fades to nothing — then true black */
}
@keyframes pocketfade { from { opacity: 0.7; } to { opacity: 0; } }
.pocket.is-flash {
  background: var(--band, var(--magenta));
  animation: pocketflash 0.25s steps(2, jump-none) 4;
}
@keyframes pocketflash { 50% { filter: brightness(0.25); } }
.hunt__pocketbtn { min-height: 52px; font-size: 1rem; }

/* ============ OUT OF BOUNDS (red vignette + label) ============ */
.oob {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
  display: flex; justify-content: center; align-items: flex-start;
  opacity: 0; transition: opacity 0.3s;
  box-shadow: inset 0 0 110px 36px rgba(255, 42, 64, 0.7);
}
.oob.is-on { opacity: 1; animation: oobpulse 1.1s ease-in-out infinite; }
@keyframes oobpulse { 50% { box-shadow: inset 0 0 160px 64px rgba(255, 42, 64, 0.92); } }
.oob__label {
  margin-top: calc(var(--safe-t) + 54px);
  font-family: var(--display); font-size: 1.25rem; color: #ff4757;
  text-shadow: 0 0 16px rgba(255, 42, 64, 0.7), 0 2px 0 rgba(0, 0, 0, 0.5);
}

/* ============ SNAP TO MY LOCATION (map screens) ============ */
.snapbtn {
  position: absolute; right: 14px;
  bottom: calc(186px + var(--safe-b)); /* floats above the board hint */
  z-index: 640;
  width: 52px; height: 52px;
  border-radius: 50%;
  font-size: 1.35rem;
  color: var(--text);
  background: rgba(14, 7, 32, 0.92);
  border: 2px solid var(--card-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.snapbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.snapbtn.is-off { opacity: 0.4; }
[data-screen="placer"] .snapbtn { bottom: calc(248px + var(--safe-b)); } /* clear of the two-row armbar */

/* ============ BOUNDARY DRAWING (placer armbar chips) ============ */
[data-armbar] { flex-wrap: wrap; } /* chips + select up top, big START below */
[data-armbar] .armbar__go { flex: 1 1 100%; }
.armbar__chip { flex: none; min-height: 52px; white-space: nowrap; }
.armbar__chip.is-on { background: var(--lime); color: var(--ink); border-color: var(--ink); }
.armbar--drawing .armbar__select,
.armbar--drawing [data-arm-hunt] { display: none; } /* room for ✓ / ✕ while drawing */

/* ============ ROUNDS ============ */
.armbar--done { justify-content: space-between; }
.reveal__auto { color: var(--muted); font-weight: 800; font-size: 0.9rem; min-height: 1.2em; }
.reveal__auto[hidden] { display: none; }

/* ============ OUTDOOR (sun-readable) MODE ============ */
body.outdoor {
  background: linear-gradient(160deg, #120722, #0d1430);
}
body.outdoor .confetti { display: none; }
body.outdoor .hero-card,
body.outdoor .perm,
body.outdoor .album__slot,
body.outdoor .team-hero,
body.outdoor .book,
body.outdoor .scores li {
  background: #241345;
  border-color: rgba(255, 255, 255, 0.45);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.outdoor .muted { color: #d8d2ee; }
body.outdoor .hunt__band { text-shadow: 0 0 8px var(--band, var(--cyan)), 0 4px 0 #000; }

/* ============ MOTION SENSITIVITY ============ */
@media (prefers-reduced-motion: reduce) {
  .confetti, .splash__grid { display: none; }
  .splash__kinrow img, .hunt__raise, .badge--legendary { animation: none; }
  .reveal-card.is-flipped .reveal-card__back,
  .reveal-card.is-flipped .reveal-card__front { transition-duration: 0.2s; }
}

@media (min-width: 700px) {
  .home-grid { grid-template-columns: repeat(4, 1fr); }
  .album { grid-template-columns: repeat(4, 1fr); }
}

/* role-aware nav: hidden attribute must beat the flex display on these */
.nav__btn[hidden], .tile[hidden], .chip[hidden] { display: none !important; }

/* ============ INDOOR MODE — scan a bird card ============ */
.hunt__scanchip { margin-top: 2px; }
.scan__overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  overflow: hidden; /* the reticle's giant dim-shadow must not scroll the page */
}
.scan__reticle {
  width: min(62vw, 300px);
  aspect-ratio: 1;
  border: 4px dashed var(--cyan);
  border-radius: 26px;
  box-shadow: 0 0 0 9999px rgba(10, 5, 25, 0.35); /* dim everything but the window */
  animation: scanpulse 1.6s ease-in-out infinite;
}
.scan__reticle.is-shake {
  border-color: var(--magenta);
  animation: scanshake 0.4s ease;
}
@keyframes scanpulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes scanshake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-12px); }
  75% { transform: translateX(12px); }
}
@media (prefers-reduced-motion: reduce) {
  .scan__reticle { animation: none; }
}

/* ============ INDOOR MODE — printable bird QR cards ============ */
/* Hidden on screen; @media print flips the page to ink-friendly white and
   shows ONLY the cards (color accents survive via print-color-adjust). */
.printcards { display: none; }
.fam-print { width: 100%; max-width: 360px; display: block; margin: 18px auto 8px; }
.fam-print__note { font-size: 0.82rem; }
@media print {
  body {
    background: #fff !important;
    min-height: 0;
  }
  body > *:not(.printcards) { display: none !important; }
  .printcards {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3-up = pocket-size cards */
    color: var(--ink);
  }
  .printcard {
    border: 2px dashed #9a93b5; /* cut lines */
    padding: 14px 10px 12px;
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .printcard__bird { width: 68%; max-width: 150px; display: block; margin: 0 auto; }
  .printcard__name {
    font-family: var(--display);
    font-size: 1.02rem;
    color: var(--ink);
    margin: 4px 0 6px;
  }
  .printcard__badge {
    display: inline-block;
    font-family: var(--display);
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    padding: 3px 12px;
    border-radius: var(--r-pill);
    color: #fff;
    margin-bottom: 10px;
  }
  .printcard--common    .printcard__badge { background: #6e6788; }
  .printcard--rare      .printcard__badge { background: #00a8b5; }
  .printcard--epic      .printcard__badge { background: var(--purple); }
  .printcard--legendary .printcard__badge { background: #d4a900; color: #fff; }
  .printcard--legendary { border-color: #d4a900; }
  .printcard__qr {
    width: 60%;
    max-width: 128px;
    display: block;
    margin: 0 auto;
    image-rendering: pixelated; /* crisp modules, no resampling blur */
  }
  .printcard__hint {
    font-size: 0.6rem;
    font-weight: 800;
    color: #6e6788;
    margin-top: 8px;
  }
}

/* ============ CLUE (street view peek at the hiding spot) ============ */
.hunt__chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.clue {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(10, 5, 25, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.clue[hidden] { display: none; }
.clue__panel {
  width: min(100%, 440px);
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 2px solid var(--card-border);
  background: rgba(10, 5, 25, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(0, 240, 255, 0.18);
  animation: cluein 0.22s ease-out;
}
@keyframes cluein { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.clue__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.clue__title { pointer-events: none; }
.clue__photo {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--card-border);
  background: #0d0620;
}
.clue__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clue__img[hidden] { display: none; }
.clue__map { position: absolute; inset: 0; }
.clue__map[hidden] { display: none; }
.clue__spinner {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--cyan);
  animation: cluespin 0.9s linear infinite;
}
.clue__spinner[hidden] { display: none; }
@keyframes cluespin { to { transform: rotate(360deg); } }
.clue__strip { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.clue__arrow {
  font-size: 1.7rem; line-height: 1;
  color: var(--lime);
  text-shadow: 0 0 14px rgba(170, 255, 0, 0.7);
  transition: transform 0.6s ease-out;
  will-change: transform;
}
.clue__dist {
  font-family: var(--display);
  font-size: 1.25rem;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.55);
  min-width: 4ch;
}
.clue__striphint { font-size: 0.78rem; font-weight: 800; color: var(--muted); margin-left: auto; }

/* fallback map's pulsing "HERE-ish" dot */
.clue-dot { position: relative; }
.clue-dot__core {
  position: absolute; inset: 3px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta);
}
.clue-dot__pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(255, 46, 151, 0.5);
  animation: cluedot 1.4s ease-out infinite;
}
@keyframes cluedot { from { transform: scale(0.5); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }

/* ---------- gameover trophy (tap = confetti storm) ---------- */
.gameover__trophy {
  background: none; border: none; cursor: pointer;
  display: block; margin: 2px auto 6px; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.gameover__trophy-cup { font-size: 5.2rem; display: block; filter: drop-shadow(0 6px 14px rgba(255, 215, 0, 0.45)); }
.gameover__trophy-birds {
  font-size: 1.5rem; display: block; margin-bottom: -14px;
  letter-spacing: 0.3em;
}
.gameover__trophy.is-win .gameover__trophy-cup { animation: trophy-wiggle 2.4s ease-in-out infinite; }
.gameover__trophy.is-pop .gameover__trophy-cup { animation: trophy-pop 0.55s ease-out; }
@keyframes trophy-wiggle { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes trophy-pop { 0% { transform: scale(1); } 35% { transform: scale(1.35) rotate(-6deg); } 70% { transform: scale(0.92) rotate(4deg); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .gameover__trophy-cup { animation: none !important; } }

/* ============ capture lab (?dev=capture) ============ */
.caplab {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(16, 8, 32, 0.82);
  backdrop-filter: blur(4px);
  font-family: var(--body);
  font-size: 13px;
}
.caplab__stats { font-family: var(--display); font-size: 15px; color: var(--cyan); margin-bottom: 4px; }
.caplab__row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.caplab__row span { width: 56px; opacity: 0.8; }
.caplab__row input { flex: 1; accent-color: var(--cyan); min-height: 22px; }
.caplab__row b { width: 38px; text-align: right; }
.caplab__nums { font-size: 11px; opacity: 0.65; margin-top: 4px; user-select: all; }
.caplab__go { width: 100%; margin-top: 8px; }

/* ============ host/join doors + game-mode cards ============ */
.mode-row { display: flex; gap: 10px; margin: 12px 0; }
.mode-card {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 10px;
  background: var(--card, rgba(255,255,255,0.06));
  border: 3px solid var(--card-border);
  border-radius: 16px;
  color: inherit;
  font-family: var(--body);
  text-align: center;
  cursor: pointer;
}
.mode-card.is-on {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0,240,255,0.25), var(--shadow-pop, 4px 4px 0) var(--ink);
  background: rgba(0,240,255,0.08);
}
.mode-card__emoji { font-size: 30px; }
.mode-card__name { font-family: var(--display); font-size: 15px; letter-spacing: 0.04em; }
.mode-card__sub { font-size: 11.5px; opacity: 0.75; line-height: 1.3; }
.modechip {
  display: inline-block;
  font-family: var(--display); font-size: 13px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(0,240,255,0.12); border: 2px solid var(--cyan);
  margin-bottom: 10px;
}

/* peek countdown chip — how long until the screen goes black again */
.peekchip {
  position: absolute; top: 14px; right: 14px;
  font-family: var(--display); font-size: 14px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(0,0,0,0.5); border: 2px solid var(--cyan);
  z-index: 5;
}
.reveal-card__spin { width: 100%; height: 100%; display: block; }

/* ---------- Stella's constant full-screen trophy + captured-flock swirl ---------- */
/* The cup fills the phone and STAYS big — it never shrinks back into a score
 * card. The headline, team score and record float OVER the cup as overlays so
 * the text still reads. Each tap swirls one more captured bird (its real
 * kin3d.js 3D model) into a tilted orbit around the cup. */
.screen--gameover.is-trophy-stage .reveal__inner {
  position: absolute; inset: 0;
  display: block; padding: 0;
}
/* the cup IS the screen — sized to fill the phone, the whole UI lives on it */
.screen--gameover.is-trophy-stage .gameover__trophy {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  margin: 0; z-index: 56;
}
.screen--gameover.is-trophy-stage .gameover__trophy-cup {
  font-size: min(108vw, 96vh); line-height: 1;
  filter: drop-shadow(0 12px 30px rgba(255, 215, 0, 0.55));
}
.screen--gameover.is-trophy-stage .gameover__trophy-birds { display: none; }

/* TEXT ON THE TROPHY — engraved onto the cup bowl (upper-center of the glyph).
 * pointer-events:none so taps fall THROUGH the text to the cup beneath — the
 * whole bowl is one big tap target. */
.screen--gameover.is-trophy-stage .gameover__title {
  position: absolute; top: 30vh; left: 0; right: 0; z-index: 58; pointer-events: none;
  font-size: clamp(1.8rem, 9vw, 3rem);
  text-shadow: 0 2px 0 rgba(120, 72, 0, 0.6), 0 0 18px rgba(0, 0, 0, 0.45);
}
.screen--gameover.is-trophy-stage .gameover__sub { display: none; }
.screen--gameover.is-trophy-stage .team-hero--final {
  position: absolute; left: 50%; top: 39vh; transform: translateX(-50%); z-index: 58;
  text-align: center; pointer-events: none;
}
.screen--gameover.is-trophy-stage .team-hero__label { color: rgba(90, 55, 0, 0.85); }
.screen--gameover.is-trophy-stage .team-hero__score {
  color: #5a3700; text-shadow: 0 1px 0 rgba(255, 240, 190, 0.6);
}
.screen--gameover.is-trophy-stage .gameover__record { color: #6b4200; }
.screen--gameover.is-trophy-stage .contrib--final { display: none; }

/* BUTTONS BUILT INTO THE BASE — an engraved plaque on the trophy's plinth */
.screen--gameover.is-trophy-stage .stack {
  position: absolute; left: 50%; bottom: calc(6vh + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 58;
  width: min(78vw, 360px);
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 14px 16px; border-radius: 16px;
  background: linear-gradient(180deg, #ffe89a 0%, #f4c64b 45%, #c8902a 100%);
  border: 2px solid rgba(120, 72, 0, 0.55);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), inset 0 -3px 6px rgba(120, 72, 0, 0.45), 0 8px 20px rgba(0, 0, 0, 0.4);
}
.screen--gameover.is-trophy-stage .stack .btn { box-shadow: 0 3px 0 rgba(120, 72, 0, 0.5); }
.gameover__trophy { transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1); }

/* full-screen color strobe on each tap — screen-blend so the gold tints, not covers */
.go-flash {
  position: fixed; inset: 0; z-index: 61; pointer-events: none;
  opacity: 0; mix-blend-mode: screen;
}
.go-flash.is-flash { animation: go-flash 0.5s ease-out; }
@keyframes go-flash { 0% { opacity: 0.55; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .go-flash.is-flash { animation: none; } }

/* the 3D orbit canvas covers the whole screen — ABOVE the engraved text so the
 * birds clearly fly around the cup; birds emerge from the cup mouth */
.go-orbit { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.go-orbit__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* fountain pieces: burst UP out of the cup, arc with --dx, tumble down */
.fountain { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.fountain i {
  position: absolute;
  width: 10px; height: 14px;
  background: var(--c, var(--lime));
  border-radius: 2px;
  opacity: 0;
  animation: fountain var(--d, 1.8s) cubic-bezier(0.16, 0.6, 0.45, 1) var(--delay, 0s) forwards;
}
@keyframes fountain {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  40%  { opacity: 1; transform: translate(calc(var(--dx) * 0.7), calc(var(--up) * -1)) rotate(240deg) scale(1.1); }
  100% { opacity: 0.9; transform: translate(var(--dx), 60vh) rotate(720deg) scale(0.8); }
}
@media (prefers-reduced-motion: reduce) { .fountain i { animation: none; opacity: 0; } }

/* ---- build badge: glanceable "am I on latest?" stamp, bottom-right corner ---- */
.buildbadge {
  position: fixed;
  right: calc(6px + env(safe-area-inset-right, 0px));
  bottom: calc(6px + var(--safe-b, 0px));
  z-index: 9999;
  padding: 2px 7px;
  border-radius: var(--r-pill, 999px);
  font: 600 10px/1.4 var(--body, system-ui), sans-serif;
  letter-spacing: 0.02em;
  color: var(--muted, #9aa);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  opacity: 0.55;
  user-select: none;
}
.buildbadge.is-stale {
  color: #fff;
  background: var(--magenta, #e0245e);
  border-color: transparent;
  opacity: 0.95;
}
