/* ═══════════════════════════════════════════════════
   PONG P2E — Premium Dark Theme
   ═══════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────── */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-glass: rgba(17, 24, 39, 0.6);

  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00aa;
  --neon-green: #00ff88;
  --neon-ponga: #da77f2;
  --neon-purple: #a855f7;
  --neon-orange: #ff6b35;
  --neon-gold: #fbbf24;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-dim: #475569;

  --border-glass: rgba(255, 255, 255, 0.08);
  --shadow-glow-cyan: 0 0 30px rgba(0, 240, 255, 0.3);
  --shadow-glow-magenta: 0 0 30px rgba(255, 0, 170, 0.3);

  --font-display: 'Orbitron', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* ── Reset & Base ──────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100vh;
  height: 100svh;
  /* small viewport height — excludes browser chrome on mobile */
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  /* prevent double-tap zoom */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body {
  background: linear-gradient(135deg, #0a0e1a 0%, #0f172a 50%, #1a0a2e 100%);
}

/* ── Background Canvas ─────────────────────────── */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   MUTE BUTTON
   ═══════════════════════════════════════════════════ */
.btn-mute {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.btn-mute:hover {
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.btn-mute.muted {
  opacity: 0.5;
}

/* ── Screens ───────────────────────────────────── */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.95);
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* ═══════════════════════════════════════════════════
   LOBBY SCREEN
   ═══════════════════════════════════════════════════ */
.lobby-container {
  text-align: center;
  padding: 48px 30px 20px;
  padding-top: max(48px, env(safe-area-inset-top, 48px));
  max-width: 520px;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
  /* Firefox — hide scrollbar */
  -ms-overflow-style: none;
  /* IE/Edge — hide scrollbar */
}

.lobby-container::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari — hide scrollbar */
}

/* Logo */
.logo-title {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 6px;
  line-height: 1;
  margin-bottom: 8px;
}

.logo-pong {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.4));
}

.logo-p2e {
  font-size: 32px;
  color: var(--neon-gold);
  margin-left: 8px;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.logo-subtitle {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.logo-divider {
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  margin: 24px auto;
}

/* ── Mode Selector (5 modes) ───────────────────── */
.mode-selector {
  margin: 24px 0;
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.mode-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.mode-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mode-btn:hover {
  border-color: rgba(0, 240, 255, 0.3);
  transform: translateY(-2px);
}

.mode-btn:hover::before {
  opacity: 1;
}

.mode-btn.active {
  border-color: var(--neon-cyan);
  box-shadow: var(--shadow-glow-cyan), inset 0 0 20px rgba(0, 240, 255, 0.05);
}

.mode-btn.active[data-mode="bet_sol"],
.mode-btn.active[data-mode="bet_token"] {
  border-color: var(--neon-gold);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.3), inset 0 0 20px rgba(251, 191, 36, 0.05);
}

.mode-btn.active[data-mode="whale_sol"],
.mode-btn.active[data-mode="whale_token"] {
  border-color: var(--neon-orange);
  box-shadow: 0 0 30px rgba(255, 107, 53, 0.4), inset 0 0 20px rgba(255, 107, 53, 0.08);
}

.mode-icon {
  font-size: 24px;
}

.mode-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 10px;
  color: var(--text-secondary);
}

.fee-label {
  color: var(--neon-gold);
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

/* Mid-Stakes Section */
.mid-section {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.03);
}

.mid-header {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #a78bfa;
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.mid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-btn.mid {
  border-color: rgba(139, 92, 246, 0.2);
}

.mode-btn.mid::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), transparent);
}

.mode-btn.mid:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.mode-btn.active[data-mode="mid_sol"],
.mode-btn.active[data-mode="mid_token"] {
  border-color: #a78bfa;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.35), inset 0 0 20px rgba(139, 92, 246, 0.06);
}

/* Whale Section */
.whale-section {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 107, 53, 0.15);
  border-radius: var(--radius-md);
  background: rgba(255, 107, 53, 0.03);
}

.whale-header {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--neon-orange);
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
}

.whale-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-btn.whale {
  border-color: rgba(255, 107, 53, 0.2);
}

.mode-btn.whale::before {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), transparent);
}

.mode-btn.whale:hover {
  border-color: rgba(255, 107, 53, 0.4);
}

