/* =============================================================
   ANGRY PIGEONS · game styles
   Layered on top of style.css — reuses the royal palette + buttons.
   ============================================================= */

.game-body {
  min-height: 100svh;
  background:
    radial-gradient(140% 90% at 50% 0%, #1a1626 0%, #0a0810 65%, #050308 100%);
  color: var(--cream);
  display: flex; flex-direction: column;
  overflow: hidden;
  cursor: auto !important;
}
.game-body::after { display: none; } /* kill the global vignette so canvas sits clean */
.mesh--game { opacity: .45; }

/* ----- Top bar ----- */
.game-bar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 14px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(13, 11, 21, .55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.game-bar__back {
  display: inline-flex; align-items: center; gap: .45em;
  font-size: .82rem; color: var(--muted); font-weight: 500;
  padding: .5em .9em .5em .65em; border-radius: 100px;
  border: 1px solid var(--line); transition: .35s var(--ease);
}
.game-bar__back:hover { color: var(--cream); border-color: var(--gold); }
.game-bar__back svg { color: var(--gold); }

.game-bar__title {
  display: flex; align-items: baseline; gap: .55em;
  font-family: var(--serif); font-size: 1.05rem;
}
.game-bar__brand { font-weight: 600; }
.game-bar__brand em { font-style: italic; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.game-bar__dot { color: var(--muted-2); }
.game-bar__level { font-size: .82rem; color: var(--muted); font-family: var(--sans); }
.game-bar__level i { color: var(--gold); font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; margin-left: .2em; }

.game-bar__right { display: flex; align-items: center; gap: clamp(.6rem, 1.6vw, 1.2rem); }
.hud-stat {
  display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1;
}
.hud-stat em {
  font-style: normal; font-size: .56rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted-2);
}
.hud-stat i {
  font-style: normal; font-family: var(--serif); font-weight: 500;
  font-size: 1.1rem; color: var(--cream); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.hud-stat--ammo i { color: var(--gold); }

/* Ranks (leaderboard) button */
.ranks-btn {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .8rem; font-weight: 600; color: var(--gold-2);
  padding: .5em .9em; border-radius: 100px; margin-left: .3rem;
  border: 1px solid rgba(239,215,154,.3); background: rgba(239,215,154,.06);
  transition: .3s var(--ease);
}
.ranks-btn:hover { color: var(--cream); border-color: var(--gold); background: rgba(239,215,154,.12); }

/* ----- Leaderboard overlay ----- */
.ranks {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: rgba(5,3,8,.72);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.ranks[hidden] { display: none; }
.ranks__card {
  position: relative; width: min(440px, 92vw); max-height: 86vh; overflow-y: auto;
  padding: clamp(1.4rem, 3vw, 2rem);
  background: linear-gradient(160deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--line-strong); border-radius: 22px;
  box-shadow: 0 50px 120px -40px #000, inset 0 0 0 1px rgba(239,215,154,.08);
}
.ranks__close {
  position: absolute; top: 10px; right: 14px; font-size: 1.6rem; line-height: 1;
  color: var(--muted-2); width: 36px; height: 36px; border-radius: 50%;
}
.ranks__close:hover { color: var(--cream); background: rgba(255,255,255,.06); }
.ranks__title { font-family: var(--serif); font-weight: 500; font-size: clamp(1.4rem,3.4vw,1.9rem); margin-bottom: 1.1rem; }
.ranks__name { margin-bottom: 1.1rem; }
.ranks__name label { display: block; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); margin-bottom: .5rem; }
.ranks__name-row { display: flex; gap: .5rem; }
.ranks__name-row input {
  flex: 1; min-width: 0; background: rgba(255,255,255,.04); color: var(--cream);
  border: 1px solid var(--line-strong); border-radius: 100px; padding: .6em 1em; font: inherit;
}
.ranks__name-row input:focus { outline: none; border-color: var(--gold); }
.ranks__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.ranks__list li {
  display: grid; grid-template-columns: 1.8rem 1fr auto; align-items: center; gap: .7rem;
  padding: .55rem .8rem; border-radius: 12px; background: rgba(255,255,255,.02);
}
.ranks__list li .rk { font-family: var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; }
.ranks__list li .nm { color: var(--cream); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks__list li .sc { color: var(--pewter); font-variant-numeric: tabular-nums; font-weight: 600; }
.ranks__list li.me { background: linear-gradient(105deg, rgba(239,215,154,.16), rgba(188,171,223,.1)); border: 1px solid rgba(239,215,154,.3); }
.ranks__list li:nth-child(1) .rk { font-size: 1.1rem; }
.ranks__empty { display: block !important; text-align: center; color: var(--muted-2); padding: 1.4rem !important; background: none !important; }
.ranks__foot { margin-top: 1rem; font-size: .76rem; color: var(--muted-2); line-height: 1.5; }

/* ----- Stage ----- */
.game-stage {
  position: relative; flex: 1;
  display: grid; place-items: stretch;
}
#gameCanvas {
  width: 100%; height: 100%;
  display: block;
  /* Subtle in-canvas vignette via a backdrop layer below */
  background: transparent;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

/* ----- Bird tray (top strip, centred) -----
   Lives along the TOP so it can never cover the slingshot, which sits
   bottom-left. Horizontal row of compact chips. */
.bird-tray {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: clamp(10px, 1.6vw, 18px);
  z-index: 4;
  display: flex; flex-direction: row; flex-wrap: nowrap; gap: .4rem;
  padding: .45rem; border-radius: 100px;
  max-width: calc(100% - 24px); overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  background: rgba(13, 11, 21, .6);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.bird-tray::-webkit-scrollbar { display: none; }
.bird-chip {
  display: grid; grid-template-columns: 16px auto;
  align-items: center; gap: .5rem; padding: .45rem .8rem .45rem .6rem;
  border-radius: 100px; border: 1px solid transparent;
  font-family: var(--sans); text-align: left; color: var(--muted);
  background: transparent; transition: .3s var(--ease); flex: 0 0 auto; white-space: nowrap;
}
.bird-chip:hover { color: var(--cream); background: rgba(255,255,255,.04); }
.bird-chip.is-active {
  background: linear-gradient(105deg, rgba(217,182,110,.18), rgba(188,171,223,.12));
  border-color: rgba(239,215,154,.35); color: var(--cream);
}
.bird-chip__swatch {
  width: 15px; height: 15px; border-radius: 50%; background: var(--c, var(--gold));
  box-shadow: 0 0 0 2px rgba(255,255,255,.06), 0 4px 14px -4px var(--c, var(--gold));
}
.bird-chip__name { font-weight: 600; font-size: .82rem; line-height: 1; }
/* Description hidden in the compact top pill — the swatch + name say enough. */
.bird-chip__desc { display: none; }

/* ----- Controls (bottom-right of canvas) -----
   Pinned to the bottom-right of the VIEWPORT so they never get clipped by a
   short stage. Bumped z-index above tray + canvas, with a subtle scrim so
   they read against any background. Larger tap target on mobile. */
.game-controls {
  position: fixed; right: clamp(14px, 2vw, 26px); bottom: clamp(14px, 2vw, 26px);
  z-index: 50; display: flex; gap: .6rem; pointer-events: auto;
}
.game-controls .btn {
  box-shadow: 0 8px 22px -8px rgba(0,0,0,.85), 0 0 0 1px rgba(239,215,154,.15);
}

/* ----- Banner ----- */
.game-banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  z-index: 4; text-align: center; pointer-events: none;
  background: rgba(13, 11, 21, .72);
  border: 1px solid var(--line-strong);
  padding: 1.4rem 2rem; border-radius: 22px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px -30px #000;
  opacity: 0; transition: opacity .4s var(--ease), transform .5s var(--ease-expo);
}
.game-banner:not([hidden]) { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.game-banner[hidden] { display: block; transform: translate(-50%, -40%) scale(.94); pointer-events: none; }
#gameBannerTitle {
  display: block; font-family: var(--serif); font-weight: 500; font-size: clamp(1.4rem, 3vw, 2.2rem);
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: .4rem;
}
#gameBannerSub { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ----- Tutorial ----- */
.tutorial {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(5, 3, 8, .72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  transition: opacity .5s var(--ease), visibility .5s;
}
.tutorial.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.tutorial__card {
  width: min(540px, 88vw);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  background: linear-gradient(160deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--line-strong); border-radius: 24px;
  box-shadow: 0 50px 120px -40px #000, inset 0 0 0 1px rgba(239,215,154,.08);
}
.tutorial__kicker {
  font-size: .72rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold); margin-bottom: .6rem;
}
.tutorial__title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1.4rem, 3.4vw, 2rem); line-height: 1.15;
  margin-bottom: 1.2rem;
}
.tutorial__list { list-style: none; padding: 0; margin: 0 0 1.6rem; display: grid; gap: .7rem; }
.tutorial__list li {
  display: grid; grid-template-columns: 14px 1fr; gap: .8rem;
  color: var(--muted); font-size: .92rem; line-height: 1.5;
}
.tutorial__dot {
  width: 6px; height: 6px; margin-top: .55em; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px rgba(217,182,110,.6);
}
.tutorial__actions { display: flex; }
.tutorial__actions .btn { width: 100%; justify-content: center; }

/* ----- Responsive ----- */
@media (max-width: 720px) {
  .game-bar { padding: 10px 12px; }
  .game-bar__title { display: none; }
  .game-bar__right { gap: .8rem; }

  /* Move the bird selector to a horizontal strip at the TOP on mobile so it
     never covers the slingshot (which lives bottom-left). */
  .bird-tray {
    flex-direction: row; flex-wrap: nowrap;
    left: 50%; transform: translateX(-50%);
    top: 8px; bottom: auto; right: auto;
    padding: .4rem; gap: .3rem;
    max-width: calc(100vw - 16px); overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .bird-tray::-webkit-scrollbar { display: none; }
  .bird-chip {
    grid-template-columns: 14px auto; min-width: 0;
    padding: .4rem .6rem .4rem .45rem; flex: 0 0 auto;
  }
  .bird-chip__swatch { grid-row: auto; width: 14px; height: 14px; }
  .bird-chip__desc { display: none; }
  .bird-chip__name { font-size: .8rem; }

  .game-controls { right: 8px; bottom: 8px; }
  .game-controls .btn { padding: .6em 1em; }
  .game-banner { top: 30%; padding: 1.1rem 1.4rem; }
}

@media (max-width: 480px) {
  .hud-stat:not(.hud-stat--ammo) em { display: none; }
  .hud-stat:not(.hud-stat--ammo) i { font-size: .92rem; }
  .game-bar__brand { font-size: .95rem; }
}

/* Respect notches / safe areas on phones */
@supports (padding: max(0px)) {
  .game-bar { padding-top: max(10px, env(safe-area-inset-top)); }
}

/* =============================================================
   CHARACTER PICKER — gallery of playable Chill Pigeons
   ============================================================= */
.char-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .7rem; margin-bottom: 1.2rem;
}
.char-tile {
  display: flex; flex-direction: column; align-items: center; gap: .55em;
  padding: .8rem .6rem; border-radius: 16px;
  background: rgba(255,255,255,.02); border: 1px solid var(--line);
  color: var(--cream); transition: .3s var(--ease); cursor: pointer;
}
.char-tile:hover { background: rgba(255,255,255,.05); transform: translateY(-2px); }
.char-tile.is-active {
  background: linear-gradient(160deg, rgba(239,215,154,.18), rgba(188,171,223,.1));
  border-color: rgba(239,215,154,.5);
  box-shadow: 0 0 0 1px rgba(239,215,154,.2), 0 12px 30px -12px rgba(239,215,154,.4);
}
.char-swatch {
  width: 64px; height: 64px; border-radius: 50%;
  background-size: 130%; background-repeat: no-repeat;
  border: 2px solid var(--c6c9d3, #C6C9D3);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.7), inset 0 0 0 2px rgba(0,0,0,.4);
}
.char-swatch--default {
  background:
    radial-gradient(circle at 35% 35%, #c0c4d0 0%, transparent 60%),
    radial-gradient(circle at 65% 65%, #5a5468 0%, transparent 65%),
    linear-gradient(135deg, #8a8e9e 0%, #555266 100%);
}
.char-name { font-size: .82rem; font-weight: 600; }
.char-tier {
  font-size: .56rem; letter-spacing: .14em; text-transform: uppercase;
  padding: .2em .55em; border-radius: 100px;
  border: 1px solid currentColor;
}
.char-tier.rar--common     { color: var(--pewter); }
.char-tier.rar--uncommon   { color: var(--sage); }
.char-tier.rar--rare       { color: var(--blueberry); }
.char-tier.rar--epic       { color: var(--lavender); }
.char-tier.rar--legendary  { color: var(--gold); box-shadow: 0 0 12px -2px rgba(239,215,154,.5); }
.char-tier--free           { color: var(--muted-2); border-style: dashed; }

@media (max-width: 540px) {
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  .char-swatch { width: 56px; height: 56px; }
}

/* trait chips inside the character picker tiles */
.char-traits { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; margin-top: .15rem; }
.char-trait {
  font-size: .58rem; letter-spacing: .02em; color: var(--muted);
  padding: .12em .45em; border-radius: 100px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  white-space: nowrap;
}
.char-tile.is-active .char-trait { color: var(--cream); border-color: rgba(239,215,154,.3); }

.hud-stat--goal i { color: #DDABB2; }

/* 8-bit graffiti title — replaces the plain serif "Angry Pigeons" in the bar */
.brand-tag {
  display: inline-flex; align-items: center; line-height: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.65));
}
.brand-tag__svg {
  width: clamp(140px, 18vw, 220px);
  height: auto;
}
.brand-tag__svg path { paint-order: stroke fill; }
.brand-tag:hover .brand-tag__svg { filter: drop-shadow(0 0 10px rgba(239,215,154,.45)); }
@media (max-width: 720px) { .brand-tag__svg { width: 140px; } }

/* Compact bar variant (the supergraphic does the heavy lifting in the sky) */
.brand-tag--mini .brand-tag__svg { width: clamp(100px, 12vw, 140px); }
