/* ============================================================
   Klondike: Haunted Hollow — Playgama Edition
   Horror theme: flat vector UI, monochrome charcoal felt,
   bone-white & silver accents (no red)
   ============================================================ */

:root {
  /* Klondike: Haunted Hollow — monochrome palette.
     Deep charcoal felt, steel grays, bone-white & silver accents.
     Canvas felt colors in config.js (CFG.felts 'classic') must match. */
  --felt-1: #3b414a;
  --felt-2: #1d2127;
  --felt-3: #0a0c0f;
  --card-white: #ffffff;
  --ink: #101418;
  --ink-soft: #5b6472;
  --red: #c9cdd4;       /* neutralized (unused) */
  --gold: #c9cdd4;      /* bone silver (was candle amber) */
  --accent: #8b929d;    /* steel (was blood red) */
  --accent-2: #5c636e;
  --danger: #e8eaee;    /* bone white (was warning red) */
  --radius: 14px;
  --shadow-1: 0 2px 10px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.65);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-gothic: Georgia, 'Times New Roman', serif;
  --banner-bottom-h: 0px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--felt-2);
  font-family: var(--font);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.hidden { display: none !important; }

/* Horror theme: old-manuscript serif for every title */
.loading-title, .menu-title, .end-title, .pause-title, .modal h2, .reward-title {
  font-family: var(--font-gothic);
  letter-spacing: .4px;
}

/* ============ Loading screen ============ */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 40;
  background: radial-gradient(120% 120% at 50% 0%, var(--felt-1) 0%, var(--felt-2) 45%, var(--felt-3) 100%);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
.screen.fade-out { opacity: 0; visibility: hidden; }
#loading-screen { z-index: 100; }

.loading-inner { text-align: center; transform: translateY(-10px); }
.loading-logo {
  font-size: 64px; line-height: 1;
  color: #fff; text-shadow: 0 6px 24px rgba(0,0,0,.5), 0 0 34px rgba(214,220,228,.45);
  animation: logo-float 2.4s ease-in-out infinite;
}
@keyframes logo-float { 0%,100% { transform: translateY(0) rotate(-3deg);} 50% { transform: translateY(-8px) rotate(3deg);} }
.loading-title {
  margin-top: 14px; font-size: 30px; font-weight: 800; letter-spacing: 0.5px;
  text-shadow: 0 3px 14px rgba(0,0,0,.35);
}
.loading-bar {
  width: 240px; height: 8px; margin: 26px auto 12px;
  border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden;
}
#loading-bar-fill {
  width: 0%; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #ffffff, var(--gold));
  transition: width .3s ease;
}
.loading-sub { font-size: 13px; color: rgba(255,255,255,.75); }

/* ============ App layout ============
   The play scene is always full-screen: the canvas fills the whole
   window and the renderer lays cards out inside the banner-free play
   area. Banners are bottom-only — the single banner zone floats over
   the bottom of the felt (it never shrinks or clips the game). */
#app {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, var(--felt-1), var(--felt-2) 55%, var(--felt-3));
}
#app.banner-bottom { --banner-bottom-h: 90px; } /* matches the 728x90 desktop creative */

/* The play scene sits over the photo (game-background.jpg) — blurred behind a
   light scrim so the photo is clearly visible while the cards stay readable.
   z-index:0 gives #canvas-wrap its own stacking context so the ::before photo
   stays behind the canvas element. */
#canvas-wrap {
  position: absolute; inset: 0; overflow: hidden;
  z-index: 0;
}
#canvas-wrap::before {
  content: '';
  position: absolute; inset: -14px;
  background: linear-gradient(rgba(8,10,14,.3), rgba(8,10,14,.42)),
              url('game-background.jpg') center / cover no-repeat;
  filter: blur(2px);
  transform: scale(1.01);
  z-index: -1;
  pointer-events: none;
}
#game {
  display: block;
  width: 100%; height: 100%;
  touch-action: none;
  cursor: default;
}

/* Bottom banner zone = floating overlay on the felt's bottom edge.
   z-index 45: above the menu screen (40) so menu banners show,
   below modals (60) — win/lose screens hide banners via JS. */
