/* ==========================================================================
   8-BALL POOL - LUXURY CASINO / CYBER DARK DESIGN SYSTEM
   Optimized for Desktop (Mouse/Wheel/Keyboard) & Mobile (iOS Safari & Android Chrome)
   ========================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-surface: rgba(18, 26, 43, 0.88);
  --bg-surface-glow: rgba(30, 42, 69, 0.95);
  --bg-glass: rgba(13, 22, 38, 0.85);
  
  --accent-gold: #ffd15c;
  --accent-gold-glow: rgba(255, 209, 92, 0.4);
  --accent-emerald: #00e699;
  --accent-emerald-glow: rgba(0, 230, 153, 0.35);
  --accent-cyan: #00d2ff;
  --accent-ruby: #ff3366;
  --accent-purple: #9d4edd;

  --text-main: #f0f4fc;
  --text-muted: #8a99b5;
  --text-dim: #50617e;

  --border-glass: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(255, 209, 92, 0.3);
  --border-emerald: rgba(0, 230, 153, 0.35);

  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-main);
  touch-action: none;
  position: fixed;
  left: 0;
  top: 0;
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 30%, #152238 0%, #080c14 100%);
  overflow: hidden;
}

/* ==========================================================================
   GAME CANVAS VIEWPORT
   ========================================================================== */
#canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-canvas {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  touch-action: none;
  cursor: crosshair;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 230, 153, 0.1);
  will-change: transform;
  transform: translateZ(0);
}

/* In-game floating foul/status banner */
#game-banner {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 8px 24px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-gold-glow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
  white-space: nowrap;
}

#game-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#game-banner.foul {
  border-color: var(--accent-ruby);
  color: var(--accent-ruby);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 51, 102, 0.4);
}

#game-banner.success {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-emerald-glow);
}

/* ==========================================================================
   TOP HUD: PLAYERS, BALANCE & USER BADGE
   ========================================================================== */
#hud-top {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 4px) calc(var(--safe-right) + 12px) 4px calc(var(--safe-left) + 12px);
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.98) 0%, rgba(8, 12, 20, 0.75) 80%, transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
  pointer-events: auto;
}

.hud-player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 5px 12px;
  border-radius: 40px;
  transition: all 0.3s ease;
  min-width: 140px;
}

.hud-player-card.active {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 20px var(--accent-emerald-glow);
  background: rgba(0, 230, 153, 0.12);
}

.hud-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid var(--border-glass);
  position: relative;
  flex-shrink: 0;
}

.hud-player-card.active .hud-avatar {
  border-color: var(--accent-emerald);
}

.hud-player-info {
  display: flex;
  flex-direction: column;
}

.hud-player-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-ball-badge {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.hud-ball-badge.solid {
  color: #ffaa00;
}

.hud-ball-badge.stripe {
  color: #00d2ff;
}

/* Mini Ball Rack Tracker in HUD */
.ball-tracker-container {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.ball-tracker-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mini-ball {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  overflow: hidden;
}

.mini-ball .mini-num {
  font-size: 8px;
  font-weight: 900;
  color: #0f172a;
  z-index: 2;
}

.mini-ball .mini-stripe {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 1;
}

.mini-ball.potted {
  opacity: 0.22;
  filter: grayscale(1);
  transform: scale(0.85);
  box-shadow: none;
}

.mini-ball.eight-ball .mini-num {
  color: #ffffff;
}

/* Center Bet & Balance Hub */
#hud-center-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.match-pot-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255, 209, 92, 0.2), rgba(255, 170, 0, 0.05));
  border: 1px solid var(--accent-gold);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

.turn-timer-bar {
  width: 110px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 3px;
}

.turn-timer-progress {
  height: 100%;
  width: 100%;
  background: var(--accent-emerald);
  transition: width 0.1s linear, background-color 0.3s;
}

.turn-timer-progress.danger {
  background: var(--accent-ruby);
}

/* Right User Profile & Wallet in HUD */
.hud-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
}

.hud-wallet-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 26, 43, 0.9);
  border: 1px solid var(--accent-emerald);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-emerald-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.hud-wallet-btn:active {
  transform: scale(0.96);
}

.usdt-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #26a17b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
}

/* ==========================================================================
   SIDE POWER METER & FINE TUNING CONTROLS
   ========================================================================== */
#power-meter-container {
  position: absolute;
  right: calc(var(--safe-right) + 16px);
  top: 50%;
  transform: translateY(-50%);
  height: 280px;
  width: 52px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 26px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 35;
  touch-action: none;
}

.power-track {
  position: relative;
  flex: 1;
  width: 14px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 7px;
  overflow: hidden;
  margin: 8px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.power-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(0deg, var(--accent-emerald) 0%, var(--accent-gold) 70%, var(--accent-ruby) 100%);
  border-radius: 7px;
  transition: height 0.05s linear;
  pointer-events: none;
}

.power-handle {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 50%);
  bottom: 0%;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 50%, #64748b 100%);
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 10px var(--accent-gold-glow);
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.power-handle:active {
  cursor: grabbing;
  transform: translate(-50%, 50%) scale(1.1);
}

.power-cue-icon {
  font-size: 14px;
}

/* Angle Fine Tune Wheel on Left */
#fine-tune-container {
  position: absolute;
  left: calc(var(--safe-left) + 16px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 35;
}

.side-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.side-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.side-btn:active {
  transform: scale(0.92);
}

