/* Zona Games lobby.

   This page should feel like the title screen of our games, not a page about
   them: the same night-purple sky, gold buttons that press down, the Fredoka
   face and Nyota the star that the quiz, Quest and Safari already use. Every
   game gets its own colour so the tiles read at a glance, and the pixel
   monsters drifting in the background are cut from the games' own sprite
   sheets (assets/px). */

:root {
  --night: #150A28;
  --night-2: #26103F;
  --night-3: #3A1657;
  --ink: #2A0B3F;
  --text: #FFF4E6;
  --muted: #C9B6E6;
  --gold: #FFC24D;
  --gold-deep: #F59E1B;
  --gold-edge: #B35F00;
  --coral: #FF3D6E;
  --mint: #2EE6A8;
  --violet: #8B5CFF;
  --sky: #42C6FF;

  --edge: max(16px, calc((100vw - 1180px) / 2));
  --edge-l: max(var(--edge), env(safe-area-inset-left));
  --edge-r: max(var(--edge), env(safe-area-inset-right));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0; min-height: 100svh; overflow-x: hidden;
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text); line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- sky + floating sprites ----------------
   The sky is painted on this fixed layer rather than as a fixed body
   background: iOS ignores background-attachment:fixed, and a long page
   showed bare canvas below the first screen. */
.floaters {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, #5B1E86 0%, transparent 60%),
    radial-gradient(80% 50% at 100% 60%, rgba(255, 61, 110, .22) 0%, transparent 60%),
    radial-gradient(70% 45% at 0% 85%, rgba(66, 198, 255, .18) 0%, transparent 60%),
    linear-gradient(175deg, var(--night-2) 0%, var(--night) 70%);
}
/* a star field: two layers of dots, the far one twinkling */
.floaters::before, .floaters::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 90px 120px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 160px 60px, #FFE3A3 50%, transparent 51%),
    radial-gradient(1px 1px at 230px 170px, #fff 50%, transparent 51%);
  background-size: 260px 220px; opacity: .55;
}
.floaters::after { background-size: 340px 300px; background-position: 70px 40px; animation: twinkle 4s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .15; } to { opacity: .6; } }

img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.floaters img {
  position: absolute; left: var(--x); top: var(--y);
  width: calc(var(--w) * var(--k)); height: auto;
  image-rendering: pixelated; opacity: .9;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45));
  animation: drift var(--t) ease-in-out var(--d) infinite alternate;
}
@keyframes drift {
  0% { transform: translate(0, 0) rotate(-6deg); }
  50% { transform: translate(calc(var(--dx) * .5), -18px) rotate(4deg); }
  100% { transform: translate(var(--dx), 6px) rotate(-3deg); }
}

