:root {
  /* Background */
  --bg:      #0e0e14;
  --panel:   rgba(16,16,22,0.92);
  --surface: #1a1a24;
  --border:  rgba(150,60,255,0.1);

  /* Text */
  --text:    #eeeef2;
  --muted:   #6b6b80;
  --dim:     #444454;

  /* Accents — NSFW DEGEN palette */
  --accent:  #c840ff;
  --accent2: #ff2da0;
  --neon:    #ff2da0;
  --neon2:   #c840ff;
  --pink:    #ff2da0;
  --hotpink: #ff69b4;
  --cyan:    #38e1ff;
  --gold:    #ffd24a;
  --gold2:   #ff9a1f;
  --danger:  #ff3b5c;
  --hp:      #ff4d6d;
  --xp:      #ffd166;
  --wet:     rgba(150,60,255,0.06);

  /* Typography */
  --font-display: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  --font-ui:      'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'Space Mono', 'Courier New', monospace;
}

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

/* ---- Custom scrollbars ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(16,16,22,0.6); border-radius: 10px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6d28d9, #9333ea);
  border-radius: 10px;
  border: 2px solid rgba(16,16,22,0.6);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #7c3aed, #a855f7); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---- Range sliders ---- */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(150,60,255,0.15);
  border-radius: 6px;
  outline: none;
  transition: background 0.2s;
}
input[type=range]:hover { background: rgba(150,60,255,0.25); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9333ea, #c840ff);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(150,60,255,0.5), 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}
input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px rgba(150,60,255,0.7), 0 2px 8px rgba(0,0,0,0.5);
}
input[type=range]::-moz-range-track {
  height: 6px;
  background: rgba(150,60,255,0.15);
  border-radius: 6px;
}
input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9333ea, #c840ff);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(150,60,255,0.5), 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.15);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(150,60,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(60,220,255,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(150,60,255,0.02) 0%, transparent 70%);
}

#game { display: block; width: 100vw; height: 100vh; cursor: none; }
#game.lobby {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='5' fill='none' stroke='%23ff2da0' stroke-width='1.5' opacity='0.9'/%3E%3Ccircle cx='16' cy='16' r='1.5' fill='%23ff2da0' opacity='0.9'/%3E%3Cline x1='16' y1='2' x2='16' y2='10' stroke='%23ff2da0' stroke-width='1.5' opacity='0.7'/%3E%3Cline x1='16' y1='22' x2='16' y2='30' stroke='%23ff2da0' stroke-width='1.5' opacity='0.7'/%3E%3Cline x1='2' y1='16' x2='10' y2='16' stroke='%23ff2da0' stroke-width='1.5' opacity='0.7'/%3E%3Cline x1='22' y1='16' x2='30' y2='16' stroke='%23ff2da0' stroke-width='1.5' opacity='0.7'/%3E%3C/svg%3E") 16 16, crosshair;
}

/* Custom neon cursor everywhere the default cursor is visible */
html, body,
.lobby-card, .panel, #loadingScreen,
#settingsPanel, #historyPanel, #globalLb, #tutorialPanel,
#scoreboard, button, input, a, label {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='5' fill='none' stroke='%23c840ff' stroke-width='1.5' opacity='0.9'/%3E%3Ccircle cx='16' cy='16' r='1.5' fill='%23c840ff' opacity='0.9'/%3E%3Cline x1='16' y1='2' x2='16' y2='10' stroke='%23c840ff' stroke-width='1.5' opacity='0.7'/%3E%3Cline x1='16' y1='22' x2='16' y2='30' stroke='%23c840ff' stroke-width='1.5' opacity='0.7'/%3E%3Cline x1='2' y1='16' x2='10' y2='16' stroke='%23c840ff' stroke-width='1.5' opacity='0.7'/%3E%3Cline x1='22' y1='16' x2='30' y2='16' stroke='%23c840ff' stroke-width='1.5' opacity='0.7'/%3E%3C/svg%3E") 16 16, crosshair !important;
}

.hidden { display: none !important; }

/* HUD */
#hud {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.4));
}

.bar {
  position: relative;
  height: 22px;
  background: rgba(16,16,22,0.82);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(150,60,255,0.1);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 2px 10px rgba(0,0,0,0.3);
  backdrop-filter: blur(14px);
}
.bar > div { height: 100%; width: 0%; transition: width 0.14s ease; }
.bar.hp #hpFill {
  background: linear-gradient(90deg, #ff2da0, #ff69b4, #ff2da0);
  background-size: 200% 100%;
  animation: barShimmer 2s linear infinite;
  box-shadow: 0 0 14px rgba(255,45,160,0.5);
}
.bar.sol { height: 18px; }
.bar.sol #solFill {
  background: linear-gradient(90deg, #ffd24a, #ff9a1f, #ffd24a);
  background-size: 200% 100%;
  animation: barShimmer 2.5s linear infinite;
  box-shadow: 0 0 12px rgba(255,210,74,0.5);
  width: 0;
}
.bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
@keyframes barShimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

#stats {
  display: flex;
  gap: 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(16,16,22,0.82);
  border-radius: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(150,60,255,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  backdrop-filter: blur(14px);
}
#stats b { color: var(--cyan); font-weight: 700; }

/* Leaderboard */
#leaderboard {
  position: fixed;
  top: 96px;
  right: 16px;
  width: 220px;
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(150,60,255,0.1);
  border-top: 1px solid rgba(150,60,255,0.25);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(18px) saturate(1.3);
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
#leaderboard::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,210,74,0.25), rgba(150,60,255,0.15), transparent);
}
#leaderboard h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 10px;
  text-shadow: 0 0 12px rgba(255,210,74,0.3);
}
#lbList { list-style: none; }
#lbList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  gap: 6px;
  min-width: 0;
  transition: all 0.2s;
  border-radius: 4px;
}
#lbList li:hover {
  background: rgba(255,255,255,0.03);
}
#lbList li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
#lbList li:last-child { border-bottom: none; }
#lbList li b { font-family: var(--font-mono); color: var(--gold); font-weight: 700; white-space: nowrap; flex-shrink: 0; text-shadow: 0 0 8px rgba(255,210,74,0.2); }
@keyframes borderFlow {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* Match announcement banner */
#announcement {
  position: fixed;
  top: 13%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 36px;
  border-radius: 14px;
  border: 1px solid rgba(150,60,255,0.3);
  border-top: 1px solid rgba(150,60,255,0.5);
  background: rgba(16,16,22,0.92);
  backdrop-filter: blur(14px) saturate(1.4);
  color: #fff;
  text-align: center;
  white-space: nowrap;
  max-width: min(480px, 85vw);
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    0 0 40px rgba(150,60,255,0.15),
    inset 0 1px 0 rgba(255,255,255,0.06);
  text-shadow: 0 0 12px rgba(150,60,255,0.5), 0 2px 4px rgba(0,0,0,0.5);
}
#announcement::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,60,255,0.5), rgba(56,225,255,0.3), transparent);
}
#announcement::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(150,60,255,0.08), transparent, rgba(56,225,255,0.04));
  pointer-events: none;
}
.ann-in  { animation: annIn  0.4s cubic-bezier(0.2,1.4,0.4,1) both; }
.ann-out { animation: annOut 0.5s ease-in  both; }
@keyframes annIn  {
  from { opacity: 0; transform: translateX(-50%) scale(0.7) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}
@keyframes annOut {
  from { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-15px); }
}