.shoot-btn {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-emerald) 0%, #00c087 100%);
  border: 3px solid #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 230, 153, 0.5), 0 0 20px rgba(0, 230, 153, 0.3);
  transition: all 0.2s ease;
  z-index: 50;
  display: none;
}

.shoot-btn:active {
  transform: translateX(-50%) scale(0.95);
  box-shadow: 0 4px 15px rgba(0, 230, 153, 0.6), 0 0 15px rgba(0, 230, 153, 0.4);
}

@media (max-width: 768px) {
  .shoot-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Bottom Actions Bar */
#hud-bottom {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 10px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  z-index: 35;
}

/* ==========================================================================
   SPIN / ENGLISH SELECTOR MODAL
   ========================================================================== */
#spin-modal {
  position: absolute;
  bottom: 80px;
  left: calc(var(--safe-left) + 20px);
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px var(--accent-gold-glow);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#spin-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.spin-ball-surface {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f0 60%, #94a3b8 100%);
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.3), 0 6px 15px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: none;
}

.spin-crosshair-h, .spin-crosshair-v {
  position: absolute;
  background: rgba(0, 0, 0, 0.2);
}

.spin-crosshair-h {
  top: 50%;
  left: 10%;
  right: 10%;
  height: 1px;
}

.spin-crosshair-v {
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 1px;
}

.spin-tip-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-ruby);
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ==========================================================================
   POPUP MODALS & SCREENS (AUTH, LOBBY, WALLET, MATCHMAKING, VICTORY)
   ========================================================================== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 13, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.glass-dialog {
  background: linear-gradient(145deg, rgba(22, 33, 56, 0.98), rgba(13, 20, 36, 0.99));
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(0, 230, 153, 0.1);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-overlay.active .glass-dialog {
  transform: translateY(0) scale(1);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.dialog-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: rgba(0, 230, 153, 0.15);
  color: var(--accent-emerald);
  border: 1px solid var(--accent-emerald);
}

.auth-error {
  font-size: 12px;
  color: var(--accent-ruby);
  background: rgba(255, 51, 102, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  display: none;
}

/* Modern Primary & Secondary Buttons */
.btn-primary {
  background: linear-gradient(135deg, #00e699 0%, #00b377 100%);
  color: #04120c;
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px var(--accent-emerald-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-gold {
  background: linear-gradient(135deg, #ffd15c 0%, #e6a800 100%);
  color: #1a1200;
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px var(--accent-gold-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-gold:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* Form inputs */
.dialog-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialog-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.dialog-input {
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.dialog-input:focus {
  border-color: var(--accent-emerald);
}

/* ==========================================================================
   MAIN MENU / LOBBY
   ========================================================================== */
#lobby-screen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, #172642 0%, #080c14 85%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 24px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#lobby-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.05);
}

.game-logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.lobby-logo-img {
  max-width: 220px;
  width: 75vw;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(255, 209, 92, 0.4)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: logoGlowPulse 4s ease-in-out infinite alternate;
}

.lobby-logo-img:hover {
  transform: scale(1.04);
}

.auth-dialog-header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-bottom: 4px;
}

.auth-logo-img {
  max-width: 180px;
  width: 65vw;
  height: auto;
  max-height: 110px;
  object-fit: contain;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(255, 209, 92, 0.35)) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

@keyframes logoGlowPulse {
  0% {
    filter: drop-shadow(0 6px 20px rgba(255, 209, 92, 0.3)) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  }
  100% {
    filter: drop-shadow(0 10px 32px rgba(255, 209, 92, 0.6)) drop-shadow(0 0 15px rgba(0, 230, 153, 0.25)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7));
  }
}

.game-title-glow {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, #ffd15c 50%, #00e699 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(0, 230, 153, 0.2);
}

.game-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.lobby-balance-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-gold-glow);
  cursor: pointer;
  transition: transform 0.2s;
}

.lobby-balance-card:hover {
  transform: scale(1.02);
}

.lobby-balance-amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-gold);
}

.install-banner-card {
  background: linear-gradient(135deg, rgba(30, 42, 69, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--accent-gold);
  border-radius: 18px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--accent-gold-glow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: pulseGlow 3s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 209, 92, 0.3); }
  50% { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 25px rgba(0, 230, 153, 0.4); }
}

.install-banner-card:hover {
  transform: translateY(-2px);
}

.lobby-modes-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.mode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-card:hover {
  border-color: var(--accent-emerald);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-emerald-glow);
}

.mode-card.featured {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(30, 42, 69, 0.9), rgba(20, 28, 48, 0.95));
}

.mode-card.featured:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 25px var(--accent-gold-glow);
}

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mode-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.mode-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(0, 230, 153, 0.15);
  color: var(--accent-emerald);
  border: 1px solid var(--accent-emerald);
}

.mode-tag.bet {
  background: rgba(255, 209, 92, 0.15);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

/* ==========================================================================
   VICTORY & DEFEAT SPLASH SCREEN
   ========================================================================== */
#result-modal .result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.result-trophy {
  font-size: 56px;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.result-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.result-title.win {
  color: var(--accent-gold);
  text-shadow: 0 0 25px var(--accent-gold-glow);
}

.result-title.lose {
  color: var(--accent-ruby);
}

.result-payout {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 209, 92, 0.12);
  border: 1px solid var(--accent-gold);
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-gold);
}

/* ==========================================================================
   MATCH FOUND MODAL & TIMER STYLES
   ========================================================================== */
.match-found-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(18, 26, 43, 0.9);
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 14px 18px;
  margin: 6px 0;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--accent-gold-glow);
}

