/* =====================================================================
   WORM RAID — theme (see design-docs/worm-raid.html)
   Fonts: Bebas Neue (display) · Rajdhani (UI) · Russo One (numbers)
   ===================================================================== */
:root {
  --bg-0: #020712;
  --bg-1: #071525;
  --ink: #f5fbff;
  --muted: #a8bdd0;
  --mint: #b7ff00;
  --mint-2: #57d600;
  --cyan: #00d7ff;
  --blue: #0077ff;
  --pink: #ff344d;
  --gold: #ffcb2e;
  --stroke: rgba(0, 215, 255, 0.36);
  --panel: rgba(4, 14, 25, 0.72);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  font-synthesis: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  font-family: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}

#game {
  position: fixed; inset: 0;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

#statsBL {
  position: absolute;
  right: 12px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
#statsBL .statRow { display: flex; gap: 8px; align-items: stretch; }
#brStats {
  position: absolute;
  right: 14px;
  top: 174px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.stat.srow {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 13px;
}
.stat.srow span { font-size: 16px; }
.sic { width: 16px; height: 16px; flex-shrink: 0; }
#aliveBox .sic { fill: var(--cyan); }
#killsBox .sic { fill: var(--pink); }
.stat {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 6px 13px;
  text-align: center;
  min-width: 74px;
  backdrop-filter: blur(6px);
}
.stat span {
  display: block;
  font-family: "Russo One", sans-serif;
  color: var(--cyan);
  font-size: 19px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span.drain { color: var(--pink); }
.stat label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 2.5px;
  font-weight: 700;
}

#zoneMsg {
  position: absolute; top: 74px; left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 203, 46, 0.5);
  white-space: nowrap;
}
#zoneMsg.danger { color: var(--pink); animation: pulse 0.8s infinite; }

#powerMsg {
  position: absolute; top: 98px; left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 14px currentColor;
  white-space: nowrap;
}
@keyframes pulse { 50% { opacity: 0.45; } }

#killMsg {
  position: absolute; top: 24%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(30px, 6.5vw, 52px);
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 26px rgba(255, 203, 46, 0.7), 0 3px 0 rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
#killMsg .sub {
  display: block;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 0.38em;
  letter-spacing: 5px;
  color: var(--pink);
  text-shadow: 0 0 16px rgba(255, 52, 77, 0.6);
}
#killMsg.pop { animation: killpop 0.5s ease-out; }
@keyframes killpop {
  0% { transform: translate(-50%, -50%) scale(1.9); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#countdown {
  position: absolute; top: 36%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
#countNum {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(96px, 20vw, 170px);
  line-height: 1;
  background: linear-gradient(180deg, #ffffff, #c8ff55 55%, var(--mint-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 34px rgba(183, 255, 0, 0.55));
}
#countNum.pop { animation: countpop 0.45s ease-out; }
@keyframes countpop {
  0% { transform: scale(1.7); opacity: 0.2; }
  100% { transform: scale(1); opacity: 1; }
}
#countSub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
}

#feed {
  position: absolute; top: 236px; left: 12px;
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-start;
  max-width: 52vw;
}
#feed .entry {
  background: var(--panel);
  border: 1px solid rgba(0, 215, 255, 0.15);
  border-radius: 8px;
  padding: 4px 10px;
  color: #d5e8f5;
  font-size: 12.5px;
  font-weight: 600;
  animation: feedfade 4s forwards;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#feed .entry b { color: var(--cyan); }
#feed .entry.me b { color: var(--mint); }
@keyframes feedfade {
  0% { opacity: 0; transform: translateX(-14px); }
  6% { opacity: 1; transform: none; }
  82% { opacity: 1; }
  100% { opacity: 0; }
}

#minimap {
  position: absolute; right: 14px; top: 12px;
  width: 150px; height: 150px;
  opacity: 0.92;
}

#muteBtn {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: #d5e8f5;
  font-size: 16px;
  width: 44px;
  cursor: pointer;
}

/* in-match free-play board */
#board {
  position: absolute; top: 12px; left: 12px; right: auto; bottom: auto;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 176px;
  font-size: 12.5px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
#board .btitle {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 2.5px;
  font-weight: 700;
  margin-bottom: 5px;
  text-align: center;
  text-transform: uppercase;
}
#board .brow {
  display: flex;
  gap: 8px;
  color: #d5e8f5;
  font-weight: 600;
  line-height: 1.65;
  white-space: nowrap;
}
#board .brow .rank { width: 22px; color: var(--muted); font-weight: 700; }
#board .brow .name { flex: 1; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
#board .brow .mass { font-family: "Russo One", sans-serif; font-size: 11.5px; color: var(--cyan); font-variant-numeric: tabular-nums; }
#board .brow.me, #board .brow.me .rank, #board .brow.me .mass { color: var(--mint); }
#board .bsep { border-top: 1px dashed rgba(0, 215, 255, 0.3); margin: 4px 0; }