/* Toasts */
#toasts {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 9999;
}
.toast {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.7);
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px) scale(1.1); }
}

/* ═══════ LOADING SCREEN ═══════ */
#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e0e14;
  overflow: hidden;
}
#loadingScreen.fade-out {
  animation: lsFadeOut 1s ease forwards;
}
@keyframes lsFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

#loadingBg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ls-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}

.loading-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: lsIn 1.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes lsIn {
  from { opacity: 0; transform: translateY(50px) scale(0.85); filter: blur(8px); }
  60% { filter: blur(0); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Character stage */
.ls-stage {
  position: relative;
  width: 360px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ls-stage::before {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150,60,255,0.12) 0%, rgba(56,225,255,0.06) 40%, transparent 70%);
  animation: lsGlow 3s ease-in-out infinite;
  z-index: 1;
}
@keyframes lsGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}
#loadingChar, #loadingChar2 {
  position: absolute;
  image-rendering: pixelated;
  width: 140px;
  height: 140px;
  z-index: 3;
}
#loadingChar {
  filter: drop-shadow(0 0 20px rgba(150,60,255,0.6)) drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  animation: lsChar1 2s ease-in-out infinite;
  left: 40px;
}
#loadingChar2 {
  filter: drop-shadow(0 0 20px rgba(56,225,255,0.5)) drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  animation: lsChar2 2s ease-in-out infinite 0.15s;
  right: 40px;
  transform: scaleX(-1);
}
@keyframes lsChar1 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes lsChar2 {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50% { transform: scaleX(-1) translateY(-14px); }
}
#loadingCross {
  position: absolute;
  z-index: 4;
  width: 80px;
  height: 80px;
  animation: lsClash 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 14px rgba(255,210,74,0.5));
}
@keyframes lsClash {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  45%, 55% { opacity: 1; transform: scale(1.05); }
}

/* Title */
.ls-title {
  font-family: var(--font-display);
  font-size: 68px;
  color: transparent;
  background: linear-gradient(135deg, #ffd24a 0%, #ff69b4 35%, #c840ff 65%, #38e1ff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  letter-spacing: 0.06em;
  line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.9)) drop-shadow(0 0 40px rgba(150,60,255,0.25));
  position: relative;
  animation: lsTitleShimmer 4s linear infinite;
}
@keyframes lsTitleShimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Subtitle */
.ls-sub {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: rgba(56,225,255,0.5);
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(56,225,255,0.15);
}

/* Progress */
.ls-progress {
  width: 280px;
}
.ls-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}
#loadingFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6d28d9, #9333ea, #38e1ff);
  background-size: 200% auto;
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 14px rgba(150,60,255,0.5);
  animation: lsBarPulse 2s linear infinite;
}
@keyframes lsBarPulse {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Tip */
.ls-tip {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.04em;
  transition: opacity 0.4s ease, transform 0.4s ease;
  max-width: 340px;
  text-align: center;
  line-height: 1.5;
}

/* Overlay — transparent so live game shows behind */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  overflow-y: auto;
  z-index: 150;
}
#overlayBg {
  display: none;
}
#overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