/* Wallet token balance */
.wallet-balances {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.token-bal {
  color: var(--neon-gold);
}

/* ── Wallet Section ────────────────────────────── */
.wallet-section {
  margin: 20px 0;
  transition: all 0.4s ease;
}

.wallet-section.hidden {
  display: none;
}

.btn-wallet {
  width: 100%;
  background: linear-gradient(135deg, #512da8, #7c3aed);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  color: white;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-wallet:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
}

.wallet-icon {
  font-size: 22px;
}

.wallet-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
  backdrop-filter: blur(10px);
}

.wallet-info.hidden {
  display: none;
}

.wallet-address {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
}

.wallet-balance {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--neon-green);
}

.wallet-balance.token-bal {
  color: var(--neon-ponga);
}

.wallet-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-disconnect {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.btn-disconnect:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

/* $PONGA accent on token mode fee labels */
.mode-btn[data-mode="bet_token"] .fee-label,
.mode-btn[data-mode="mid_token"] .fee-label,
.mode-btn[data-mode="whale_token"] .fee-label {
  color: var(--neon-ponga);
}

.entry-fee-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 13px;
}

.fee-amount {
  color: var(--neon-gold);
  font-weight: 700;
}

/* ── Play Button ───────────────────────────────── */
.btn-play {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 300px;
  padding: 18px 40px;
  margin: 24px auto 0;
  background: linear-gradient(135deg, var(--neon-cyan), #0088cc);
  border: none;
  border-radius: var(--radius-xl);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #0a0e1a;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.btn-play:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 40px rgba(0, 240, 255, 0.4);
}

.btn-play:active {
  transform: translateY(0);
}

.btn-play-glow {
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta), var(--neon-cyan));
  background-size: 200% 200%;
  border-radius: inherit;
  z-index: -1;
  animation: glowRotate 3s linear infinite;
  filter: blur(8px);
  opacity: 0.6;
}

@keyframes glowRotate {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* ── Lobby Stats ───────────────────────────────── */
.lobby-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border-glass);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--neon-cyan);
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ═══════════════════════════════════════════════════
   LEADERBOARD
   ═══════════════════════════════════════════════════ */
.leaderboard-panel {
  margin-top: 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.leaderboard-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
}

.lb-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.lb-tab:hover {
  color: var(--text-secondary);
}

.lb-tab.active {
  color: var(--neon-cyan);
}

.lb-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.lb-content {
  display: none;
  padding: 0;
}

.lb-content.active {
  display: block;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.lb-table thead {
  background: rgba(0, 240, 255, 0.04);
}

.lb-table th {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 10px 8px;
  text-align: center;
}

.lb-table th:nth-child(2) {
  text-align: left;
}

.lb-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.lb-table td:nth-child(2) {
  text-align: left;
}

.lb-table tr:hover {
  background: rgba(0, 240, 255, 0.03);
}

.lb-table tr.lb-top3 td {
  color: var(--text-primary);
}

.lb-rank {
  font-size: 14px;
}

.lb-name {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.lb-wins {
  color: var(--neon-green) !important;
  font-weight: 600;
}

.lb-losses {
  color: var(--neon-magenta) !important;
}

.lb-winrate {
  color: var(--neon-cyan) !important;
  font-weight: 600;
}

.lb-streak {
  color: var(--neon-orange) !important;
}

.lb-earnings {
  color: var(--neon-gold) !important;
  font-weight: 700;
}

.lb-empty td {
  padding: 24px;
  color: var(--text-dim);
  font-style: italic;
}

/* Leaderboard scroll — fixed height, internal scrolling */
.lb-content {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.2) transparent;
}

.lb-content::-webkit-scrollbar {
  width: 3px;
}

.lb-content::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════
   NICKNAME MODAL
   ═══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.nickname-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.nickname-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.nickname-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

.nickname-error {
  font-size: 11px;
  color: var(--neon-magenta);
  margin-top: 8px;
  min-height: 16px;
}

.modal-box .btn-play {
  margin-top: 16px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════
   WAITING SCREEN
   ═══════════════════════════════════════════════════ */
.waiting-container {
  text-align: center;
}

.waiting-spinner {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 30px;
}

.spinner-ring {
  position: absolute;
  border: 3px solid transparent;
  border-radius: 50%;
}

.spinner-ring:nth-child(1) {
  inset: 0;
  border-top-color: var(--neon-cyan);
  animation: spin 1.2s linear infinite;
}

.spinner-ring:nth-child(2) {
  inset: 10px;
  border-right-color: var(--neon-magenta);
  animation: spin 1.8s linear infinite reverse;
}

.spinner-ring:nth-child(3) {
  inset: 20px;
  border-bottom-color: var(--neon-gold);
  animation: spin 2.4s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.waiting-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
}

.waiting-dots span {
  animation: blink 1.4s infinite;
  font-size: 28px;
  color: var(--neon-cyan);
}

.waiting-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.waiting-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  80%,
  100% {
    opacity: 0;
  }

  40% {
    opacity: 1;
  }
}

.btn-cancel {
  margin-top: 30px;
  padding: 12px 36px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-cancel:hover {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
}

/* ═══════════════════════════════════════════════════
   GAME SCREEN
   ═══════════════════════════════════════════════════ */
#gameScreen {
  flex-direction: column;
  background: transparent;
}

/* Score */
.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 30px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  margin-bottom: 16px;
  z-index: 10;
}

