* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --ink: #1a1530; --muted: #7a7292; --line: #e3ddf5;
  --accent: #ff3b5c; --accent2: #7b3fe4;
  --bg: #f3f0fb; --surface: #ffffff;
  --danger: #dc2626;
}
html, body { overscroll-behavior: none; }
body {
  font-family: 'Sora', sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100vh; min-height: 100dvh;
  padding: 10px 12px 0;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 480px; width: 100%; margin: 0 auto; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* -- Platform logo strip: infinite marquee, same as every other game page -- */
.platform-strip { position: relative; overflow: hidden; padding: 8px 0; flex-shrink: 0; }
.platform-strip::before, .platform-strip::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 32px; z-index: 2; pointer-events: none;
}
.platform-strip::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.platform-strip::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.platform-track {
  display: flex; align-items: center; gap: 10px; width: max-content;
  animation: platformMarquee 36s linear infinite;
}
.platform-strip:hover .platform-track { animation-play-state: paused; }
@keyframes platformMarquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.platform-card {
  flex: 0 0 auto; width: 76px; height: 42px; border-radius: 12px;
  background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.platform-card:active { transform: scale(.92); }
.platform-card img { height: 22px; width: auto; max-width: 90%; object-fit: contain; display: block; }
@media (prefers-reduced-motion: reduce) { .platform-track { animation: none; } }

/* -- Header -- */
/* ── Header (unified cross-game pattern -- see word/src/base.css) ── */
.top {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  padding: 5px 0 4px; gap: 6px; flex-shrink: 0;
}
.top-left { display: flex; align-items: center; gap: 6px; }
.icon-group { display: flex; align-items: center; gap: 6px; }
.brand { height: 44px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.brand img { max-height: 100%; width: auto; object-fit: contain; }
.icon {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: 19px; font-weight: 800;
  text-decoration: none; cursor: pointer;
}

/* -- HUD control row below the game, same placement/sizing /arrow, /connect,
   /block and /merge use for their Ranking/Como-jogar buttons (kept out of
   the persistent top header, which stays back-button + logo only there). -- */
/* Bottom clearance big enough that the site-wide #rpGuestBanner (fixed,
   bottom:12px, ~70px tall -- src/authui.js) never sits on top of these
   buttons and eats their taps, since this row is the last thing on the
   page instead of sitting above more content like it does elsewhere. */
.hud-btns { position: static; display: flex; align-items: center; justify-content: center; gap: 22px; padding: 14px 0 calc(90px + env(safe-area-inset-bottom, 0px)); }
.icon-btn {
  position: relative; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; line-height: 1; padding: 0;
  background: #f8fafc; border: 1px solid var(--line);
  box-shadow: 0 3px 8px rgba(15,23,42,.10);
  cursor: pointer; transition: transform .15s cubic-bezier(.34,1.56,.64,1);
}
.icon-btn:active { transform: scale(.88); }

/* -- How to play / Leaderboard overlays -- shared shell every game reuses -- */
.howto-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 20px;
}
.howto-overlay.show { display: flex; }
.howto-card {
  background: var(--surface); border-radius: 18px; padding: 22px 20px;
  max-width: 380px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.howto-title { font-size: 19px; font-weight: 800; text-align: center; margin-bottom: 16px; }
.howto-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.howto-emoji { font-size: 24px; flex-shrink: 0; line-height: 1.3; }
.howto-step b { display: block; font-size: 13px; margin-bottom: 2px; }
.howto-step p { font-size: 12px; color: var(--muted); line-height: 1.4; }
.howto-card .result-btn { width: 100%; margin-top: 6px; }

.leaderboard-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 50vh; overflow-y: auto; }
.leaderboard-loading, .leaderboard-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 0; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.lb-row.me { background: rgba(245,158,11,.15); border: 1.5px solid var(--accent); }
.lb-rank { font-weight: 800; font-size: 13px; color: var(--muted); width: 22px; text-align: center; flex-shrink: 0; }
.lb-row:nth-child(1) .lb-rank { color: #eab308; }
.lb-row:nth-child(2) .lb-rank { color: #94a3b8; }
.lb-row:nth-child(3) .lb-rank { color: #b45309; }
.lb-name { flex: 1; font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; font-size: 14px; color: var(--accent); }

/* -- Name gate: guest-friendly, matches /arrow, /sort etc -- a logged-in
   member skips this entirely (handled in game.js) and plays under their
   real account; a guest can still play under a typed display name, just
   without their score persisting to the leaderboard. -- */
.namegate-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(15,10,30,.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.namegate-overlay.show { display: flex; }
.namegate-card {
  background: #fff; border-radius: 22px; padding: 28px 24px; max-width: 320px; width: 100%;
  text-align: center; box-shadow: 0 20px 50px -12px rgba(0,0,0,.4);
}
.namegate-logo { height: 64px; width: auto; margin-bottom: 12px; }
.namegate-title { font-family: 'Baloo 2', sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.namegate-sub { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }

/* ── Pop Hit ── */
html, body { height: 100%; }
body { height: 100dvh; overflow: hidden; padding-bottom: 8px; }
body:has(#rpGuestBanner > *) { padding-bottom: 92px; }
.wrap { min-height: 0; }
.brand-txt, .namegate-logo-txt { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 26px; letter-spacing: .5px;
  color: #ffd23f; -webkit-text-stroke: 1.5px #7b3fe4; paint-order: stroke fill; text-shadow: 0 3px 0 #7b3fe4; }
.namegate-logo-txt { font-size: 40px; margin-bottom: 8px; }
#gameStage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin-top: 4px; }
#hitCanvas { display: block; touch-action: none; border-radius: 22px; background: #fff;
  box-shadow: 0 14px 32px -16px rgba(123,63,228,.35); cursor: pointer; user-select: none; -webkit-user-select: none; }
.stage-btn { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.9); font-size: 17px; cursor: pointer; z-index: 2; }
.result-card { text-align: center; }
.res-emoji { font-size: 46px; line-height: 1; margin-bottom: 4px; }
.res-score { font-family: 'Baloo 2', sans-serif; font-size: 56px; font-weight: 800; line-height: 1; color: var(--accent); }
.res-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.res-row { display: flex; gap: 10px; margin-bottom: 14px; }
.res-row > div { flex: 1; background: var(--bg); border-radius: 14px; padding: 10px 6px; }
.res-row b { display: block; font-size: 22px; font-family: 'Baloo 2', sans-serif; }
.res-row span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.res-login { font-size: 12.5px; font-weight: 700; color: var(--accent2); cursor: pointer; margin-bottom: 10px; text-decoration: underline; }
.result-btn {
  width: 100%; padding: 14px; border-radius: 999px; border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  font-weight: 800; font-size: 15px; cursor: pointer; font-family: 'Sora', sans-serif;
  box-shadow: 0 10px 22px -8px rgba(124,58,237,.5);
}

.res-unlock { font-size: 13px; font-weight: 800; color: #c98a12; background: #fff7dd; border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; }
.namegate-logo { height: 96px; }
#hitCanvas { background: #2a0f5c; }

/* result card extras (Dec 3 2026): mascot, WhatsApp, POP platforms, more games */
.res-cap { width: 104px; height: 104px; margin: -6px auto 0; background: url('../asset/game/cap-cheer.webp') 0 0 / 1040px 104px no-repeat; }
.res-cap.win { background-image: url('../asset/game/cap-cheer.webp'); background-position: -104px 0; }
.res-cap.lose { background-image: url('../asset/game/cap-oops.webp'); background-position: -936px 0; }
.result-card .rp-wa-btn { max-width: none; margin: 10px 0 0; border-radius: 999px; }
.res-plat { margin-top: 14px; padding: 10px; border-radius: 16px; background: linear-gradient(135deg, #fff4dc, #fde7f3); }
.res-plat-t { font-size: 12.5px; font-weight: 800; color: #7b3fe4; margin-bottom: 8px; }
.res-plat-row { display: flex; gap: 8px; }
.res-plat-row a { flex: 1; min-width: 0; height: 46px; border-radius: 12px; background: #fff; border: 1px solid #f0e2f5;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 #ecd9f2; }
.res-plat-row a:active { transform: translateY(2px); box-shadow: 0 1px 0 #ecd9f2; }
.res-plat-row img { max-width: 86%; max-height: 26px; object-fit: contain; display: block; }
.res-more { display: inline-block; margin-top: 12px; font-size: 13.5px; font-weight: 800; color: var(--accent2); text-decoration: none; }
/* keep the whole result card on one phone screen */
.result-card { padding: 16px 18px 14px; max-height: 92vh; }
.result-card .howto-title { margin-bottom: 6px; font-size: 18px; }
.res-cap { width: 84px; height: 84px; background-size: 840px 84px; margin: -4px auto 0; }
.res-cap.win { background-position: -84px 0; }
.res-cap.lose { background-position: -756px 0; }
.res-score { font-size: 46px; }
.res-sub { margin-bottom: 10px; }
.res-row { margin-bottom: 10px; }
.res-row > div { padding: 7px 6px; }
.res-row b { font-size: 19px; }
.res-unlock { margin-bottom: 8px; padding: 6px 10px; }
.res-login { margin-bottom: 8px; }
.res-plat { margin-top: 10px; }
.res-more { margin-top: 8px; }