/* ═══════ LOBBY THREE-COLUMN LAYOUT ═══════ */
.lobby-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 300px 340px 280px;
  align-items: start;
  gap: 16px;
  max-width: 98vw;
  max-height: 96vh;
  overflow-y: auto;
  padding: 20px 18px;
}
@media (max-width: 1060px) {
  .lobby-layout {
    grid-template-columns: 300px 1fr;
  }
  .lobby-right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (max-width: 700px) {
  .lobby-layout {
    grid-template-columns: 1fr;
    max-width: 480px;
  }
  .lobby-right { grid-template-columns: 1fr; }
}
.lobby-left, .lobby-center, .lobby-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Card base — nightclub glass panel */
.lobby-card {
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(150,60,255,0.25);
  border-radius: 14px;
  padding: 22px;
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.35s, border-color 0.35s;
}
.lobby-card:hover {
  border-color: rgba(150,60,255,0.15);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.6),
    0 0 30px rgba(150,60,255,0.04);
}
.lobby-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,60,255,0.35), rgba(60,220,255,0.2), transparent);
}
.lobby-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(180deg, rgba(150,60,255,0.04), transparent);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
}
.lobby-card h3 {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

/* Brand card */
.lobby-brand-card {
  text-align: center;
  padding: 22px 16px 18px;
}
.lobby-brand-card h1 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: transparent;
  background: linear-gradient(135deg, #ffd24a 0%, #ff69b4 40%, #c840ff 70%, #38e1ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.9));
}
.lobby-brand-card .tagline {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(56,225,255,0.45);
  text-transform: uppercase;
  margin-bottom: 10px;
}
#lobbyChar {
  image-rendering: pixelated;
  width: 90px;
  height: 90px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(150,60,255,0.5));
  animation: lobbyFloat 3s ease-in-out infinite;
}
@keyframes lobbyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
/* P2E/PvP/On-Chain badges */
.lobby-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 10px;
}
.lbadge {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid;
}
.lbadge-pvp  { background: rgba(255,45,160,0.12); border-color: rgba(255,45,160,0.35); color: #ff69b4; }
.lbadge-p2e  { background: rgba(255,210,74,0.10); border-color: rgba(255,210,74,0.35); color: #ffd24a; }
.lbadge-onchain { background: rgba(56,225,255,0.08); border-color: rgba(56,225,255,0.3); color: #38e1ff; }
.lbadge-sol  { background: rgba(150,60,255,0.10); border-color: rgba(150,60,255,0.3); color: #c840ff; }
/* Hero pitch line */
.hero-pitch {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 0 4px;
}
.lobby-socials {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.lobby-socials a {
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  transition: color 0.15s;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.lobby-socials a:hover { color: var(--cyan); border-color: rgba(56,225,255,0.2); }

/* Stats card */
.lobby-stats-card { padding: 16px 18px; }
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}
.stat-row + .stat-row { border-top: 1px solid rgba(255,255,255,0.04); }
.stat-row span { font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.stat-row b { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--gold); text-shadow: 0 0 12px rgba(255,210,74,0.3); }
/* Arena stats 3-up grid */
.arena-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.arena-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 10px 6px 8px;
  border: 1px solid rgba(255,255,255,0.04);
}
.astat-icon { font-size: 16px; line-height: 1; }
.arena-stat b {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}
.arena-stat span:last-child {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* How it works card */
.lobby-how-card { padding: 18px 20px; }
.how-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.how-step:last-child { margin-bottom: 0; }
.how-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(150,60,255,0.12);
  border: 1px solid rgba(150,60,255,0.3);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
}
.how-step div b {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}
.how-step div p {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

/* Play card */
.lobby-play-card { padding: 22px 20px; }

/* Subtitle message (shown on death/extract) */
#subtitle {
  font-family: var(--font-ui);
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 12px 16px;
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(150,60,255,0.1);
  border-radius: 10px;
  line-height: 1.5;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
#subtitle .warn { color: #ff6b6b; }

/* Controls card */
.lobby-controls-card { padding: 16px 20px; }
.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ctrl kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(150,60,255,0.06);
  border: 1px solid rgba(150,60,255,0.15);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  min-width: 38px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: all 0.2s;
}
.ctrl kbd:hover {
  border-color: rgba(150,60,255,0.35);
  background: rgba(150,60,255,0.1);
}
.ctrl span {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--muted);
  font-weight: 500;
}

/* Token card */
.lobby-token-card { padding: 16px 18px; }
.token-ticker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.token-ticker {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255,210,74,0.4);
}
.token-chain {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}
.token-ca-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: auto !important;
}
.token-ca-row:hover {
  border-color: rgba(150,60,255,0.3);
  background: rgba(150,60,255,0.06);
}
.token-ca-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--cyan);
  flex-shrink: 0;
  letter-spacing: 0.08em;
}
.token-ca {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* SOON placeholder — gold italic */
#tokenCA {
  font-style: italic;
  color: var(--gold);
  opacity: 0.75;
}
.token-copy-icon {
  color: var(--cyan);
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.6;
  line-height: 1;
}
.token-ca-row:hover .token-copy-icon { opacity: 1; }
.token-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.token-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 8px 4px;
}
.token-stat span {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.token-stat b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}
.token-buy-btn {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, rgba(255,210,74,0.12), rgba(255,154,31,0.1));
  border: 1px solid rgba(255,210,74,0.3);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}
.token-buy-btn:hover {
  background: linear-gradient(135deg, rgba(255,210,74,0.2), rgba(255,154,31,0.16));
  border-color: rgba(255,210,74,0.5);
  box-shadow: 0 0 20px rgba(255,210,74,0.15);
}

/* Tokenomics card */
.lobby-tokenomics-card { padding: 16px 18px; }
.tknm-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.tknm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0,0,0,0.15);
  font-family: var(--font-ui);
}
.tknm-row span { font-size: 11px; color: rgba(255,255,255,0.5); }
.tknm-row b { font-family: var(--font-mono); font-size: 11px; color: var(--cyan); font-weight: 700; }
.tknm-note {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

/* Rules card */
.lobby-rules-card { padding: 16px 20px; }
.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.rule-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rule-item b {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.rule-item span {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
}

/* Badge */
.lobby-badge {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: rgba(56,225,255,0.5);
  background: rgba(16,16,22,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56,225,255,0.1);
  padding: 8px 16px;
  border-radius: 10px;
  letter-spacing: 0.1em;
  position: relative;
  z-index: 2;
}

/* Form inputs (used inside lobby-play-card) */
.lobby-card input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}
.lobby-card input::placeholder { color: rgba(255,255,255,0.2); }
.lobby-card input:focus {
  border-color: rgba(150,60,255,0.35);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 16px rgba(150,60,255,0.1), inset 0 2px 6px rgba(0,0,0,0.3);
}
.lobby-card button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d28d9, #9333ea, #c840ff);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow:
    0 4px 20px rgba(150,60,255,0.3),
    inset 0 1px 0 rgba(255,255,255,0.12);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.lobby-card button::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}