/* ---------- Overlays (menus get the full aurora treatment) ---------- */
.overlay {
  position: fixed; inset: 0;
  z-index: 10;
  display: flex; justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background:
    radial-gradient(1100px 800px at 82% -10%, rgba(0, 215, 255, 0.25), transparent 55%),
    radial-gradient(900px 700px at 8% 108%, rgba(183, 255, 0, 0.16), transparent 55%),
    radial-gradient(800px 600px at 50% 40%, rgba(0, 215, 255, 0.10), transparent 60%),
    linear-gradient(160deg, rgba(7, 21, 37, 0.96), rgba(2, 7, 18, 0.97) 62%);
  backdrop-filter: blur(4px);
}
.overlay::before { /* faint grid */
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(120, 110, 220, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 110, 220, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 85%);
}
.overlay::after { /* dot sparkle */
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: radial-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at 50% 18%, #000, transparent 70%);
}
.panel {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 22px 22px 34px;
  max-width: 460px;
  width: calc(100% - 32px);
  margin: auto;
}

/* ---------- Home / brand ---------- */
.worm-logo {
  display: block;
  width: min(300px, 78%);
  margin: 2px auto 6px;
  filter: drop-shadow(0 0 24px rgba(0, 215, 255, 0.5)) drop-shadow(0 14px 22px rgba(0, 0, 0, 0.65));
}
.tag {
  color: #d9e9f2;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(0, 215, 255, 0.5);
  margin: 0 0 16px;
}

#nameInput {
  display: block;
  margin: 0 auto 6px;
  width: min(320px, 100%);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--stroke);
  background: rgba(8, 5, 24, 0.75);
  color: var(--ink);
  font-family: "Russo One", sans-serif;
  font-size: 19px;
  text-align: center;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 6px 20px rgba(0, 0, 0, 0.35);
}
#nameInput:focus { border-color: var(--mint); box-shadow: 0 0 18px rgba(183, 255, 0, 0.25); }

.pickLabel {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.34em;
  font-weight: 700;
  text-transform: uppercase;
  margin: 14px 0 10px;
}
#facePick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 6px 10px;
  margin: 0 auto 16px;
  max-width: 420px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#facePick::-webkit-scrollbar { display: none; }
#facePick button { flex: 0 0 auto; scroll-snap-align: center; }
#facePick button {
  width: 62px; height: 76px;
  background: radial-gradient(circle at 30% 20%, rgba(60, 40, 120, 0.45), rgba(12, 8, 32, 0.85));
  border: 2px solid rgba(140, 120, 255, 0.28);
  border-radius: 16px;
  cursor: pointer;
  padding: 3px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
#facePick button:hover { transform: translateY(-3px); border-color: rgba(0, 215, 255, 0.6); }
#facePick button.selected {
  border-color: #3bf58a;
  box-shadow: 0 0 0 3px rgba(59, 245, 138, 0.3), 0 0 24px rgba(59, 245, 138, 0.6);
  transform: translateY(-2px) scale(1.07);
}