.match-found-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.match-found-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.match-found-wager {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 209, 92, 0.15);
  border: 1px solid var(--accent-gold);
  border-radius: 20px;
  padding: 4px 10px;
}

.accept-timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 4px 0 10px 0;
}

.accept-timer-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.accept-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-gold) 100%);
  border-radius: 3px;
  transition: width 0.1s linear;
}

/* ==========================================================================
   RESPONSIVENESS (MOBILE SAFARI & ANDROID CHROME)
   ========================================================================== */
@media (max-width: 768px) {
  #hud-top {
    min-height: 48px;
    padding: calc(var(--safe-top) + 4px) 8px 4px 8px;
  }

  .hud-player-card {
    min-width: auto;
    padding: 3px 8px;
    gap: 6px;
  }

  .hud-avatar {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .hud-player-name {
    font-size: 11px;
    max-width: 58px;
  }

  .match-pot-badge {
    font-size: 10px;
    padding: 2px 7px;
  }

  .turn-timer-bar {
    width: 75px;
    height: 3px;
  }

  #power-meter-container {
    height: 260px;
    width: 50px;
    right: calc(var(--safe-right) + 6px);
  }

  .power-track {
    width: 14px;
  }

  .power-handle {
    width: 40px;
    height: 40px;
  }

  #fine-tune-container {
    left: calc(var(--safe-left) + 6px);
    gap: 8px;
  }

  .side-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .hud-wallet-btn {
    padding: 4px 10px;
    font-size: 11px;
  }
}

/* Landscape orientation - compact HUD so table is 100% visible */
@media (orientation: landscape) and (max-height: 520px) {
  #hud-top {
    min-height: 36px;
    padding: calc(var(--safe-top) + 2px) calc(var(--safe-right) + 8px) 2px calc(var(--safe-left) + 8px);
  }

  .hud-player-card {
    min-width: auto;
    padding: 2px 6px;
    gap: 4px;
  }

  .hud-avatar {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .hud-player-name {
    font-size: 10px;
    max-width: 50px;
  }

  .hud-ball-badge {
    font-size: 8px;
  }

  .mini-ball {
    width: 10px;
    height: 10px;
  }

  .mini-ball .mini-num {
    font-size: 6px;
  }

  .match-pot-badge {
    font-size: 9px;
    padding: 1px 6px;
  }

  .turn-timer-bar {
    width: 65px;
    height: 3px;
  }

  #power-meter-container {
    height: 170px;
    width: 40px;
    right: calc(var(--safe-right) + 4px);
    top: 50%;
  }

  .power-track {
    width: 10px;
  }

  .power-handle {
    width: 32px;
    height: 32px;
  }

  #fine-tune-container {
    left: calc(var(--safe-left) + 4px);
    top: 50%;
    gap: 6px;
  }

  .side-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  #hud-bottom {
    bottom: calc(var(--safe-bottom) + 4px);
    gap: 8px;
  }

  #game-banner {
    top: 42px;
    font-size: 12px;
    padding: 4px 16px;
  }
}

/* ==========================================================================
   PRO ESPORTS UI LAYER  (v10)
   Sharper HUD, vector icons, tournament-grade typography
   ========================================================================== */
:root {
  --font-main: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Chakra Petch', 'Rajdhani', -apple-system, sans-serif;
  --bg-glass: rgba(10, 17, 30, 0.82);
  --border-glass: rgba(140, 190, 255, 0.16);
  --edge-hi: rgba(255, 255, 255, 0.07);
}

body, #app-container { font-family: var(--font-main); letter-spacing: 0.01em; }

#app-container {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(0, 210, 255, 0.10), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(0, 230, 153, 0.08), transparent 60%),
    linear-gradient(180deg, #0b1120 0%, #060a12 100%);
}
#app-container::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(120, 180, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 45%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 10%, transparent 78%);
}

/* ---------- Vector icon baseline ---------- */
.ico { width: 18px; height: 18px; display: block; }
.side-btn .ico { width: 17px; height: 17px; }
.mode-title .ico { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; color: var(--accent-cyan); }
.power-cue-icon .ico { width: 15px; height: 15px; color: var(--accent-gold); }

/* ---------- Control buttons ---------- */
.side-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(30, 44, 70, 0.95), rgba(14, 22, 38, 0.95));
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-main);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform .12s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}
.side-btn:hover {
  color: var(--accent-cyan);
  border-color: rgba(0, 210, 255, 0.5);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 0 0 1px rgba(0, 210, 255, 0.14), 0 6px 18px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}
.side-btn:active { transform: translateY(1px) scale(0.97); }
#btn-sound .ico-off { display: none; }
#btn-sound.muted .ico-on { display: none; }
#btn-sound.muted .ico-off { display: block; color: var(--accent-ruby); }