.lobby-card button:hover::after {
  left: 150%;
}
.lobby-card button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 28px rgba(150,60,255,0.4),
    0 0 40px rgba(150,60,255,0.1);
  filter: brightness(1.1);
}
.lobby-card button:active { transform: translateY(1px) scale(0.98); }
.lobby-card button.secondary {
  background: rgba(150,60,255,0.08);
  border: 1px solid rgba(150,60,255,0.2);
  color: rgba(200,160,255,0.8);
  font-size: 13px;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  text-transform: none;
  font-weight: 600;
}
.lobby-card button.secondary::after { display: none; }
.lobby-card button.secondary:hover {
  border-color: rgba(150,60,255,0.35);
  background: rgba(150,60,255,0.12);
}
.lobby-card button.secondary.connected {
  border-color: rgba(74,222,128,0.5);
  color: #4ade80;
}
.lobby-card button:disabled { opacity: 0.35; cursor: not-allowed; }
.controls { margin-top: 20px; font-size: 13px; color: var(--text); display: none; }
.controls .muted { color: var(--muted); margin-top: 6px; }
.controls .warn { color: #fca5a5; margin-top: 10px; font-weight: 600; font-size: 12px; }

/* Stake field */
.field { text-align: left; margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field small { display: block; margin-top: 4px; font-size: 11px; }

/* Secondary button (wallet connect) */
.panel button.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 12px;
}
.panel button.secondary.connected {
  border-color: rgba(74,222,128,0.5);
  color: #4ade80;
}
.panel button:disabled { opacity: 0.35; cursor: not-allowed; }

.status {
  min-height: 18px;
  margin-top: 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.status.error { color: #ff6b6b; }

.terms-link {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}
.terms-link a {
  color: rgba(150, 60, 255, 0.6);
  text-decoration: none;
}
.terms-link a:hover {
  color: rgba(150, 60, 255, 0.9);
  text-decoration: underline;
}

/* Top bar */
#topbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 130;
}
.chip {
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(150,60,255,0.1);
  border-top: 1px solid rgba(150,60,255,0.2);
  border-radius: 10px;
  padding: 8px 16px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transition: all 0.2s;
  position: relative;
}
.chip:hover {
  border-color: rgba(150,60,255,0.2);
}
.chip b { font-family: var(--font-mono); color: var(--hotpink); font-weight: 700; }
.chip-pool b { color: var(--gold); text-shadow: 0 0 10px rgba(255,210,74,0.4); }
#modeChip { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
#modeChip.devnet { color: #4ade80; }
#modeChip.sim { color: var(--gold); }

/* Extraction prompt (cash-out) */
#extractPrompt {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(150,60,255,0.15);
  border-top: 1px solid rgba(150,60,255,0.3);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  animation: pulseGlow 1.5s ease-in-out infinite;
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
#extractPrompt b { font-family: var(--font-mono); color: var(--gold); text-shadow: 0 0 8px rgba(255,210,74,0.3); }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 14px rgba(150,60,255,0.12); }
  50% { box-shadow: 0 0 24px rgba(150,60,255,0.2), 0 0 40px rgba(150,60,255,0.06); }
}

/* Gold cashout WIN card (in the overlay panel) */
.win-card {
  position: relative;
  margin: -8px 0 22px;
  padding: 18px 20px 20px;
  border-radius: 16px;
  background: linear-gradient(165deg, #ffdf6e 0%, #ffc02e 45%, #ff8f1f 100%);
  box-shadow:
    0 0 0 3px rgba(0, 0, 0, 0.35),
    0 0 40px rgba(255, 180, 40, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
  animation: winPop 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.win-card::before {
  content: "";
  position: absolute;
  inset: -50% -10%;
  background: conic-gradient(from 0deg, transparent 0 75%, rgba(255, 255, 255, 0.35) 85%, transparent 92%);
  animation: winSweep 2.6s linear infinite;
  pointer-events: none;
}
.win-card > * { position: relative; z-index: 1; }
.win-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: #6b3a00;
  background: rgba(255, 255, 255, 0.55);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.win-sub {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #7a4a00;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.win-amount {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #fff;
  -webkit-text-stroke: 3px #6b3a00;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #6b3a00, 0 6px 14px rgba(0, 0, 0, 0.35);
}
.win-detail {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #6b3a00;
}
@keyframes winPop {
  0% { opacity: 0; transform: scale(0.6) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes winSweep {
  to { transform: rotate(360deg); }
}

/* ---- Global leaderboard panel ---- */
#globalLb {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,14,0.88);
  backdrop-filter: blur(6px);
  z-index: 200;
}
.glb-inner {
  width: min(460px, 92vw);
  background: rgba(16,16,22,0.95);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,210,74,0.25);
  border-radius: 14px;
  padding: 28px 32px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}
.glb-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,210,74,0.3), rgba(150,60,255,0.15), transparent);
}
.glb-inner h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--gold);
}
#glbTable { width: 100%; border-collapse: collapse; }
#glbTable th {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
#glbTable td {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  color: var(--text);
}
#glbTable tr:nth-child(1) td { color: var(--gold); }
#glbTable tr:nth-child(2) td { color: #c0c0c0; }
#glbTable tr:nth-child(3) td { color: #cd7f32; }
#glbTable tr:hover td { background: rgba(255,255,255,0.03); }

/* ---- Prevent mobile scroll/bounce ---- */
html, body {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* ---- Mobile touch controls ---- */
#mobileControls {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 200px;
  pointer-events: none;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 12px 20px;
}
#mobileControls.active { pointer-events: all; }

#joystickZone {
  width: 150px; height: 150px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: all;
}
#joystickBase {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 2.5px solid rgba(255,255,255,0.15);
  position: relative;
  touch-action: none;
}
#joystickKnob {
  position: absolute;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(56,225,255,0.5);
  border: 2.5px solid rgba(56,225,255,0.85);
  box-shadow: 0 0 14px rgba(56,225,255,0.45);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: box-shadow 0.1s;
  pointer-events: none;
}
#actionBtns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  pointer-events: all;
  align-items: end;
}
.mBtn {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.03em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s, transform 0.08s;
  backdrop-filter: blur(4px);
}
.mBtn:active { background: rgba(255,255,255,0.22); transform: scale(0.9); }
.mBtn-atk   { background: rgba(255,45,160,0.25);  border-color: rgba(255,45,160,0.6); }
.mBtn-dodge { background: rgba(56,225,255,0.2);   border-color: rgba(56,225,255,0.55); }
.mBtn-heal  { background: rgba(74,222,128,0.2);   border-color: rgba(74,222,128,0.55); }
.mBtn-shield{ background: rgba(96,165,250,0.2);   border-color: rgba(96,165,250,0.55); }
.mBtn-ext   { background: rgba(251,191,36,0.2);   border-color: rgba(251,191,36,0.6); }

/* Aim indicator (directional arrow when dragging right side) */
#aimIndicator {
  position: fixed;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,45,160,0.6);
  background: rgba(255,45,160,0.1);
  pointer-events: none;
  z-index: 51;
  transform: translate(-50%, -50%);
}
#aimIndicator::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  border-top: 3px solid rgba(255,45,160,0.9);
  border-right: 3px solid rgba(255,45,160,0.9);
  transform-origin: center center;
  transform: translate(-70%, -50%) rotate(45deg);
}

/* ---- Share buttons ---- */
.win-share { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.share-btn {
  padding: 7px 18px; border-radius: 8px; font-weight: 700; font-size: 13px;
  text-decoration: none; transition: opacity 0.15s;
}
.share-btn:hover { opacity: 0.8; }
.share-x  { background: #000; color: #fff; border: 1px solid #333; }
.share-tg { background: #229ED9; color: #fff; }

/* ---- Settings panel ---- */
#settingsPanel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,14,0.88);
  backdrop-filter: blur(6px);
  z-index: 200;
}
.settings-inner {
  width: min(420px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(16,16,22,0.95);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(150,60,255,0.2);
  border-radius: 14px;
  padding: 28px 32px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(16px);
  position: relative;
}
.settings-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,60,255,0.25), rgba(60,220,255,0.15), transparent);
}
.settings-inner h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
}
.settings-quit-btn {
  width: 100%;
  padding: 13px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,80,80,0.35);
  border-radius: 10px;
  background: rgba(255,60,60,0.08);
  color: #ff6b6b;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
}
.settings-quit-btn:hover {
  background: rgba(255,60,60,0.16);
  border-color: rgba(255,80,80,0.6);
  box-shadow: 0 0 18px rgba(255,60,60,0.12);
}
.settings-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.settings-row label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  width: 110px;
  flex-shrink: 0;
}
.settings-row input[type=range] { flex: 1; }
.settings-row span {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  width: 36px;
  text-align: right;
}
.chip-btn {
  background: rgba(150,60,255,0.06);
  border: 1px solid rgba(150,60,255,0.15);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  color: rgba(200,160,255,0.8);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chip-btn:hover {
  background: rgba(150,60,255,0.1);
  border-color: rgba(150,60,255,0.3);
}

/* ---- Alive count chip ---- */
.chip-alive { border-color: rgba(60,220,255,0.2); }
.chip-alive b { color: var(--cyan); }

/* Pot pulse when it grows */
@keyframes potPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); color: var(--gold); }
  100% { transform: scale(1); }
}
.chip-pool.pop { animation: potPop 0.4s ease-out; }