/* big mode buttons */
#modeBtns { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.modeBtn {
  pointer-events: auto;
  position: relative;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 20px;
  padding: 15px 20px;
  cursor: pointer;
  font-family: "Rajdhani", sans-serif;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.28), 0 18px 34px rgba(0, 0, 0, 0.45);
}
.modeBtn:active { transform: translateY(6px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28), 0 10px 20px rgba(0, 0, 0, 0.4); }
.modeBtn::after {
  content: "";
  position: absolute; left: 14px; right: 14px; top: 7px; height: 38%;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent);
  opacity: 0.6;
  pointer-events: none;
}
.modeBtn .mtitle {
  display: block;
  font-family: "Bebas Neue", sans-serif;
  font-size: 36px;
  letter-spacing: 0.03em;
  line-height: 1;
}
.modeBtn .mdesc {
  display: block;
  position: relative; z-index: 1;
  font-weight: 700;
  font-size: 14px;
  opacity: 0.82;
  margin-top: 3px;
}
.modeBtn .btag {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.22);
  padding: 5px 10px;
  border-radius: 999px;
}
.modeBtn.royale { background: linear-gradient(180deg, #e9ff6d, var(--mint) 38%, var(--mint-2)); color: #102000; }
.modeBtn.free { background: linear-gradient(180deg, #9af3ff, var(--cyan) 42%, var(--blue)); color: #021827; }

.midRow { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
button.mid {
  pointer-events: auto;
  width: 100%;
  padding: 13px;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(12, 8, 34, 0.6);
  border: 1.5px solid var(--stroke);
  border-radius: 16px;
  cursor: pointer;
  transition: 0.18s;
  backdrop-filter: blur(6px);
}
button.mid:hover { border-color: var(--cyan); box-shadow: 0 0 22px rgba(37, 208, 255, 0.35); color: #eafcff; }

#netMsg {
  margin-top: 10px;
  color: #ff8ba0;
  font-size: 13px;
  font-weight: 600;
  min-height: 16px;
}

.controls {
  margin-top: 16px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
  font-weight: 600;
  background: rgba(10, 6, 28, 0.4);
  border: 1px solid rgba(120, 110, 220, 0.16);
  border-radius: 16px;
  padding: 11px 14px;
}
.controls b { color: #dcd6ff; }
.controls .hint { font-size: 12.5px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 11px; }
.p-speed { color: #25d0ff; background: rgba(37, 208, 255, 0.14); }
.p-rage { color: #ff5c7a; background: rgba(255, 92, 122, 0.14); }
.p-shield { color: #ff9e2e; background: rgba(255, 158, 46, 0.14); }
.p-ghost { color: #cdb4ff; background: rgba(205, 180, 255, 0.14); }

.alpha {
  margin-top: 14px;
  color: rgba(140, 170, 200, 0.4);
  font-size: 10px;
  letter-spacing: 3px;
  font-weight: 700;
}

/* ---------- Match summary (end screen) ---------- */
.endPanel { max-width: 430px; }
.go-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 10px;
}
.result {
  border-radius: 26px;
  padding: 22px 18px 20px;
  background: linear-gradient(180deg, rgba(24, 14, 58, 0.7), rgba(10, 6, 26, 0.7));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

h2 {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(52px, 12vw, 70px);
  line-height: 0.9;
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, #ffffff, var(--pink) 72%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 20px rgba(255, 59, 92, 0.5));
}
h2.win {
  background: linear-gradient(180deg, #ffffff, var(--gold) 72%);
  filter: drop-shadow(0 0 24px rgba(255, 203, 46, 0.55));
}

#newHigh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
  color: #3a2a05;
  padding: 7px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe27a, var(--gold));
  box-shadow: 0 0 22px rgba(255, 203, 46, 0.5);
}

#endPlace { margin-top: 6px; }
#endPlace .placeNum {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(88px, 22vw, 118px);
  line-height: 0.85;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #ffffff, #c8ff55 65%, var(--mint-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 26px rgba(59, 245, 138, 0.55));
  animation: placein 0.5s ease-out;
}
#endPlace .placeNum.gold {
  background: linear-gradient(180deg, #ffffff, #ffe27a 55%, var(--gold));
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 0 30px rgba(255, 203, 46, 0.6));
}
#endPlace .placeSub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  margin-top: 4px;
}
@keyframes placein {
  0% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.tile {
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  background: rgba(10, 6, 28, 0.6);
  border: 1px solid var(--stroke);
}
.tile .t-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile .t-val { font-family: "Russo One", sans-serif; font-size: 27px; margin-top: 4px; }
.tile .t-val.mint { color: var(--mint); text-shadow: 0 0 18px rgba(183, 255, 0, 0.4); }

.sumRows { margin-top: 10px; }
.sumRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  margin-bottom: 6px;
  background: rgba(10, 6, 28, 0.5);
  border: 1px solid rgba(120, 110, 220, 0.2);
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  animation: rowin 0.4s ease-out forwards;
}
.sumRow .si { width: 22px; text-align: center; }
.sumRow .sl { flex: 1; text-align: left; color: #d5e8f5; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11.5px; }
.sumRow .sx { font-family: "Russo One", sans-serif; font-size: 14px; color: var(--gold); font-variant-numeric: tabular-nums; }
@keyframes rowin {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: none; }
}

.stats3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  border-radius: 16px;
  padding: 12px 8px;
  background: rgba(10, 6, 28, 0.5);
  border: 1px solid rgba(120, 110, 220, 0.2);
}
.stats3 .st { text-align: center; }
.stats3 .s-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stats3 .s-val { font-family: "Russo One", sans-serif; font-size: 19px; color: var(--cyan); margin-top: 3px; }

#endRank {
  margin-top: 14px;
  color: #c9c0f2;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 13.5px;
  min-height: 17px;
}
.bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(10, 6, 28, 0.8);
  border: 1px solid rgba(120, 110, 220, 0.25);
  margin: 10px auto 0;
  max-width: 340px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
  box-shadow: 0 0 14px rgba(59, 245, 138, 0.6);
  transition: width 0.8s ease;
}

button.big {
  pointer-events: auto;
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  font-family: "Bebas Neue", sans-serif;
  font-size: 38px;
  letter-spacing: 0.04em;
  color: #102000;
  background: linear-gradient(180deg, #e9ff6d, var(--mint) 38%, var(--mint-2));
  border: none;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.28), 0 18px 34px rgba(0, 0, 0, 0.45);
  transition: transform 0.1s;
  position: relative;
}
button.big::after {
  content: "";
  position: absolute; left: 14px; right: 14px; top: 7px; height: 36%;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent);
  opacity: 0.6;
  pointer-events: none;
}
button.big:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28), 0 10px 20px rgba(0, 0, 0, 0.4); }
button.big .bsub {
  display: block;
  font-family: "Rajdhani", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: -4px;
}
#menuBtn { margin-top: 12px; }