.banner-zone { position: fixed; display: none; z-index: 45; }
#zone-bottom {
  left: 0; right: 0; bottom: 0;
  height: var(--banner-bottom-h);
  align-items: center; justify-content: center;
}
#app.banner-bottom #zone-bottom { display: flex; }

/* ============ HUD ============ */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(8, 10, 13, .6), rgba(8,10,13,0));
  pointer-events: none;
  z-index: 20;
}

#hud > * { pointer-events: auto; }
.hud-left { display: flex; align-items: center; gap: 8px; }
/* stats sit dead-centre of the top bar */
.hud-center {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 18px;
}
.hud-right { display: flex; align-items: center; gap: 10px; }
.stat { text-align: center; line-height: 1.1; }
.stat-label { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.6); }
.stat-value { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-badge {
  padding: 4px 12px; border-radius: 99px;
  background: rgba(255,255,255,.14); backdrop-filter: blur(4px);
  font-size: 12px; font-weight: 700;
}
.hud-btn {
  min-width: 44px; min-height: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(6px);
  font-size: 15px; font-weight: 700; color: #fff;
  transition: transform .12s ease, background .15s ease, opacity .2s;
}
.hud-btn:hover { background: rgba(255,255,255,.24); transform: translateY(-1px); }
.hud-btn:active { transform: scale(.94); }
.hud-btn:disabled { opacity: .4; cursor: default; transform: none; }
.icon-btn { font-size: 19px; padding: 6px 10px; }
.hud-btn .count { display: inline-block; min-width: 16px; }

/* The undo / redo / hint buttons live in the top HUD's right group — no
   separate bottom bar anymore (moved by player request). */

/* ============ Toasts ============ */
#toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 99px;
  background: rgba(24, 26, 31, .92); border: 1px solid rgba(210,216,224,.3);
  box-shadow: var(--shadow-2);
  font-size: 14px; font-weight: 600;
  animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.3);
}
.toast.gold { background: linear-gradient(135deg, #6a717c, #aab1bb); border-color: #e6e9ee; }
.toast.leave { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.9);} }
@keyframes toast-out { to { opacity: 0; transform: translateY(-14px) scale(.9);} }

/* ============ Main menu ============
   Mobile-first hub layout: a compact centered column (logo → progress →
   Play) with feature entrances docked to the screen edges as "islands".
   Islands are half-pills that stick out past the viewport edge; their
   rounded side faces inward.

   The menu sits over the frosted-glass photo (menu-background.jpg) — blurred
   behind a dark scrim so the glass card and islands stay readable. */
#screen-menu {
  background: none;
}
#screen-menu::before {
  content: '';
  position: absolute; inset: -14px;
  background: linear-gradient(rgba(10,14,20,.42), rgba(10,14,20,.55)),
              url('menu-background.jpg') center / cover no-repeat;
  filter: blur(5px);
  transform: scale(1.03);
  z-index: -1;
  pointer-events: none;
}
.menu-inner {
  width: min(400px, 88vw);
  max-height: 94vh; overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(10,14,20,.55), rgba(10,14,20,.35));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow-3);
  text-align: center;
  animation: pop-in .4s cubic-bezier(.2,.9,.3,1.25);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(18px) scale(.96);} }
.menu-logo { font-size: 54px; line-height: 1; text-shadow: 0 8px 28px rgba(0,0,0,.5), 0 0 36px rgba(214,220,228,.45); animation: logo-float 2.4s ease-in-out infinite; }
.menu-title { font-size: 32px; font-weight: 900; letter-spacing: .4px; margin-top: 6px; text-shadow: 0 3px 14px rgba(0,0,0,.3); }
.menu-tagline { font-size: 13px; color: rgba(255,255,255,.7); margin-top: 4px; }