/* ---------- Top HUD ---------- */
#hud-top {
  z-index: 5;
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.94), rgba(8, 14, 26, 0));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hud-player-card {
  background: linear-gradient(150deg, rgba(22, 33, 55, 0.92), rgba(11, 18, 32, 0.92));
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.hud-player-card.active {
  border-color: rgba(0, 230, 153, 0.55);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 0 0 1px rgba(0, 230, 153, 0.18), 0 0 26px rgba(0, 230, 153, 0.18);
}
.hud-player-card.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-emerald), transparent);
  border-radius: 2px;
}
.hud-player-name {
  font-family: var(--font-display);
  font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.hud-avatar {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 28%, #2b3c5f, #0c1322);
  border: 1px solid var(--border-glass);
  color: var(--accent-cyan);
}
.avatar-ball {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #4a4a4a, #0b0b0b 70%);
  font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.6), 0 0 8px rgba(255,255,255,.12);
}
.hud-ball-badge {
  font-family: var(--font-display);
  letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700;
}
.match-pot-badge {
  font-family: var(--font-display);
  letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid var(--border-gold);
  background: linear-gradient(180deg, rgba(255, 209, 92, 0.14), rgba(255, 209, 92, 0.04));
  box-shadow: 0 0 18px rgba(255, 209, 92, 0.12);
}
.pot-label { color: var(--accent-gold); font-weight: 700; }
.turn-timer-progress {
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  box-shadow: 0 0 12px rgba(0, 230, 153, 0.5);
}
.hud-wallet-btn, .user-badge {
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.03em;
  border: 1px solid var(--border-emerald);
  background: linear-gradient(180deg, rgba(0, 230, 153, 0.14), rgba(0, 230, 153, 0.04));
}
.user-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald-glow);
}

/* ---------- Banner ---------- */
#game-banner {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  border: 1px solid var(--border-glass);
  background: linear-gradient(180deg, rgba(16, 26, 45, 0.96), rgba(9, 15, 27, 0.96));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Power meter / shoot ---------- */
.power-track {
  border: 1px solid var(--border-glass);
  background: linear-gradient(180deg, rgba(12, 20, 34, 0.95), rgba(8, 13, 23, 0.95));
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}
.power-fill {
  background: linear-gradient(180deg, var(--accent-ruby), var(--accent-gold) 55%, var(--accent-emerald));
  box-shadow: 0 0 18px rgba(255, 209, 92, 0.35);
}
.shoot-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.shoot-btn .ico { width: 20px; height: 20px; }

/* ---------- Lobby ---------- */
#lobby-screen {
  background:
    radial-gradient(900px 520px at 50% 0%, rgba(0, 210, 255, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(7, 12, 22, 0.97), rgba(4, 7, 13, 0.99));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.game-subtitle {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.22em; font-size: 11px;
  color: var(--text-muted);
}
.lobby-balance-card, .install-banner-card {
  border: 1px solid var(--border-glass);
  background: linear-gradient(150deg, rgba(22, 33, 55, 0.9), rgba(10, 17, 30, 0.9));
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 10px 28px rgba(0, 0, 0, 0.5);
}
.lobby-balance-amount { font-family: var(--font-display); font-weight: 700; }
.mode-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--border-glass);
  background: linear-gradient(150deg, rgba(21, 32, 54, 0.94), rgba(10, 16, 29, 0.94));
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease;
}
.mode-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent-cyan), transparent);
  opacity: .6;
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 210, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 210, 255, 0.14), 0 14px 34px rgba(0, 0, 0, 0.55);
}
.mode-card.featured::before { background: linear-gradient(180deg, var(--accent-gold), transparent); }
.mode-card.featured { border-color: var(--border-gold); }
.mode-title {
  font-family: var(--font-display);
  font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
}
.mode-desc { color: var(--text-muted); }
.mode-tag {
  font-family: var(--font-display);
  letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
}

/* ---------- Dialogs ---------- */
.glass-dialog {
  border: 1px solid var(--border-glass);
  background: linear-gradient(160deg, rgba(18, 28, 48, 0.97), rgba(8, 13, 24, 0.98));
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 30px 70px rgba(0, 0, 0, 0.7);
}
.glass-dialog h2, .dialog-header, .auth-tab, .btn-primary, .btn-secondary {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.btn-primary, .btn-secondary, .auth-tab { text-transform: uppercase; font-weight: 700; }
.btn-primary {
  background: linear-gradient(180deg, #00f3a5, #00b87c);
  box-shadow: 0 8px 22px rgba(0, 230, 153, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover { filter: brightness(1.06); }
input, select, textarea { font-family: var(--font-main); }
.ico-lg .ico { width: 22px; height: 22px; }
.dialog-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; }


/* ==========================================================================
   HD POWER METER (touch-first) + SPIN SELECTOR REFINEMENTS
   ========================================================================== */
#power-meter-container {
  height: min(46vh, 320px);
  width: 62px;
  padding: 12px 6px 10px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(18, 28, 48, 0.92), rgba(7, 12, 22, 0.94));
  border: 1px solid var(--border-glass);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 16px 40px rgba(0, 0, 0, 0.55);
  gap: 6px;
  touch-action: none;
  cursor: grab;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
#power-meter-container.charging {
  cursor: grabbing;
  border-color: var(--border-gold);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 0 0 1px var(--accent-gold-glow), 0 18px 46px rgba(0, 0, 0, 0.6);
}

.power-track {
  width: 18px;
  border-radius: 12px;
  margin: 6px 0;
  overflow: visible;
  pointer-events: none;
}
.power-fill {
  border-radius: 12px;
  transition: height .04s linear;
}
.power-ticks {
  position: absolute;
  inset: 8px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.power-ticks span {
  display: block;
  height: 1px;
  margin: 0 auto;
  width: 60%;
  background: rgba(255, 255, 255, 0.16);
}
.power-handle {
  width: 42px;
  height: 42px;
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #dbe4f0 45%, #8ea0b8 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65), 0 0 14px var(--accent-gold-glow);
  pointer-events: none;
  transition: transform .08s ease;
}
.power-handle-grip {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: #64748b;
  box-shadow: 0 5px 0 #64748b, 0 -5px 0 #64748b;
}
#power-meter-container.charging .power-handle {
  transform: translate(-50%, 50%) scale(1.12);
}
.power-value {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-gold);
  min-height: 14px;
}