/* ---------------- header ---------------- */
.bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) var(--edge-r) 4px var(--edge-l);
}
.brand { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
.nyota-btn {
  flex: none; width: 70px; height: 70px; padding: 0; margin: -4px -2px -4px -8px;
  border: 0; background: none; cursor: pointer; border-radius: 50%;
}
.nyota-btn:active { transform: scale(.94); }
.bubble {
  position: absolute; left: 60px; top: -2px; z-index: 3;
  padding: 5px 11px; border-radius: 14px 14px 14px 4px;
  background: #fff; color: var(--ink);
  font: 600 13px/1.2 'Fredoka', sans-serif; white-space: nowrap;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
  transform-origin: 0 100%;
  animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both;
}
.bubble.hide { animation: none; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }

/* The logo: "ZONA" big and "GAMES" small, gold on a thick dark outline with
   a hard drop underneath. Each word's outline lives on its own ::before so it
   can sit behind the gradient fill. */
.logo {
  display: flex; flex-direction: column; align-items: flex-start;
  margin: 12px 0 0; line-height: .9; text-transform: uppercase; white-space: nowrap;
  font-family: 'Fredoka', sans-serif; font-weight: 700;
}
.logo > span {
  /* no z-index here: it would make a stacking context and put the ::before
     outline in front of the gold fill instead of behind it */
  position: relative;
  background: linear-gradient(180deg, #FFF3B0 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo > span::before {
  content: attr(data-text); position: absolute; inset: 0; z-index: -1;
  color: var(--ink); -webkit-text-stroke: 8px var(--ink);
  text-shadow: 0 5px 0 var(--ink), 0 10px 16px rgba(0, 0, 0, .45);
}
.logo-zona { font-size: clamp(38px, 11vw, 58px); letter-spacing: .02em; }
.logo > .logo-games {
  margin: 1px 0 0 3px; font-size: clamp(14px, 3.9vw, 19px); letter-spacing: .42em;
  background-image: linear-gradient(180deg, #FFFFFF 0%, #FFD7E6 100%);
}
.logo > .logo-games::before { -webkit-text-stroke-width: 6px; text-shadow: 0 3px 0 var(--ink); }

/* ---------------- player bar: hearts, coins, Zona Pass ---------------- */
.player {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  padding: 6px var(--edge-r) 2px var(--edge-l);
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 999px; font: 700 16px/1 'Fredoka', sans-serif; color: #fff;
  background: rgba(16, 6, 34, .9); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), 0 3px 0 rgba(0, 0, 0, .35);
}
button.pill { cursor: pointer; }
button.pill:active { transform: translateY(2px); }
.hearts-row { display: inline-flex; align-items: center; gap: 2px; }
.hearts-row img { width: 21px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .4)); }
.hearts-row img.empty { filter: grayscale(1) brightness(.45); opacity: .7; }
.hearts-row .inf { margin-left: 4px; font-size: 22px; color: #FF7AA2; }
.refill { font: 12px/1 'Press Start 2P', monospace; color: #FFB3C8; }
.refill:empty { display: none; }
.coins b { font-variant-numeric: tabular-nums; min-width: 1.6em; }
.coin-ic {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFF0B0 0 25%, #FFC24D 30% 65%, #C47A00 70%);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .45);
}
.coins.bump { animation: bump .18s ease-in-out infinite alternate; }
@keyframes bump { to { transform: scale(1.1); } }
.pass-btn {
  margin-left: auto; color: #3A1500;
  background: linear-gradient(180deg, #FFE9A6 0%, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: 0 4px 0 var(--gold-edge), 0 0 18px rgba(255, 194, 77, .45);
  position: relative; overflow: hidden;
}
.pass-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .8) 50%, transparent 65%);
  transform: translateX(-130%); animation: glint 4.2s ease-in-out infinite;
}
.pass-btn .crown { width: 20px; height: 20px; color: #fff; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .3)); }
.has-pass .pass-btn { background: linear-gradient(180deg, #D8C2FF, #8B5CFF); color: #fff; box-shadow: 0 4px 0 #4A1FB8, 0 0 18px rgba(139, 92, 255, .5); }
.has-pass .pass-btn .crown { color: var(--gold); }

/* ---------------- Zona Pass sheet ---------------- */
.pass {
  width: min(420px, calc(100vw - 24px)); max-height: calc(100svh - 24px);
  padding: 0; border: 0; border-radius: 28px; overflow: visible;
  background: transparent; color: var(--text);
}
.pass::backdrop { background: rgba(10, 4, 24, .78); backdrop-filter: blur(3px); }
.pass[open] { animation: passIn .35s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes passIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
.pass-card {
  position: relative; overflow: hidden; max-height: calc(100svh - 24px); overflow-y: auto;
  padding: 26px 22px 18px; border-radius: 28px; text-align: center;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 194, 77, .35), transparent 60%),
    linear-gradient(170deg, #4A1C78 0%, #26103F 100%);
  box-shadow: 0 0 0 4px var(--gold), 0 0 0 9px #3A1657, 0 20px 50px rgba(0, 0, 0, .6);
}
.pass-x {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .3); color: #fff; cursor: pointer;
}
.pass-x svg { width: 18px; height: 18px; }
.pass-crown { width: 64px; height: 64px; color: var(--gold); filter: drop-shadow(0 4px 0 #7A3E00) drop-shadow(0 0 16px rgba(255, 194, 77, .7)); animation: crownBob 2.4s ease-in-out infinite; }
.pass-crown.big { width: 96px; height: 96px; }
@keyframes crownBob { 50% { transform: translateY(-5px) rotate(-4deg); } }
.pass-kicker { margin-top: 6px; font: 700 15px/1.2 'Fredoka', sans-serif; color: #FF9DBA; }
.pass[data-why="hearts"] .pass-kicker { font-size: 19px; color: #FF7AA2; }
.pass-title {
  margin-top: 2px; font: 700 40px/1 'Fredoka', sans-serif; text-transform: uppercase; letter-spacing: .02em;
  background: linear-gradient(180deg, #FFF3B0 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 var(--ink));
}
.perks { margin: 18px 0 0; padding: 0; list-style: none; text-align: left; display: grid; gap: 10px; }
.perks li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, .07); font-size: 15px; line-height: 1.3; color: var(--muted);
}
.perks b { color: #fff; font-weight: 700; }
.perks img { width: 30px; flex: none; image-rendering: pixelated; }
.price { margin-top: 14px; font-size: 13px; color: var(--muted); }
.gold-btn {
  width: 100%; min-height: 58px; margin-top: 10px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 22px/1 'Fredoka', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #3A1500;
  background: linear-gradient(180deg, #FFE08A 0%, var(--gold) 40%, var(--gold-deep) 100%);
  box-shadow: 0 6px 0 var(--gold-edge), 0 12px 24px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .6);
  animation: breathe 1.8s ease-in-out infinite;
}
.gold-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--gold-edge), inset 0 2px 0 rgba(255, 255, 255, .6); animation: none; }
@keyframes breathe { 50% { transform: scale(1.03); } }
.pass-alt { margin-top: 14px; }
.coin-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border: 0; border-radius: 999px; cursor: pointer; color: #fff; font: 600 15px/1 'Fredoka', sans-serif;
  background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2);
}
.coin-btn img { width: 20px; image-rendering: pixelated; }
.coin-btn small { font: 500 12px/1 'Outfit', sans-serif; color: var(--muted); }
.coin-btn[disabled] { opacity: .45; cursor: default; }
.wait { margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pass[data-pass="true"] .pass-alt, .pass[data-pass="true"] .gold-btn, .pass[data-pass="true"] .price { display: none; }
.pass[data-pass="true"] .pass-kicker::after { content: ' · Active'; }
.demo-note { margin-top: 14px; font-size: 12px; color: var(--muted); }
.link { border: 0; padding: 0; background: none; color: #FF9DBA; font: inherit; text-decoration: underline; cursor: pointer; }
.pass-done { display: none; padding: 30px 0 20px; }
.pass.done .pass-offer { display: none; }
.pass.done .pass-done { display: block; animation: passIn .4s cubic-bezier(.3, 1.6, .5, 1); }
.done-title { margin-top: 10px; font: 700 34px/1 'Fredoka', sans-serif; color: var(--gold); text-shadow: 0 3px 0 var(--ink); }
.done-line { margin-top: 8px; color: var(--muted); }
/* a phone on its side: offer on the left, Subscribe on the right, so the
   button is on screen without scrolling */
@media (max-height: 520px) {
  .pass { width: min(780px, calc(100vw - 24px)); }
  .pass-card { padding: 14px 20px 12px; }
  .pass-offer { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: center; text-align: left; }
  .pass-head { text-align: center; }
  .pass-crown { width: 40px; height: 40px; }
  .pass-title { font-size: 30px; }
  .pass-kicker { margin-top: 0; }
  .perks { margin-top: 10px; gap: 6px; }
  .perks li { padding: 7px 10px; font-size: 13.5px; }
  .perks img { width: 22px; }
  .perks .more { display: none; }
  .pass-buy { text-align: center; padding-top: 30px; }
  .price { margin-top: 0; }
  .pass-alt { margin-top: 10px; }
  .demo-note { margin-top: 10px; }
  .pass-done { padding: 10px 0; }
}
.confetto { position: absolute; top: 20px; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; }

@media (max-width: 479px) {
  .player { gap: 6px; flex-wrap: wrap; row-gap: 6px; }
  .pill { padding: 0 10px; font-size: 15px; }
  .hearts-row img { width: 16px; }
  .refill { font-size: 10px; }
  .pass-btn .pass-label { font-size: 14px; }
}

.fly-heart { position: fixed; z-index: 50; width: 26px; image-rendering: pixelated; pointer-events: none; }

.snd {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  border: 0; border-radius: 16px; cursor: pointer;
  background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16), 0 4px 0 rgba(0, 0, 0, .3);
}
.snd svg { width: 24px; height: 24px; }
.snd .off { display: none; }
.snd[aria-pressed="false"] .on { display: none; }
.snd[aria-pressed="false"] .off { display: inline; }
.snd:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16), 0 1px 0 rgba(0, 0, 0, .3); }

/* ---------------- Nyota (rules from quiz/css/game.css) ---------------- */
.nyota-host { display: block; width: 100%; height: 100%; }
.nyota { width: 100%; height: 100%; position: relative; }
.nyota-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.n-body { transform-origin: 60px 70px; animation: nBob 3.4s ease-in-out infinite; }
.n-glow { opacity: .5; }
.n-mouth { display: none; }
.n-eyes-shut { display: none; }
.n-fire { display: none; transform-origin: 60px 20px; }
.nyota.idle .m-idle { display: block; }
.nyota.happy .m-happy, .nyota.fire .m-happy { display: block; }
.nyota.sad .m-sad { display: block; }
.nyota.sad .n-body { animation: nSink .5s ease-out forwards; }
.nyota.sad .n-glow { opacity: .2; }
.nyota.blink .n-eyes { display: none; }
.nyota.blink .n-eyes-shut { display: block; }
.nyota.happy .n-body { animation: nJump .62s cubic-bezier(.25, 1.6, .4, 1) 2; }
.nyota.happy .n-eyes { display: none; }
.nyota.happy .n-eyes-shut { display: block; }
.nyota.happy .n-glow { opacity: 1; }
.nyota.happy .n-cheek { opacity: .9; }
.nyota.fire .n-fire { display: block; animation: nFlame .42s ease-in-out infinite alternate; }
.nyota.fire .n-body { animation: nBob 1.1s ease-in-out infinite; }
.nyota.fire .n-glow { opacity: 1; animation: nPulse .9s ease-in-out infinite; }
@keyframes nBob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-5px) rotate(1.5deg); } }
@keyframes nJump {
  0% { transform: translateY(0) scale(1, 1); }
  28% { transform: translateY(-19px) scale(.93, 1.09); }
  55% { transform: translateY(0) scale(1.09, .9); }
  75% { transform: translateY(-5px) scale(1, 1); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes nSink { to { transform: translateY(7px) scale(1.04, .9); } }
@keyframes nFlame { from { transform: scaleY(.82) translateY(2px); } to { transform: scaleY(1.15) translateY(-2px); } }
@keyframes nPulse { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }

main { position: relative; z-index: 1; }

/* ---------------- shared game pieces ---------------- */
.sticker {
  display: inline-block; padding: 4px 10px 3px; border-radius: 9px;
  background: #fff; color: var(--c2, var(--ink));
  font: 700 12px/1.1 'Fredoka', sans-serif; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3); transform: rotate(-4deg);
}
.sticker.new { background: var(--coral); color: #fff; animation: wiggle 2.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(-4deg) scale(1); } 86% { transform: rotate(5deg) scale(1.12); } 92% { transform: rotate(-7deg) scale(1.08); } }

/* ---------------- the arcade screen (assets/runner.js) ----------------
   A cabinet screen: thick bezel, a glow, faint scanlines over the pixels.
   The canvas fills it; score and prompts are DOM on top so text stays sharp. */
.arcade { padding: 8px var(--edge-r) 6px var(--edge-l); }
.screen {
  position: relative; overflow: hidden; cursor: pointer;
  height: clamp(230px, 42svh, 360px);
  border-radius: 24px; background: #12082a;
  box-shadow:
    0 0 0 4px #FFC24D, 0 0 0 9px #3A1657, 0 9px 0 9px #1B0B33,
    0 0 40px 10px rgba(255, 61, 110, .28), 0 24px 40px rgba(0, 0, 0, .45);
  margin: 9px 9px 22px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.screen:focus-visible { outline: 3px solid #fff; outline-offset: 12px; }
.screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .13) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .55);
}
.hud {
  position: absolute; left: 12px; right: 12px; top: 10px; z-index: 1; pointer-events: none;
  display: flex; justify-content: space-between; align-items: center;
  font: 12px/1 'Press Start 2P', monospace; color: #fff; text-shadow: 0 2px 0 #000;
}
.hud b { font-weight: 400; color: var(--gold); }
.hud-coins { display: inline-flex; align-items: center; gap: 7px; font-size: 16px; }
.hud-coin {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFF0B0 0 25%, #FFC24D 30% 65%, #C47A00 70%);
  box-shadow: 0 2px 0 #000;
}
.prompt {
  position: absolute; left: 0; right: 0; top: 34%; z-index: 1; pointer-events: none;
  text-align: center; color: #fff;
}
.prompt-title {
  margin-bottom: 12px; font: 10px/1 'Press Start 2P', monospace; letter-spacing: .12em; color: #FF9DBA;
  text-shadow: 0 2px 0 #000;
}
.screen[data-mode="over"] .prompt-title { display: none; }
.pops { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.pop {
  position: absolute; transform: translate(-50%, -100%);
  font: 12px/1 'Press Start 2P', monospace; color: #fff; text-shadow: 0 2px 0 #000, 0 0 8px rgba(0, 0, 0, .6);
  animation: rise .9s ease-out forwards; white-space: nowrap;
}
.pop.combo { color: var(--gold); font-size: 15px; }
.pop.star { color: #FFE38A; font-size: 16px; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -100%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
.prompt-big {
  font: clamp(16px, 4.6vw, 26px)/1.2 'Press Start 2P', monospace; color: var(--gold);
  text-shadow: 0 3px 0 #3A1500, 0 0 18px rgba(255, 194, 77, .55);
  animation: blinkish 1.1s steps(2, jump-none) infinite;
}
.prompt-sub { margin-top: 10px; font: 600 14px/1.3 'Fredoka', sans-serif; text-shadow: 0 2px 0 rgba(0, 0, 0, .7); }
.screen[data-mode="play"] .prompt { display: none; }
.screen[data-mode="over"] .prompt-big { animation: none; }
@keyframes blinkish { 0% { opacity: 1; } 100% { opacity: .25; } }

/* ---------------- weekly leaderboard ---------------- */
.board { padding: 18px var(--edge-r) 4px var(--edge-l); }
.board-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.board-demo { padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.12); color: var(--muted); font: 700 12px/1 'Fredoka', sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.board-ends { margin-left: auto; color: var(--gold); font: 700 15px/1 'Fredoka', sans-serif; }
.board-tabs { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.board-tabs button { flex: 0 0 auto; padding: 8px 14px; border-radius: 99px; border: 2px solid rgba(255,255,255,.18); background: var(--night-2); color: var(--muted); font: 700 15px/1 'Fredoka', sans-serif; cursor: pointer; }
.board-tabs button[aria-selected="true"] { background: var(--gold); color: #3A1500; border-color: var(--gold-edge); box-shadow: 0 3px 0 var(--gold-edge); }
.board-list { list-style: none; margin: 12px 0 0; padding: 8px; border-radius: 18px; background: linear-gradient(var(--night-2), var(--night-3)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 0 6px 0 rgba(0,0,0,.25); display: grid; gap: 4px; }
.board-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 12px; font: 600 16px/1.2 'Outfit', sans-serif; }
.board-list li:nth-child(odd) { background: rgba(255,255,255,.04); }
.board-list li .rk { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.1); font: 700 15px/1 'Fredoka', sans-serif; }
.board-list li.r1 .rk { background: #FFC24D; color: #3A1500; } .board-list li.r2 .rk { background: #D9DEEA; color: #2A2440; } .board-list li.r3 .rk { background: #E09A5A; color: #3A1500; }
.board-list li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li .nm small { margin-left: 6px; color: var(--muted); font-size: 12px; }
.board-list li .sc { font: 700 16px/1 'Fredoka', sans-serif; color: var(--gold); }
.board-list li.me { background: rgba(46,230,168,.18); box-shadow: inset 0 0 0 2px var(--mint); }
.board-list li.me .nm { color: var(--mint); }
.board-list li.gap { padding: 0; height: 10px; background: none; text-align: center; color: var(--muted); }
.board-list li.gap::before { content: '•••'; line-height: 10px; letter-spacing: 4px; }
.board-list li.none { display: block; text-align: center; color: var(--muted); padding: 14px; }
.board-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 14px; }
.board-prize { margin: 0; flex: 1; }
.board-name { display: flex; gap: 8px; }
.board-name[hidden] { display: none; }
.board-name input { width: 150px; padding: 6px 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,.2); background: var(--night); color: var(--text); font: inherit; }

/* ---------------- all games ---------------- */
.all { padding: 22px var(--edge-r) 10px var(--edge-l); }
.sec-title {
  display: flex; align-items: center; gap: 10px;
  font: 700 26px/1 'Fredoka', sans-serif; text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.count {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px;
  background: var(--gold); color: #3A1500; font-size: 17px; text-shadow: none;
  box-shadow: 0 3px 0 var(--gold-edge);
}
/* category chips: one row that scrolls sideways on a phone */
.cats {
  display: flex; gap: 8px; margin: 14px calc(-1 * var(--edge-r)) 0 calc(-1 * var(--edge-l)); padding: 2px var(--edge-r) 8px var(--edge-l);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 0 var(--edge-l);
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px 0 15px; border-radius: 99px;
  border: 2px solid rgba(255, 255, 255, .18); background: var(--night-2); color: var(--muted);
  font: 700 15px/1 'Fredoka', sans-serif; cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
.cat-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: 12.5px; }
.cat[aria-pressed="true"] { background: var(--gold); color: #3A1500; border-color: var(--gold-edge); box-shadow: 0 3px 0 var(--gold-edge); }
.cat[aria-pressed="true"] .cat-n { background: rgba(58, 21, 0, .16); }
.cat:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
@media (hover: hover) { .cat:hover { color: var(--text); border-color: rgba(255, 255, 255, .35); } .cat[aria-pressed="true"]:hover { color: #3A1500; } }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.grid .tile[hidden] { display: none; }

.tile {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; text-decoration: none;
  background: linear-gradient(170deg, var(--c1) 0%, var(--c2) 100%);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 255, 255, .25);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:active { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 255, 255, .25); }
@media (hover: hover) {
  .tile:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 10px 0 rgba(0, 0, 0, .35), 0 18px 30px rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 255, 255, .4); }
}
/* a glint that sweeps across one tile after another, like a store shelf */
.tile::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .32) 50%, transparent 62%);
  transform: translateX(-130%);
  animation: glint 8.4s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 1.2s);
}
@keyframes glint { 0%, 82% { transform: translateX(-130%); } 96%, 100% { transform: translateX(130%); } }
.tile.mystery::after { display: none; }
.tile-art { position: relative; aspect-ratio: 4 / 3; margin: 6px 6px 0; border-radius: 16px; overflow: hidden; background: var(--night); }
.tile-art img { width: 100%; height: 100%; object-fit: cover; }
.tile .sticker { position: absolute; top: 12px; left: 12px; font-size: 11px; }
.tile-foot { display: flex; align-items: center; gap: 8px; padding: 9px 10px 11px 12px; }
.tile-text { flex: 1; min-width: 0; }
.tile-name { display: block; font: 700 19px/1.05 'Fredoka', sans-serif; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.tile-kind { display: block; margin-top: 3px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-play {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(180deg, #FFE08A 0%, var(--gold) 45%, var(--gold-deep) 100%); color: #3A1500;
  box-shadow: 0 4px 0 var(--gold-edge), inset 0 2px 0 rgba(255, 255, 255, .6);
}
.tile-play svg { width: 17px; height: 17px; margin-left: 2px; }
.turn {
  position: absolute; right: 10px; top: 10px; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%; background: rgba(21, 10, 40, .72); color: #fff;
}
.turn svg { width: 18px; height: 18px; }

/* the weekly surprise: a pixel chest that rattles */
.extras { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.extra {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 2px var(--c1);
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600;
}
.extra b { font: 700 15px/1 'Fredoka', sans-serif; color: var(--c1); }
.extra:active { transform: translateY(2px); }

.tile.mystery {
  grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; padding: 14px 18px;
  --c1: #3A1657; --c2: #26103F;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 194, 77, .45);
}
.tile.mystery img { width: 80px; image-rendering: pixelated; animation: rattle 2.2s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes rattle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-8deg) translateY(-3px); } 80% { transform: rotate(7deg); } 85% { transform: rotate(-5deg); } 90% { transform: rotate(3deg); } }
.mystery-name { font: 700 21px/1.1 'Fredoka', sans-serif; color: var(--gold); }
.mystery-line { margin-top: 3px; font-size: 14.5px; color: var(--muted); }

.foot {
  position: relative; z-index: 1;
  padding: 26px var(--edge-r) calc(30px + env(safe-area-inset-bottom)) var(--edge-l);
  text-align: center; font-size: 13.5px; color: var(--muted);
}
/* shown only where the site is locked to demo accounts (lobby.js asks) */
.signout { display: block; width: max-content; margin: 12px auto 0; padding: 8px 14px; border: 0; background: none; font: inherit; color: #FF9DBA; text-decoration: underline; cursor: pointer; }
.signout[hidden] { display: none; }

/* ---------------- the demo lock: the sign-in sheet ----------------
   Opens when a guest taps a game. A purple card with a gold rim, the padlock,
   two big fields and the gold button. */
.signin {
  width: min(424px, calc(100vw - 24px)); max-height: calc(100svh - 24px);
  padding: 0; border: 0; border-radius: 26px; overflow: visible;
  background: transparent; color: var(--text);
}
.signin::backdrop { background: rgba(10, 4, 24, .78); backdrop-filter: blur(3px); }
.signin[open] { animation: passIn .35s cubic-bezier(.3, 1.5, .5, 1); }
.signin-card {
  position: relative; max-height: calc(100svh - 24px); overflow-y: auto;
  padding: 22px 20px 18px; border-radius: 26px;
  background: linear-gradient(180deg, #4E1B78, #26103F);
  border: 2px solid rgba(255, 194, 77, .45);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .28), 0 22px 44px rgba(0, 0, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .12);
}
.signin-card[data-state="wrong"] { animation: signNo .32s; }
@keyframes signNo { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.signin-head { display: flex; align-items: center; gap: 12px; padding-right: 44px; }
.signin-lock { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.signin-title { margin: 0; font: 700 23px/1.1 'Fredoka', sans-serif; }
.signin-sub { margin: 3px 0 0; font-size: 14.5px; color: var(--muted); }
.signin-form { display: grid; gap: 12px; margin-top: 18px; }
.signin-form label { display: grid; gap: 5px; font: 600 13.5px/1 'Fredoka', sans-serif; letter-spacing: .05em; text-transform: uppercase; color: #FFE3A3; }
.signin-form input {
  width: 100%; min-height: 54px; padding: 0 16px; border-radius: 16px;
  border: 2px solid rgba(201, 182, 230, .4); background: rgba(21, 10, 40, .75);
  font: 600 21px/1 'Outfit', sans-serif; letter-spacing: .04em; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.signin-form input::placeholder { color: rgba(201, 182, 230, .45); font-weight: 500; }
.signin-form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 194, 77, .25); }
#signPin { letter-spacing: .32em; }
.signin-card[data-state="wrong"] input { border-color: var(--coral); }
.signin-go { margin-top: 6px; animation: none; }
.signin-go:disabled { filter: saturate(.55) brightness(.85); cursor: default; }
.signin-msg { min-height: 1.4em; margin: 2px 0 0; font-size: 14.5px; font-weight: 600; color: #FF9DBA; text-align: center; }
.signin-note { margin: 8px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
/* a phone on its side: the two fields go side by side so the sheet fits */
@media (max-height: 520px) {
  .signin { width: min(560px, calc(100vw - 24px)); }
  .signin-card { padding: 14px 18px 12px; }
  .signin-lock { width: 36px; height: 36px; }
  .signin-title { font-size: 20px; }
  .signin-form { grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 10px; }
  .signin-form input { min-height: 46px; font-size: 19px; }
  .signin-go, .signin-msg { grid-column: 1 / -1; }
  .signin-go { min-height: 48px; margin-top: 2px; }
  .signin-note { margin-top: 2px; }
}
.noscript { position: relative; z-index: 1; padding: 20px var(--edge-l); }

/* ---------------- sideways and bigger screens ---------------- */
@media (min-aspect-ratio: 5/4) {
  .player { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: calc(var(--edge-r) + 58px); padding: 0; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* a phone on its side: little height, so the header gets compact and the
   arcade screen takes what is left of the first screen */
@media (min-aspect-ratio: 5/4) and (max-height: 520px) {
  .bar { padding-top: calc(4px + env(safe-area-inset-top)); }
  .nyota-btn { width: 54px; height: 54px; }
  .bubble { left: 48px; font-size: 12px; }
  .logo { margin-top: 8px; }
  .logo-zona { font-size: 30px; }
  .logo > .logo-games { font-size: 11px; }
  .player { top: calc(8px + env(safe-area-inset-top)); right: calc(var(--edge-r) + 52px); }
  .snd { width: 40px; height: 40px; }
  .screen { height: calc(100svh - 92px); min-height: 200px; }
}
@media (min-width: 900px) {
  .screen { height: clamp(300px, 44svh, 400px); }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile.mystery { grid-column: auto; flex-direction: column; justify-content: center; text-align: center; }
  .tile.mystery img { width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .floaters img, .floaters::after, .sticker.new, .tile.mystery img, .n-body { animation: none !important; }
  .tile { transition: none; }
  .prompt-big, .tile::after, .gold-btn, .pass-crown, .pass-btn::after, .signin-card { animation: none !important; }
}
