:root {
  --bg: #12162e;
  --bg-2: #0c0f22;
  --card: #1b2144;
  --card-2: #232a55;
  --ink: #f3f5ff;
  --ink-dim: #a6adde;
  --line: #333c78;
  --p0: #ee3a44;   /* default Red  */
  --p1: #3a7bee;   /* default Blue */
  --spark: #7cf6ff;
  --spark-2: #fff27c;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-2);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
}
body { overflow: hidden; }

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ============ Pokéball decoration ============ */
.pokeball {
  width: 34px; height: 34px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 5px, #23232f 5px 8px, transparent 8px),
    linear-gradient(#ee3a44 0 48%, #23232f 48% 52%, #f6f7fb 52% 100%);
  border: 2px solid #23232f;
  display: inline-block; flex: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.pokeball.small { width: 22px; height: 22px; border-width: 1.5px;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 3px, #23232f 3px 5px, transparent 5px),
    linear-gradient(#ee3a44 0 48%, #23232f 48% 52%, #f6f7fb 52% 100%);
}

/* ============ SETUP ============ */
.setup {
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, #22306b 0, transparent 60%),
    radial-gradient(1200px 600px at 80% 110%, #3a1c46 0, transparent 60%),
    var(--bg-2);
  display: grid; place-items: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  overflow-y: auto;
}
.setup-card {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, var(--card), var(--bg));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.setup-logo { display: flex; align-items: center; gap: 12px; justify-content: center; }
.setup-logo h1 { margin: 0; font-size: 30px; letter-spacing: .5px; }
.setup-tagline { text-align: center; color: var(--ink-dim); margin: 8px 0 20px; font-size: 14px; }

.setup-players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; }
.setup-vs { align-self: center; font-weight: 900; color: var(--ink-dim); font-size: 13px; letter-spacing: 1px; padding-top: 26px; }
.setup-player label { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.setup-player .sp-name,
.sum-row input, .fld input, #searchInput {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 12px; padding: 12px; font-size: 16px; outline: none;
}
.setup-player .sp-name:focus, .sum-row input:focus, .fld input:focus, #searchInput:focus { border-color: var(--spark); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.swatch.sel { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 2px rgba(0,0,0,.4); }

.setup-sum { margin: 22px 0 8px; }
.setup-sum > label { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.sum-row { display: flex; align-items: center; gap: 8px; }
.sum-row .unit { color: var(--ink-dim); font-weight: 700; }
.sum-presets { display: flex; gap: 8px; margin-top: 10px; }
.sum-presets button {
  flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 8px; font-weight: 700;
}
.sum-presets button:active { transform: scale(.96); }

.btn-primary {
  width: 100%; border: none; border-radius: 14px; padding: 15px;
  background: linear-gradient(180deg, #ffd84d, #ffb020);
  color: #2a1a00; font-weight: 900; font-size: 16px;
  box-shadow: 0 8px 24px rgba(255,176,32,.35);
}
.btn-primary.big { margin-top: 18px; font-size: 18px; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { width: 100%; margin-top: 10px; background: transparent; border: 1px solid var(--line); color: var(--ink-dim); border-radius: 12px; padding: 12px; font-weight: 700; }
.btn-danger { width: 100%; background: #3a1420; border: 1px solid #7a2438; color: #ff9db0; border-radius: 12px; padding: 13px; font-weight: 800; }

/* ============ GAME ============ */
.game { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar {
  height: calc(52px + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 10px; padding-right: 10px;
  background: rgba(12,15,34,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); z-index: 20; flex: none;
}
.brand { font-weight: 900; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 20px; display: grid; place-items: center;
}
.icon-btn.add { background: linear-gradient(180deg, #ffd84d, #ffb020); color: #2a1a00; border: none; font-weight: 900; }
.icon-btn:active { transform: scale(.94); }
.icon-btn .btn-ico-sm { width: 22px; height: 22px; object-fit: contain; }
#backBtn { font-size: 26px; line-height: 1; font-weight: 900; }

.arena { flex: 1; display: flex; position: relative; min-height: 0; }

.side { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pc) 36%, var(--bg)) 0%,
    color-mix(in srgb, var(--pc) 12%, var(--bg)) 42%,
    var(--bg) 72%);
}
.side-head {
  padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--pc) 30%, var(--line));
}
.side-name-row { display: flex; align-items: center; gap: 8px; }
.complete-row { display: flex; }
.side-name { font-weight: 900; font-size: 19px; color: #fff; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 8px color-mix(in srgb, var(--pc) 60%, transparent); }

.wallet { display: flex; align-items: baseline; gap: 6px; }
.wallet-amount { font-size: clamp(26px, 8vw, 46px); font-weight: 900; line-height: 1; letter-spacing: -.5px;
  color: var(--pc); text-shadow: 0 0 20px color-mix(in srgb, var(--pc) 40%, transparent); }
.wallet-amount.negative { color: #ff6b6b; text-shadow: 0 0 20px rgba(255,107,107,.4); }
.wallet-unit { font-size: 14px; color: var(--ink-dim); font-weight: 700; white-space: nowrap; }
.wallet-meta { font-size: 11px; color: var(--ink-dim); }

/* A-Z strip */
.az-strip { display: flex; flex-wrap: wrap; gap: 2px; }
.az-cell {
  width: 15px; height: 15px; font-size: 8.5px; line-height: 15px; text-align: center;
  border-radius: 3px; color: var(--ink-dim); background: rgba(255,255,255,.04); font-weight: 700;
}
.az-cell.taken { background: var(--pc); color: #12162e; }

/* type strip (type-mode games) */
.type-strip { display: flex; flex-wrap: wrap; gap: 3px; }
.type-cell {
  padding: 2px 5px; font-size: 8.5px; line-height: 1.3; border-radius: 4px; font-weight: 800;
  color: var(--ink-dim); background: rgba(255,255,255,.05); text-transform: capitalize; opacity: .55;
}
.type-cell.taken { background: var(--tc); color: #12162e; opacity: 1; }

/* sort toggle */
.sort-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sort-label { font-size: 11px; color: var(--ink-dim); font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.sort-toggle { display: flex; background: rgba(0,0,0,.28); border-radius: 9px; padding: 2px; }
.sort-toggle button { border: none; background: transparent; color: var(--ink-dim); font-weight: 800; font-size: 11px; padding: 5px 9px; border-radius: 7px; }
.sort-toggle button.active { background: var(--pc); color: var(--pc-ink); }

.collection { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.collection::-webkit-scrollbar { width: 0; }
.empty-note { color: var(--ink); opacity: .8; text-align: center; font-size: 13px; margin-top: 30px; padding: 0 10px; line-height: 1.5; }

/* per-player add button (in that player's colour) */
.side-foot { flex: none; padding: 10px 10px calc(10px + var(--safe-b)); position: relative; z-index: 12; }
.side-add {
  width: 100%; border: none; border-radius: 14px; padding: 15px; font-weight: 900; font-size: 15px;
  background: var(--pc); color: var(--pc-ink);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--pc) 45%, transparent);
}
.side-add:active { transform: translateY(1px); }

.mon {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  background: color-mix(in srgb, var(--pc) 22%, var(--card));
  border: 1px solid color-mix(in srgb, var(--pc) 45%, var(--line)); border-radius: 14px;
  animation: pop .25s ease; cursor: pointer;
}
.mon:active { transform: scale(.98); }
.mon-chev { color: var(--ink-dim); font-size: 20px; font-weight: 700; flex: none; margin-left: -2px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.mon-img { width: 46px; height: 46px; flex: none; border-radius: 10px; background: rgba(0,0,0,.28) center/contain no-repeat; image-rendering: auto; display: grid; place-items: center; position: relative; }
.mon-img .letter-fallback { font-weight: 900; font-size: 20px; color: #fff; }
.mon-info { flex: 1; min-width: 0; }
.mon-name { font-weight: 800; font-size: 13.5px; text-transform: capitalize; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.mon-weight { font-size: 12px; color: var(--spark); font-weight: 700; white-space: nowrap; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.mon-letter { width: 17px; height: 17px; border-radius: 5px; background: var(--pc); color: var(--pc-ink); font-weight: 900; font-size: 10px; display: grid; place-items: center; flex: none; }
.mon-type { padding: 1px 6px; border-radius: 999px; background: var(--tc); color: #12162e; font-weight: 800; font-size: 9.5px; text-transform: capitalize; flex: none; }
.mon-amt { white-space: nowrap; }
.mon-del { background: transparent; border: none; color: var(--ink-dim); font-size: 15px; padding: 4px 2px; flex: none; align-self: flex-start; }
.mon-del:active { color: #ff6b6b; }

/* ============ Electric divider ============ */
.divider { position: absolute; left: 50%; top: 0; bottom: 0; width: 40px; transform: translateX(-50%);
  pointer-events: none; z-index: 10; display: grid; place-items: center; }
.divider .bolt { position: absolute; inset: 0; width: 100%; height: 100%; }
.bolt-glow { fill: none; stroke: var(--spark); stroke-width: 5; opacity: .28; filter: blur(3px);
  stroke-linecap: round; stroke-linejoin: round; }
.bolt-core { fill: none; stroke: #eaffff; stroke-width: 1.6; opacity: .85; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 3px var(--spark)); }
.vs-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%; background: #12162e; border: 2px solid var(--spark);
  display: grid; place-items: center; font-weight: 900; font-size: 12px; color: var(--spark);
  box-shadow: 0 0 14px color-mix(in srgb, var(--spark) 40%, transparent); z-index: 11;
}

/* ============ SHEETS ============ */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(4,6,16,.6); backdrop-filter: blur(2px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--card), var(--bg));
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(20px + var(--safe-b));
  box-shadow: 0 -20px 60px rgba(0,0,0,.55); animation: slideup .28s cubic-bezier(.2,.9,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; }

.buyer-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--ink-dim); }
.buyer-chip { flex: 1; border: 2px solid var(--line); background: var(--bg-2); color: var(--ink);
  border-radius: 12px; padding: 10px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buyer-chip.sel { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 22%, var(--bg-2)); color: #fff; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; background: var(--bg-2); padding: 4px; border-radius: 12px; }
.tab { flex: 1; background: transparent; border: none; color: var(--ink-dim); padding: 9px; border-radius: 9px; font-weight: 700; font-size: 14px; }
.tab.active { background: var(--card-2); color: var(--ink); }

.fld { display: block; margin-bottom: 12px; }
.fld span { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 6px; font-weight: 700; }
.search-status { font-size: 13px; color: var(--ink-dim); min-height: 18px; margin: 10px 2px; }

/* manual type picker */
.manual-types .type-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.type-chip { border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-dim);
  border-radius: 999px; padding: 6px 11px; font-weight: 800; font-size: 12px; text-transform: capitalize; }
.type-chip.sel { background: var(--tc); color: #12162e; border-color: var(--tc); }
.type-chip:active { transform: scale(.95); }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.res {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.res:active { transform: scale(.95); border-color: var(--spark); }
.res img { width: 64px; height: 64px; object-fit: contain; background: var(--bg-2); border-radius: 10px; }
.res .rn { font-size: 12px; font-weight: 800; text-transform: capitalize; line-height: 1.1; }
.res .rw { font-size: 11px; color: var(--spark); font-weight: 700; }
.res .rl { position: absolute; }
.skeleton { height: 120px; border-radius: 14px; background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============ menu players ============ */
.menu-info { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.menu-players { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.menu-player { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.menu-player .mp-top { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.menu-player .mp-name { flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 10px; font-size: 15px; font-weight: 700; }
.menu-player .mp-sum-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.menu-player .mp-sum-row label { font-size: 12px; color: var(--ink-dim); font-weight: 700; }
.menu-player .mp-sum { width: 110px; background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 8px; }
.menu-actions { margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }
.menu-hint { color: var(--ink-dim); font-size: 12px; text-align: center; margin: 14px 0 0; }

/* ============ update banner ============ */
.update-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(60px + var(--safe-t)); z-index: 70;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, #ffd84d, #ffb020); color: #2a1a00;
  padding: 7px 8px 7px 14px; border-radius: 999px; font-weight: 800; font-size: 13px;
  box-shadow: 0 12px 34px rgba(0,0,0,.5); border: 1px solid rgba(0,0,0,.15);
  animation: dropin .3s ease; max-width: 92vw;
}
.update-banner .ub-dot { width: 8px; height: 8px; border-radius: 50%; background: #2a1a00; flex: none; animation: pulse 1.3s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.update-banner button { border: none; background: #12162e; color: #fff; font-weight: 800; border-radius: 999px; padding: 7px 14px; font-size: 13px; white-space: nowrap; }
.update-banner button:active { transform: scale(.95); }
@keyframes dropin { from { transform: translate(-50%, -14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ============ toast ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%);
  background: #23232f; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 14px;
  z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.5); border: 1px solid var(--line); animation: toastIn .2s ease;
  max-width: 90vw; text-align: center;
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ============ setup language ============ */
.setup-lang { display: flex; gap: 8px; margin: 16px 0 2px; }
.setup-lang .lang-btn { flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 10px; padding: 10px; font-weight: 800; }
.setup-lang .lang-btn.active { background: var(--spark); color: #062a2e; border-color: var(--spark); }

/* ============ themed buy panel ============ */
.buy-panel { border-top: 3px solid var(--cc, var(--spark)); }
.buy-banner {
  display: flex; align-items: center; gap: 10px;
  margin: -16px -16px 14px; padding: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 60%, var(--bg)), color-mix(in srgb, var(--cc) 20%, var(--bg)));
  border-bottom: 1px solid color-mix(in srgb, var(--cc) 40%, var(--line));
  border-radius: 22px 22px 0 0;
}
.buy-banner h2 { flex: 1; margin: 0; font-size: 18px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.icon-btn.ghost { background: rgba(0,0,0,.28); border-color: rgba(255,255,255,.25); color: #fff; }
.buy-panel .tab.active { background: color-mix(in srgb, var(--cc) 34%, var(--card-2)); color: #fff; }
.buy-panel #searchInput:focus, .buy-panel .fld input:focus { border-color: var(--cc); }
.buy-panel .btn-primary { background: var(--cc); color: var(--cc-ink); box-shadow: 0 8px 24px color-mix(in srgb, var(--cc) 40%, transparent); }
.buy-panel .res:active { border-color: var(--cc); }

/* ============ detail sheet ============ */
.detail-panel { border-top: 3px solid var(--cc, var(--spark)); }
.detail-head { display: flex; justify-content: flex-end; margin: -4px -4px 2px; }
.d-hero {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 10px; border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 34%, var(--bg)), transparent);
}
.d-img { width: 108px; height: 108px; flex: none; border-radius: 16px; background: rgba(0,0,0,.28) center/contain no-repeat; display: grid; place-items: center; }
.d-img .letter-fallback { font-size: 46px; font-weight: 900; color: #fff; }
.d-name { font-size: 24px; font-weight: 900; text-transform: capitalize; }
.d-weight { color: var(--spark); font-weight: 800; margin-top: 4px; }
.d-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.d-k { width: 74px; color: var(--ink-dim); font-weight: 800; font-size: 13px; flex: none; }
.d-v { display: flex; gap: 6px; flex-wrap: wrap; font-weight: 700; }
.type-badge { text-transform: capitalize; color: #12162e; font-weight: 800; font-size: 12px; padding: 3px 11px; border-radius: 999px; }
.d-genus { margin-top: 10px; color: var(--ink-dim); font-style: italic; }
.d-fact { margin: 8px 0 4px; line-height: 1.5; }
.d-note { color: var(--ink-dim); }
.d-evo-label { margin: 16px 0 8px; font-weight: 800; color: var(--ink-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.evo-line { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.evo-stage { display: flex; flex-direction: column; gap: 6px; }
.evo { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 80px; color: var(--ink); }
.evo img { width: 58px; height: 58px; object-fit: contain; }
.evo span { font-size: 11px; font-weight: 700; text-transform: capitalize; }
.evo.cur { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 22%, var(--card)); }
.evo:not(.cur) { cursor: pointer; }
.evo:not(.cur):active { border-color: var(--spark); transform: scale(.96); }
.evo-arrow { color: var(--ink-dim); font-weight: 900; flex: none; }
.detail-foot { margin-top: 16px; }
.detail-panel .btn-primary { background: var(--cc); color: var(--cc-ink); }
.d-sk { height: 150px; border-radius: 14px; }

/* ============ menu sections / slider ============ */
.menu-section { margin-bottom: 16px; }
.menu-label { font-size: 12px; color: var(--ink-dim); font-weight: 800; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.seg { display: flex; gap: 6px; background: var(--bg-2); padding: 4px; border-radius: 12px; }
.seg button { flex: 1; background: transparent; border: none; color: var(--ink-dim); padding: 10px; border-radius: 9px; font-weight: 800; }
.seg button.active { background: var(--card-2); color: var(--ink); }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-end { font-size: 11px; color: var(--ink-dim); font-weight: 700; white-space: nowrap; }
#boltSlider { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: var(--line); outline: none; }
#boltSlider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--spark); border: 2px solid #062a2e; cursor: pointer; }
#boltSlider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--spark); border: 2px solid #062a2e; cursor: pointer; }

/* ============ side header extras ============ */
.complete-chip { background: var(--pc); color: var(--pc-ink); font-weight: 800; font-size: 10px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; flex: none; }
.gallery-btn { flex: none; width: 32px; height: 32px; border-radius: 9px; font-size: 15px; display: grid; place-items: center;
  background: rgba(0,0,0,.25); border: 1px solid color-mix(in srgb, var(--pc) 40%, var(--line)); color: #fff; }
.gallery-btn:active { transform: scale(.94); }

/* ============ completion confetti ============ */
.confetti { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; z-index: 5; pointer-events: none;
  animation-name: confettiFall; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(var(--rot)); opacity: 1; }
  100% { transform: translateY(115vh) rotate(calc(var(--rot) + 540deg)); opacity: .15; }
}
.celebrate-pop {
  position: absolute; top: 36%; left: 50%; transform: translate(-50%, -50%); z-index: 6;
  font-weight: 900; font-size: 18px; color: #fff; white-space: nowrap; pointer-events: none;
  background: color-mix(in srgb, var(--pc) 72%, #000); padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: popIn .4s cubic-bezier(.2,1.2,.3,1), fadeAway .5s ease 2s forwards;
}
@keyframes popIn { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes fadeAway { to { opacity: 0; } }

/* ============ collection gallery ============ */
.gallery {
  position: fixed; inset: 0; z-index: 35; display: flex; flex-direction: column;
  padding-top: var(--safe-t); animation: fade .2s ease;
  background:
    radial-gradient(1000px 520px at 50% -8%, color-mix(in srgb, var(--cc) 42%, var(--bg)) 0, transparent 62%),
    var(--bg-2);
}
.gallery-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid color-mix(in srgb, var(--cc) 30%, var(--line)); }
.gallery-head h2 { flex: 1; margin: 0; font-size: 20px; color: #fff; text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-grid { flex: 1; overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding-bottom: calc(20px + var(--safe-b)); }
.g-card { background: color-mix(in srgb, var(--cc) 18%, var(--card)); border: 1px solid color-mix(in srgb, var(--cc) 40%, var(--line)); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); }
.g-card:active { transform: scale(.97); }
.g-img { width: 100%; aspect-ratio: 1; border-radius: 12px; background: rgba(0,0,0,.28) center/contain no-repeat; display: grid; place-items: center; }
.g-img .letter-fallback { font-size: 42px; font-weight: 900; color: #fff; }
.g-name { font-weight: 800; text-transform: capitalize; font-size: 14px; text-align: center; line-height: 1.15; }
.g-sub { font-size: 12px; color: var(--spark); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.g-letter { width: 17px; height: 17px; border-radius: 5px; background: var(--cc); color: var(--cc-ink); font-weight: 900; font-size: 10px; display: grid; place-items: center; }
.g-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-dim); margin-top: 40px; }

/* ============ games list ============ */
.games {
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, #22306b 0, transparent 60%),
    radial-gradient(1200px 600px at 80% 110%, #3a1c46 0, transparent 60%),
    var(--bg-2);
  display: flex; flex-direction: column;
  padding: calc(18px + var(--safe-t)) 16px calc(16px + var(--safe-b));
}
.games-head { text-align: center; margin-bottom: 16px; flex: none; }
.games-title { display: flex; align-items: center; justify-content: center; gap: 10px; }
.games-title h1 { margin: 0; font-size: 26px; letter-spacing: .5px; }
.games-ico { width: 34px; height: 34px; object-fit: contain; }
.games-sub { color: var(--ink-dim); font-size: 13px; margin: 6px 0 0; }

.games-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  max-width: 560px; width: 100%; margin: 0 auto; padding: 4px 2px; }
.games-list::-webkit-scrollbar { width: 0; }

.game-card {
  position: relative; display: flex; align-items: stretch;
  background: linear-gradient(180deg, var(--card), var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,.35); overflow: hidden;
}
.gc-open { flex: 1; min-width: 0; text-align: left; background: transparent; border: none;
  color: var(--ink); padding: 14px 44px 14px 14px; display: flex; flex-direction: column; gap: 9px; }
.gc-open:active { background: rgba(255,255,255,.03); }
.gc-players { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 900; font-size: 17px; }
.gc-p { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.gc-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.gc-pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.gc-vs { color: var(--ink-dim); font-size: 12px; font-weight: 800; }
.gc-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.gc-meta { font-size: 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 4px; }
.gc-crown { width: 14px; height: 14px; object-fit: contain; vertical-align: -2px; }
.gc-del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 9px;
  background: rgba(0,0,0,.3); border: 1px solid var(--line); color: var(--ink-dim); font-size: 14px; }
.gc-del:active { color: #ff6b6b; transform: scale(.94); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); white-space: nowrap; }
.badge img { width: 14px; height: 14px; object-fit: contain; }
.badge-cur { background: color-mix(in srgb, #ffb020 18%, var(--bg-2)); border-color: #7a5a1e; color: #ffd88a; }
.badge-mode.letter { background: color-mix(in srgb, #3a7bee 20%, var(--bg-2)); border-color: #2a4f9a; color: #a9c6ff; }
.badge-mode.type   { background: color-mix(in srgb, #b45cff 20%, var(--bg-2)); border-color: #6a3aa0; color: #dcb8ff; }

.games-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--ink-dim); text-align: center; }
.games-empty img { width: 72px; height: 72px; object-fit: contain; opacity: .8; }
.games-empty p { margin: 0; font-size: 15px; line-height: 1.5; }

.games-foot { flex: none; max-width: 560px; width: 100%; margin: 14px auto 0; }
.btn-ico { width: 22px; height: 22px; object-fit: contain; vertical-align: -4px; margin-right: 6px; }

/* ============ setup: back + currency/mode toggles ============ */
.setup-card { position: relative; }
.setup-back { position: absolute; top: 14px; left: 14px; background: transparent; border: 1px solid var(--line);
  color: var(--ink-dim); border-radius: 10px; padding: 6px 12px; font-weight: 800; font-size: 13px; }
.setup-back:active { transform: scale(.96); }

.setup-choice { margin: 18px 0 0; }
.setup-choice > label { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.choice-toggle { display: flex; gap: 8px; background: var(--bg-2); padding: 5px; border-radius: 14px; border: 1px solid var(--line); }
.choice-toggle button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: none; color: var(--ink-dim); font-weight: 800; font-size: 14px;
  padding: 11px 8px; border-radius: 10px;
}
.choice-toggle button img { width: 20px; height: 20px; object-fit: contain; }
.choice-toggle button small { color: var(--ink-dim); font-weight: 700; font-size: 11px; }
.choice-toggle button.active { background: linear-gradient(180deg, var(--card-2), var(--card)); color: var(--ink); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.choice-toggle button.active small { color: var(--spark); }

/* ============ desktop niceties ============ */
@media (min-width: 720px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 22px; border-bottom: 1px solid var(--line); max-height: 80vh; }
  .collection { padding: 14px; }
}