/* Spin selector */
.spin-btn { position: relative; }
.spin-btn.has-spin { border-color: var(--border-gold); box-shadow: 0 0 12px var(--accent-gold-glow); }
.spin-mini-dot {
  position: absolute;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-ruby);
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.spin-title {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-gold);
}
.spin-ball-surface {
  width: 112px; height: 112px;
  touch-action: none;
  cursor: crosshair;
}
.spin-ring {
  position: absolute; inset: 8%;
  border-radius: 50%;
  border: 1px dashed rgba(15, 23, 42, 0.25);
  pointer-events: none;
}
.spin-tip-dot { width: 18px; height: 18px; transition: left .05s linear, top .05s linear; }
.spin-label {
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 0.08em; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
}
.spin-reset-btn {
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
}
.spin-reset-btn:active { transform: scale(0.96); }

/* Phone tuning: bigger, thumb-friendly targets */
@media (max-width: 640px), (pointer: coarse) {
  #power-meter-container {
    width: 68px;
    height: min(52vh, 300px);
    right: calc(var(--safe-right) + 8px);
  }
  .power-track { width: 20px; }
  .power-handle { width: 48px; height: 48px; }
  .side-btn { width: 46px; height: 46px; }
  .spin-ball-surface { width: 124px; height: 124px; }
  .spin-tip-dot { width: 20px; height: 20px; }
  #spin-modal { bottom: 92px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  #power-meter-container { height: min(76vh, 210px); width: 54px; padding: 8px 4px; }
  .power-track { width: 16px; }
  .power-handle { width: 38px; height: 38px; }
  .spin-ball-surface { width: 92px; height: 92px; }
  #spin-modal { bottom: 60px; padding: 10px; gap: 6px; }
}

/* ==========================================================================
   PROFILE CHIP + DROPDOWN MENU (top right)
   ========================================================================== */
.profile-wrap { position: relative; display: flex; align-items: center; }

.profile-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 9px 5px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
  background: linear-gradient(150deg, rgba(24, 36, 60, 0.95), rgba(10, 17, 30, 0.95));
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.profile-chip:hover { border-color: var(--accent-gold); transform: translateY(-1px); }
.profile-flag { font-size: 18px; line-height: 1; }
.profile-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.profile-chip-name {
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-chip-rank { font-size: 10px; font-weight: 700; color: var(--accent-gold); letter-spacing: 0.04em; }
.profile-caret { width: 14px; height: 14px; color: var(--text-muted); }

.profile-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 244px; padding: 10px;
  display: flex; flex-direction: column; gap: 4px;
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  background: linear-gradient(170deg, rgba(16, 25, 42, 0.98), rgba(6, 11, 20, 0.99));
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  z-index: 220;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}
.profile-menu.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.profile-menu-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; }
.pm-flag { font-size: 26px; line-height: 1; }
.pm-head-text { display: flex; flex-direction: column; min-width: 0; }
.pm-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text-main); }
.pm-country { font-size: 11px; color: var(--text-muted); }

.pm-rank-card {
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--border-gold);
  border-radius: 12px; padding: 9px 10px; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.pm-rank-top { display: flex; align-items: center; justify-content: space-between; }
.pm-rank-name { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--accent-gold); }
.pm-rank-wins { font-size: 10px; font-weight: 700; color: var(--text-muted); }
.pm-rank-bar { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.pm-rank-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold));
  transition: width 0.3s ease;
}
.pm-rank-next { font-size: 10px; color: var(--text-dim); }

.pm-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: none; border-radius: 10px; background: transparent;
  color: var(--text-main); font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.pm-item .ico { width: 16px; height: 16px; color: var(--accent-cyan); }
.pm-item:hover { background: rgba(255, 255, 255, 0.07); }
.pm-item.danger { color: var(--accent-ruby); }
.pm-item.danger .ico { color: var(--accent-ruby); }
.pm-divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 4px 2px; }

/* ---------- Country picker ---------- */
.country-field { position: relative; display: flex; align-items: center; }
.country-field-flag {
  position: absolute; left: 12px; font-size: 18px; line-height: 1; pointer-events: none;
}
.country-select {
  width: 100%; padding-left: 40px; appearance: none;
  background-color: rgba(0, 0, 0, 0.35); color: var(--text-main); cursor: pointer;
}
.country-select option { background: #0b1220; color: #e8eefc; }

/* ---------- Affiliate + settings ---------- */
.affiliate-code-row { display: flex; align-items: center; gap: 8px; }
.affiliate-code {
  flex: 1; padding: 11px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border-gold);
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  letter-spacing: 0.16em; color: var(--accent-gold); text-align: center;
}
.affiliate-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.affiliate-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-glass);
}
.affiliate-stat-val { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text-main); }
.affiliate-stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

.settings-toggle {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; color: var(--text-main); cursor: pointer;
}
.settings-toggle input { width: 18px; height: 18px; accent-color: var(--accent-emerald); }

@media (max-width: 560px) {
  .profile-chip-rank { display: none; }
  .profile-chip-name { max-width: 62px; }
  .profile-menu { width: 218px; }
}

/* Keep the profile chip reachable while the lobby overlay is on top */
body.lobby-open .hud-right-group {
  position: fixed; top: 10px; right: 12px; z-index: 200;
}
body.lobby-open #btn-reset-round,
body.lobby-open .hud-wallet-btn { display: none; }