.score-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
}

.score-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
}

.score-top .score-value {
  color: var(--neon-magenta);
}

.score-bottom .score-value {
  color: var(--neon-cyan);
}

.score-divider {
  font-size: 24px;
  color: var(--text-dim);
}

/* Canvas — captures all mouse/touch input directly */
#gameCanvas {
  border-radius: var(--radius-md);
  box-shadow: 0 0 60px rgba(0, 240, 255, 0.15), inset 0 0 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 240, 255, 0.15);
  max-width: 100%;
  cursor: none;
  touch-action: none;
}

/* Countdown */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 26, 0.8);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.countdown-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.countdown-text {
  font-family: var(--font-display);
  font-size: 120px;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 40px rgba(0, 240, 255, 0.6);
  animation: countPulse 0.6s ease-out;
}

@keyframes countPulse {
  0% {
    transform: scale(1.5);
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Touch area */
.touch-area {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  z-index: 20;
  /* transparent touch zone */
}

/* ═══════════════════════════════════════════════════
   RESULT SCREEN
   ═══════════════════════════════════════════════════ */
.result-container {
  text-align: center;
  padding: 40px 30px;
}

.result-icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

.result-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 6px;
  margin-bottom: 8px;
}

.result-title.win {
  background: linear-gradient(135deg, var(--neon-gold), var(--neon-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-title.lose {
  color: var(--neon-magenta);
}

.result-subtitle {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

.result-payout {
  margin: 24px auto;
  padding: 16px 32px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: var(--radius-md);
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.result-payout.hidden {
  display: none;
}

.payout-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.payout-amount {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.payout-amount.payout-ponga {
  color: var(--neon-ponga);
  text-shadow: 0 0 20px rgba(218, 119, 242, 0.4);
}

.result-note {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 300px;
  margin: 8px auto 0;
  line-height: 1.5;
  opacity: 0.8;
}

.result-note.hidden {
  display: none;
}

.result-actions {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.result-actions .btn-play {
  max-width: 250px;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .logo-title {
    font-size: 42px;
  }

  .logo-p2e {
    font-size: 22px;
  }

  .mode-btn {
    padding: 14px 10px;
  }

  .mode-label {
    font-size: 11px;
  }

  .btn-play {
    font-size: 15px;
    padding: 15px 30px;
  }

  .score-value {
    font-size: 28px;
  }

  .countdown-text {
    font-size: 80px;
  }

  .result-title {
    font-size: 32px;
  }

  .lobby-stats {
    gap: 16px;
  }

  .stat-value {
    font-size: 18px;
  }

  .lb-table {
    font-size: 11px;
  }

  .lb-tab {
    font-size: 10px;
  }
}

@media (max-height: 600px) {
  .lobby-container {
    padding: 20px;
  }

  .logo-title {
    font-size: 36px;
  }

  .lobby-stats {
    margin-top: 12px;
  }

  .leaderboard-panel {
    margin-top: 12px;
  }
}

/* ═══════════════════════════════════════════════════
   HOW IT WORKS — Button & Modal
   ═══════════════════════════════════════════════════ */
.btn-how-it-works {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
  margin-top: 8px;
  letter-spacing: 1px;
  transition: color 0.2s, text-shadow 0.2s;
  opacity: 0.7;
}

.btn-how-it-works:hover {
  color: var(--neon-cyan);
  opacity: 1;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Overlay */
.hiw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.92);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.hiw-overlay.active {
  display: flex;
}

/* Modal container */
.hiw-modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(10, 14, 26, 0.98));
  border: 1px solid rgba(0, 240, 255, 0.12);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(0, 240, 255, 0.06),
    0 24px 80px rgba(0, 0, 0, 0.6);
}

.hiw-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.hiw-close:hover {
  background: rgba(255, 0, 170, 0.15);
  border-color: rgba(255, 0, 170, 0.3);
  color: #ff00aa;
}

.hiw-scroll {
  overflow-y: auto;
  max-height: 90vh;
  padding: 36px 32px 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.15) transparent;
}

/* Header */
.hiw-header {
  text-align: center;
  margin-bottom: 28px;
}

.hiw-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 3px;
}

.hiw-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 6px;
  letter-spacing: 1px;
}

/* Sections */
.hiw-section {
  margin-bottom: 28px;
}

.hiw-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: 1px;
}

/* Steps (Getting Started) */
.hiw-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hiw-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.hiw-step-num {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), rgba(0, 240, 255, 0.3));
  color: #0a0e1a;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hiw-step-content h4 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hiw-step-content p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Mode cards grid */
.hiw-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hiw-mode-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.2s;
}