/* ---- Kill feed ---- */
#killfeed {
  position: fixed;
  top: 96px;
  left: 16px;
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  z-index: 30;
}
.kf-entry {
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(150,60,255,0.08);
  border-left: 2px solid rgba(150,60,255,0.35);
  border-radius: 10px;
  padding: 7px 12px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  animation: kfSlide 0.25s ease-out both;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
  backdrop-filter: blur(14px) saturate(1.3);
}
.kf-entry .kf-killer { color: var(--hotpink); font-weight: 700; }
.kf-entry .kf-victim { color: var(--muted); font-weight: 500; }
.kf-entry .kf-method { color: var(--dim); font-size: 10px; }
.kf-entry.kf-fade { animation: kfFade 0.4s ease-out forwards; }
@keyframes kfSlide {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes kfFade {
  to { opacity: 0; transform: translateX(-10px); }
}

/* ---- ds-title ---- */
.ds-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--text);
  text-align: center;
  margin-bottom: 12px;
}

/* ---- Ability bar ---- */
#abilityBar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ability {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(16,16,22,0.82);
  border: 1px solid rgba(150,60,255,0.1);
  border-top: 1px solid rgba(150,60,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(14px);
  transition: all 0.2s;
}
.ability:hover {
  border-color: rgba(150,60,255,0.25);
}
.ability-icon { font-size: 20px; line-height: 1; }
.ability-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.ability-cd {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.ability-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  border-radius: 10px;
  display: none;
}
.ability.on-cd .ability-overlay { display: block; }
.ability.on-cd .ability-icon { opacity: 0.4; }

/* ---- Scoreboard (TAB) ---- */
#scoreboard {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,6,10,0.25);
  z-index: 80;
  pointer-events: none;
}
.scoreboard-inner {
  width: min(980px, 96vw);
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(16,16,22,0.72);
  border: 1px solid rgba(150,60,255,0.15);
  border-top: 1px solid rgba(150,60,255,0.35);
  border-radius: 14px;
  padding: 28px 40px 24px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    0 0 60px rgba(150,60,255,0.06),
    inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
}
.scoreboard-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,60,255,0.35), rgba(60,220,255,0.2), transparent);
}
.scoreboard-inner::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(180deg, rgba(150,60,255,0.04), transparent);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
}
.scoreboard-inner h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--gold);
  margin-bottom: 22px;
  text-shadow: 0 0 20px rgba(255,210,74,0.3);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  line-height: 1;
}
.scoreboard-inner h2 span {
  font-family: var(--font-ui);
  font-size: 13px;
  color: rgba(56,225,255,0.7);
  font-weight: 600;
  margin-left: 10px;
}
#sbTable { width: 100%; border-collapse: separate; border-spacing: 0 3px; position: relative; z-index: 1; }
#sbTable thead th {
  font-family: var(--font-ui);
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(150,130,200,0.5);
  padding: 0 10px 14px;
  border-bottom: 1px solid rgba(150,60,255,0.1);
}
#sbTable tbody tr {
  background: rgba(150,60,255,0.02);
  border-radius: 8px;
  transition: background 0.15s;
}
#sbTable tbody tr:nth-child(even) { background: rgba(150,60,255,0.04); }
#sbTable tbody tr:hover { background: rgba(150,60,255,0.08); }
#sbTable tbody td {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 10px;
  color: rgba(230,230,240,0.85);
}
#sbTable tbody td:first-child {
  font-family: var(--font-mono);
  color: rgba(150,130,200,0.45);
  font-weight: 700;
  width: 36px;
  font-size: 13px;
  border-radius: 8px 0 0 8px;
}
#sbTable tbody td:last-child {
  border-radius: 0 8px 8px 0;
}
.sb-me {
  background: rgba(150,60,255,0.1) !important;
  box-shadow: inset 3px 0 0 rgba(150,60,255,0.6);
}
.sb-me td { color: #fff !important; font-weight: 600; }
.sb-mw td:nth-child(2) { color: var(--gold) !important; font-weight: 700; text-shadow: 0 0 8px rgba(255,210,74,0.3); }
.sb-dead td { opacity: 0.2; }
.sb-col-icon {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  margin-right: 4px;
  image-rendering: pixelated;
  filter: brightness(1.4) saturate(1.2);
  display: inline-block;
}
.sb-pvp-icon {
  filter: brightness(1.4) drop-shadow(0 0 4px rgba(255,100,180,0.5));
}
.sb-mob-icon {
  width: 30px;
  height: 30px;
  filter: brightness(1.4) drop-shadow(0 0 4px rgba(150,60,255,0.5));
}
.sb-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(150,130,200,0.35);
  text-align: center;
  margin-top: 18px;
  letter-spacing: 0.06em;
  position: relative;
  z-index: 1;
}

