/* ---------- Kook Pro — official Bingo brand font (Persian, FaNum digits) ---------- */
@font-face { font-family: "Kook"; src: url("assets/fonts/KookFaNum-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kook"; src: url("assets/fonts/KookFaNum-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Kook"; src: url("assets/fonts/KookFaNum-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Kook"; src: url("assets/fonts/KookFaNum-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  /* Official Bingo game palette */
  --bg: #022c15;      /* dark green */
  --bg2: #0a5c31;
  --green: #009349;   /* brand green */
  --yellow: #f6bf34;  /* brand yellow */
  --red: #b7010a;     /* Bingo red */
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.16);
  --text: #eafff2;
  --muted: #a9cbb6;
  --primary: #b7010a;   /* CTAs are red */
  --primary2: #d4131d;
  --accent: #f6bf34;    /* accents are yellow */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

* { box-sizing: border-box; }

/* Ensure the `hidden` attribute always wins, even for elements that set an
   explicit display (buttons, overlay, chips). Without this, `hideOverlay()`
   and other show()/hide() toggles have no visual effect. */
[hidden] { display: none !important; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

/* Mobile-first base: fill the (dynamic) viewport, no horizontal scroll, and
   don't let pull-to-refresh fight the board swipes. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  font-family: "Kook", "Vazirmatn", "IRANSans", Tahoma, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(64% 42% at 50% -6%, rgba(64, 236, 148, 0.28) 0%, rgba(64, 236, 148, 0) 60%),
    radial-gradient(110% 72% at 50% 12%, rgba(0, 8, 4, 0) 16%, rgba(0, 7, 4, 0.98) 88%),
    radial-gradient(circle at 50% -6%, #0f9850 0%, #0a6f38 28%, #053a20 54%, #01130a 100%);
  background-attachment: fixed;
}

/* A phone-width column, centered on larger screens; honors notch/home safe areas. */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(8px + env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
}

/* Sticky topbar so the countdown/score stay visible while the page scrolls. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -14px 10px;
  padding: 8px 14px calc(8px + env(safe-area-inset-top));
  margin-top: calc(-8px - env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(10, 78, 43, 0.94), rgba(7, 61, 34, 0.72));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: 0.2px; white-space: nowrap; }
.brand b { color: #ff5a5f; font-style: italic; font-weight: 900; margin-inline-start: 2px; }
.user-chip {
  display: flex; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--card-border);
  padding: 6px 10px; border-radius: 999px; font-size: 13px; color: var(--muted);
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.mini {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 11px 5px 8px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-variant-numeric: tabular-nums;
}
.mini-ico { font-size: 14px; line-height: 1; }
.mini b { color: #fff; font-size: 15px; font-weight: 800; min-width: 1.2ch; text-align: center; }
/* The countdown is the hero chip. */
.timer-chip {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 6px 13px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  font-variant-numeric: tabular-nums;
}
.timer-ico { font-size: 15px; line-height: 1; }
.timer-val {
  color: #fff; font-size: 18px; font-weight: 800; letter-spacing: 0.5px;
  /* Fixed box so the rapidly-changing SS.mmm digits never reflow the top bar.
     em-based so it scales with font-size; overflow spills without moving siblings. */
  display: inline-block; width: 4.3em; text-align: center;
  white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.timer-val.warn { color: #ffd54a; }
.timer-chip.low {
  border-color: #ff7a3d;
  background: linear-gradient(180deg, rgba(255, 90, 60, 0.4), rgba(255, 90, 60, 0.14));
  box-shadow: 0 0 14px rgba(255, 120, 50, 0.6);
  animation: tick 1s ease-in-out infinite;
}
@keyframes tick { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; line-height: 1.5; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
/* Form controls don't inherit font-family by default — force the Kook brand font everywhere */
button, input, select, textarea { font-family: inherit; }
input {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 16px; /* >=16px avoids iOS zoom-on-focus */
  letter-spacing: 2px;
  outline: none;
}
input:focus { border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; /* comfortable thumb target */
  border: none; cursor: pointer; font-weight: 700; font-size: 16px;
  padding: 13px 18px; border-radius: 12px; margin-top: 12px;
  transition: transform 0.06s ease, filter 0.15s ease; color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #d4131d 0%, var(--red) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 16px rgba(183, 1, 10, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  width: 100%;
}
.btn.ghost { background: rgba(255, 255, 255, 0.1); border: 1px solid var(--card-border); }
.btn.shop {
  background: linear-gradient(180deg, #0aa557, var(--green)); color: #fff; text-decoration: none; width: 100%;
  box-shadow: 0 6px 16px rgba(0, 147, 73, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.row { display: flex; gap: 10px; }
.row .btn { width: 100%; }
.linkbtn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  text-decoration: underline; font-size: 13px; padding: 4px;
}
.msg { min-height: 18px; font-size: 13px; margin: 10px 0 0; }
.msg.err { color: #ff9db1; }
.msg.ok { color: var(--accent); }
.dev-hint {
  margin-top: 10px; font-size: 12px; color: var(--primary2);
  background: rgba(255, 138, 61, 0.1); padding: 8px 10px; border-radius: 8px;
}

/* ---------- Record / register card (matches design reference) ---------- */
.reg {
  position: relative;
  margin-top: 44px; /* room for the overlapping trophy badge */
  padding: 40px 20px 22px;
  text-align: center;
  background: linear-gradient(180deg, rgba(5, 46, 25, 0.72), rgba(2, 22, 12, 0.7));
  border: 1.5px solid rgba(246, 191, 52, 0.5);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(246, 191, 52, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.reg-badge {
  position: absolute; top: -32px; left: 50%; transform: translateX(-50%);
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: radial-gradient(circle at 50% 38%, #0a5a30, #04301a);
  border: 2.5px solid var(--yellow);
  box-shadow: 0 0 18px rgba(246, 191, 52, 0.55), inset 0 2px 6px rgba(0, 0, 0, 0.5);
}
.reg h2 { color: #fff; font-size: 20px; margin: 0 0 6px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.reg .sub { color: #eafff2; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); margin: 0 0 18px; }
.reg label { text-align: center; color: rgba(255, 255, 255, 0.72); font-size: 13px; margin: 12px 0 7px; }
.reg input {
  text-align: center; letter-spacing: normal;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(246, 191, 52, 0.32);
}
.reg input::placeholder { color: rgba(255, 255, 255, 0.34); letter-spacing: normal; }
.reg input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(246, 191, 52, 0.16); }
.reg .btn.primary {
  border-radius: 30px; margin-top: 18px;
  box-shadow: 0 8px 22px rgba(183, 1, 10, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ---------- HUD ---------- */
.hud {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px;
}
.stat {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 8px 4px; text-align: center;
}
.stat-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-val { display: block; font-size: 20px; font-weight: 800; margin-top: 2px; }

/* ---------- Board ---------- */
.board-shell { position: relative; }
.board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px;
  border-radius: 14px;
  touch-action: none; /* let the board own swipe gestures (no page scroll/zoom) */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, 8vw, 42px);
  cursor: pointer;
  touch-action: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.12s ease;
}
.cell.sel { transform: scale(0.86); box-shadow: 0 0 0 3px #fff inset, 0 0 12px var(--primary); }
.cell.pop { animation: pop 0.18s ease; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.15); } 100% { transform: scale(1); } }
/* Matched candies popping out before the survivors fall. */
.cell.clear { animation: clearpop 0.2s ease forwards; z-index: 2; }
@keyframes clearpop {
  0%   { transform: scale(1);    opacity: 1; }
  35%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0);    opacity: 0; }
}
/* Candies falling into place after a match clears cells below them. */
.cell.drop { animation: drop 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes drop {
  0%   { transform: translateY(-70%); opacity: 0.3; }
  60%  { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
/* candy colors */
.t0 { background: linear-gradient(160deg, #ff6b6b, #d63d3d); }
.t1 { background: linear-gradient(160deg, #ffd166, #f0a500); }
.t2 { background: linear-gradient(160deg, #6bcB77, #2f9e44); }
.t3 { background: linear-gradient(160deg, #4dabf7, #1c7ed6); }
.t4 { background: linear-gradient(160deg, #b197fc, #7048e8); }
.t5 { background: linear-gradient(160deg, #ff9ff3, #f368e0); }

/* Every candy is a Bingo product inside a glassy bubble. */
.candy-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}
.cell.bubble {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 0 10px rgba(255, 255, 255, 0.18);
}
.cell.bubble::after { /* glassy sheen, painted over the product (default paint order) */
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.12) 42%, rgba(255, 255, 255, 0) 66%);
  pointer-events: none;
}
/* The double-score special product gets a gold halo. */
.cell.special { box-shadow: 0 0 16px 3px rgba(246, 191, 52, 0.8); }

/* Burst ring flashed where a bubble popped. */
.burst-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 235, 130, 0.95);
  box-shadow: 0 0 12px rgba(255, 235, 130, 0.85);
  pointer-events: none;
  animation: burstring 0.42s ease-out forwards;
}
@keyframes burstring {
  0%   { transform: scale(0.3); opacity: 0.95; }
  100% { transform: scale(1.7); opacity: 0; }
}

.toast {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 11; pointer-events: none; white-space: nowrap;
  background: rgba(0, 0, 0, 0.78); color: #fff;
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.in { opacity: 1; transform: translateX(-50%) translateY(0); }

.board-overlay {
  position: absolute; inset: 0;
  z-index: 10; /* above the product bubbles and the demo badge */
  background: rgba(5, 40, 22, 0.92);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  backdrop-filter: blur(3px);
}
.overlay-inner { padding: 24px; max-width: 320px; }
.overlay-title { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.overlay-body { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 8px; }
.game-actions { margin-top: 12px; text-align: center; }

/* ---------- Reward ---------- */
.reward { text-align: center; }
.voucher { margin-top: 16px; }
.voucher-code {
  font-size: 22px; font-weight: 800; letter-spacing: 3px;
  background: rgba(51, 214, 166, 0.12); border: 1px dashed var(--accent);
  padding: 14px; border-radius: 12px; margin-bottom: 12px; color: var(--accent);
}
.fine { color: var(--muted); font-size: 12px; margin-top: 8px; }
.reward-badge { font-size: 46px; line-height: 1; margin-bottom: 6px; }
.reward .btn.shop { margin-top: 18px; }

/* ---------- Landing: my rank ---------- */
.myrank {
  margin: 16px auto 0; max-width: 330px; width: 100%;
  background: rgba(246, 191, 52, 0.14); border: 1px solid rgba(246, 191, 52, 0.5);
  border-radius: 14px; padding: 10px 14px; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.myrank b { color: var(--yellow); }

/* ---------- Landing: how-to-play demo ---------- */
.demo { margin: 28px auto 0; max-width: 330px; width: 100%; }
.demo-title, .splash-lb-title { color: var(--yellow); font-weight: 800; font-size: 16px; margin-bottom: 10px; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.demo-row { display: flex; gap: 6px; justify-content: center; }
.demo-cell {
  position: relative; flex: 1 1 0; max-width: 56px; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
}
.demo-cell .candy-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.demo-cell.slide { transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.3, 1); z-index: 2; }
.demo-cell.pop .candy-img { animation: demoPop 0.42s ease forwards; }
@keyframes demoPop { 0% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.25); } 100% { transform: scale(0); opacity: 0; } }
.demo-cap { color: #eafff2; font-size: 13.5px; font-weight: 700; margin-top: 10px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }

/* ---------- Landing: leaderboard ---------- */
.splash-lb { margin: 28px auto 4px; max-width: 340px; width: 100%; text-align: right; }
.splash-lb-title { text-align: center; }

/* ---------- Finish screen (game over → register → lottery + affiliate) ---------- */
.finish {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  -webkit-overflow-scrolling: touch; transition: opacity 0.3s ease;
}
.finish.hide { opacity: 0; pointer-events: none; }
.finish-content {
  position: relative; z-index: 1; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
}
.finish-brand { font-size: 18px; font-weight: 800; margin-bottom: 8px; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.finish-brand b { color: var(--red); font-style: italic; }
.finish-bubble {
  position: relative; width: 210px; height: 210px; margin: 6px auto 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  /* the same real iridescent soap bubble as the landing hero */
  background: url("assets/bubble.png") center/contain no-repeat;
  animation: bob 3.2s ease-in-out infinite;
}
.finish-trophy { font-size: 48px; line-height: 1; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5)); }
.finish-score-label { color: var(--yellow); font-weight: 700; font-size: 13px; margin-top: 2px; text-shadow: 0 1px 5px rgba(0, 0, 0, 0.6); }
.finish-score { color: var(--yellow); font-weight: 800; font-size: 44px; line-height: 1.05; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.finish-card {
  width: 100%; max-width: 360px;
  background: linear-gradient(180deg, rgba(5, 46, 25, 0.74), rgba(2, 22, 12, 0.72));
  border: 1.5px solid rgba(246, 191, 52, 0.5); border-radius: 18px; padding: 20px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(246, 191, 52, 0.1);
}
.fs-title { color: #fff; font-size: 20px; margin: 0 0 6px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.fs-title::before, .fs-title::after { content: "🌿"; margin: 0 7px; font-size: 14px; }
.fs-sub { color: #eafff2; font-weight: 600; margin: 0 0 4px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.fs-sub2 { color: #fff; font-weight: 800; margin: 2px 0 12px; }
.fs-cap { color: rgba(234, 255, 242, 0.7); font-size: 12.5px; margin: 10px 0 0; }
.finish .btn { width: 100%; margin-top: 10px; }
.btn.glass { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(246, 191, 52, 0.4); color: #fff; }
.finish .linkbtn { display: block; margin: 12px auto 2px; color: rgba(234, 255, 242, 0.75); }
.ffield { position: relative; margin-top: 12px; }
.ffield .ficon { position: absolute; inset-inline-end: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: 0.85; }
.ffield input { text-align: center; letter-spacing: normal; }
.ffield input::placeholder { color: rgba(255, 255, 255, 0.4); }
.fcheck { display: flex; align-items: center; justify-content: center; gap: 8px; color: #eafff2; font-size: 13.5px; margin-top: 13px; cursor: pointer; }
.fcheck input { width: 18px; height: 18px; accent-color: var(--green); }
.chances { display: flex; gap: 14px; justify-content: center; margin: 14px 0 4px; }
.chance {
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.03) 60%, rgba(0, 0, 0, 0) 72%), rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(246, 191, 52, 0.35); transition: all 0.35s ease;
}
.chance.filled {
  background: radial-gradient(circle at 40% 32%, #ffe9a8, #f6bf34 55%, #d99a10 100%);
  box-shadow: 0 0 16px rgba(246, 191, 52, 0.7); border-color: #ffd76a;
}

/* ---------- Leaderboard ---------- */
.lb-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.lb-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.04);
}
.lb-row .rk { font-weight: 800; width: 28px; color: var(--muted); }
.lb-row.me { background: rgba(255, 77, 148, 0.16); border: 1px solid var(--primary); }
.lb-row .ph { flex: 1; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
.lb-row .sc { font-weight: 800; }
.lb-row.top1 .rk { color: #ffd166; }
.lb-empty { color: var(--muted); font-size: 14px; padding: 8px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; opacity: 0.7; }

/* ---------- Splash (Bingo brand + products in bubbles) ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto; /* scroll if content is taller than the screen (button always reachable) */
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.35s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
/* Brand-green background (fixed so it covers while content scrolls). A custom
   bingo-splash.jpg, if added, shows over it. */
.splash-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(56% 38% at 50% 33%, rgba(64, 236, 148, 0.30) 0%, rgba(64, 236, 148, 0) 60%), /* tight luminous bloom */
    radial-gradient(102% 74% at 50% 37%, rgba(0, 8, 4, 0) 18%, rgba(0, 7, 4, 0.99) 90%), /* strong dark vignette */
    radial-gradient(circle at 50% 34%, #0f9850 0%, #0a6f38 30%, #053a20 56%, #01150a 100%); /* deep brand green */
}
/* Flowing light-ray wave (glow-on-black art): screen blend drops the black and
   adds the cyan/green/gold glow onto the green, sweeping behind the bubble. */
.rays {
  position: fixed;
  left: -8%; right: -8%;
  top: 50%;
  height: 62vh; min-height: 380px; max-height: 560px;
  transform: translateY(-50%);
  z-index: 0;
  pointer-events: none;
  background: url("assets/rays.jpg") center/116% auto no-repeat;
  mix-blend-mode: screen;
  opacity: 0.95;
  animation: raysDrift 10s ease-in-out infinite;
}
@keyframes raysDrift {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-52%) translateX(-2.5%); }
}
.splash-content {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom, 0px));
}
.splash-head { color: var(--yellow); font-size: clamp(30px, 9vw, 42px); font-weight: 800; line-height: 1.15; margin: 0 0 8px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); }
.splash-sub2 { color: #fff; font-size: 15px; margin: 0; font-weight: 700; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
/* Central soap bubble holding the Bingo logo */
.hero-bubble {
  width: 200px; height: 200px;
  margin: 22px auto;
  display: flex; align-items: center; justify-content: center;
  background: url("assets/bubble.png") center/contain no-repeat;
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.brand-logo-img { width: 120px; height: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.3)); }
.howto-logo-img { display: block; width: 132px; height: auto; margin: 0 auto 6px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)); }
.splash-sub { color: #eafff2; font-size: 15px; line-height: 1.6; margin: 0 0 22px; max-width: 330px; font-weight: 600; text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); }
.splash-btn { width: 100%; max-width: 330px; padding: 16px 44px; font-size: 19px; }
.splash-fine { color: rgba(255, 255, 255, 0.82); font-size: 12px; margin-top: 16px; }
.hl { color: var(--accent); font-weight: 800; }

/* ---------- Floating soap bubbles (decoration) ---------- */
.bubbles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bubbles .bub {
  position: absolute; bottom: -90px;
  background: url("assets/bubble.png") center/contain no-repeat;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.9); opacity: 0; }
  12% { opacity: 0.85; }
  88% { opacity: 0.85; }
  100% { transform: translateY(-118vh) scale(1.12); opacity: 0; }
}

/* ---------- How-to (intro that explains the game) ---------- */
.howto {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: flex;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(56% 38% at 50% 26%, rgba(64, 236, 148, 0.28) 0%, rgba(64, 236, 148, 0) 60%),
    radial-gradient(102% 74% at 50% 32%, rgba(0, 8, 4, 0) 18%, rgba(0, 7, 4, 0.99) 90%),
    radial-gradient(circle at 50% 30%, #0f9850 0%, #0a6f38 30%, #053a20 56%, #01150a 100%);
  transition: opacity 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.howto.hide { opacity: 0; pointer-events: none; }
/* margin:auto centers AND stays scrollable when taller than the screen. */
.howto-inner { position: relative; z-index: 1; width: 100%; max-width: 440px; margin: auto; text-align: center; }
.howto-logo { font: italic 800 44px "Kook", "Segoe UI", system-ui, sans-serif; color: var(--red); text-shadow: 0 2px 0 #fff; }
.howto-title { font-size: 23px; font-weight: 800; margin: 8px 0 18px; color: var(--yellow); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.howto-list { list-style: none; padding: 0; margin: 0 0 22px; }
.howto-list li {
  display: flex; align-items: center; gap: 13px;
  text-align: right;
  background: rgba(0, 0, 0, 0.16); border: 1.5px solid rgba(246, 191, 52, 0.55);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
  color: #eafff2; font-size: 15px; line-height: 1.55; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.howto-list li .txt { flex: 1; }
.hint-ico {
  flex: 0 0 42px; width: 42px; height: 42px; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
.hint-emoji { display: flex; align-items: center; justify-content: center; font-size: 30px; }
.howto-list li b { color: var(--yellow); text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); }
.howto .btn.primary { max-width: 340px; margin-inline: auto; }

/* Auto-play demo badge over the board */
.demo-tag {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 5; background: rgba(0, 0, 0, 0.6); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  animation: tick 1.1s ease-in-out infinite;
}

/* Narrow phones: tighten the 5-stat HUD and padding so nothing overflows. */
@media (max-width: 480px) {
  .app { padding: 10px 10px 32px; }
  .card { padding: 16px; }
  /* Free header space during play: collapse brand to the emoji, hide the phone. */
  #userPhone { display: none; }
  .brand-txt { display: none; }
  .brand { font-size: 22px; }
  .topbar-right { gap: 5px; }
  .mini { padding: 3px 7px; font-size: 10px; }
  .mini b { font-size: 14px; }
  .timer-val { font-size: 17px; }
}