.hiw-mode-card:hover {
  border-color: rgba(0, 240, 255, 0.2);
}

.hiw-mode-card.whale {
  grid-column: span 1;
}

.hiw-mode-icon {
  font-size: 24px;
}

.hiw-mode-card strong {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.hiw-mode-fee {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--neon-green);
  font-weight: 600;
}

.hiw-mode-card.free .hiw-mode-fee {
  color: var(--neon-cyan);
}

.hiw-mode-card.token .hiw-mode-fee {
  color: var(--neon-ponga);
}

.hiw-mode-card.mid .hiw-mode-fee {
  color: var(--neon-ponga);
}

.hiw-mode-card.whale .hiw-mode-fee {
  color: #fbbf24;
}

.hiw-mode-card.ponga .hiw-mode-fee {
  color: var(--neon-ponga);
}

/* Leaderboard $PONGA column */
.lb-earnings-token {
  color: var(--neon-ponga);
  font-weight: 600;
}

.hiw-mode-card p {
  font-size: 10.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 4px;
}

/* Payout breakdown */
.hiw-payout-breakdown {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.hiw-payout-item {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.hiw-payout-item.winner {
  border-color: rgba(0, 255, 136, 0.2);
  background: rgba(0, 255, 136, 0.04);
}

.hiw-payout-item.dev {
  border-color: rgba(255, 0, 170, 0.15);
  background: rgba(255, 0, 170, 0.03);
}

.hiw-payout-item.rewards {
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.04);
}

.hiw-payout-item.rewards .hiw-payout-pct {
  color: #fbbf24;
}

/* Rewards ladder */
.hiw-rewards-intro {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.hiw-rewards-intro strong {
  color: var(--text-primary);
}

.hiw-rewards-ladder {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.hiw-reward-row {
  display: grid;
  grid-template-columns: 32px 90px 50px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.hiw-reward-medal {
  font-size: 20px;
  text-align: center;
}

.hiw-reward-place {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.hiw-reward-share {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.hiw-reward-bar {
  height: 8px;
  border-radius: 4px;
  display: block;
}

/* Gold */
.hiw-reward-row.gold {
  border-color: rgba(251, 191, 36, 0.15);
}

.hiw-reward-row.gold .hiw-reward-share {
  color: #fbbf24;
}

.hiw-reward-row.gold .hiw-reward-bar {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

/* Silver */
.hiw-reward-row.silver {
  border-color: rgba(192, 192, 214, 0.12);
}

.hiw-reward-row.silver .hiw-reward-share {
  color: #c0c0d6;
}

.hiw-reward-row.silver .hiw-reward-bar {
  background: linear-gradient(90deg, #c0c0d6, #9898ac);
}

/* Bronze */
.hiw-reward-row.bronze {
  border-color: rgba(205, 127, 50, 0.15);
}

.hiw-reward-row.bronze .hiw-reward-share {
  color: #cd7f32;
}

.hiw-reward-row.bronze .hiw-reward-bar {
  background: linear-gradient(90deg, #cd7f32, #a0622a);
}

/* 4th–10th */
.hiw-reward-row.rest {
  border-color: rgba(0, 240, 255, 0.08);
}

.hiw-reward-row.rest .hiw-reward-share {
  color: var(--neon-cyan);
}

.hiw-reward-row.rest .hiw-reward-bar {
  background: linear-gradient(90deg, var(--neon-cyan), rgba(0, 240, 255, 0.4));
}

.hiw-rewards-note {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 10px 14px;
  background: rgba(251, 191, 36, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.1);
  border-radius: 10px;
  line-height: 1.5;
}

.hiw-token-note {
  font-size: 11.5px;
  color: var(--text-secondary);
  text-align: center;
  padding: 9px 14px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  line-height: 1.5;
}

.hiw-token-note strong {
  color: var(--neon-cyan);
}

.hiw-payout-pct {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  display: block;
}

.hiw-payout-item.winner .hiw-payout-pct {
  color: var(--neon-green);
}

.hiw-payout-item.dev .hiw-payout-pct {
  color: var(--neon-magenta);
}

.hiw-payout-label {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin: 4px 0 6px;
}

.hiw-payout-item p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hiw-payout-example {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
}

.hiw-payout-example p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.hiw-payout-example strong {
  color: var(--text-primary);
}

/* Controls */
.hiw-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hiw-control-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.hiw-control-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}

.hiw-control-card strong {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-primary);
  letter-spacing: 1px;
  display: block;
  margin-bottom: 6px;
}

.hiw-control-card p {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Safety list */
.hiw-safety-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hiw-safety-item {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border-left: 3px solid rgba(0, 255, 136, 0.3);
}

.hiw-safety-item strong {
  color: var(--text-primary);
}

/* GOT IT button */
.hiw-got-it {
  width: 100%;
  margin-top: 8px;
  max-width: none;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .hiw-scroll {
    padding: 28px 20px 24px;
  }

  .hiw-title {
    font-size: 22px;
  }

  .hiw-modes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hiw-modes-grid .hiw-mode-card:first-child {
    grid-column: span 2;
  }

  .hiw-controls-grid {
    grid-template-columns: 1fr;
  }

  .hiw-payout-breakdown {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════
   SOCIAL ICONS + BUY $PONGA
   ═══════════════════════════════════════════ */

.social-buy-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.social-icons {
  display: flex;
  gap: 8px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  transition: all 0.25s ease;
  text-decoration: none;
}

.social-link:hover {
  color: var(--neon-cyan);
  border-color: rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.06);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.2);
  transform: translateY(-2px);
}

/* BUY $PONGA button */
.btn-buy-ponga {
  background: linear-gradient(135deg, var(--neon-ponga), #b044d4);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 16px rgba(218, 119, 242, 0.3);
  animation: ponga-pulse 2s ease-in-out infinite;
}

.btn-buy-ponga:hover {
  box-shadow: 0 0 28px rgba(218, 119, 242, 0.5);
  transform: translateY(-2px) scale(1.03);
}

@keyframes ponga-pulse {

  0%,
  100% {
    box-shadow: 0 0 16px rgba(218, 119, 242, 0.3);
  }

  50% {
    box-shadow: 0 0 24px rgba(218, 119, 242, 0.5);
  }
}

/* ═══════════════════════════════════════════
   BUY $PONGA MODAL
   ═══════════════════════════════════════════ */

.buy-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.buy-overlay.active {
  opacity: 1;
  visibility: visible;
}

.buy-modal {
  position: relative;
  width: 90%;
  max-width: 440px;
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.97), rgba(10, 14, 26, 0.98));
  border: 1px solid rgba(218, 119, 242, 0.15);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(218, 119, 242, 0.08);
  transform: scale(0.92);
  transition: transform 0.3s ease;
}

.buy-overlay.active .buy-modal {
  transform: scale(1);
}

.buy-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
}

.buy-close:hover {
  color: var(--text-primary);
}

.buy-header {
  text-align: center;
  margin-bottom: 24px;
}

.buy-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-ponga), #b044d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
}

.buy-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.buy-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.buy-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s ease;
  cursor: pointer;
}

.buy-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.buy-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.buy-card strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-primary);
  display: block;
}

.buy-card p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Platform accent colors */
.buy-card.pumpfun {
  border-color: rgba(0, 255, 136, 0.12);
}

.buy-card.pumpfun:hover {
  border-color: rgba(0, 255, 136, 0.3);
  background: rgba(0, 255, 136, 0.04);
}

.buy-card.dexscreener {
  border-color: rgba(0, 240, 255, 0.12);
}

.buy-card.dexscreener:hover {
  border-color: rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.04);
}

.buy-card.raydium {
  border-color: rgba(139, 92, 246, 0.12);
}

.buy-card.raydium:hover {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.04);
}