/* ---- Death stats (shown in overlay panel) ---- */
#deathStats {
  background: rgba(16,16,22,0.6);
  border: 1px solid rgba(150,60,255,0.12);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  text-align: center;
}
.ds-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-shadow: 0 0 16px rgba(255,59,92,0.4);
}
.ds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.ds-card {
  background: rgba(30,30,42,0.8);
  border: 1px solid rgba(150,60,255,0.1);
  border-radius: 10px;
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ds-icon { font-size: 18px; line-height: 1; }
.ds-card b {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.ds-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ds-card-sol .ds-card-val,
.ds-bad { color: var(--danger) !important; }
.ds-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 2px;
  font-family: var(--font-ui);
  font-size: 12px;
}
.ds-row span { color: var(--muted); }
.ds-row b { font-family: var(--font-mono); font-weight: 700; color: var(--danger); }

/* ---- Wallet connect UI ---- */
.wallet-gate-desc {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.5;
}
.wallet-connect-btn {
  width: 100%;
  padding: 13px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(150,60,255,0.22), rgba(60,100,255,0.18));
  border: 1px solid rgba(150,60,255,0.35);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
  letter-spacing: 0.02em;
  box-shadow: 0 0 18px rgba(150,60,255,0.12);
  margin-bottom: 10px;
}
.wallet-connect-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(150,60,255,0.35), rgba(60,100,255,0.28));
  border-color: rgba(150,60,255,0.55);
  box-shadow: 0 0 28px rgba(150,60,255,0.25);
  transform: translateY(-1px);
}
.wallet-connect-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.wallet-connected-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(74,222,128,0.06);
  border: 1px solid rgba(74,222,128,0.18);
  border-radius: 10px;
  margin-bottom: 14px;
}
.wallet-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74,222,128,0.6);
  flex-shrink: 0;
}
.wallet-address {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #4ade80;
  flex: 1;
  letter-spacing: 0.04em;
}
.wallet-disconnect-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s;
  width: auto !important;
  flex-shrink: 0;
}
.wallet-disconnect-btn:hover { color: #f87171; border-color: rgba(248,113,113,0.3); }
#playForm {
  display: flex;
  flex-direction: column;
  gap: 0;
}
#playForm input, #playForm .field { margin-bottom: 10px; }

/* ---- Toast duration tweak ---- */
.toast { animation: floatUp 2.5s ease-out forwards; }
@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
  15%  { opacity: 1; }
  75%  { opacity: 1; transform: translateY(-28px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-50px) scale(1.08); }
}

/* ---- Minimap ---- */
#minimap {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 160px;
  height: 160px;
  border-radius: 14px;
  border: 1px solid rgba(150,60,255,0.1);
  border-top: 1px solid rgba(150,60,255,0.25);
  background: rgba(16,16,22,0.82);
  backdrop-filter: blur(18px) saturate(1.3);
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ---- Lobby buttons row ---- */
.lobby-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
}
.lobby-btns .chip-btn {
  width: 100%;
}

/* ---- Match History panel ---- */
#historyPanel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,14,0.88);
  backdrop-filter: blur(6px);
  z-index: 200;
}
.hist-inner {
  width: min(560px, 92vw);
  background: rgba(16,16,22,0.96);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(150,60,255,0.25);
  border-radius: 16px;
  padding: 24px 28px 22px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(150,60,255,0.06);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.hist-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,60,255,0.35), rgba(60,220,255,0.2), transparent);
}
/* Header row */
.hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.hist-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.02em;
}
.hist-close-x {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.hist-close-x:hover { background: rgba(255,60,60,0.12); border-color: rgba(255,60,60,0.3); color: #f87171; }
/* Tabs */
.hist-tabs {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.hist-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.hist-tab:hover { background: rgba(150,60,255,0.08); color: var(--text); }
.hist-tab.active {
  background: rgba(150,60,255,0.14);
  border-color: rgba(150,60,255,0.3);
  color: var(--text);
  box-shadow: 0 0 12px rgba(150,60,255,0.1);
}
/* Tab panes */
.hist-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.hist-tab-pane.hidden { display: none; }
/* Filter row */
.hist-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.hist-filter input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(150,60,255,0.12);
  background: rgba(20,20,28,0.6);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.hist-filter input::placeholder { color: rgba(255,255,255,0.2); }
.hist-filter input:focus {
  border-color: rgba(150,60,255,0.35);
  box-shadow: 0 0 12px rgba(150,60,255,0.1);
}
#histSearchBtn {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(150,60,255,0.15);
  background: rgba(150,60,255,0.1);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  width: auto !important;
}
#histSearchBtn:hover { background: rgba(150,60,255,0.2); }
/* Entry list */
.hist-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
}
.hist-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 30px 0;
  font-style: italic;
}
.hist-entry {
  background: rgba(20,20,28,0.6);
  border: 1px solid rgba(255,255,255,0.05);
  border-left: 3px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.hist-entry:hover { background: rgba(255,255,255,0.04); }
.hist-entry.hist-extract { border-left-color: #4ade80; }
.hist-entry.hist-death   { border-left-color: #f87171; }
.hist-top {
  display: flex; justify-content: space-between; align-items: center;
}
.hist-type {
  font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
}
.hist-type.extract { color: #4ade80; }
.hist-type.death   { color: #f87171; }
.hist-time { color: var(--muted); font-size: 10px; }
.hist-detail {
  display: flex; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 11px;
}
.hist-detail b { color: rgba(255,255,255,0.8); font-weight: 600; }
/* Summary bar */
.hist-summary {
  padding: 10px 14px;
  background: rgba(150,60,255,0.06);
  border: 1px solid rgba(150,60,255,0.1);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  display: flex; gap: 16px; flex-wrap: wrap;
  flex-shrink: 0;
}
.hist-summary .hs-label { color: var(--muted); font-family: var(--font-ui); font-size: 10px; }
.hist-summary .hs-good { color: #4ade80; font-weight: 700; }
.hist-summary .hs-bad  { color: #f87171; font-weight: 700; }
/* Leaderboard tab */
.hist-lb-section { flex: 1; }
.hist-lb-section table {
  width: 100%;
  border-collapse: collapse;
}
.hist-lb-section th {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hist-lb-section td {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 10px;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.hist-lb-section tr:nth-child(1) td { color: var(--gold); font-weight: 700; }
.hist-lb-section tr:nth-child(2) td { color: #c0c0c0; }
.hist-lb-section tr:nth-child(3) td { color: #cd7f32; }
.hist-lb-section tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* ---- Tutorial panel ---- */
#tutorialPanel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,14,0.92);
  backdrop-filter: blur(8px);
  z-index: 200;
}
.tutorial-inner {
  width: min(520px, 92vw);
  background: rgba(16,16,22,0.95);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 1px solid rgba(150,60,255,0.2);
  border-radius: 14px;
  padding: 28px 32px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}
.tutorial-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,60,255,0.25), rgba(60,220,255,0.15), transparent);
}
.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tutorial-header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 0;
  color: var(--text);
}
.tutorial-step-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
  background: rgba(255,255,255,0.04);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
}
.tutorial-progress {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}
.tutorial-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6d28d9, #9333ea, #38e1ff);
  background-size: 200% 100%;
  animation: barShimmer 2s linear infinite;
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(150,60,255,0.4);
}
.tutorial-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  background: #0e0e14;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 0 30px rgba(0,0,0,0.4);
}
.tutorial-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.tutorial-try-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(150,60,255,0.12);
  border: 1px solid rgba(150,60,255,0.3);
  color: rgba(56,225,255,0.9);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  letter-spacing: 0.1em;
  animation: tutPulse 1.5s ease-in-out infinite;
}
.tutorial-done-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(74,222,128,0.12);
  border: 1px solid rgba(74,222,128,0.3);
  color: #4ade80;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  letter-spacing: 0.1em;
}
@keyframes tutPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.tutorial-slide {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.tutorial-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.tutorial-desc {
  font-family: var(--font-ui);
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  max-width: 400px;
}
.tutorial-desc kbd {
  background: rgba(150,60,255,0.1);
  border: 1px solid rgba(150,60,255,0.25);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
}
.tutorial-tip {
  font-family: var(--font-ui);
  font-size: 12px;
  color: rgba(56,225,255,0.6);
  background: rgba(56,225,255,0.03);
  border: 1px solid rgba(56,225,255,0.1);
  border-radius: 8px;
  padding: 8px 16px;
  margin-top: 4px;
}
.tutorial-nav {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.tutorial-nav button {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d28d9, #9333ea, #c840ff);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(150,60,255,0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tutorial-nav button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(150,60,255,0.35);
  filter: brightness(1.1);
}
.tutorial-nav button:active {
  transform: translateY(1px) scale(0.98);
}
.tutorial-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  filter: none;
}
.tutorial-nav button#tutPrev {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  box-shadow: none;
  text-shadow: none;
}
.tutorial-nav button#tutPrev:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
  color: var(--text);
  box-shadow: none;
}