/* ---------- Leaderboards ---------- */
.lbTitle {
  font-family: "Bebas Neue", sans-serif !important;
  font-size: 46px !important;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffffff, #ffe27a 55%, var(--gold));
  -webkit-background-clip: text !important; background-clip: text !important; color: transparent !important;
  filter: drop-shadow(0 0 22px rgba(255, 203, 46, 0.45)) !important;
  margin-bottom: 12px;
}
#lbTabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(10, 6, 30, 0.7);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
  margin-bottom: 14px;
}
.lbTab {
  pointer-events: auto;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 12.5px;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.lbTab.sel {
  color: #06121c;
  background: linear-gradient(180deg, #8affc4, var(--mint) 40%, var(--mint-2));
  box-shadow: 0 0 18px rgba(59, 245, 138, 0.5);
}
#lbList {
  max-width: 350px;
  margin: 0 auto 16px;
  text-align: left;
  font-size: 13.5px;
  background: rgba(10, 6, 26, 0.55);
  border: 1px solid rgba(120, 110, 220, 0.2);
  border-radius: 16px;
  padding: 10px;
}
#lbList .lrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  color: #d5e8f5;
  font-weight: 600;
  line-height: 1.55;
}
#lbList .lrow:nth-child(odd) { background: rgba(0, 215, 255, 0.05); }
#lbList .lrow .rank { width: 32px; color: var(--muted); font-weight: 700; }
#lbList .lrow .face { width: 24px; text-align: center; }
#lbList .lrow .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lbList .lrow .score { font-family: "Russo One", sans-serif; font-size: 12.5px; color: var(--cyan); font-variant-numeric: tabular-nums; }
#lbList .lrow.me { background: rgba(183, 255, 0, 0.1); color: var(--mint); }
#lbList .lrow.me .rank, #lbList .lrow.me .score { color: var(--mint); }
#lbList .lsep { border-top: 1px dashed rgba(0, 215, 255, 0.3); margin: 6px 0; }
#lbList .lempty { color: var(--muted); text-align: center; padding: 12px 0; font-weight: 600; }


/* ---------- special slot (Mario Kart style deploy button) ---------- */
#specialBtn {
  --sp: #6f87a8;
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: 92px; height: 92px;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: radial-gradient(circle at 30% 25%, rgba(28, 20, 64, 0.85), rgba(8, 5, 24, 0.92));
  border: 3px dashed rgba(120, 140, 170, 0.4);
  color: var(--muted);
  touch-action: manipulation;
  transition: border-color 0.2s, box-shadow 0.2s;
  z-index: 6;
}
#specialBtn .spIcon { font-size: 32px; line-height: 1; }
#specialBtn .spName {
  font-family: "Rajdhani", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
#specialBtn.filled {
  border: 3px solid var(--sp);
  color: var(--sp);
  box-shadow: 0 0 26px var(--sp), inset 0 0 18px rgba(255, 255, 255, 0.08);
  animation: sppulse 1.6s ease-in-out infinite;
}
#specialBtn.filled .spName { color: #f5fbff; text-shadow: 0 0 10px var(--sp); }
#specialBtn.pop { animation: sppop 0.45s ease-out, sppulse 1.6s ease-in-out 0.45s infinite; }
#specialBtn:active { transform: translateX(-50%) scale(0.92); }
@keyframes sppop {
  0% { transform: translateX(-50%) scale(1.6); }
  100% { transform: translateX(-50%) scale(1); }
}
@keyframes sppulse {
  0%, 100% { box-shadow: 0 0 18px var(--sp); }
  50% { box-shadow: 0 0 34px var(--sp); }
}
@media (max-width: 700px) {
  #minimap { right: 10px; top: 10px; width: 110px; height: 110px; }
  #brStats { right: 10px; top: 128px; }
  #board { left: 10px; top: 10px; }
  #feed { left: 10px; top: 228px; }
}

/* image head faces */
#facePick button { overflow: hidden; }
#facePick button img { width: 100%; height: 100%; object-fit: contain; display: block; }
.faceImg { width: 22px; height: 22px; vertical-align: -5px; }
#lbList .lrow .face .faceImg { width: 22px; height: 22px; }

/* power icon art */
#specialBtn .spIcon { height: 46px; display: flex; align-items: center; justify-content: center; }
#specialBtn .spIcon img { width: 46px; height: 46px; }
.pmIcon { width: 22px; height: 22px; vertical-align: -5px; }