/* Lift only the profile chip above the lobby overlay */
body.lobby-open #hud-top {
  z-index: 210;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
body.lobby-open #hud-top > * { pointer-events: none; }
body.lobby-open #hud-top .hud-right-group,
body.lobby-open #hud-top .hud-right-group * { pointer-events: auto; }
body.lobby-open #hud-player-1,
body.lobby-open #hud-player-2,
body.lobby-open #hud-center-info { opacity: 0; }

/* ── v12: phone field, referral label, lobby overflow fix ─────────────────── */

.phone-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.phone-field .dial-select {
  flex: 0 0 42%;
  max-width: 150px;
  min-width: 0;
  padding-right: 6px;
  text-overflow: ellipsis;
}

.phone-field .phone-input {
  flex: 1 1 auto;
  min-width: 0;
}

.label-optional {
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.85;
}

/* Lobby: never clip the crown of the 8ballWIN logo on short screens.
   The lobby scrolls instead of centring content out of view, and the
   profile chip in the HUD gets clearance at the top. */
#lobby-screen {
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 72px) 24px calc(var(--safe-bottom) + 32px);
  gap: 20px;
}

#lobby-screen > * {
  flex-shrink: 0;
}

.game-logo-wrapper {
  margin-top: auto;
  padding-top: 4px;
}

.lobby-modes-grid {
  margin-bottom: auto;
}

.lobby-logo-img {
  /* Leave headroom so the animated glow/scale never crops the crown. */
  padding-top: 6px;
  transform-origin: center bottom;
}

@media (max-height: 640px) {
  #lobby-screen {
    padding-top: calc(var(--safe-top) + 60px);
    gap: 14px;
  }
  .lobby-logo-img {
    max-width: 170px;
    width: 52vw;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  #lobby-screen {
    padding-top: calc(var(--safe-top) + 52px);
    gap: 10px;
  }
  .lobby-logo-img {
    max-width: 130px;
    width: 30vw;
  }
}

/* ══════════════════════════════════════════════════
   CUE SKINS — lobby shortcut, profile item & picker
   ══════════════════════════════════════════════════ */

.pm-item-value {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-cue-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.lobby-cue-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent-gold-glow);
}
.lobby-cue-preview {
  width: 96px;
  height: 26px;
  object-fit: contain;
  transform: scaleX(-1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}
.lobby-cue-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.lobby-cue-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.lobby-cue-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lobby-cue-cta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-glow);
  border-radius: 999px;
  padding: 4px 10px;
}

.skins-dialog {
  max-width: 640px;
  width: min(92vw, 640px);
}
.skins-rank-line {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
  text-align: center;
  margin: 0;
}
.skins-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: -4px 0 2px;
}
.skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  max-height: min(56vh, 420px);
  overflow-y: auto;
  padding: 2px;
}
.skin-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.skin-card:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: var(--accent-gold-glow);
}
.skin-card.equipped {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 1px var(--accent-emerald-glow) inset;
}
.skin-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.85);
}
.skin-rank {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.skin-art {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.skin-art img {
  width: 100%;
  max-height: 52px;
  object-fit: contain;
  transform: scaleX(-1);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
}
.skin-name {
  font-size: 13px;
  font-weight: 800;
}
.skin-status {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}
.skin-card.equipped .skin-status {
  color: var(--accent-emerald);
}


/* ==========================================================================
   HD ART UI — DRAG MODE SELECTOR, RANK BADGES, RESULT & MATCH ART BUTTONS
   ========================================================================== */
.mode-slider {
  /* fixed slide width => exact, non-circular centring padding */
  --mode-slide-w: min(330px, 80vw);
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mode-track {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  padding: 4px calc((100% - var(--mode-slide-w)) / 2);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}
.mode-track::-webkit-scrollbar { display: none; }
.mode-track.dragging { cursor: grabbing; scroll-snap-type: none; }

.mode-slide {
  flex: 0 0 var(--mode-slide-w);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 4px 10px;
  border-radius: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.42;
  filter: saturate(0.5) brightness(0.72);
  transform: scale(0.86);
  transition: opacity .25s ease, transform .25s ease, filter .25s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mode-slide.is-active {
  opacity: 1;
  filter: none;
  transform: scale(1);
}
.mode-slide .mode-art {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.6));
}
.mode-slide.is-active .mode-art:not(.mode-art-vfx) {
  animation: modeArtFloat 4.5s ease-in-out infinite;
}
@keyframes modeArtFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.mode-slide.is-active:active { transform: scale(0.97); }

/* Ranked 1v1 — animated VFX button (breathes / moves in the webp itself) */
.mode-slide-vfx .mode-art-vfx {
  width: 100%;
  max-width: 360px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.65));
  /* webp already animates — no CSS float */
  animation: none !important;
}
.mode-slide-vfx.is-active .mode-art-vfx {
  filter: drop-shadow(0 18px 32px rgba(255, 180, 40, 0.28))
          drop-shadow(0 14px 26px rgba(0, 0, 0, 0.55));
}

.mode-slide-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mode-slide-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-main);
}
.mode-slide-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.04);
}
.mode-slide-tag.bet {
  color: var(--accent-gold);
  border-color: var(--border-gold);
  background: rgba(255, 209, 92, 0.1);
}