.menu-progress-card {
  margin: 16px 0 4px; padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.1);
  text-align: left;
}
.menu-progress-row { display: flex; justify-content: space-between; font-size: 13px; }
.menu-xp-label { color: rgba(255,255,255,.65); }
.xp-bar { height: 9px; margin-top: 8px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.xp-fill { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, #ffffff, var(--gold)); transition: width .6s cubic-bezier(.2,.8,.2,1); }

.menu-actions { display: grid; gap: 10px; margin-top: 14px; }
.menu-actions .btn-lg { min-height: 56px; font-size: 18px; }
.menu-footer { margin-top: 14px; display: flex; justify-content: center; gap: 12px 14px; align-items: center; flex-wrap: wrap; }

/* ---------- Edge islands ----------
   The button only positions the island; .island-pill carries the visuals
   and the entrance animation. Animating the pill's transform (not the
   standalone `translate` property) keeps the centering transform on the
   button untouched and works reliably across browsers. */
.menu-island {
  position: absolute;
  z-index: 5;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.menu-island:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 22px; }
.island-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 16px 14px 16px 26px;  /* extra inner padding balances the off-screen lip */
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 0 22px 22px 0;
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,.28);
  color: #fff;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
  /* No entrance animation on the pills: they are the menu's primary
     navigation, and an opacity-0 from-state could leave them invisible in
     webviews that don't run CSS animations. */
}
.menu-island:hover .island-pill { transform: translateY(-3px) scale(1.05); filter: brightness(1.1); box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,.3); }
.menu-island:active .island-pill { transform: scale(.94); }
.island-icon { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 5px rgba(0,0,0,.45)); }
.island-label {
  font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,.55); white-space: nowrap;
}
.island-badge {
  position: absolute; top: -7px;
  min-width: 22px; height: 22px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 99px;
  background: linear-gradient(180deg, #ffffff, var(--gold));
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  color: #14181d; font-size: 11px; font-weight: 900;
}
.island-badge:empty { display: none; }
.island-badge.pulse { animation: badge-pulse 1.5s ease-in-out infinite; }
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
  50% { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(255,255,255,.30), 0 2px 10px rgba(0,0,0,.35); }
}

/* left-docked islands */
.island-daily, .island-levels { left: -14px; }
/* right-docked islands (mirrored padding + radius) */
.island-cosmetics, .island-achievements { right: -14px; }
.island-cosmetics .island-pill, .island-achievements .island-pill {
  padding: 16px 26px 16px 14px;
  border-radius: 22px 0 0 22px;
}

