/* ============================================================
   Seep King — production UI stylesheet
   Sections: tokens · base · buttons/fields · screens · menu · lobby
   · hud · table · seats/timer · cards · dock · toast · result · overlays
   · responsive
   ============================================================ */

:root {
  --felt-1: #1c9163;
  --felt-2: #0c5538;
  --felt-3: #06331f;
  --rail: #6b4423;
  --rail-hi: #8a5a30;

  --bg: #08151b;
  --panel: #14202b;
  --panel-2: #1c2c3a;
  --ink: #eaf1f4;
  --muted: #93a6b0;

  --accent: #4f8cff;
  --teamA: #2fd07e;
  --teamB: #ff7a59;
  --gold: #ffd34d;
  --danger: #ff5d5d;

  --card-w: clamp(48px, 7.2vw, 80px);
  --r: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 50% -15%, #163a2c, var(--bg));
  overflow: hidden;
}
#app { height: 100%; position: relative; }

/* ---------------- buttons & fields ---------------- */
.btn {
  border: 0; border-radius: 12px; cursor: pointer;
  font: 600 15px/1 var(--font); color: #fff; padding: 13px 18px;
  background: var(--accent); transition: transform .08s, filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-primary { background: linear-gradient(180deg, #5b97ff, #3f7bf0); }
.btn-secondary { background: linear-gradient(180deg, #2bbf74, #1f9d5e); }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px rgba(79,140,255,.4); }
.btn.done { background: linear-gradient(180deg, #2bbf74, #1f9d5e); }
.hidden { display: none !important; }

input {
  width: 100%; padding: 13px 14px; border-radius: 12px; font-size: 16px;
  background: #0c1822; color: var(--ink); border: 1.5px solid #2a3b49; outline: none;
}
input:focus { border-color: var(--accent); }
#inpCode, #codeCopy { text-transform: uppercase; letter-spacing: 3px; }

/* ---------------- screens ---------------- */
.screen {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.screen.is-active { display: flex; }

/* ---------------- menu ---------------- */
.menu-card, .lobby-card, .result-card {
  width: min(440px, 92vw); background: var(--panel); border: 1px solid #243340;
  border-radius: 20px; padding: 26px; box-shadow: var(--shadow);
}
/* The menu is wider so arenas can sit in a 2-column grid, and the whole
   screen scrolls when the content is taller than the viewport. */
.menu-card { width: min(760px, 94vw); }
#screen-menu.is-active { display: block; overflow-y: auto; }
#screen-menu .menu-card { margin: 24px auto; }
#screen-menu .hint { text-align: center; margin: 0 auto 24px; }
.brand { text-align: center; margin-bottom: 18px; }
.brand-logo { width: 64px; height: 64px; }
.brand h1 { margin: 8px 0 2px; font-size: 30px; letter-spacing: .5px; }
.brand-sub { margin: 0; color: var(--muted); font-size: 13px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.divider { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0; position: relative; }
.divider::before, .divider::after {
  content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: #2a3b49;
}
.divider::before { left: 0; } .divider::after { right: 0; }
.join-row { display: flex; gap: 8px; margin-bottom: 12px; }
.join-row input { flex: 1; }
.room-list { list-style: none; padding: 0; margin: 12px 0 0; max-height: 160px; overflow: auto; }
.room-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 12px; border-radius: 10px; background: #0d1a24; margin-bottom: 6px; cursor: pointer;
}
.room-list li:hover { background: #122231; }
.room-list .rl-code { font-weight: 700; letter-spacing: 2px; color: var(--gold); }
.room-list .rl-meta { color: var(--muted); font-size: 13px; }
.room-list .empty { justify-content: center; color: var(--muted); cursor: default; }
.hint { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; }

/* ---------------- lobby ---------------- */
.lobby-card h2 { margin: 0 0 14px; }
.room-code { text-align: center; margin-bottom: 18px; }
.room-code-label { display: block; font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.room-code-value {
  background: #0d1a24; border: 1px dashed #2f4658; color: var(--gold);
  font: 800 34px/1 var(--font); padding: 10px 18px; border-radius: 12px; margin-top: 6px; cursor: pointer;
}
.lobby-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.lobby-seat {
  display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px;
  background: #0e1b25; border-left: 4px solid var(--muted); position: relative;
}
.lobby-seat.team-a { border-left-color: var(--teamA); }
.lobby-seat.team-b { border-left-color: var(--teamB); }
.lobby-seat.me { outline: 2px solid var(--accent); }
.ls-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: #1d2f3d; display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}
.ls-name { font-weight: 600; }
.ls-status { font-size: 12px; color: var(--muted); }
.ls-status.ready { color: var(--teamA); }
.ls-status.offline { color: var(--danger); }
.ls-team { font-size: 11px; color: var(--muted); }
.lobby-actions { display: flex; gap: 10px; margin-bottom: 10px; }
.lobby-actions .btn { flex: 1; }

/* ---------------- HUD (team panels + turn) ---------------- */
#screen-game { justify-content: flex-start; padding: 0; }
.hud {
  width: 100%; display: flex; align-items: stretch; gap: 8px; padding: 8px;
  padding-top: max(8px, env(safe-area-inset-top));
}
.team-panel {
  flex: 1; max-width: 200px; background: var(--panel); border-radius: 14px; padding: 8px 12px;
  border: 1px solid #243340; position: relative; overflow: hidden;
}
.team-panel.team-a { box-shadow: inset 3px 0 0 var(--teamA); }
.team-panel.team-b { box-shadow: inset -3px 0 0 var(--teamB); text-align: right; }
.team-panel.mine::after {
  content: "YOU"; position: absolute; top: 6px; right: 8px; font-size: 9px; color: var(--gold);
  letter-spacing: 1px;
}
.team-panel.team-b.mine::after { right: auto; left: 8px; }
.team-tag { font-size: 11px; letter-spacing: 1.5px; color: var(--muted); }
.team-stat { display: flex; align-items: baseline; gap: 5px; }
.team-panel.team-b .team-stat { justify-content: flex-end; }
.team-stat b { font-size: 26px; }
.team-a .team-stat b { color: var(--teamA); }
.team-b .team-stat b { color: var(--teamB); }
.team-stat span { font-size: 11px; color: var(--muted); }
.team-sub { font-size: 11px; color: var(--muted); }
.hud-center { flex: 1; display: grid; place-items: center; }
.turn-banner {
  padding: 8px 18px; border-radius: 22px; font-weight: 700; font-size: 14px;
  background: var(--panel-2); border: 1px solid #2c3f50; white-space: nowrap;
}
.turn-banner.mine { background: linear-gradient(180deg, #5b97ff, #3f7bf0); border-color: transparent; }
.turn-banner.seep-flash { animation: seepFlash .9s ease; }
@keyframes seepFlash {
  0%,100% { background: var(--panel-2); }
  30% { background: var(--gold); color: #1a1300; transform: scale(1.12); }
}

/* ---------------- table ---------------- */
.table-wrap { flex: 1; display: grid; place-items: center; width: 100%; min-height: 0; padding: 4px; }
.table-felt {
  position: relative; width: min(96vw, 980px); height: min(58vh, 600px);
  border-radius: 50% / 44%;
  background: radial-gradient(ellipse at 50% 42%, var(--felt-1), var(--felt-2) 62%, var(--felt-3));
  border: 12px solid var(--rail);
  box-shadow:
    inset 0 0 60px rgba(0,0,0,.55), inset 0 0 0 3px rgba(0,0,0,.25),
    0 0 0 2px var(--rail-hi), var(--shadow);
}
.felt-ring {
  position: absolute; inset: 7%; border-radius: 50% / 44%;
  border: 2px dashed rgba(255,255,255,.10);
}
.floor {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
  max-width: 64%; min-height: calc(var(--card-w) * 1.4);
}
.floor-empty { color: rgba(255,255,255,.45); font-size: 13px; font-style: italic; }
.fly-layer { position: absolute; inset: 0; pointer-events: none; }

/* ---------------- seats + timer ---------------- */
.seat {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: max-content;
}
.seat-bottom { bottom: -6px; left: 50%; transform: translateX(-50%); }
.seat-top    { top: -6px;    left: 50%; transform: translateX(-50%); }
.seat-left   { left: -10px;  top: 50%;  transform: translateY(-50%); }
.seat-right  { right: -10px; top: 50%;  transform: translateY(-50%); }
.avatar-wrap { position: relative; width: 56px; height: 56px; }
.avatar {
  position: absolute; inset: 6px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff; background: #21384a;
  border: 2px solid #34506a;
}
.seat.team-a .avatar { background: #15553b; border-color: var(--teamA); }
.seat.team-b .avatar { background: #5a2a1e; border-color: var(--teamB); }
.seat.me .avatar { box-shadow: 0 0 0 2px var(--gold); }
.timer-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(0,0,0,.35); stroke-width: 5; }
.ring-fg { fill: none; stroke: transparent; stroke-width: 5; stroke-linecap: round; }
.seat.active .ring-fg { stroke: var(--gold); }
.seat.active .ring-fg.urgent { stroke: var(--danger); }
.seat.active .avatar { box-shadow: 0 0 16px var(--gold); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 26px var(--gold); } }
.ring-count {
  position: absolute; right: -4px; bottom: -2px; background: #0c1822; color: var(--ink);
  font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 6px; border: 1px solid #34506a;
}
.seat-name { font-size: 12px; color: #d8e6ee; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.mini-fan { display: flex; height: 26px; }
.card-mini { width: calc(var(--card-w) * .42); margin-left: calc(var(--card-w) * -.30); transform: rotate(calc(var(--i) * 5deg)); transform-origin: bottom center; }
.seat-left .mini-fan, .seat-right .mini-fan { display: none; }

/* ---------------- cards ---------------- */
.card { width: var(--card-w); aspect-ratio: 240 / 336; position: relative; flex: 0 0 auto; }
.card-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); border-radius: 9px; }
.card-svg .card-face { fill: #fbfcff; }
.card-svg .pip { font: 700 42px var(--font); text-anchor: middle; dominant-baseline: central; }
.card-svg .idx-rank { font: 800 30px var(--font); text-anchor: middle; }
.card-svg .idx-suit { font: 700 26px var(--font); text-anchor: middle; }
.card-svg .ace { font: 700 120px var(--font); text-anchor: middle; dominant-baseline: central; }
.card-svg .court-letter { font: 800 96px var(--font); text-anchor: middle; dominant-baseline: central; }
.card-svg .court-suit { font: 700 44px var(--font); text-anchor: middle; dominant-baseline: central; }

.card.on-floor { cursor: pointer; transition: transform .15s, filter .15s; }
.card.on-floor:hover { transform: translateY(-6px); }
.card.on-floor.selected {
  transform: translateY(-12px) scale(1.05); z-index: 3;
  animation: selGlow 1.1s ease-in-out infinite;
}
.card.on-floor.selected .card-svg { filter: drop-shadow(0 0 8px var(--gold)); }
@keyframes selGlow { 50% { transform: translateY(-16px) scale(1.07); } }
.card.locked { cursor: default; }

/* hand fan + deal animation */
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(var(--card-w) * 1.5); padding-top: 24px; }
.card.in-hand {
  cursor: pointer; margin: 0 calc(var(--card-w) * -0.26);
  transform: translateY(0) rotate(calc(var(--i) * 3deg)); transform-origin: bottom center;
  transition: transform .18s ease, filter .18s;
  animation: dealIn .42s cubic-bezier(.2,.8,.3,1) backwards;
  animation-delay: calc(var(--deal) * 45ms);
}
@keyframes dealIn { from { transform: translateY(360px) rotate(0) scale(.6); opacity: 0; } }
.card.in-hand:hover { transform: translateY(-18px) rotate(calc(var(--i) * 3deg)) scale(1.06); z-index: 5; }
.card.in-hand.chosen {
  transform: translateY(-30px) rotate(0deg) scale(1.1); z-index: 6;
}
.card.in-hand.chosen .card-svg { filter: drop-shadow(0 0 12px var(--gold)); }
.card.in-hand.locked { cursor: default; }

/* ---------------- dock ---------------- */
.dock {
  width: 100%; background: linear-gradient(180deg, transparent, rgba(0,0,0,.35) 30%);
  padding: 4px 10px max(12px, env(safe-area-inset-bottom));
}
.selection-bar {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 13px; color: var(--muted); padding: 4px 0;
}
.selection-bar .selection-label { color: var(--ink); font-weight: 600; }
#selInfo { color: var(--gold); }
.action-bar { display: flex; justify-content: center; padding: 6px 0 0; }
.action-bar .btn { min-width: 200px; }

/* ---------------- toast ---------------- */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--card-w) * 2.1); transform: translate(-50%, 20px);
  background: #0c1822; border: 1px solid #2c3f50; color: var(--ink); padding: 10px 16px;
  border-radius: 12px; font-size: 13px; max-width: 86vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: var(--gold); color: var(--gold); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--teamA); color: var(--teamA); }
.toast.seep { border-color: var(--gold); color: var(--gold); font-weight: 700; }

/* ---------------- result ---------------- */
.result-card { text-align: center; }
.result-badge { font-size: 64px; line-height: 1; margin-bottom: 6px; animation: pop .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(0); } }
#resultTitle { margin: 0 0 18px; font-size: 30px; }
#resultTitle.win { color: var(--gold); }
#resultTitle.lose { color: var(--teamB); }
.result-scores { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 14px; }
.result-team { flex: 1; background: #0e1b25; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.result-team.team-a { box-shadow: inset 0 3px 0 var(--teamA); }
.result-team.team-b { box-shadow: inset 0 3px 0 var(--teamB); }
.result-team.winner { outline: 2px solid var(--gold); }
.result-team .rt-name { font-size: 12px; color: var(--muted); }
.result-team b { font-size: 38px; }
.result-team.team-a b { color: var(--teamA); }
.result-team.team-b b { color: var(--teamB); }
.result-team .rt-sub { font-size: 11px; color: var(--muted); }
.result-vs { color: var(--muted); font-size: 13px; }
.result-detail { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* confetti */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------------- overlays ---------------- */
.overlay {
  position: absolute; inset: 0; display: none; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; z-index: 60;
  background: rgba(6, 16, 22, .82); backdrop-filter: blur(6px); color: var(--ink);
}
.overlay.is-active { display: flex; }
.overlay-warn { background: rgba(40, 16, 10, .8); }
.overlay p { margin: 0; font-size: 16px; font-weight: 600; }
.overlay small { color: var(--muted); }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.18); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- responsive ---------------- */
@media (max-width: 720px) {
  :root { --card-w: clamp(42px, 12vw, 64px); }
  .table-felt { height: min(52vh, 460px); border-width: 9px; }
  .team-panel { padding: 6px 9px; }
  .team-stat b { font-size: 20px; }
  .turn-banner { font-size: 12px; padding: 6px 12px; }
  .avatar-wrap { width: 48px; height: 48px; }
  .seat-name { font-size: 11px; }
  .action-bar .btn { min-width: 160px; }
}
@media (max-width: 460px) {
  .lobby-seats { grid-template-columns: 1fr; }
  .floor { max-width: 78%; gap: 6px; }
  .hand { padding-top: 18px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .table-felt { height: min(70vh, 360px); }
  .hand { min-height: calc(var(--card-w) * 1.3); }
}

/* ---------------- floor houses (builds) ---------------- */
.house {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 8px; border-radius: 10px; background: #0d1322;
  border: 2px solid #2a3350; cursor: pointer; transition: transform .15s;
}
.house.team-a { border-color: var(--teamA); }
.house.team-b { border-color: var(--teamB); }
.house.selected { outline: 2px solid var(--gold); transform: translateY(-8px); }
.house.locked { cursor: default; }
.house-val { font: 800 14px var(--font); color: var(--gold); }
.house-cards { display: flex; }
.house-cards .card-mini { width: calc(var(--card-w) * 0.5); margin-left: calc(var(--card-w) * -0.34); }
.house-cards .card-mini:first-child { margin-left: 0; }

/* ---- mode toggle (1v1 / 2v2) on the menu ---- */
.mode-toggle { display: flex; gap: 8px; margin: 4px 0 12px; }
.mode-toggle .mode-btn { flex: 1; opacity: .55; border: 2px solid transparent; }
.mode-toggle .mode-btn.is-active {
  opacity: 1; border-color: var(--accent, #4ade80);
  background: rgba(74, 222, 128, .14);
}

/* in 1v1 the side seats are unused */
.seat.seat-hidden { display: none; }

/* ---- seep-ready: Collect button glows gold when the move clears the floor ---- */
#btnCapture.seep-ready {
  background: linear-gradient(180deg, #ffd34d, #f5a623);
  color: #1a1206; font-weight: 800;
  box-shadow: 0 0 0 2px #ffe488, 0 0 18px 4px rgba(255, 200, 60, .75);
  animation: seepPulse 0.9s ease-in-out infinite;
}
@keyframes seepPulse {
  0%, 100% { box-shadow: 0 0 0 2px #ffe488, 0 0 14px 3px rgba(255,200,60,.6); }
  50%      { box-shadow: 0 0 0 2px #fff2bf, 0 0 26px 8px rgba(255,210,80,.95); }
}

/* ---- call value picker (9–13) ---- */
.call-bar { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.call-bar .call-label { color: #cfe8d8; font-weight: 700; margin-right: 4px; }
.call-bar .call-val {
  min-width: 54px; font-size: 1.25rem; font-weight: 800;
  background: linear-gradient(180deg, #4f8cff, #3567d6); color: #fff;
}
.call-bar .call-val:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.call-bar .call-val:disabled { opacity: .45; }

/* ---- 3rd-seep PENALTY: Collect button turns red/warning ---- */
#btnCapture.seep-penalty {
  background: linear-gradient(180deg, #ff6b5a, #e63b28);
  color: #fff; font-weight: 800;
  box-shadow: 0 0 0 2px #ffb3a8, 0 0 18px 4px rgba(255, 80, 60, .7);
  animation: seepPulse 0.9s ease-in-out infinite;
}

/* ===================== wallet + arenas ===================== */
.wallet-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px 12px; flex-wrap: wrap;
  margin: 4px 0 14px; padding: 8px 10px; border-radius: 12px;
  background: #0d1a24; box-shadow: inset 0 0 0 1.5px rgba(255,211,77,.35);
  color: var(--gold); font-weight: 800; font-size: 18px;
}
.wallet-bar .coin { filter: drop-shadow(0 0 4px rgba(255,211,77,.6)); }

.arena-block { margin: 14px 0; }
.arena-head { display: flex; align-items: baseline; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.arena-head small { color: var(--muted); font-weight: 500; font-size: 12px; }
.arena-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
/* Keep the casual play controls in a tidy centered column even though the
   card is wide enough for the arena grid. */
#screen-menu .field,
#screen-menu .mode-toggle,
#screen-menu #btnCreate,
#screen-menu .join-row,
#screen-menu #btnRefresh,
#screen-menu #roomList,
#screen-menu .divider { max-width: 420px; margin-left: auto; margin-right: auto; }
.arena-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: #102234; box-shadow: inset 0 0 0 1.5px rgba(79,140,255,.3);
  transition: transform .08s, box-shadow .15s, background .15s;
}
.arena-card:hover { background: #14304a; transform: translateY(-1px); }
.arena-card.locked { opacity: .45; cursor: not-allowed; }
.arena-card .ac-main { display: flex; flex-direction: column; gap: 2px; }
.arena-card .ac-name { font-weight: 700; }
.arena-card .ac-mode { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.arena-card .ac-stakes { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.arena-card .ac-fee { color: var(--gold); }
.arena-card .ac-arrow { color: var(--muted); }
.arena-card .ac-prize { color: #36c275; }
.arena-list .empty { color: var(--muted); text-align: center; padding: 8px; }

.prize-win { color: #36c275; font-weight: 800; }
.prize-lose { color: var(--muted); font-weight: 600; }

/* ===================== leaderboard ===================== */
#btnLeaderboard { color: var(--gold); box-shadow: inset 0 0 0 1.5px rgba(255,211,77,.4); }

.lb-card {
  width: min(460px, 92vw); max-height: 80vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid #243340; border-radius: 18px;
  padding: 20px; box-shadow: var(--shadow);
}
.lb-head { display: flex; align-items: center; justify-content: space-between; }
.lb-head h2 { margin: 0; font-size: 22px; }
.lb-sub { margin: 2px 0 12px; color: var(--muted); font-size: 13px; }
.lb-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; display: grid; gap: 6px; }
.lb-row {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; background: #102234; font-size: 14px;
}
.lb-row.top3 { box-shadow: inset 0 0 0 1.5px rgba(255,211,77,.45); }
.lb-row .lb-rank { font-weight: 800; text-align: center; }
.lb-row .lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-won { color: var(--gold); font-weight: 700; }
.lb-row .lb-wg { color: var(--muted); font-size: 12px; }
.lb-list .empty { color: var(--muted); text-align: center; padding: 16px; }
.lb-mine { margin: 12px 0 0; text-align: center; color: var(--accent); font-weight: 700; }

/* ===================== store ===================== */
.wallet-bar .balances { display: flex; gap: 16px; align-items: center; }
.wallet-bar .wallet-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.wallet-bar .gem { filter: drop-shadow(0 0 4px rgba(120,200,255,.6)); }
#btnStore { color: #7fd1ff; box-shadow: inset 0 0 0 1.5px rgba(120,200,255,.4); }

.store-card { width: min(560px, 94vw); }
.store-balances {
  display: flex; gap: 20px; justify-content: center; font-weight: 800; font-size: 18px;
  margin: 2px 0 8px; color: var(--gold);
}
.store-balances .gem { filter: drop-shadow(0 0 4px rgba(120,200,255,.6)); }
.store-grid {
  list-style: none; padding: 0; margin: 0 0 8px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
}
.pack {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; border-radius: 14px; background: #102234;
  box-shadow: inset 0 0 0 1.5px rgba(79,140,255,.3);
}
.pack.locked { opacity: .6; }
.pack .pk-top { font-weight: 800; font-size: 18px; color: var(--gold); }
.pack .pk-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.pack .pk-buy { width: 100%; margin-top: 4px; }

/* ===================== free rewards ===================== */
#btnRewards { color: #36c275; box-shadow: inset 0 0 0 1.5px rgba(54,194,117,.4); }
.rewards-card { width: min(440px, 94vw); }
.reward-block {
  margin: 10px 0; padding: 14px; border-radius: 14px; background: #102234;
  box-shadow: inset 0 0 0 1.5px rgba(79,140,255,.2);
}
.reward-block .rb-title { font-weight: 800; margin-bottom: 8px; }
.reward-block .rb-streak { color: var(--muted); font-weight: 600; font-size: 13px; }
.daily-ladder {
  list-style: none; padding: 0; margin: 0 0 12px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px;
}
.daily-ladder .lad {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 10px; background: #0c1a28; font-size: 11px;
}
.daily-ladder .lad.current { box-shadow: inset 0 0 0 2px var(--gold); background: #15233a; }
.daily-ladder .lad-day { color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.daily-ladder .lad-amt { color: var(--gold); font-weight: 700; font-size: 12px; }

/* ===================== level / xp bar ===================== */
.level-bar { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.lvl-chip {
  flex: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800;
  color: #1a1300; background: var(--gold); white-space: nowrap;
}
.lvl-chip b { font-weight: 900; }
.xp-track {
  flex: 1; height: 10px; border-radius: 999px; background: #0c1a28; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.xp-fill {
  display: block; height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #36c275, #8be0a8); transition: width .4s ease;
}
.xp-text { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ===================== leaderboard v2 + friends ===================== */
#btnFriends { color: #7fd1ff; box-shadow: inset 0 0 0 1.5px rgba(120,200,255,.4); }
.lb-tabs { margin: 4px 0 10px; }
.lb-lastweek {
  background: #0c1a28; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px;
  box-shadow: inset 0 0 0 1.5px rgba(255,211,77,.25);
}
.lb-lastweek .lw-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.lb-lastweek .lw-row { display: inline-block; margin-right: 14px; font-size: 13px; font-weight: 600; }
.lb-lastweek .lw-row b { color: #7fd1ff; }
#lbReset { color: var(--gold); font-weight: 700; }

/* rows: flexible so both leaderboard (rank/lvl/name/won) and friends (lvl/name/btn) fit */
.lb-row { display: flex; align-items: center; gap: 10px; }
.lb-row.me { box-shadow: inset 0 0 0 2px var(--accent); }
.lb-row .lb-rank { flex: none; min-width: 34px; text-align: center; font-weight: 800; }
.lb-row .lb-lvl {
  flex: none; font-size: 11px; font-weight: 800; color: #1a1300; background: var(--gold);
  border-radius: 999px; padding: 2px 7px;
}
.lb-row .lb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-won { flex: none; color: var(--gold); font-weight: 700; }

.fr-code { text-align: center; margin: 4px 0 12px; color: var(--muted); }
.fr-code b { color: var(--gold); letter-spacing: 2px; font-size: 18px; margin: 0 6px; }
.fr-add { display: flex; gap: 8px; margin-bottom: 12px; }
.fr-add input { flex: 1; text-transform: uppercase; letter-spacing: 2px; }
.fr-remove { color: #ff7a59 !important; }

/* ===================== store tabs ===================== */
.store-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; justify-content: center; }
.store-tabs .store-tab { padding: 6px 10px; opacity: .6; }
.store-tabs .store-tab.is-active { opacity: 1; color: var(--gold); box-shadow: inset 0 0 0 1.5px rgba(255,211,77,.5); }
.pack.owned { box-shadow: inset 0 0 0 1.5px rgba(54,194,117,.5); }
.pack.owned .pk-buy { color: #36c275 !important; }

/* ===================== account ===================== */
#btnAccount { color: #c4b5fd; box-shadow: inset 0 0 0 1.5px rgba(167,139,250,.4); }
.account-card { width: min(420px, 92vw); }
.acc-section { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.acc-section .rb-title { font-weight: 800; }
.acc-section input { width: 100%; }

/* ===================== game type (Single / Classic) ===================== */
.game-type { margin: 2px 0 14px; }
.game-type .mode-btn { font-weight: 700; }
.classic-card {
  text-align: center; padding: 36px 18px; border-radius: 16px; background: #102234;
  box-shadow: inset 0 0 0 1.5px rgba(79,140,255,.3);
}
.classic-card .classic-emoji { font-size: 48px; }
.classic-card .classic-title { font-size: 22px; font-weight: 800; margin-top: 8px; }
.classic-card .classic-sub { color: var(--muted); margin: 8px 0 0; }