/* ---------- How To Play ---------- */
.howPanel { max-width: 440px; }
.howCard {
  text-align: left;
  background: rgba(10, 6, 26, 0.55);
  border: 1px solid rgba(120, 110, 220, 0.22);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.howHead {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: center;
}
.howRow {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #d5e8f5;
  font-weight: 600;
}
.howRow:last-child { margin-bottom: 0; }
.howRow .hIcon { font-size: 20px; width: 44px; text-align: center; flex-shrink: 0; }
.howRow .hPw { width: 44px; height: 44px; flex-shrink: 0; }
.howRow kbd {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11.5px;
}
.hMode {
  flex-shrink: 0;
  width: 92px;
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 17px;
  letter-spacing: 0.05em;
  border-radius: 8px;
  padding: 4px 2px;
  margin-top: 2px;
}
.hMode.mint { background: linear-gradient(180deg, #e9ff6d, var(--mint) 45%, var(--mint-2)); color: #102000; }
.hMode.blue { background: linear-gradient(180deg, #9af3ff, var(--cyan) 45%, var(--blue)); color: #021827; }
.howNote { font-size: 13px; color: var(--muted); font-weight: 600; line-height: 1.55; margin-bottom: 10px; }
.howCard .howNote:last-child { margin-bottom: 0; }
.c-speed { color: #25d0ff; }
.c-rage { color: #ff5c7a; }
.c-ghost { color: #cdb4ff; }
.c-shield { color: #ff9e2e; }

.copyright {
  margin-top: 6px;
  color: rgba(140, 170, 200, 0.35);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* modal-style popup: menu stays visible behind a dim backdrop */
.overlay.modal {
  background: rgba(2, 7, 18, 0.7);
  backdrop-filter: blur(5px);
}
.overlay.modal::before, .overlay.modal::after { display: none; }
.overlay.modal .howPanel {
  background: linear-gradient(180deg, rgba(24, 14, 58, 0.95), rgba(10, 6, 26, 0.97));
  border: 1px solid var(--stroke);
  border-radius: 26px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 20px 16px 22px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  animation: modalin 0.35s ease;
}
@keyframes modalin {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: none; }
}
#howClose.playCta { font-size: 32px; padding: 10px; margin-top: 6px; }

#board .brow .bk {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--pink);
  font-weight: 700;
  font-size: 11px;
  width: 30px;
}
#board .brow .bk svg { width: 11px; height: 11px; fill: var(--pink); }

/* stopwatch countdown on the special slot */
#specialBtn .spIcon, #specialBtn .spName { position: relative; z-index: 1; }
.spCount {
  font-family: "Bebas Neue", sans-serif;
  font-size: 46px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 16px var(--sp);
  display: block;
}
.spCount.tick { animation: sptick 0.5s ease-out; }
@keyframes sptick {
  0% { transform: scale(1.55); }
  100% { transform: scale(1); }
}
#specialBtn.counting::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(var(--sp) var(--pct, 100%), rgba(120, 140, 170, 0.15) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}
#specialBtn .spHeld {
  position: absolute;
  top: -7px; right: -7px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(8, 5, 24, 0.92);
  border: 2px solid rgba(120, 140, 170, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
#specialBtn .spHeld img { width: 21px; height: 21px; }

/* boost stamina bar — floats just above the deploy slot */
#boostBar {
  position: absolute;
  left: 50%;
  bottom: calc(122px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: 150px;
  height: 9px;
  border-radius: 999px;
  background: rgba(8, 5, 24, 0.8);
  border: 1px solid rgba(0, 215, 255, 0.35);
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}
#boostBar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
  box-shadow: 0 0 10px rgba(0, 215, 255, 0.6);
  transition: width 0.12s linear;
}
#boostBar.low i { background: linear-gradient(90deg, #ff9e2e, #ff344d); box-shadow: 0 0 10px rgba(255, 84, 60, 0.6); }
#boostBar.locked { animation: pulse 0.7s infinite; }

#lbCaption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 2px 0 10px;
}

/* ---------- Accounts ---------- */
#guestRow { margin: 2px 0 10px; }
#loginLink {
  background: none;
  border: none;
  color: var(--cyan);
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 4px 8px;
}
#loginLink:hover { text-decoration: underline; }
#authedRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 10px;
  flex-wrap: wrap;
}
.authedAs { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }
.authedAs b { color: var(--mint); letter-spacing: 0.05em; }
.chipBtn {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: #d5e8f5;
  font-family: "Rajdhani", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 12px;
  cursor: pointer;
}
.chipBtn:hover { border-color: var(--cyan); color: var(--cyan); }

.authPanel { max-width: 360px; }
.authInput {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  background: rgba(8, 5, 24, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: #eaf6ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  outline: none;
}
.authInput:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(0, 215, 255, 0.18); }
.authInput:disabled { opacity: 0.55; }
.authInput.code {
  text-align: center;
  font-family: "Russo One", monospace;
  font-size: 22px;
  letter-spacing: 0.5em;
}
.authInput.soc { padding: 9px 14px; font-size: 13.5px; }
.authCta { font-size: 26px; padding: 8px; margin: 2px 0 6px; }
.linkBtn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--muted);
  font-family: "Rajdhani", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 7px;
}
.linkBtn b { color: var(--cyan); }
.linkBtn:hover b { text-decoration: underline; }
.orRow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 8px 0;
}
.orRow::before, .orRow::after { content: ""; flex: 1; height: 1px; background: var(--stroke); }
.ssoBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 8px;
  padding: 11px;
  border-radius: 12px;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}
.ssoBtn .ssoIc { width: 18px; height: 18px; }
.ssoBtn.apple { background: #000; color: #fff; border-color: #333; }
.ssoBtn.apple .ssoIc { fill: #fff; }
.ssoBtn.google { background: #fff; color: #1a1a1a; }
.ssoBtn:hover { filter: brightness(1.12); }
#authMsg, #profMsg {
  min-height: 18px;
  margin: 0 0 8px;
  color: var(--pink);
  font-size: 13px;
  font-weight: 700;
}
#authMsg.ok, #profMsg.ok { color: var(--mint); }
.authNote { color: #d5e8f5; font-size: 13.5px; font-weight: 600; margin: 0 0 12px; line-height: 1.5; }
.authNote b { color: var(--cyan); }
.pfLabel {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  margin: 6px 0 8px;
}
.overlay.busy { pointer-events: none; opacity: 0.75; }
.big.gold {
  background: linear-gradient(180deg, #ffe28a, var(--gold) 45%, #d99b00);
  color: #241a00;
  box-shadow: 0 10px 28px rgba(255, 203, 46, 0.35);
}
.gchip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid rgba(140, 170, 200, 0.4);
  border-radius: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  vertical-align: 1px;
}

/* name required nudge */
#nameInput.nameNeed {
  border-color: var(--pink);
  box-shadow: 0 0 0 2px rgba(255, 52, 77, 0.25);
  animation: nameshake 0.35s ease;
}
#nameInput.nameNeed::placeholder { color: var(--pink); }
@keyframes nameshake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ---------- user chip + menu (top right of home) ---------- */
#userChip { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 40; }
#chipBtn {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  color: var(--mint);
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
}
#chipBtn:hover { border-color: var(--mint); }
#chipFace .faceImg { width: 26px; height: 26px; display: block; }
#chipBadge, #menuBadge {
  background: var(--pink);
  color: #fff;
  border-radius: 999px;
  min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
#userMenu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 168px;
  background: linear-gradient(180deg, rgba(24, 14, 58, 0.97), rgba(10, 6, 26, 0.98));
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 6px;
  animation: modalin 0.18s ease;
}
#userMenu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: none; border: none;
  color: #d5e8f5;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px; font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}
#userMenu button:hover { background: rgba(0, 215, 255, 0.1); color: var(--cyan); }

/* ---------- friends ---------- */
.frAddRow { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.frAddRow .authInput { margin: 0; flex: 1; }
.frSendBtn { border-radius: 12px; line-height: 1.15; font-size: 11px; padding: 4px 12px; }
#frList { text-align: left; max-height: 46vh; overflow-y: auto; }
.frRow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px; font-weight: 700;
  color: #eaf6ff;
}
.frRow:nth-child(odd) { background: rgba(0, 215, 255, 0.05); }
.frRow .frName { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frTagChip {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  padding: 2px 8px; border-radius: 6px;
}
.frTagChip.friends { color: var(--mint); border: 1px solid rgba(183, 255, 0, 0.4); }
.frTagChip.sent { color: var(--muted); border: 1px solid rgba(140, 170, 200, 0.35); }
.frAccept {
  background: linear-gradient(180deg, #e9ff6d, var(--mint) 45%, var(--mint-2));
  color: #102000;
  border: none; border-radius: 8px;
  font-family: "Rajdhani", sans-serif;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  padding: 5px 12px;
  cursor: pointer;
}

/* ---------- XP revive (free play) ---------- */
#revOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 7, 18, 0.55);
  z-index: 45;
}
.revCard {
  width: min(320px, 88vw);
  background: linear-gradient(180deg, rgba(24, 14, 58, 0.96), rgba(10, 6, 26, 0.97));
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  text-align: center;
  animation: modalin 0.3s ease;
}
.revTitle {
  font-family: "Bebas Neue", sans-serif;
  font-size: 34px;
  letter-spacing: 0.08em;
  color: var(--pink);
  text-shadow: 0 0 18px rgba(255, 52, 77, 0.5);
}
.revRing {
  width: 54px; height: 54px;
  margin: 8px auto 10px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 16px rgba(255, 203, 46, 0.35);
}
#revSecs { font-family: "Bebas Neue", sans-serif; font-size: 28px; color: var(--gold); }
#revBal { color: var(--cyan); font-size: 12px; font-weight: 700; letter-spacing: 0.15em; margin-bottom: 4px; }
#revMsg { min-height: 16px; color: var(--pink); font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.revBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(180deg, #e9ff6d, var(--mint) 45%, var(--mint-2));
  color: #102000;
  font-family: "Rajdhani", sans-serif;
}
.revBtn b { font-family: "Bebas Neue", sans-serif; font-size: 22px; letter-spacing: 0.06em; font-weight: 400; }
.revBtn .revCost { font-size: 15px; font-weight: 800; }
.revBtn .revSub { font-size: 11px; font-weight: 700; opacity: 0.75; }
.revBtn.full { background: linear-gradient(180deg, #ffe28a, var(--gold) 45%, #d99b00); color: #241a00; }
.revBtn:disabled { filter: grayscale(0.8) brightness(0.6); cursor: default; }
#revOverlay .mid { width: 100%; }

/* wallet chip (top left of home) */
#walletChip {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 7px 14px;
}
#walletChip .wIcon { font-size: 14px; }
#walletAmt {
  font-family: "Russo One", sans-serif;
  font-size: 15px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
#walletChip .wLabel {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
/* profile XP stats */
#pfXpRow { display: flex; gap: 8px; margin-bottom: 10px; }
.pfXp {
  flex: 1;
  background: rgba(8, 5, 24, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 9px 6px;
  text-align: center;
}
.pfXp span { display: block; font-family: "Russo One", sans-serif; font-size: 17px; color: var(--cyan); }
.pfXp label { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; }
.pfXp:last-child span { color: var(--gold); }

/* boost tutorial hint — retires itself once the player has learned it */
#boostHint {
  position: absolute;
  left: 50%;
  bottom: calc(136px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-shadow: 0 0 12px rgba(0, 215, 255, 0.5);
  pointer-events: none;
  z-index: 6;
  animation: hintblink 1.6s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes hintblink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
#boostBar.teach {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 215, 255, 0.55);
}

/* duo flow */
#duoCap { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 10px; }
#duoMsg { min-height: 18px; color: var(--pink); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
#duoMsg.ok { color: var(--mint); }
#duoList { text-align: left; max-height: 46vh; overflow-y: auto; }
.duoRow {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 6px;
  background: rgba(8, 5, 24, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: #eaf6ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.duoRow:hover { border-color: var(--cyan); }
.duoRow .frName { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duoRow .duoState { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.duoRow.lit {
  border-color: var(--mint);
  background: rgba(183, 255, 0, 0.1);
  animation: hintblink 1.4s ease-in-out infinite;
}
.duoRow.lit .duoState { color: var(--mint); }
.duoRow.waiting { border-color: var(--gold); cursor: default; }
.duoRow.waiting .duoState { color: var(--gold); }
#duoBtn.locked { filter: grayscale(0.7) brightness(0.65); }

/* player id + share */
#pfCodeRow { display: flex; gap: 8px; margin-bottom: 10px; }
#pfCode {
  flex: 1;
  background: rgba(8, 5, 24, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  font-family: "Russo One", sans-serif;
  font-size: 20px;
  letter-spacing: 0.35em;
  color: var(--gold);
  text-align: center;
}
#pfShare {
  background: linear-gradient(180deg, #9af3ff, var(--cyan) 45%, var(--blue));
  color: #021827;
  border: none;
  border-radius: 12px;
  font-family: "Rajdhani", sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0 16px;
  cursor: pointer;
}
#pfShare:hover { filter: brightness(1.1); }

/* ---------- backgrounds picker ---------- */
#bgCap { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 12px; }
#bgGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.bgTile {
  position: relative;
  height: 92px;
  border-radius: 14px;
  border: 2px solid var(--stroke);
  background-color: #0a0e17;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}
/* art previews are brightened for the picker — in-game stays true-dark */
.bgTile .bgArt {
  position: absolute;
  inset: 0;
  background-size: cover;
}
.bgTile .bgName {
  z-index: 2;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 5px 8px;
  background: linear-gradient(0deg, rgba(3, 2, 12, 0.9), transparent);
  color: #eaf6ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: left;
}
.bgTile.sel { border-color: var(--mint); box-shadow: 0 0 14px rgba(183, 255, 0, 0.35); }
.bgTile .bgBadge {
  position: absolute;
  top: 7px; right: 7px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: "Rajdhani", sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.bgTile .bgBadge.pro { background: linear-gradient(180deg, #ffe28a, var(--gold)); color: #241a00; }
.bgTile .bgBadge.soon { background: rgba(120, 140, 170, 0.25); color: var(--muted); }
.bgTile.locked { cursor: default; }
.bgTile.locked::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(3, 2, 12, 0.45);
}
.bgTile.locked .bgBadge { z-index: 2; }

/* coin economy */
.stat.gold span { color: var(--gold); }
#coinsRow {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 203, 46, 0.08);
  border: 1px solid rgba(255, 203, 46, 0.3);
}
#coinsRow .cTotal {
  font-family: "Bebas Neue", sans-serif;
  font-size: 26px;
  letter-spacing: 0.05em;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 203, 46, 0.4);
}
#coinsRow .cParts {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.revBtn.ad { background: linear-gradient(180deg, #9af3ff, var(--cyan) 45%, var(--blue)); color: #021827; }

/* free coins claim (app only) */
#freeCoinsBtn {
  margin-left: 4px;
  background: linear-gradient(180deg, #ffe28a, var(--gold) 45%, #d99b00);
  color: #241a00;
  border: none;
  border-radius: 999px;
  font-family: "Rajdhani", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  cursor: pointer;
  animation: hintblink 2.2s ease-in-out infinite;
}
#freeCoinsBtn:disabled { filter: grayscale(0.6) brightness(0.7); animation: none; }

/* phones: home content starts below the wallet/user chip row */
@media (max-width: 700px) {
  #home .panel { padding-top: calc(54px + env(safe-area-inset-top, 0px)); }
  #walletChip, #userChip { top: calc(10px + env(safe-area-inset-top, 0px)); }
}

/* ---------- coin store ---------- */
.mid.gold { color: var(--gold); border-color: rgba(255, 203, 46, 0.45); }
#storeCoins {
  font-family: "Russo One", sans-serif;
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 10px;
}
#storeTabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
#storeMsg { min-height: 18px; color: var(--pink); font-size: 13px; font-weight: 700; margin-bottom: 6px; }
#storeMsg.ok { color: var(--mint); }
#storeGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; max-height: 46vh; overflow-y: auto; }
.stTile {
  position: relative;
  height: 104px;
  border-radius: 14px;
  border: 2px solid var(--stroke);
  background-color: #0a0e17;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}
.stTile .bgArt { position: absolute; inset: 0; background-size: cover; }
.stTile .stName {
  position: absolute; left: 0; right: 0; bottom: 22px;
  padding: 2px 8px;
  color: #eaf6ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 12px; font-weight: 800; letter-spacing: 0.1em;
  text-align: left;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
}
.stTile .stPrice {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 8px;
  background: linear-gradient(0deg, rgba(3, 2, 12, 0.95), rgba(3, 2, 12, 0.6));
  color: var(--gold);
  font-family: "Russo One", sans-serif;
  font-size: 12px;
  text-align: left;
}
.stTile.owned .stPrice { color: var(--mint); }
.stTile .headArt {
  position: absolute; inset: 8px 8px 26px;
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.lempty2 { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 14px 0; }

/* avatar picker: scrolls as the collection grows; store tile at the end */
/* facePick is a horizontal wheel now */
.pickMore {
  width: 62px; height: 76px;
  border-radius: 16px;
  border: 2px dashed rgba(255, 203, 46, 0.5);
  background: none;
  color: var(--gold);
  font-family: "Rajdhani", sans-serif;
  font-size: 11px; font-weight: 800;
  cursor: pointer;
}

/* ---------- slot-machine wheels (characters + backgrounds) ---------- */
.wheelWrap {
  position: relative;
  max-width: 430px;
  margin: 0 auto 12px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(10, 6, 26, 0.4);
  box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.35);
}
.wheelWrap::before, .wheelWrap::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 34px;
  z-index: 2; pointer-events: none;
}
.wheelWrap::before { left: 0; background: linear-gradient(90deg, rgba(7, 10, 20, 0.95), transparent); }
.wheelWrap::after { right: 0; background: linear-gradient(270deg, rgba(7, 10, 20, 0.95), transparent); }
#facePick { margin: 0; max-width: none; padding: 6px 34px; }
#bgWheel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 4px 34px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#bgWheel::-webkit-scrollbar { display: none; }
.bgw {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: center;
  width: 84px; height: 52px;
  border-radius: 12px;
  border: 2px solid rgba(140, 120, 255, 0.28);
  background-color: #0a0e17;
  background-size: cover;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.bgw.selected {
  border-color: #3bf58a;
  box-shadow: 0 0 0 3px rgba(59, 245, 138, 0.3), 0 0 20px rgba(59, 245, 138, 0.55);
  transform: scale(1.06);
}
.bgw .bgwName {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2px 5px;
  background: linear-gradient(0deg, rgba(3, 2, 12, 0.92), transparent);
  color: #eaf6ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.08em;
  text-align: left;
}
.bgw.lockedBg { filter: saturate(0.55) brightness(0.75); }
.bgw .bgwPrice {
  position: absolute; top: 3px; right: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(3, 2, 12, 0.85);
  color: var(--gold);
  font-family: "Russo One", sans-serif;
  font-size: 8.5px;
}

/* wheel arrows: tap to page, pulse to teach */
.wArrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 215, 255, 0.45);
  background: rgba(8, 5, 24, 0.85);
  color: var(--cyan);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  animation: hintblink 2.4s ease-in-out infinite;
  padding: 0 0 2px;
}
.wArrow.left { left: 5px; }
.wArrow.right { right: 5px; }
.wArrow:active { transform: translateY(-50%) scale(0.9); }

/* breathing room between the background wheel and the mode buttons */
#modeBtns { margin-top: 18px; }

/* account deletion — quiet until armed */
.pfDanger { color: #ff5d6e; border-color: rgba(255,93,110,0.35); opacity: 0.75; }
.pfDanger.armed { background: rgba(255,93,110,0.14); opacity: 1; animation: pulse 1s infinite; }

/* audio modal */
#volRow { display: flex; gap: 8px; margin: 6px 0 14px; }
.volBtn {
  flex: 1; padding: 10px 4px; font: inherit; font-size: 13px; letter-spacing: 0.04em;
  background: rgba(93,225,255,0.05); color: #c8d6e5;
  border: 1px solid rgba(93,225,255,0.25); border-radius: 10px; cursor: pointer;
}
.volBtn.sel { background: rgba(157,255,61,0.12); border-color: #9dff3d; color: #9dff3d; }
#trackList { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.trackTile {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; font: inherit; font-size: 14px; letter-spacing: 0.05em;
  background: rgba(93,225,255,0.05); color: #c8d6e5;
  border: 1px solid rgba(93,225,255,0.25); border-radius: 10px; cursor: pointer;
}
.trackTile.sel { border-color: #9dff3d; color: #9dff3d; background: rgba(157,255,61,0.10); }

#volRow { align-items: center; }
#volSlider { flex: 1; accent-color: #9dff3d; height: 26px; }
#volPct { width: 52px; text-align: right; color: #9dff3d; font-size: 14px; letter-spacing: 0.04em; }