/* hero islands — Daily (left, candle-lit) & Cosmetics (right, blood-curse), mid-height */
.island-daily { top: 40%; transform: translateY(-50%); }
.island-daily .island-pill { background: linear-gradient(165deg, #e8ecf1, #9aa2ad 55%, #565d68); }
.island-cosmetics { top: 40%; transform: translateY(-50%); }
.island-cosmetics .island-pill { background: linear-gradient(165deg, #8a919c, #4c525b 55%, #1e2228); }
/* small pair — Nights (left, ghost-green) & Achievements (right, bone), lower */
.island-levels { top: 60%; transform: translateY(-50%); }
.island-levels .island-pill {
  padding-top: 10px; padding-bottom: 10px;
  background: linear-gradient(165deg, #bcc2cc, #767d88 55%, #3a4048);
}
.island-achievements { top: 60%; transform: translateY(-50%); }
.island-achievements .island-pill {
  padding-top: 10px; padding-bottom: 10px;
  background: linear-gradient(165deg, #f2f4f7, #c3c8d0 55%, #8a919c);
}
.island-levels .island-icon, .island-achievements .island-icon { font-size: 20px; }
.island-levels .island-label, .island-achievements .island-label { font-size: 9.5px; }

/* badges sit on the inner (rounded) side of each island */
.island-daily .island-badge { left: -6px; }
.island-cosmetics .island-badge { right: -6px; }

/* gentle bobbing of the island icons */
.menu-island .island-icon { animation: icon-bob 3.2s ease-in-out infinite; }
.island-cosmetics .island-icon { animation-delay: .4s; }
.island-levels .island-icon { animation-delay: .8s; }
.island-achievements .island-icon { animation-delay: 1.2s; }
@keyframes icon-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* Settings gear (top-right) — plain top first, safe-area via @supports so
   browsers without env() still keep it pinned top-right. */
.menu-icon-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 5;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-1);
  font-size: 20px;
  transition: transform .15s ease, background .15s ease;
}
.menu-icon-btn:hover { background: rgba(255,255,255,.24); transform: rotate(18deg) scale(1.05); }
.menu-icon-btn:active { transform: scale(.92); }
.menu-icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@supports (top: env(safe-area-inset-top)) {
  .menu-icon-btn { top: calc(14px + env(safe-area-inset-top)); }
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  border-radius: 13px;
  font-size: 15px; font-weight: 800;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s;
  border: 1px solid transparent;
}
.btn:active { transform: scale(.96); }
.btn-lg { min-height: 54px; font-size: 17px; }
.btn-primary {
  background: linear-gradient(180deg, #eef1f5, #a9b0ba);
  color: #14181d; box-shadow: 0 8px 22px rgba(0,0,0,.45);
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-secondary {
  background: rgba(255,255,255,.11);
  border-color: rgba(255,255,255,.16);
  color: #fff;
}
.btn-secondary:hover { background: rgba(255,255,255,.2); }
.btn-ghost { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.btn-danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }
/* ---------- Menu social chips ----------
   Leaderboard / Credits are little glass chips that echo the menu islands
   (gradient fill, icon + label, hover lift, press squash). Monochrome
   steel/bone palette. */
.menu-footer .social-chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px;
  padding: 7px 16px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 4px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.3);
  font-size: 13px; font-weight: 800; letter-spacing: .3px;
  color: #fff;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.menu-footer .social-chip .chip-icon { font-size: 15px; line-height: 1; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
/* distinct fills — same family as the islands */
.menu-footer #btn-leaderboard { background: linear-gradient(165deg, #e8ecf1, #aab1bb 55%, #6a717c); color: #14181d; }
.menu-footer #btn-credits     { background: linear-gradient(165deg, #bcc2cc, #767d88 55%, #33383f); }
.menu-footer .social-chip:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.14);
  box-shadow: 0 8px 18px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.35);
}
.menu-footer .social-chip:active { transform: scale(.93); filter: brightness(.95); }
.menu-footer .social-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.streak-chip {
  min-height: 34px;
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 700;
  background: rgba(210,216,224,.15); border: 1px solid rgba(210,216,224,.4); color: #dfe3e8;
}

/* ============ Modals ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 20, 11, .66);
  backdrop-filter: blur(6px);
  animation: fade-in .25s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: min(440px, 92vw);
  max-height: 90vh; overflow-y: auto;
  border-radius: 22px;
  background: linear-gradient(180deg, #1c2128, #101318);
  border: 1px solid rgba(200,206,214,.18);
  box-shadow: var(--shadow-3);
  padding: 22px;
  animation: pop-in .35s cubic-bezier(.2,.9,.3,1.2);
  color: #fff;
}
.modal h2 { font-size: 21px; font-weight: 900; margin-bottom: 4px; }
.modal .sub { font-size: 13px; color: rgba(255,255,255,.65); margin-bottom: 16px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.1); font-size: 17px; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,.2); }
.modal-head { position: relative; padding-right: 40px; }
.modal-body { margin-top: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* Settings rows */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 2px; border-bottom: 1px solid rgba(255,255,255,.08); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 15px; font-weight: 600; }
.setting-desc { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 2px; }
.switch { position: relative; width: 50px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 99px; background: rgba(255,255,255,.2); transition: .2s; }
.slider::before { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; left: 3px; top: 3px; background: #fff; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ============ Shop / cosmetics grid ============ */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.shop-card {
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, border-color .15s;
  overflow: hidden;
}
.shop-card:hover { transform: translateY(-3px); }
.shop-card.selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224,230,238,.35); }
.shop-card.locked { filter: grayscale(.9) brightness(.75); }
.shop-card .mini-back { width: 78%; height: 100%; border-radius: 8px; }
.shop-card.felt .mini-back { background: transparent; border-radius: 14px; height: 100%; }
.shop-lock {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: rgba(4,20,11,.55); font-size: 11px; font-weight: 700; text-align: center; padding: 6px;
}
.shop-lock .lock-icon { font-size: 22px; }
.shop-lock .unlock-price { color: #e8eaee; }

/* ============ Achievements ============ */
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach-card {
  padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  display: flex; gap: 10px; align-items: center;
}
.ach-card.locked { opacity: .55; filter: grayscale(.6); }
.ach-icon { font-size: 26px; flex: none; }
.ach-name { font-size: 13px; font-weight: 800; line-height: 1.15; }
.ach-progress { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 2px; }
.ach-bar { height: 5px; margin-top: 6px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.ach-bar-fill { height: 100%; background: linear-gradient(90deg, #ffffff, var(--gold)); border-radius: 99px; }

/* ============ Leaderboard ============ */
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
}
.lb-row.me { background: rgba(224,230,238,.15); border-color: rgba(224,230,238,.5); }
.lb-rank { width: 34px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 900; font-variant-numeric: tabular-nums; }

/* ============ Win / Lose screens ============ */
.end-card { text-align: center; }
.end-emoji { font-size: 66px; }
.end-title { font-size: 32px; font-weight: 900; margin-top: 6px; }
.end-stars { font-size: 34px; letter-spacing: 4px; margin: 10px 0 4px; color: #c9cdd4; }
.end-stars .dim { opacity: .25; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.end-stat { padding: 10px; border-radius: 12px; background: rgba(255,255,255,.07); }
.end-stat .v { font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; }
.end-stat .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.6); margin-top: 2px; }
.xp-gain { margin-top: 4px; font-size: 14px; font-weight: 700; color: #e8eaee; }
.end-actions { display: grid; gap: 10px; margin-top: 18px; }
.end-actions .btn { width: 100%; }
.reward-row { margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(224,230,238,.12); border: 1px solid rgba(224,230,238,.4); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.daily-objectives { display: grid; gap: 8px; margin-top: 10px; }
.obj-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  font-size: 14px; font-weight: 600;
}
.obj-row.done { background: rgba(160,168,178,.22); border-color: rgba(190,196,204,.5); }
.obj-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.obj-row.done .obj-check { background: var(--accent); border-color: var(--accent); }

/* ============ Pause menu ============ */
.pause-modal { width: min(360px, 92vw); }
.pause-card { text-align: center; }
.pause-emoji { font-size: 58px; line-height: 1; filter: drop-shadow(0 6px 20px rgba(0,0,0,.35)); }
.pause-title { font-size: 26px; font-weight: 900; margin-top: 8px; }
.pause-mode { font-size: 12.5px; color: rgba(255,255,255,.65); margin-top: 2px; letter-spacing: .3px; }
.pause-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 2px; }
.pause-stats .end-stat { padding: 9px 6px; }
.pause-primary { margin-top: 16px; }
.pause-primary .btn { width: 100%; min-height: 52px; font-size: 16px; }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pause-actions .btn { width: 100%; }
.pause-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pause-links .btn { width: 100%; }
.pause-extra {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 10px 12px;
  border-radius: 12px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09); text-align: left;
}
.pause-extra-label { font-size: 13.5px; font-weight: 700; }
.pause-extra-desc { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 1px; }
.pause-saved { margin-top: 12px; font-size: 11px; color: rgba(255,255,255,.45); }
.pause-card .sub { margin-top: 8px; margin-bottom: 0; }

/* ============ AdBlock popup ============ */
.adblock-card { text-align: center; padding: 10px 4px; }
.adblock-icon { font-size: 54px; }
.adblock-text { font-size: 14px; line-height: 1.5; color: rgba(255,255,255,.75); margin: 12px 0 4px; }

/* ============ Reward offer modal ============ */
.reward-card { text-align: center; }
.reward-icon { font-size: 52px; }
.reward-title { font-size: 21px; font-weight: 900; margin: 8px 0 6px; }
.reward-desc { font-size: 14px; color: rgba(255,255,255,.72); line-height: 1.45; }
.ad-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 6px 14px; border-radius: 99px;
  background: rgba(224,230,238,.15); border: 1px solid rgba(224,230,238,.45);
  font-size: 12.5px; font-weight: 800; color: #e8eaee;
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  #hud { padding: 8px 10px; gap: 6px; }
  .stat-value { font-size: 14px; }
  .hud-center { gap: 10px; }
  .hud-right { gap: 8px; }
  .hud-btn { min-width: 40px; min-height: 44px; padding: 6px 9px; font-size: 14px; }
  .icon-btn { font-size: 18px; }
  #app.banner-bottom { --banner-bottom-h: 60px; }

  /* Islands leave the mid-height spots and dock to the corners so they
     never crowd the center column on narrow screens. Plain offsets first
     (universal support); safe-area padding is added separately only where
     env() exists — browsers without it must NOT lose the dock. */
  .island-daily { top: 12px; transform: none; }
  .island-cosmetics { top: 74px; transform: none; }
  .island-levels { top: auto; bottom: calc(14px + var(--banner-bottom-h)); transform: none; }
  .island-achievements { top: auto; bottom: calc(74px + var(--banner-bottom-h)); transform: none; }
  @supports (top: env(safe-area-inset-top)) {
    .island-daily { top: calc(12px + env(safe-area-inset-top)); }
    .island-cosmetics { top: calc(74px + env(safe-area-inset-top)); }
    .island-levels { bottom: calc(14px + var(--banner-bottom-h) + env(safe-area-inset-bottom)); }
    .island-achievements { bottom: calc(74px + var(--banner-bottom-h) + env(safe-area-inset-bottom)); }
  }

  /* compact island sizing */
  .island-pill { padding: 12px 10px 12px 20px; border-radius: 0 18px 18px 0; }
  .island-cosmetics .island-pill, .island-achievements .island-pill { padding: 12px 20px 12px 10px; border-radius: 18px 0 0 18px; }
  .island-icon { font-size: 22px; }
  .island-levels .island-icon, .island-achievements .island-icon { font-size: 18px; }
  .island-label { font-size: 9.5px; }

  /* tighten the center column for phones */
  .menu-inner { padding: 18px 16px 14px; }
  .menu-logo { font-size: 46px; }
  .menu-title { font-size: 27px; }
  .menu-tagline { font-size: 12px; }
}
@media (max-width: 400px) {
  .menu-inner { width: min(340px, 90vw); padding: 14px 12px 12px; }
  .menu-logo { font-size: 38px; }
  .menu-title { font-size: 23px; }
  .menu-progress-card { padding: 10px 12px; }
  .island-daily, .island-levels { left: -8px; }
  .island-cosmetics, .island-achievements { right: -8px; }
  .island-daily .island-badge { left: -3px; }
  .island-cosmetics .island-badge { right: -3px; }
}
/* small phones: drop the stat labels so centre stats + side buttons fit */
@media (max-width: 480px) {
  .stat-label { display: none; }
  .stat-value { font-size: 13px; }
  .hud-center { gap: 12px; }
  .hud-badge { padding: 3px 9px; font-size: 11px; }
}
/* short WIDE landscape windows (desktop / tablet): shrink the hub so
   nothing scrolls. Narrow landscape phones keep the corner-docked
   islands from the ≤720px rules above. */
@media (min-width: 721px) and (max-height: 560px) and (orientation: landscape) {
  .menu-inner { padding: 12px 12px; max-height: 86vh; }
  .menu-logo { font-size: 34px; }
  .menu-title { font-size: 22px; }
  .menu-tagline { display: none; }
  .menu-progress-card { margin: 10px 0 2px; padding: 8px 12px; }
  .menu-progress-row { font-size: 12px; }
  .menu-actions { margin-top: 10px; }
  .menu-footer { margin-top: 10px; gap: 8px 12px; }
  .menu-actions .btn-lg { min-height: 48px; }
  .island-daily, .island-cosmetics { top: 42%; }
  .island-levels, .island-achievements { top: 62%; }
}

/* Safe-area insets for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  #hud { padding-top: calc(10px + env(safe-area-inset-top)); }
}

/* Reduced motion: skip the decorative entrances so the islands are always
   fully visible from the first frame (also a11y best practice). */
@media (prefers-reduced-motion: reduce) {
  .menu-inner { animation: none; }
  .island-pill { animation: none; }
  .menu-island .island-icon { animation: none; }
  .island-badge.pulse { animation: none; }
  .menu-logo { animation: none; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 99px; }