.mode-slider-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}
.mode-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, transform .15s ease;
}
.mode-arrow:hover { color: var(--accent-gold); border-color: var(--border-gold); transform: translateY(-1px); }
.mode-dots { display: flex; align-items: center; gap: 7px; }
.mode-dot {
  width: 7px; height: 7px; padding: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: all .2s ease;
}
.mode-dot.is-active {
  width: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-gold));
}
.mode-slider-hint {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Rank division badges */
.rank-badge { display: inline-block; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55)); }
.rank-badge.sm { width: 20px; height: 20px; }
.rank-badge.md { width: 34px; height: 34px; }
.profile-chip-rank { display: inline-flex; align-items: center; gap: 5px; }
.pm-rank-name-wrap { display: inline-flex; align-items: center; gap: 8px; }
.skins-rank-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; }

/* Victory / defeat art */
.result-art {
  width: min(280px, 78%);
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.65));
  animation: resultArtPop .45s cubic-bezier(0.2, 1.4, 0.4, 1) both, modeArtFloat 4s ease-in-out 0.5s infinite;
}
@keyframes resultArtPop {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* Accept / decline art buttons */
.btn-art {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, filter .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-art img { width: 100%; height: auto; display: block; pointer-events: none; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55)); }
.btn-art:hover { transform: translateY(-2px) scale(1.03); }
.btn-art:active { transform: scale(0.96); }
.btn-art-accept { flex: 1.15; }
.btn-art-decline { flex: 1; }

@media (max-width: 420px) {
}
@media (max-height: 700px) {
  .mode-slide .mode-art { max-height: 30vh; width: auto; }
  .mode-slide { justify-content: flex-end; }
}


/* ---------- Promo code redemption (Cue Skins dialog) ---------- */
.promo-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin: 4px 0 6px;
}

