/* Big Friday Game Arena — base theme + hub. No external fonts or CDNs (strict CSP). */
:root {
  /* Space for the phone's status bar (top) and gesture bar (bottom). The browser fills these
     from the display cutout; the CartUp app can override them (see js/bridge.js: insets). */
  --safe-top: max(env(safe-area-inset-top, 0px), var(--safe-top-min, 0px));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Notch / camera cutout on the side when the phone is held sideways. */
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* Where page content may start: below the status bar / notch / camera cutout, plus a margin.
     Headers and back buttons add this to their own padding, so they never touch the cutout. */
  --top-margin: 12px;
  --top-gap: calc(var(--safe-top) + var(--top-margin));
  --bg: #0b0820;
  --bg2: #17113d;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f4ff;
  --muted: #aaa5d0;
  --pink: #ff3d7f;
  --orange: #ff9f43;
  --violet: #7c4dff;
  --cyan: #22d3ee;
  --gold: #facc15;
  --green: #22c55e;
  --accent-a: #ff3d7f;
  --accent-b: #ff9f43;
  --radius: 22px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button { font-family: inherit; }
img { display: block; }

/* background glow: soft radial gradients, static. (A blur filter on these screen-sized,
   moving circles had to be recomputed every frame and made low-end phones lag.) */
.bg-glow { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg-glow i { position: absolute; border-radius: 50%; opacity: 0.5; }
.bg-glow i:nth-child(1) { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: radial-gradient(circle, #7c4dff 0, rgba(124,77,255,.35) 30%, transparent 70%); }
.bg-glow i:nth-child(2) { width: 60vmax; height: 60vmax; right: -25vmax; top: 5vh; background: radial-gradient(circle, #ff3d7f 0, rgba(255,61,127,.35) 30%, transparent 70%); }
.bg-glow i:nth-child(3) { width: 55vmax; height: 55vmax; left: 5vw; bottom: -30vmax; background: radial-gradient(circle, #0ea5e9 0, rgba(14,165,233,.35) 30%, transparent 70%); }

/* ---------- avatar ---------- */
.cg-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 800; color: #fff; flex: none; overflow: hidden; box-shadow: 0 0 0 2px rgba(255,255,255,.18); letter-spacing: .02em; }
.cg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cg-icon svg, .cg-hero svg, .cg-icon-sm svg { width: 100%; height: 100%; display: block; }
.cg-icon-sm { width: 18px; height: 18px; display: inline-block; flex: none; }

/* ---------- buttons ---------- */
.cg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 22px; font-weight: 800; font-size: 15px;
  color: #fff; text-decoration: none; cursor: pointer; letter-spacing: .03em;
  transition: transform .15s ease, filter .15s ease, background .2s;
  user-select: none;
}
.cg-btn:active { transform: scale(.95); }
.cg-btn:disabled { opacity: .6; cursor: default; }
.cg-btn-primary { background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); box-shadow: 0 10px 30px -8px var(--accent-a), inset 0 1px 0 rgba(255,255,255,.35); }
.cg-btn-primary:hover { filter: brightness(1.08); }
.cg-btn-ghost { background: var(--card); border: 1px solid var(--line); }
.cg-btn-ghost:hover { background: var(--card2); }
.cg-btn-big { position: relative; font-size: 19px; padding: 16px 40px; width: 100%; max-width: 320px; }
/* pulse ring: scale + opacity only (runs on the GPU; animating box-shadow repainted every frame) */
.cg-btn-big::after { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 3px solid rgba(255,61,127,.5); pointer-events: none; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 70%, 100% { transform: scale(1.08, 1.35); opacity: 0; } }
.cg-iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 9px; flex: none; text-decoration: none; }
.cg-iconbtn svg { width: 100%; height: 100%; }
.cg-iconbtn.off { color: var(--muted); }

/* ---------- toasts ---------- */
.cg-toasts { position: fixed; left: 50%; bottom: max(24px, var(--safe-bottom)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.cg-toast { background: rgba(23, 17, 61, .95); border: 1px solid var(--line); padding: 12px 16px; border-radius: 14px; font-size: 14px; text-align: center; animation: toastIn .3s ease; transition: opacity .4s, transform .4s; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.cg-toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

.fx-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }
.fx-flash { position: fixed; inset: 0; pointer-events: none; z-index: 89; animation: flash ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* An app build that does not report its insets: --safe-top is only a guess (js/bridge.js), so
   keep a little more margin under it. Android status bars vary (24-50px against a 40px guess),
   so it gets the most; the iPhone guess is per model and close to exact.
   Builds that report the real insets get the exact fit above. */
:root.cg-guess { --top-margin: 20px; }
:root.cg-guess.cg-ios { --top-margin: 14px; }

/* ================= HUB ================= */
.hub { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 16px 16px 48px; padding-top: calc(var(--top-gap) + 4px); padding-bottom: calc(48px + var(--safe-bottom)); padding-left: max(16px, var(--safe-left)); padding-right: max(16px, var(--safe-right)); }
.hub-top { display: flex; align-items: center; gap: 12px; }
.hub-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px 12px 4px 4px; margin: -4px 0 -4px -4px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .2s ease; }
.hub-me:hover, .hub-me:focus-visible { background: rgba(255,255,255,.07); }
.hub-me:active { transform: scale(.98); }
.hub-hello { flex: 1; min-width: 0; display: block; }
.hub-hello small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
.hub-hello strong { display: block; font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-hello em { display: inline-flex; align-items: center; gap: 4px; font-style: normal; font-size: 11.5px; line-height: 1.2; font-weight: 800; color: var(--gold); }
.hub-hello em::after { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
body.locked { overflow: hidden; }

/* ---------- welcome (join with name + age) ---------- */
.welcome { position: fixed; inset: 0; z-index: 50; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: radial-gradient(circle at 20% 0%, rgba(124,77,255,.55), transparent 55%), radial-gradient(circle at 100% 30%, rgba(236,0,140,.45), transparent 50%), radial-gradient(circle at 30% 100%, rgba(14,165,233,.4), transparent 55%), #0b0820;
  padding: calc(var(--top-gap) + 8px) max(16px, var(--safe-right)) max(24px, var(--safe-bottom)) max(16px, var(--safe-left)); }
.welcome-inner { width: 100%; max-width: 440px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; animation: welcomeIn .55s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes welcomeIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.welcome-games { position: relative; width: 100%; max-width: 320px; height: 118px; margin: 4px 0 -2px; }
.welcome-games .wg { position: absolute; top: 50%; filter: drop-shadow(0 12px 20px rgba(0,0,0,.45)); }
.welcome-games .wg-1 { left: 2%; width: 86px; height: 86px; margin-top: -48px; animation: bob 3.2s ease-in-out infinite; }
.welcome-games .wg-2 { left: 50%; width: 132px; height: auto; margin: -62px 0 0 -66px; animation: bob 3s ease-in-out infinite -1s; z-index: 1; }
.welcome-games .wg-3 { right: 2%; width: 86px; height: 86px; margin-top: -40px; animation: bob 3.4s ease-in-out infinite -2s; }
.welcome h1 { margin: 0; font-size: clamp(26px, 7.4vw, 34px); line-height: 1.12; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(135deg, #ffffff, #ffd1ea 55%, #9fe8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-sub { margin: -4px 0 4px; color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.45; }
.welcome-form { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 16px 16px; border-radius: 26px; background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 30px 60px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.12); }
.field { width: 100%; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field span { font-size: 13px; font-weight: 800; letter-spacing: .02em; color: rgba(255,255,255,.88); padding-left: 4px; }
.field input { width: 100%; font: inherit; font-size: 17px; font-weight: 700; color: #fff; padding: 14px 16px; border-radius: 16px; border: 1.5px solid rgba(255,255,255,.18); background: rgba(7,5,26,.55); outline: none; transition: border-color .2s ease, box-shadow .2s ease; -moz-appearance: textfield; }
.field input::placeholder { color: rgba(255,255,255,.38); font-weight: 600; }
.field input:focus { border-color: #ff7ac4; box-shadow: 0 0 0 4px rgba(255,61,127,.22); }
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.welcome-err { min-height: 1.3em; margin: -2px 0 -4px; color: #ff8fa3; font-size: 13.5px; font-weight: 700; }
.welcome-form .cg-btn-big { max-width: none; }
.welcome-form .cg-btn-ghost { width: 100%; }
.welcome-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---------- profile sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-top: calc(var(--top-gap) + 4px); background: rgba(5,3,20,.8); animation: sheetFade .2s ease; overflow-y: auto; }
@keyframes sheetFade { from { opacity: 0; } }
.sheet-card { position: relative; width: 100%; max-width: 420px; margin: auto auto 0; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 24px 18px max(18px, var(--safe-bottom)); border-radius: 28px; background: linear-gradient(180deg, #2a1b6b, #160f3d); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 30px 70px -20px rgba(0,0,0,.85); animation: sheetUp .35s cubic-bezier(.2,.9,.3,1.15); }
@media (min-width: 560px) { .sheet { align-items: center; } .sheet-card { margin: auto; } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(40px); } }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; }
.sheet-avatar .cg-avatar { box-shadow: 0 0 0 4px rgba(255,255,255,.12), 0 12px 24px -8px rgba(0,0,0,.6); }
.sheet-title { margin: 6px 0 0; font-size: 22px; font-weight: 900; max-width: 100%; overflow-wrap: anywhere; }
.sheet-sub { margin: 0; color: var(--muted); font-size: 13px; }
.sheet-list { width: 100%; margin: 10px 0 2px; display: grid; gap: 6px; }
.sheet-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.06); text-align: left; }
.sheet-list dt { color: var(--muted); font-size: 13px; font-weight: 700; flex: none; }
.sheet-list dd { margin: 0; font-weight: 800; font-size: 14px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.sheet-note { margin: 2px 0 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.sheet-card .cg-btn { width: 100%; }

.hero { margin: 12px 0 8px; padding: 20px 20px; border-radius: 28px; position: relative; overflow: hidden; background: linear-gradient(135deg, #3b1d8f 0%, #7c1d6f 55%, #c2410c 100%); box-shadow: 0 30px 60px -30px rgba(124,77,255,.8); }
.hero h1 { margin: 0; font-size: clamp(26px, 6vw, 40px); line-height: 1.05; letter-spacing: -.02em; font-weight: 900; }
.hero p { margin: 8px 0 0; color: rgba(255,255,255,.85); max-width: 30em; font-size: 15px; }
.hero .shine { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.18) 45%, transparent 60%); animation: shine 4.5s ease-in-out infinite; }
@keyframes shine { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
.hero .orb { position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero .orb.a { width: 160px; height: 160px; right: -40px; top: -50px; }
.hero .orb.b { width: 90px; height: 90px; right: 70px; bottom: -40px; background: rgba(250,204,21,.25); }

.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.section-h h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.section-h span { color: var(--muted); font-size: 13px; }

/* Game cards: all shown games in one row (hidden games carry the [hidden] attribute). */
[hidden] { display: none !important; }
.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.game-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px;
  padding: 14px 8px 10px; border-radius: var(--radius); text-decoration: none; overflow: hidden; isolation: isolate;
  border: 1px solid rgba(255,255,255,.14); transition: transform .2s ease, box-shadow .2s ease;
  animation: cardIn .5s cubic-bezier(.2,.9,.3,1.3) backwards;
}
.game-card:nth-child(2) { animation-delay: .07s; } .game-card:nth-child(3) { animation-delay: .14s; } .game-card:nth-child(4) { animation-delay: .21s; } .game-card:nth-child(5) { animation-delay: .28s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.95); } }
.game-card:hover { transform: translateY(-4px); }
.game-card:active { transform: scale(.97); }
.game-card::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .95; }
.game-card.catch::before { background: radial-gradient(circle at 50% 110%, #ff7ac4 0, transparent 50%), radial-gradient(circle at 15% 0%, rgba(255,255,255,.25) 0, transparent 40%), linear-gradient(160deg, #3346c9, #7c4dff 55%, #c026d3); }
.game-card.sky::before { background: radial-gradient(circle at 50% 110%, #ffb36b 0, transparent 50%), radial-gradient(circle at 15% 0%, rgba(255,255,255,.18) 0, transparent 40%), linear-gradient(160deg, #ec008c, #4b237f 60%, #140c3a); }
.game-card.puzzle::before { background: radial-gradient(circle at 80% 0%, #ff7eb3 0, transparent 55%), linear-gradient(160deg, #a21caf, #4c1d95); }
.game-card.cricket::before { background: radial-gradient(circle at 80% 0%, #4ade80 0, transparent 55%), linear-gradient(160deg, #15803d, #064e3b); }
.game-card.soccer::before { background: radial-gradient(circle at 50% 0%, #38bdf8 0, transparent 55%), linear-gradient(160deg, #1d4ed8, #172554); }
.game-card .cg-icon { width: 58px; height: 58px; margin: 6px 0 2px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); animation: bob 3s ease-in-out infinite; }
.game-card:nth-child(2) .cg-icon { animation-delay: -.8s; } .game-card:nth-child(3) .cg-icon { animation-delay: -1.6s; } .game-card:nth-child(4) .cg-icon { animation-delay: -2.4s; } .game-card:nth-child(5) .cg-icon { animation-delay: -3.2s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.game-card img.card-art { object-fit: contain; }
.game-card h3 { margin: 2px 0 0; font-size: 15px; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
.game-card p { margin: 0; font-size: 11px; line-height: 1.3; color: rgba(255,255,255,.82); min-height: 2.6em; }
/* today's highest score + mine */
.game-card .day { width: 100%; margin-top: auto; padding-top: 6px; display: grid; gap: 4px; }
.day-row { display: flex; flex-direction: column; align-items: center; min-width: 0; background: rgba(0,0,0,.3); border-radius: 10px; padding: 4px 4px 5px; }
.day-row small { font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: rgba(255,255,255,.72); text-align: center; line-height: 1.15; }
.day-row b { font-size: 15px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
.day-row em { font-style: normal; font-size: 10.5px; font-weight: 700; color: rgba(255,255,255,.85); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-row.top b { color: var(--gold); }
.day-row.top { min-height: 56px; justify-content: center; } /* same height with or without a name */
.day-row.empty b { font-size: 12px; color: rgba(255,255,255,.8); }
@media (min-width: 560px) {
  .games { gap: 16px; }
  .game-card { padding: 18px 14px 14px; gap: 4px; }
  .game-card .cg-icon { width: 84px; height: 84px; }
  .game-card h3 { font-size: 20px; }
  .game-card p { font-size: 13px; min-height: 0; }
  .day-row { padding: 6px 8px; }
  .day-row.top { min-height: 74px; }
  .day-row small { font-size: 10px; }
  .day-row b { font-size: 18px; }
  .day-row em { font-size: 12px; }
}

/* leaderboard */
.lb { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.tab .cg-icon { width: 18px; height: 18px; }
.tab[aria-selected='true'] { color: #fff; background: linear-gradient(135deg, var(--pink), var(--orange)); border-color: transparent; }
/* day filter: a compact pill (Today | Yesterday | calendar for any earlier day) */
.dayfilter { display: flex; gap: 3px; margin: 12px 0 4px; background: rgba(0,0,0,.25); border-radius: 999px; padding: 3px; width: 100%; max-width: 420px; }
.dayfilter button, .daypick {
  flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 13px; line-height: 1.2;
  padding: 7px 8px; border-radius: 999px; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.dayfilter button[aria-pressed='true'], .daypick[aria-pressed='true'] { background: linear-gradient(135deg, var(--pink), var(--orange)); color: #fff; }
.daypick { position: relative; flex-grow: 1.4; } /* icon + the longest label: a little wider so "Pick a day" fits on 320px phones */
.daypick .cal { width: 15px; height: 15px; flex: none; }
.daypick > span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 359px) { .dayfilter button, .daypick { font-size: 12px; padding: 7px 6px; gap: 4px; } }
/* the native date input covers the whole button so tapping anywhere opens the picker */
.daypick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; font-size: 16px; }
.daypick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.dayline { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 2px 2px 0; }
.lb-meta { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 14px 0 8px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; animation: cardIn .5s cubic-bezier(.2,.9,.3,1.3) backwards; }
.pod .name { font-weight: 800; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .score { font-weight: 900; font-size: 15px; }
.pod .when { font-size: 10px; font-weight: 700; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .step { width: 100%; border-radius: 14px 14px 6px 6px; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; font-weight: 900; font-size: 22px; color: rgba(255,255,255,.95); }
.pod.p1 .step { height: 92px; background: linear-gradient(180deg, #facc15, #b45309); }
.pod.p2 .step { height: 70px; background: linear-gradient(180deg, #e2e8f0, #64748b); }
.pod.p3 .step { height: 56px; background: linear-gradient(180deg, #fdba74, #9a3412); }
.pod.p1 { animation-delay: .1s; } .pod.p3 { animation-delay: .2s; }
.pod .crown { width: 26px; height: 18px; background: #facc15; clip-path: polygon(0 100%, 0 25%, 25% 60%, 50% 0, 75% 60%, 100% 25%, 100% 100%); margin-bottom: -4px; }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; background: rgba(255,255,255,.035); animation: rowIn .35s ease backwards; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-8px); } }
.lb-row.me { background: linear-gradient(90deg, rgba(255,61,127,.28), rgba(255,159,67,.14)); box-shadow: inset 0 0 0 1px rgba(255,61,127,.55); }
.lb-rank { width: 28px; text-align: center; font-weight: 900; color: var(--muted); flex: none; }
.lb-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lb-nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-when { font-size: 11px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 900; font-variant-numeric: tabular-nums; }
.lb-empty { text-align: center; color: var(--muted); padding: 26px 8px; }
.lb-me { margin-top: 10px; }
/* tappable leaderboard entries (open a player card / your profile) */
[data-player] { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s ease, transform .15s ease; }
.lb-row[data-player]:hover { background: rgba(255,255,255,.08); }
[data-player]:active { transform: scale(.985); }
[data-player]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.lb-more { width: 100%; margin-top: 10px; }
/* refreshing the board already on screen: keep it visible, just dim it a little */
.lb #podium, .lb #lbList { transition: opacity .2s ease; }
.lb.refreshing #podium, .lb.refreshing #lbList { opacity: .6; }
/* same board re-rendered with fresh numbers: no entry animations (no flicker) */
.lb.calm .lb-row, .lb.calm .pod { animation: none; }
.lb-error { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb-retry { min-width: 140px; }
.pl-games { width: 100%; display: grid; gap: 6px; margin: 10px 0 2px; }
.pl-game { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.06); text-align: left; }
.pl-game b { grid-row: 1 / span 2; font-size: 14.5px; font-weight: 900; }
.pl-game span { font-size: 12.5px; color: rgba(255,255,255,.85); text-align: right; font-weight: 700; }
.pl-game span:last-child { color: var(--gold); }
.pl-skel { height: 52px; }

.skeleton { height: 46px; border-radius: 14px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; line-height: 1.9; }
.foot-link { color: var(--gold); font-weight: 800; text-decoration: none; border-bottom: 1px solid rgba(250,204,21,.4); }
.foot-link:hover, .foot-link:focus-visible { border-bottom-color: var(--gold); }
.welcome-terms { color: var(--gold); font-weight: 800; }

/* Play & Win campaign banner (opens the Terms & Conditions) */
.promo { display: flex; align-items: center; gap: 14px; margin: 16px 0 0; padding: 14px 16px; border-radius: 22px; text-decoration: none; color: #fff; position: relative; overflow: hidden; isolation: isolate;
  background: radial-gradient(circle at 100% 0%, rgba(250,204,21,.4), transparent 45%), linear-gradient(120deg, #6d28d9 0%, #c026d3 55%, #ec008c 100%);
  border: 1px solid rgba(255,255,255,.2); box-shadow: 0 18px 40px -22px rgba(236,0,140,.9); transition: transform .2s ease; animation: cardIn .5s cubic-bezier(.2,.9,.3,1.3) backwards; }
.promo::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.18) 45%, transparent 60%); animation: shine 4.5s ease-in-out infinite; }
.promo:hover { transform: translateY(-2px); }
.promo:active { transform: scale(.98); }
.promo:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.promo-gift { flex: none; width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; animation: bob 3s ease-in-out infinite; }
.promo-gift svg { width: 38px; height: 38px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.promo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.promo-kicker { font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #ffe08a; }
.promo-text strong { font-size: 18px; font-weight: 900; line-height: 1.15; }
.promo-sub { font-size: 12.5px; color: rgba(255,255,255,.88); }
.promo-go { flex: none; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; }
.promo-go::after { content: ''; width: 8px; height: 8px; border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg); margin-left: -3px; }

/* launch + dev pages */
.center-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; padding-top: calc(var(--top-gap) + 56px); padding-bottom: calc(24px + var(--safe-bottom)); padding-left: max(24px, var(--safe-left)); padding-right: max(24px, var(--safe-right)); text-align: center; position: relative; z-index: 1; }
.loader { width: 64px; height: 64px; border-radius: 50%; border: 6px solid rgba(255,255,255,.12); border-top-color: var(--pink); border-right-color: var(--orange); animation: spin .9s linear infinite; margin: 0 auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
.dev-page { background: var(--bg); }
.dev-wrap { max-width: 560px; margin: 0 auto; padding: 32px 16px; padding-top: calc(var(--top-gap) + 20px); }
.dev-wrap h1 { font-size: 26px; }
.dev-wrap p { color: var(--muted); line-height: 1.5; }
.dev-list { display: grid; gap: 10px; margin: 20px 0; }
.dev-user { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-decoration: none; }
.dev-user:hover { background: var(--card2); }
.dev-user span { color: var(--muted); font-size: 13px; }
.dev-note { font-size: 12px; }
.dev-logo { display: block; width: 132px; height: auto; margin-bottom: 18px; }
.dev-form { display: grid; gap: 14px; margin: 20px 0; }
.dev-form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.dev-form input { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: inherit; }
.dev-form input:focus { outline: 2px solid var(--accent-b); outline-offset: 1px; }
.dev-form .cg-btn { margin-top: 6px; }
.dev-wrap .dev-error { color: #ff6b6b; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

[hidden] { display: none !important; }

/* CartUp logo badge */
.cg-logo { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 999px; padding: 7px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.3); flex: none; }
.cg-logo img { height: 18px; width: auto; display: block; }
.cg-logo-lg { padding: 9px 18px; }
.cg-logo-lg img { height: 26px; }
.hero .cg-logo { margin-bottom: 10px; position: relative; }
.center-page .cg-logo { margin-bottom: 22px; }

/* Overlay cards: used by the game pages and by the "Open from the CartUp app" screen on every page. */
.cg-overlay { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 16px; padding-top: calc(var(--top-gap) + 4px); background: radial-gradient(circle at 50% 30%, rgba(40,20,100,.7), rgba(5,3,20,.92)); overflow-y: auto; }
.cg-overlay.show { display: flex; }
body > .cg-overlay { position: fixed; }
.cg-card { width: min(100%, 420px); margin: auto; background: linear-gradient(180deg, rgba(40,28,100,.92), rgba(20,14,55,.95)); border: 1px solid rgba(255,255,255,.16); border-radius: 28px; padding: 22px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; box-shadow: 0 40px 80px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.12); }
.cg-h2 { margin: 0; font-size: 24px; font-weight: 900; }
.cg-muted { color: var(--muted); margin: 0; line-height: 1.45; }

/* Back button on pages without a top bar (launch / sign-in error page). */
.page-back { position: fixed; z-index: 5; top: var(--top-gap); left: max(14px, var(--safe-left)); }
.hub-top > .cg-iconbtn { flex: none; }