/* ---- Settings panel enhancements ---- */
.settings-hint {
  margin: -8px 0 14px;
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
}
.settings-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.settings-section:last-of-type { border-bottom: none; }
.settings-section-title {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.settings-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: #9333ea;
  cursor: pointer;
}
.settings-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
}
.settings-keys kbd {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
  margin-right: 4px;
}

/* ---- Lobby leaderboard card ---- */
.lobby-lb-card {
  max-height: 260px;
  overflow-y: auto;
}
.lobby-lb-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  color: var(--gold);
  margin: 0 0 10px;
}
#lobbyLbTable {
  width: 100%;
  border-collapse: collapse;
}
#lobbyLbTable th {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
#lobbyLbTable td {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 8px;
  color: var(--text);
}
#lobbyLbTable tr:nth-child(1) td { color: var(--gold); font-weight: 700; }
#lobbyLbTable tr:nth-child(2) td { color: #c0c0c0; }
#lobbyLbTable tr:nth-child(3) td { color: #cd7f32; }
#lobbyLbTable tr:hover td { background: rgba(255,255,255,0.03); }

/* ---- Match history improvements ---- */
.hist-entry {
  border-radius: 8px;
  padding: 10px 14px;
  transition: transform 0.15s, background 0.2s;
}
.hist-entry:hover {
  transform: translateX(2px);
  background: rgba(255,255,255,0.04);
}
.hist-entry.hist-extract {
  border-left: 3px solid #4ade80;
  background: rgba(74,222,128,0.03);
}
.hist-entry.hist-death {
  border-left: 3px solid #f87171;
  background: rgba(248,113,113,0.03);
}
.hist-type { font-size: 12px; }
.hist-summary {
  background: rgba(20,20,28,0.8);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 14px;
}

#glbTable td:nth-child(1) {
  font-weight: 700;
  color: var(--muted);
  width: 30px;
}

/* ---- Panel close buttons (shared across settings/history/leaderboard) ---- */
.settings-inner .secondary,
.hist-inner .secondary,
.glb-inner .secondary {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d28d9, #9333ea, #c840ff);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(150,60,255,0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  margin-top: 14px;
}
.settings-inner .secondary:hover,
.hist-inner .secondary:hover,
.glb-inner .secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(150,60,255,0.35);
  filter: brightness(1.1);
}
.settings-inner .secondary:active,
.hist-inner .secondary:active,
.glb-inner .secondary:active {
  transform: translateY(1px) scale(0.98);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---- Burn Stats Panel ---- */
.lobby-burn-card { padding: 16px 18px; }
.burn-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.burn-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,60,60,0.06);
  border: 1px solid rgba(255,60,60,0.15);
  border-radius: 10px;
  padding: 10px 6px 8px;
}
.burn-stat b {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #ff6b6b;
  text-shadow: 0 0 10px rgba(255,80,80,0.4);
  white-space: nowrap;
}
.burn-stat span {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-align: center;
}
.burn-accumulator { margin-bottom: 10px; }
.burn-acc-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.burn-acc-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.burn-acc-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ff9900);
  border-radius: 4px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px rgba(255,100,0,0.5);
}
.burn-last {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.burn-tx-link {
  color: #ff6b6b;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
}
.burn-tx-link:hover { text-decoration: underline; }
.daily-reset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255,210,74,0.06);
  border: 1px solid rgba(255,210,74,0.15);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
}
.daily-reset-row b {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold);
}