.promo-input {
  flex: 1 1 auto;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.promo-btn {
  flex: 0 0 auto;
  width: auto;
  padding: 0 18px;
  white-space: nowrap;
}

.promo-msg {
  margin: 0 0 10px;
  min-height: 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

.promo-msg.ok { color: #2ee6a8; }
.promo-msg.err { color: #ff6b81; }

/* ---- Turn lock: opponent's turn – disable aim / power UI ---- */
body.controls-locked #btn-fine-left,
body.controls-locked #btn-fine-right,
body.controls-locked #power-container,
body.controls-locked #btn-shoot,
body.controls-locked #btn-spin-toggle {
  pointer-events: none !important;
  opacity: 0.45;
  filter: grayscale(0.35);
}
body.controls-locked #game-canvas {
  cursor: default;
}

/* ---- Wallet dialog ---- */
.wallet-dialog { max-width: 400px; }
.wallet-balance-hero {
  background: rgba(0,0,0,0.35);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: center;
  border: 1px solid var(--border-gold);
}
.wallet-balance-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
}
.wallet-balance-row {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
}
.wallet-balance-num { font-size: 32px; font-weight: 900; color: var(--accent-gold); }
.wallet-balance-unit { font-size: 14px; font-weight: 700; color: var(--text-muted); }
.wallet-balance-hint { font-size: 11px; color: var(--accent-emerald); font-weight: 600; display: block; margin-top: 4px; }

.wallet-coins {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0;
}
.wallet-coin {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: 12px; padding: 10px 12px;
}
.wallet-coin strong { display: block; font-size: 13px; }
.wallet-coin span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.wallet-coin-sym {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(38,161,123,0.25); color: #26a17b; font-weight: 800; font-size: 14px;
}
.wallet-coin-sym.eth { background: rgba(98,126,234,0.25); color: #8fa0ff; }
.wallet-coin-sym.btc { background: rgba(247,147,26,0.2); color: #f7931a; }
.wallet-coin-sym.bnb { background: rgba(243,186,47,0.2); color: #f3ba2f; }

.wallet-tabs {
  display: flex; gap: 6px; margin: 8px 0 12px;
}
.wallet-tab {
  flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--border-glass);
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.wallet-tab.active {
  color: var(--accent-gold); border-color: var(--border-gold);
  background: rgba(255,209,92,0.12);
}
.wallet-panel { display: none; }
.wallet-panel.active { display: block; }
.wallet-panel-note { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; line-height: 1.4; }
.wallet-panel-note.muted { opacity: 0.75; font-size: 11px; margin-top: 8px; }
.deposit-addr-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
}
.deposit-addr {
  flex: 1; font-size: 11px; word-break: break-all;
  background: rgba(0,0,0,0.35); border-radius: 10px; padding: 10px;
  border: 1px solid var(--border-glass); color: var(--text-main);
}
.btn-copy-addr { flex-shrink: 0; padding: 8px 12px; font-size: 11px; }

/* ---- Rank ladder ---- */
.rank-dialog { max-width: 420px; }
.rank-current-card {
  display: flex; align-items: center; gap: 14px;
  background: rgba(0,0,0,0.3); border-radius: 14px; padding: 12px 14px;
  border: 1px solid var(--border-glass); margin-bottom: 12px;
}
.rank-current-name { display: block; font-weight: 800; font-size: 16px; }
.rank-current-wins { font-size: 12px; color: var(--text-muted); }
.rank-progress-wrap { margin-bottom: 14px; }
.pm-rank-bar.tall { height: 10px; }
.rank-ladder {
  max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.rank-ladder-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-glass);
  opacity: 0.55;
}
.rank-ladder-row.reached { opacity: 1; }
.rank-ladder-row.current {
  border-color: var(--border-gold);
  background: rgba(255,209,92,0.08);
  box-shadow: 0 0 0 1px rgba(255,209,92,0.15);
}
.rank-ladder-meta { flex: 1; min-width: 0; }
.rank-ladder-meta strong { display: block; font-size: 13px; }
.rank-ladder-meta span { font-size: 11px; color: var(--text-muted); }
.rank-ladder-status {
  font-size: 11px; font-weight: 800; color: var(--text-muted); letter-spacing: 0.04em;
}
.rank-ladder-row.current .rank-ladder-status { color: var(--accent-gold); }
.rank-ladder-row.reached .rank-ladder-status { color: var(--accent-emerald); }
.rank-badge.lg { width: 48px; height: 48px; object-fit: contain; }

/* ---- Support ---- */
.support-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.support-item {
  display: block; padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-glass);
  color: var(--text-main); text-decoration: none; font-size: 13px; font-weight: 600;
}
.support-item:hover { border-color: var(--border-gold); color: var(--accent-gold); }

/* ---- Opponent profile popup ---- */
.opp-profile-pop {
  position: fixed; z-index: 80;
  top: 72px; left: 50%; transform: translateX(-50%) translateY(-6px);
  min-width: 220px; max-width: 90vw;
  padding: 14px 16px 12px;
  border-radius: 16px;
  background: rgba(12, 16, 28, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  color: #fff;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.opp-profile-pop.open {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.opp-profile-close {
  position: absolute; top: 6px; right: 8px;
  background: transparent; border: none; color: rgba(255,255,255,0.7);
  font-size: 18px; cursor: pointer; line-height: 1;
}
.opp-profile-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.opp-profile-flag { font-size: 22px; }
.opp-profile-row strong { display: block; font-size: 14px; }
.opp-profile-country { font-size: 11px; color: rgba(255,255,255,0.65); }
.opp-profile-rank {
  display: flex; align-items: center; gap: 10px;
  padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.1);
}
.opp-profile-rank span { display: block; font-size: 12px; }
.opp-profile-rank span:last-child { font-size: 11px; color: rgba(255,255,255,0.65); }

.hud-player-card { cursor: pointer; }

/* ---- New profile bars (replace old HUD cards) ---- */
.hud-profile-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(42vw, 220px);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 14px;
  overflow: visible;
  opacity: 0.78;
  transform: scale(0.96);
  transition: opacity .2s ease, transform .2s ease, filter .2s ease;
  filter: saturate(0.85) brightness(0.92);
}
.hud-profile-bar.active {
  opacity: 1;
  transform: scale(1);
  filter: none;
  z-index: 2;
}
.hud-bar-bg {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  border-radius: 12px;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.45));
}
.hud-bar-overlay {
  position: absolute;
  left: 6%;
  right: 8%;
  top: 12%;
  bottom: 28%;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hud-profile-bar.mirror .hud-bar-overlay {
  flex-direction: row-reverse;
  text-align: right;
}
.hud-bar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.hud-bar-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud-bar-name {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.hud-bar-sub {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.hud-profile-bar.mirror .hud-bar-sub { justify-content: flex-end; }
.rank-badge.xs { width: 12px; height: 12px; object-fit: contain; }
.hud-bar-tracker {
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
}
.hud-social-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 4px;
}
.hud-social-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.35);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.hud-social-btn .ico { width: 16px; height: 16px; }
.hud-social-btn:active { transform: scale(0.94); }

/* Bet chips */
.bet-select-block { margin-bottom: 14px; }
.bet-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.bet-chip {
  min-width: 52px; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--border-glass);
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  font-size: 12px; font-weight: 800; cursor: pointer;
}
.bet-chip.active {
  color: var(--accent-gold); border-color: var(--border-gold);
  background: rgba(255,209,92,0.12);
}
.bet-pot-line { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.bet-pot-line strong { color: var(--accent-gold); }

/* Quick chat */
.quick-chat-tray {
  position: fixed; z-index: 75;
  left: 50%; bottom: 88px; transform: translateX(-50%);
  width: min(360px, 94vw);
  background: rgba(10,14,24,0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; padding: 10px 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.quick-chat-head {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px;
}
.quick-chat-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.quick-chat-btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 8px 10px; border-radius: 999px; cursor: pointer;
}
.quick-chat-btn:active { background: rgba(255,209,92,0.15); border-color: var(--border-gold); }
.chat-bubble-log {
  position: fixed; z-index: 70;
  left: 50%; top: 110px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; width: min(320px, 90vw); align-items: center;
}
.chat-bubble {
  background: rgba(12,16,28,0.78);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 14px;
  animation: chatFade 3.2s ease forwards;
  text-align: center; max-width: 100%;
}
@keyframes chatFade {
  0% { opacity: 0; transform: translateY(6px); }
  12% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Friends */
.friends-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.friend-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-glass);
}
.friend-row img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.friend-row .friend-meta { flex: 1; min-width: 0; }
.friend-row strong { display: block; font-size: 13px; }
.friend-row span { font-size: 11px; color: var(--text-muted); }
.friend-invite-btn {
  padding: 8px 12px; font-size: 11px; font-weight: 800;
  border-radius: 10px; border: 1px solid var(--border-gold);
  background: rgba(255,209,92,0.12); color: var(--accent-gold); cursor: pointer;
}
.opp-profile-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,0.25);
}
.opp-profile-actions { margin-top: 10px; }
.opp-action-btn { width: 100%; font-size: 12px; padding: 8px; }

@media (max-width: 720px) {
  .hud-profile-bar { width: min(40vw, 150px); }
  .hud-bar-avatar { width: 28px; height: 28px; }
  .hud-bar-name { font-size: 10px; max-width: 72px; }
  .hud-bar-sub { font-size: 8px; }
}
