/* The app shell around the game: lobby, saved rooms, settings, results,
   leaderboard, daily reward, store, pickers, modals, Gold coin. */

/* ============================================================
   App shell (splash → lobby → waiting → settings)
   Card-based "pro app" layout in the style of Scrabble GO /
   Solitaire Cash: top identity bar, game-mode cards with a
   ribbon + icon + glossy CTA, list cards for saved rooms.
   ============================================================ */
/* Opaque: the lobby screens are pages of their own, not a dimmed layer
   over the game board underneath. */
.lobby-overlay {
  position: fixed; left: 0; right: 0;
  background: radial-gradient(circle, var(--page-bg-1) 0%, var(--page-bg-2) 100%);
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  bottom: calc(var(--navbar-h) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center;
  z-index: 150; opacity: 1; pointer-events: auto;
  padding: 14px;
}
.lobby-overlay.hidden { opacity: 0; pointer-events: none; }
/* Frame fills the overlay's height; only .shell-scroll scrolls internally,
   so the docked top bar and bottom nav (both outside this overlay) never move. */
.shell-stack {
  width: 100%; max-width: var(--shell-max-width); height: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
}
.shell-scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 14px;
}

/* Persistent identity bar — a single docked instance shared by every screen
   (lobby and game alike), fixed flush to the top edge rather than floating
   as an inset card. */
.shell-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 170;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 8px calc(14px + env(safe-area-inset-left));
  display: flex; justify-content: center;
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border-bottom: 1px solid var(--border-gold);
  box-shadow: 0 4px 14px var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.shell-topbar-inner { display: flex; align-items: center; gap: 8px; width: 100%; max-width: var(--shell-max-width); }

/* Avatar + level badge, bottom-right of the circle -- the Solitaire-Cash-
   style profile chip. Tapping it (and every other header control) opens
   Settings, the one place all of this is actually editable. */
.hdr-avatar {
  position: relative; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, #ffe9a8, var(--gold-accent) 62%, #8a6a1c);
  box-shadow: inset 0 -3px 6px var(--shadow-soft), 0 2px 6px var(--shadow);
  border: 2px solid var(--border-gold); padding: 0; cursor: pointer; margin-right: 4px;
}
.hdr-avatar:active { transform: scale(.94); }
.shell-avatar-svg { width: 78%; height: 78%; pointer-events: none; }
.hdr-avatar-level {
  position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
  background: var(--surface-deep-2); border: 1px solid var(--gold-accent); color: var(--gold-accent);
  font-size: .58rem; font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 999px; white-space: nowrap;
}

/* Currency pill -- Gold balance, opens the Store. The little green "+"
   is the whole point: a plain balance readout doesn't read as tappable,
   the badge makes "tap this to buy more" obvious at a glance (same
   pattern as Solitaire Cash's cash counter). */
.hdr-pills { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.hdr-pill {
  display: flex; align-items: center; gap: 5px; background: var(--shell-chip-bg);
  border: 1px solid var(--border-gold); border-radius: 999px; padding: 5px 10px 5px 5px;
  cursor: pointer; flex-shrink: 0; color: var(--text-strong); font-weight: 800; font-size: .78rem; font-family: inherit;
}
.hdr-pill:active { transform: scale(.95); }
.hdr-pill-icon.coin-icon { width: 18px; height: 18px; }
.hdr-pill-plus {
  display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(180deg, var(--shell-cta-green-1), var(--shell-cta-green-2));
  color: #0d2c0a; font-weight: 900; font-size: .68rem; line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,.45), inset 0 1px rgba(255,255,255,.4);
}

/* Current screen's title (shell-nav.js updateHeaderTitle). Takes the free
   space between the Gold pill and the sound button, truncating if needed. */
.hdr-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 4px; line-height: 1.2; }
.hdr-title-text, .hdr-title-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-title-text { font-family: 'Cinzel', serif; color: var(--gold-accent); font-size: .95rem; font-weight: 800; letter-spacing: .4px; }
.hdr-title-sub { color: var(--text-faint); font-size: .64rem; }

/* Game view: "<red> vs <green>" centred in the same free space. Long team
   names truncate; the team whose turn it is gets a gold underline. */
.hdr-matchup { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 4px; }
.hdr-team {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: 'Cinzel', serif; font-weight: 800; font-size: .92rem; letter-spacing: .3px;
  padding-bottom: 2px; border-bottom: 2px solid transparent; transition: border-color .2s ease;
}
.hdr-team.red { color: var(--red-highlight); }
.hdr-team.green { color: var(--green-team); }
.hdr-team.active { border-bottom-color: var(--gold-accent); }
.hdr-vs { flex-shrink: 0; color: var(--text-faint); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }

.hdr-menu-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; margin-left: auto;
  border: 1px solid var(--border-gold); background: var(--surface-deep-2); color: var(--gold-accent); font-size: 1rem; cursor: pointer;
}
.hdr-menu-btn:active { transform: scale(.94); }
/* The ☰ nav menu button: landscape-only (responsive.css). */
.hdr-nav-btn { display: none; margin-left: 0; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; text-align: left; }
/* A screen's own title row: shown in the top bar instead (.hdr-title). */
.section-title.page-title { display: none; }
.section-title h3 { font-family: 'Cinzel', serif; color: var(--gold-accent); font-size: .95rem; letter-spacing: .5px; flex-shrink: 0; }
.section-title span { color: var(--text-faint); font-size: .68rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.home-h1 { font-family: 'Cinzel', serif; color: var(--text-strong); font-size: 1.05rem; font-weight: 700; letter-spacing: .3px; text-align: left; padding: 0 2px; margin-bottom: 2px; }
.home-intro { color: var(--text-muted); font-size: .74rem; line-height: 1.5; text-align: left; padding: 0 2px; margin-bottom: 4px; }
.home-intro a { color: var(--gold-accent); text-decoration: underline; }

/* Game-mode poster cards (Create / Join) — big icon art + bold title +
   a bottom info strip, the arcade-lobby "game tile" pattern (large art,
   chunky title, footer caption) rebuilt in Dadu's own gold/dark-wood
   palette rather than a saturated multi-color one. Whole card is the tap
   target, same as a game tile is in that pattern. */
#lobby-main { display: flex; flex-direction: column; gap: 12px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mode-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  border-radius: 18px; padding: 0; text-align: center; font: inherit; cursor: pointer;
  background: radial-gradient(circle at 50% 22%, var(--surface-1) 0%, var(--surface-2) 72%);
  border: 2px solid var(--gold-accent);
  box-shadow: 0 8px 20px var(--shadow), inset 0 1px rgba(255,255,255,.06);
  overflow: hidden; color: var(--text-primary); transition: filter .15s ease, transform .1s ease;
}
.mode-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(212,175,55,.25), transparent 60%);
}
.mode-card:hover { filter: brightness(1.08); }
.mode-card:active { transform: translateY(1px) scale(.98); }
.mode-card-art {
  position: relative; font-size: 2.5rem; padding: 20px 0 6px; line-height: 1;
  filter: drop-shadow(0 3px 6px var(--shadow-strong));
}
.mode-card-title {
  position: relative; font-family: 'Cinzel', serif; font-weight: 800; color: var(--gold-accent);
  font-size: .92rem; letter-spacing: .3px; text-shadow: 0 2px 3px var(--shadow-strong); padding: 0 8px 14px;
}
.mode-card-strip {
  position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--shadow-soft); border-top: 1px solid var(--border-gold-soft);
  padding: 7px 6px; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted);
}

/* Daily Reward screen — 7-day calendar grid, tappable "today" card */
.daily-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.daily-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 6px 12px; border-radius: 14px; text-align: center; font: inherit; cursor: default;
  background: linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border-gold); color: var(--text-primary);
}
.daily-card-day { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.daily-card-icon { font-size: 1.6rem; margin: 2px 0; }
.daily-card-amount { font-size: 1rem; font-weight: 900; color: var(--text-strong); }
.daily-card.claimed { opacity: .55; }
.daily-card-check { position: absolute; top: 6px; right: 8px; color: #8be86a; font-size: .85rem; }
.daily-card.claimable {
  cursor: pointer; border-color: var(--gold-accent); border-width: 2px;
  background: linear-gradient(160deg, #4a3312, var(--surface-2));
  box-shadow: 0 0 0 2px rgba(212,175,55,.35), 0 6px 18px var(--shadow);
}
.daily-card.claimable .daily-card-day { color: var(--gold-accent); }
.daily-card.claimable:active { transform: scale(.97); }
.daily-card.locked { opacity: .8; }

/* A small CSS-drawn gold coin, used everywhere the app shows Gold instead
   of the 🪙 emoji -- that glyph renders flat/greyish (closer to silver
   than gold) on several platforms' emoji fonts, which was the whole
   complaint. `em`-sized so one rule covers header pills, cards, and
   inline text alike. */
.coin-icon {
  display: inline-block; width: 1em; height: 1em; min-width: 12px; min-height: 12px;
  border-radius: 50%; vertical-align: -0.15em; flex-shrink: 0;
  background: radial-gradient(circle at 32% 26%, #fff8d6 0%, #ffe27a 28%, #d4af37 62%, #9a6f10 100%);
  box-shadow: inset 0 -2px 2px var(--shadow-soft), inset 0 1px 1px rgba(255,255,255,.75), 0 1px 2px var(--shadow);
  border: 1px solid #8a6300;
}

/* Store screen — Gold Coin Token packs, two per row. The "popular"/
   "best_value" SKUs (store-config.js) get a gold ring + ribbon badge so
   they stand out from the plain packs, the standard F2P nudge toward the
   mid-tier packs. */
.store-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 10px; margin-top: 4px; }
.store-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 10px 14px; border-radius: 14px; text-align: center;
  background: linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border-gold);
}
.store-card.featured {
  border-color: var(--gold-accent); border-width: 2px;
  box-shadow: 0 0 0 1px var(--gold-accent), 0 8px 20px rgba(212,175,55,.3);
}
.store-card-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: .58rem; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(180deg, var(--shell-ribbon-gold-1), var(--shell-ribbon-gold-2) 55%, var(--shell-ribbon-gold-3));
  color: #3a2405; box-shadow: 0 2px 5px var(--shadow);
}
.store-card-icon { font-size: 1.8rem; margin-bottom: 2px; }
.store-card-amount { font-size: 1.1rem; font-weight: 900; color: var(--text-strong); }
.store-card-buy {
  margin-top: 6px; width: 100%; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--border-gold);
  background: linear-gradient(160deg, #4a3312, var(--surface-2)); color: var(--gold-accent);
  font-weight: 800; font-size: .8rem; cursor: pointer;
}
.store-card.featured .store-card-buy {
  background: linear-gradient(180deg, var(--shell-ribbon-gold-1), var(--shell-ribbon-gold-2) 55%, var(--shell-ribbon-gold-3));
  color: #3a2405; border-color: transparent;
}
.store-card-buy:active { transform: scale(.97); }
.store-card-buy:disabled { opacity: .6; cursor: default; }