/* ---- Extraction Celebration Overlay ---- */
.extract-celebration {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* content docks to bottom */
  background: #000;
  cursor: default;
}
.extract-celebration.hidden { display: none; }
#celebCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.celeb-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 24px 32px;
  width: 100%;
  max-width: 600px;
  /* subtle dark gradient so text is readable over particles */
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.55) 60%, transparent 100%);
}
.celeb-tag {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #38e1ff;
  text-shadow: 0 0 24px rgba(56,225,255,1), 0 0 48px rgba(56,225,255,0.6);
  margin-bottom: -4px;
  animation: celebTagPop 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
.celeb-sol {
  font-family: var(--font-mono);
  font-size: clamp(58px, 11vw, 96px);
  font-weight: 900;
  color: #ffd700;
  text-shadow:
    0 0 30px rgba(255,215,0,1),
    0 0 60px rgba(255,180,0,0.7),
    0 0 120px rgba(255,120,0,0.4),
    0 3px 0 rgba(0,0,0,0.7);
  line-height: 1;
  animation: celebSolBounce 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
  letter-spacing: -2px;
}
.celeb-stats-row {
  display: flex;
  gap: 10px;
  animation: celebFadeUp 0.5s ease 0.4s both;
}
.celeb-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(56,225,255,0.06);
  border: 1px solid rgba(56,225,255,0.2);
  border-radius: 10px;
  padding: 8px 16px;
  min-width: 64px;
  box-shadow: inset 0 0 12px rgba(56,225,255,0.05), 0 0 8px rgba(56,225,255,0.08);
}
.celeb-stat span {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(255,255,255,0.4);
}
.celeb-stat label {
  font-family: var(--font-ui);
  font-size: 9px;
  color: #38e1ff;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.celeb-tier {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,215,0,0.07);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 20px;
  padding: 5px 16px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: #ffd700;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255,215,0,0.5);
  animation: celebFadeUp 0.5s ease 0.5s both;
}
.celeb-tx {
  animation: celebFadeUp 0.4s ease 0.55s both;
}
.celeb-tx a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #60a5fa;
  text-decoration: none;
}
.celeb-tx a:hover { text-decoration: underline; }
.celeb-share-row {
  display: flex;
  gap: 10px;
  animation: celebFadeUp 0.5s ease 0.6s both;
}
.celeb-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 24px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  letter-spacing: 0.04em;
}
.celeb-share-x {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: #fff;
  border: 1px solid rgba(56,225,255,0.3);
  box-shadow: 0 0 14px rgba(56,225,255,0.15);
}
.celeb-share-x:hover { border-color: rgba(56,225,255,0.7); box-shadow: 0 0 22px rgba(56,225,255,0.35); transform: translateY(-2px); }
.celeb-share-copy {
  background: linear-gradient(135deg, rgba(150,60,255,0.15), rgba(200,64,255,0.1));
  color: #fff;
  border: 1px solid rgba(150,60,255,0.35);
  box-shadow: 0 0 14px rgba(150,60,255,0.15);
}
.celeb-share-copy:hover { border-color: rgba(150,60,255,0.7); box-shadow: 0 0 22px rgba(150,60,255,0.35); transform: translateY(-2px); }
.celeb-skip-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.35);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 7px 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  animation: celebFadeUp 0.5s ease 0.75s both;
}
.celeb-skip-btn:hover { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.35); }
@keyframes celebTagPop {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes celebSolBounce {
  from { opacity: 0; transform: scale(0.3) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes celebFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   MOBILE – Touch device overrides
   ================================================================ */
@media (pointer: coarse), (max-width: 768px) {
  /* Hide desktop ability bar (mobile has touch buttons) */
  #abilityBar { display: none !important; }

  /* Reposition HUD to top-left so it doesn't overlap joystick */
  #hud {
    left: 12px;
    bottom: auto;
    top: 52px;
    width: 180px;
    gap: 4px;
  }
  .bar { height: 18px; }
  .bar span { font-size: 9px; }
  .bar.sol { height: 14px; }
  #stats { font-size: 10px; gap: 8px; }

  /* Compact topbar */
  #topbar {
    gap: 4px;
    padding: 6px 8px;
    flex-wrap: wrap;
    justify-content: center;
  }
  #topbar .chip {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 8px;
  }

  /* Move leaderboard to right side, smaller */
  #leaderboard {
    top: 52px;
    right: 8px;
    left: auto;
    width: 140px;
  }
  #leaderboard h3 { font-size: 11px; margin-bottom: 4px; }
  #leaderboard ol { font-size: 10px; }
  #leaderboard li { padding: 2px 0; }

  /* Kill feed — smaller, higher, out of joystick zone */
  #killfeed {
    top: auto;
    bottom: 210px;
    left: 8px;
    width: 180px;
  }
  .kf-entry {
    font-size: 9px;
    padding: 4px 8px;
    border-radius: 6px;
  }

  /* Minimap — smaller, keep bottom-right but above mobile buttons */
  #minimap {
    bottom: 210px !important;
    right: 8px !important;
    left: auto !important;
    top: auto !important;
    width: 100px !important;
    height: 100px !important;
    border-radius: 10px;
  }

  /* Extract prompt */
  #extractPrompt {
    bottom: 240px;
    font-size: 12px;
  }

  /* Death stats grid — 2 columns on mobile */
  .ds-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .ds-card b { font-size: 18px !important; }

  /* Scoreboard — compact for mobile */
  .scoreboard-inner {
    padding: 16px 12px;
  }
  .scoreboard-inner h2 { font-size: 18px; }
  #sbTable tbody td { font-size: 11px; padding: 6px 4px; }
  #sbTable thead th { font-size: 8px; padding: 0 4px 8px; }
  .sb-hint { display: none; } /* "Release TAB" is irrelevant on mobile */

  /* Lobby — tighter spacing */
  .lobby-layout { padding: 12px; gap: 12px; }
  .lobby-card { padding: 14px; }

  /* Settings panel */
  .settings-inner { padding: 20px 16px; }

  /* Mobile buttons — add cooldown overlay support */
  .mBtn { position: relative; overflow: hidden; }
  .mBtn .mBtn-cd {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    display: none;
    pointer-events: none;
  }
  .mBtn.on-cd .mBtn-cd { display: block; }
  .mBtn.on-cd { opacity: 0.5; }

  /* Bigger touch targets for action buttons */
  .mBtn { width: 54px; height: 54px; font-size: 9px; }

  /* Level-up popup — compact */
  /* (handled in JS via canvas drawing, no CSS needed) */

  /* Hide custom cursor on touch (use default) */
  #game { cursor: default !important; }
  html, body,
  .lobby-card, .panel, #loadingScreen,
  #settingsPanel, #historyPanel, #globalLb, #tutorialPanel,
  #scoreboard, button, input, a, label {
    cursor: default !important;
  }

  /* Celebration panel — tighter */
  .celeb-panel { padding: 24px 16px; max-width: 90vw; }
  .celeb-sol { font-size: 32px !important; }
  .celeb-share-row { flex-wrap: wrap; justify-content: center; }
}

/* ---- Reconnect overlay ---- */
#reconnectOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}
#reconnectOverlay.hidden { display: none; }

.reconnect-box {
  text-align: center;
  padding: 40px 48px;
  background: rgba(16, 16, 22, 0.95);
  border: 1px solid rgba(150, 60, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(150, 60, 255, 0.15);
  max-width: 360px;
}
.reconnect-box h2 {
  font-family: var(--font-display);
  color: #fbbf24;
  font-size: 24px;
  margin: 16px 0 8px;
}
.reconnect-box p {
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-body);
  font-size: 14px;
  margin: 4px 0;
}
.reconnect-sub b {
  color: #fbbf24;
  font-size: 18px;
}
.reconnect-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(150, 60, 255, 0.2);
  border-top-color: #9b5de5;
  border-radius: 50%;
  margin: 0 auto;
  animation: rc-spin 0.8s linear infinite;
}
@keyframes rc-spin {
  to { transform: rotate(360deg); }
}