/* Results screen — 2x2 stat cards */
.results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.results-stat-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px;
  border-radius: 14px; text-align: center;
  background: linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border-gold);
}
.results-stat-icon { font-size: 1.5rem; }
.results-stat-value { font-size: 1.4rem; font-weight: 900; color: var(--gold-accent); }
.results-stat-label { font-size: .66rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

/* Achievements — one row per achievement, locked (dim icon + progress bar)
   vs. unlocked (gold ring + a checkmark + the reward actually granted). */
.achv-grid { display: flex; flex-direction: column; gap: 8px; }
.achv-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border-gold-soft);
}
.achv-card.unlocked { border-color: var(--gold-accent); }
.achv-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 1.25rem; background: var(--shadow-soft); border: 1px solid var(--border-gold-soft);
}
.achv-card.locked .achv-icon { filter: grayscale(1); opacity: .5; }
.achv-card.unlocked .achv-icon { border-color: var(--gold-accent); box-shadow: 0 0 8px rgba(212,175,55,.4); }
.achv-info { flex: 1; min-width: 0; }
.achv-info > span { display: block; }
.achv-name { font-weight: 800; font-size: .84rem; color: var(--text-strong); }
.achv-card.locked .achv-name { color: var(--text-muted); }
.achv-desc { font-size: .66rem; color: var(--text-faint); margin-top: 1px; }
.achv-progress-bar { display: block; width: 100%; height: 5px; border-radius: 4px; background: var(--shadow-soft); margin-top: 6px; overflow: hidden; }
.achv-progress-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-accent), #f0d878); border-radius: 4px; }
.achv-progress-text { font-size: .62rem; color: var(--text-faint); margin-top: 3px; }
.achv-reward { font-size: .7rem; font-weight: 800; color: var(--gold-accent); margin-top: 4px; }
.achv-check { flex-shrink: 0; font-size: 1.15rem; color: #8be86a; }

/* Leaderboard — ranked rows, the signed-in viewer's own row (wherever it
   lands) picked out with a gold ring rather than a whole different style,
   so it reads as "this list, but that's you" instead of a separate UI. */
#leaderboard-category-picker { margin-bottom: 12px; }
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px;
  background: linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border-gold-soft);
}
.lb-row.me { border-color: var(--gold-accent); box-shadow: 0 0 0 1px var(--gold-accent); }
.lb-rank { flex-shrink: 0; width: 26px; text-align: center; font-family: 'Cinzel', serif; font-weight: 800; color: var(--text-muted); font-size: .82rem; }
.lb-rank.top3 { color: var(--gold-accent); font-size: .95rem; }
.lb-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  background: var(--surface-deep); border: 1px solid var(--border-gold-soft);
  display: grid; place-items: center; font-size: .8rem; color: var(--text-muted);
}
.lb-name { flex: 1; min-width: 0; font-weight: 700; font-size: .8rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-value { flex-shrink: 0; font-weight: 900; font-size: .84rem; color: var(--gold-accent); }
.lb-me-row { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-gold-soft); }

.lobby-input-row-group { display: flex; gap: 10px; margin-bottom: 14px; }
.lobby-input-row-group > .lobby-input-row { flex: 1; min-width: 0; margin-bottom: 0; }
.lobby-input-row { margin-bottom: 14px; text-align: left; }
.lobby-input-row label { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; letter-spacing: .3px; text-transform: uppercase; }
.lobby-input-row input {
  width: 100%; background: var(--surface-deep); border: 1px solid var(--border-gold);
  border-radius: 10px; color: var(--text-primary); padding: 11px 14px; font-size: 0.95rem;
}
.lobby-input-row input:focus { outline: none; border-color: var(--gold-accent); }
#lobby-code-input { text-align: center; }

/* Segmented pick buttons — team choice, players-per-team */
.pick-group { display: flex; gap: 8px; }
.pick-btn {
  flex: 1; padding: 10px; border-radius: 12px; font-size: .85rem; font-weight: 800; cursor: pointer;
  border: 1px solid var(--border-gold); background: var(--surface-deep); color: var(--text-muted);
  transition: filter .12s ease;
}
.pick-btn:active { transform: translateY(1px); }
.pick-btn.active { background: var(--gold-accent); color: #3a2405; border-color: var(--gold-accent); }
.pick-btn.team-red.active { background: var(--red-team); color: #fff; border-color: var(--red-dark); }
.pick-btn.team-green.active { background: var(--green-team); color: #fff; border-color: var(--green-border); }
.picker-hint { font-size: .68rem; color: var(--text-faint); margin: -4px 0 14px; line-height: 1.4; }
.entry-fee-fixed {
  display: inline-block; padding: 10px 14px; border-radius: 12px; font-size: .9rem; font-weight: 800;
  border: 1px solid var(--border-gold); background: var(--surface-deep); color: var(--gold-accent);
}

/* Glossy CTA buttons — Play (green), Join (gold), ghost (secondary) */
.play-btn {
  flex-shrink: 0; min-width: 92px; padding: 12px 20px; border-radius: 14px; border: 0;
  font-weight: 900; font-size: .86rem; letter-spacing: .4px; text-transform: uppercase;
  color: #0d2c08; cursor: pointer;
  background: linear-gradient(180deg, var(--shell-cta-green-1), var(--shell-cta-green-2) 65%);
  box-shadow: 0 5px 0 var(--shell-cta-green-shadow), 0 10px 18px var(--shadow), inset 0 1px rgba(255,255,255,.5);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.play-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--shell-cta-green-shadow), 0 4px 10px var(--shadow), inset 0 1px rgba(255,255,255,.5); }
.play-btn.gold {
  color: #3a2405;
  background: linear-gradient(180deg, var(--shell-ribbon-gold-1), var(--shell-ribbon-gold-2) 55%, var(--shell-ribbon-gold-3));
  box-shadow: 0 5px 0 #7c5a10, 0 10px 18px var(--shadow), inset 0 1px rgba(255,255,255,.5);
}
.play-btn.gold:active { box-shadow: 0 2px 0 #7c5a10, 0 4px 10px var(--shadow); }
.play-btn.block { display: block; width: 100%; }
.play-btn.ghost {
  background: transparent; color: var(--text-muted); box-shadow: none; border: 1px solid var(--border-gold-soft);
}
.play-btn.ghost:active { transform: translateY(1px); }
.play-btn.ghost.danger { color: var(--status-error); border-color: rgba(239,68,68,.4); }
.play-btn.ghost.danger:hover, .play-btn.ghost.danger:active { border-color: var(--danger); }
.play-btn:disabled { filter: grayscale(.6) brightness(.7); box-shadow: none; cursor: not-allowed; transform: none; }

.lobby-status { font-size: 0.8rem; color: var(--status-error); min-height: 18px; text-align: center; }

/* Rules screen */
#rules-screen { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.rules-card {
  background: linear-gradient(160deg, var(--surface-1) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-gold); border-radius: 18px; padding: 16px 18px;
  box-shadow: 0 10px 26px rgba(0,0,0,.42); text-align: left;
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.rules-card p { margin: 12px 0 6px; font-size: .85rem; color: var(--text-strong); }
.rules-card p:first-child { margin-top: 0; }
.rules-card ul { margin: 0 0 4px 18px; }
.rules-card li { font-size: .82rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 6px; }
.rules-card strong { color: var(--gold-accent); }

/* Waiting room "ticket" */
.waiting-ticket {
  background: linear-gradient(160deg, var(--surface-1) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-gold); border-radius: 18px; padding: 18px;
  box-shadow: 0 10px 26px rgba(0,0,0,.42); color: var(--text-primary);
}

/* Room code entry in the Join modal. Two classes so it outranks the phone-width
   `.lobby-input-row input` font-size in responsive.css. */
.lobby-input-row .room-code-input { text-transform: uppercase; letter-spacing: 3px; text-align: center; font-size: 1.05rem; }
