/* =========================================
   1. NEON GLOBAL VARIABLES & BASE RESET
   ========================================= */
:root {
  --neon-cyan: #00f2fe;
  --neon-green: #00ff87;
  --neon-yellow: #f1c40f;
  --neon-red: #ff003c;
  --neon-bg: #09090b;
  --neon-card-bg: rgba(255, 255, 255, 0.03);
  --neon-border: rgba(255, 255, 255, 0.08);
  --slider-glow: #f1c40f; /* Default, overridden by JS */
}

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

html,
body {
  position: fixed;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--neon-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.4s ease;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
}

.splash-logo {
  font-family: "Rajdhani", sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 6px;
  text-align: center;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0, 255, 135, 0.5);
  line-height: 1;
}

.splash-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 255, 135, 0.15);
  border-top-color: var(--neon-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

body {
  background-color: var(--neon-bg);
  background-image: radial-gradient(circle at 50% 0%, #1f1f2e 0%, #09090b 70%);
  color: #f8fafc;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  display: flex;
  justify-content: center;
  padding-bottom: 90px; /* Room for bottom nav */
}

input {
  -webkit-user-select: text;
  user-select: text;
}

.hidden {
  display: none !important;
}

/* =========================================
   2. MAIN MENU & LAYOUT CONTAINERS
   ========================================= */
.app-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 85vh;
}

/* The Glowing Logo */
.neon-logo,
.logo {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 20px;
  letter-spacing: 4px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
  line-height: 1.1;
}

/* The Frosted Glass Card */
.neon-card {
  background: var(--neon-card-bg);
  border: 1px solid var(--neon-border);
  border-radius: 20px;
  padding: 25px 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  position: relative;
  z-index: 10;
}

/* Dividers */
.neon-divider,
.divider-text {
  display: flex;
  align-items: center;
  text-align: center;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 2px;
}
.neon-divider::before,
.neon-divider::after,
.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #334155;
}
.neon-divider span,
.divider-text span {
  padding: 0 15px;
}

/* =========================================
   3. UNIVERSAL MODALS & OVERLAYS
   ========================================= */
.overlay,
#nickname-overlay,
#quit-confirm-overlay,
#friend-lobby-overlay,
#game-over-overlay {
  position: fixed !important;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Profile + Settings are full-page, not centered modals */
#profile-overlay,
#settings-overlay {
  position: fixed !important;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--neon-bg);
  background-image:
    radial-gradient(ellipse 120% 40% at 50% -10%, #1e1b4b 0%, transparent 60%), radial-gradient(ellipse 80% 60% at 80% 80%, #0f172a 0%, transparent 50%);
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

.modal,
.game-over-modal {
  width: 85%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--neon-cyan);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.8),
    inset 0 0 20px rgba(0, 242, 254, 0.1);
  border-radius: 20px;
  padding: 25px;
  text-align: center;
  color: #f8fafc;
}

.modal h2,
.game-over-modal h2 {
  color: var(--neon-cyan);
  margin-top: 0;
  margin-bottom: 20px;
  text-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
  letter-spacing: 2px;
}
.game-over-elo-delta {
  font-family: "Share Tech Mono", monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin: -10px 0 14px;
}
.game-over-elo-delta.elo-gain {
  color: #00ff87;
  text-shadow: 0 0 10px #00ff8766;
}
.game-over-elo-delta.elo-loss {
  color: #ff003c;
  text-shadow: 0 0 10px #ff003c66;
}

/* =========================================
   4. NEON INPUTS & FORMS
   ========================================= */
.action-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.neon-input {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: rgba(0, 0, 0, 0.3);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 3px;
  outline: none;
  transition: all 0.3s ease;
}

.join-row input {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
}

input[type="text"]:focus,
.neon-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
  background: rgba(0, 242, 254, 0.05);
}

input::placeholder {
  color: #475569;
}

/* =========================================
   5. NEON GLOW BUTTONS
   ========================================= */
.btn-neon,
.menu-btn,
.ready-btn,
.game-over-btn,
.settings-action-btn,
#submit-guess-btn {
  margin: 5px auto;
  width: 100%;
  background: transparent;
  color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  border-radius: 12px;
  padding: 10px 0 10px 0;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  box-shadow:
    0 0 10px rgba(0, 242, 254, 0.2),
    inset 0 0 10px rgba(0, 242, 254, 0.1);
  touch-action: manipulation;
}

/* Visual cue for whose turn it is */
#submit-guess-btn:not(:disabled) {
  animation: pulse-glow 2s infinite;
}

/* The Class to trigger pulse glow */
.pulse-animation {
  animation: pulse-glow 1.5s infinite;
  border: 2px solid var(--neon-green) !important; /* Force the border to show it's active */
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 5px var(--neon-green);
  }
  50% {
    box-shadow: 0 0 15px var(--neon-green);
  }
  100% {
    box-shadow: 0 0 5px var(--neon-green);
  }
}

.join-row button {
  width: auto;
  padding: 12px 24px;
}

.btn-primary:active {
  background: var(--neon-cyan);
  color: #09090b;
  box-shadow:
    0 0 20px rgba(0, 242, 254, 0.6),
    inset 0 0 10px rgba(0, 242, 254, 0.4);
  transform: scale(0.97);
}

/* Secondary Actions */
.btn-secondary {
  margin: 0 auto;
  color: #94a3b8;
  border-color: #334155;
  box-shadow: none;
}

.btn-secondary:hover,
.btn-secondary:active {
  background: transparent;
  color: #f8fafc;
  border-color: #f8fafc;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Action / Ready Buttons (Neon Green) */
#submit-guess-btn {
  width: 65% !important;
  margin: 15px auto !important; /* 'auto' pushes it perfectly to the center */
  display: block;
  color: var(--neon-green);
  border-color: var(--neon-green);
  box-shadow:
    0 0 10px rgba(0, 255, 135, 0.2),
    inset 0 0 10px rgba(0, 255, 135, 0.1);
}

.ready-btn,
#regenerate-secret-btn,
.btn-dark,
.btn-green {
  width: 75% !important;
  margin: 10px auto !important; /* 'auto' pushes it perfectly to the center */
  display: block;
  color: var(--neon-green);
  border-color: var(--neon-green);
  box-shadow:
    0 0 10px rgba(0, 255, 135, 0.2),
    inset 0 0 10px rgba(0, 255, 135, 0.1);
}

.btn-blue {
  width: 75% !important;
  margin: 10px auto !important;
  display: block;
  color: #3b9eff;
  border-color: #3b9eff;
  box-shadow:
    0 0 10px rgba(59, 158, 255, 0.2),
    inset 0 0 10px rgba(59, 158, 255, 0.1);
}

.btn-blue:active {
  background: #3b9eff;
  color: #09090b;
  box-shadow:
    0 0 20px rgba(59, 158, 255, 0.6),
    inset 0 0 10px rgba(59, 158, 255, 0.4);
}

.ready-btn:active,
#submit-guess-btn:active,
#regenerate-secret-btn:active,
.btn-dark:active,
.btn-green:active {
  background: var(--neon-green);
  color: #09090b;
  box-shadow:
    0 0 20px rgba(0, 255, 135, 0.6),
    inset 0 0 10px rgba(0, 255, 135, 0.4);
}

/* Cancel / Quit / Exit Buttons (Neon Red) */
.cancel,
.quit-game-btn,
#clear-stats-btn {
  color: var(--neon-red);
  border-color: var(--neon-red);
  box-shadow:
    0 0 10px rgba(255, 0, 60, 0.2),
    inset 0 0 10px rgba(255, 0, 60, 0.1);
  margin-top: 10px;
  margin-bottom: 10px;
}

.cancel:active,
.red:active,
#btn-confirm-quit:active {
  background: var(--neon-red);
  color: #fff;
  box-shadow:
    0 0 20px rgba(255, 0, 60, 0.6),
    inset 0 0 10px rgba(255, 0, 60, 0.4);
}

/* Disabled State — scoped to game neon buttons only */
.btn-neon:disabled,
.ready-btn:disabled,
.menu-btn:disabled,
.game-over-btn:disabled,
.settings-action-btn:disabled,
#submit-guess-btn:disabled {
  border-color: #334155 !important;
  color: #475569 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
}

/* Floating Back/Exit Icon Buttons */
.icon-btn {
  margin-top: -5px !important;
  width: 20px;
  height: 20px;
  position: absolute;
  left: 10px;
  background: transparent;
  border: none;
  color: whitesmoke;
  box-shadow: none;
  padding: 0;
}

.icon-btn:hover {
  background-color: transparent !important;
  color: whitesmoke !important;
  transform: scale(1.1);
  box-shadow: none;
}

/* =========================================
   6. NEON SLIDER
   ========================================= */
.difficulty-slider-container {
  width: 100%;
  position: relative;
  height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 8px;
}

#difficulty-text {
  position: absolute;
  top: 0px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
  z-index: 2;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 0 10px var(--slider-glow);
}

#difficulty-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #334155;
  border-radius: 2px;
  outline: none;
  z-index: 3;
  margin: 0;
}

#difficulty-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background-color: var(--slider-glow);
  border-radius: 50%;
  box-shadow:
    0 0 15px var(--slider-glow),
    0 0 30px var(--slider-glow);
  cursor: grab;
  transition: transform 0.2s;
}
#difficulty-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.3);
}

/* =========================================
   7. GAME BOARD, CAGES & ANIMALS
   ========================================= */
#setup-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* This moves it from Top to Middle */
  height: 90vh; /* Full screen height */
  padding: 0; /* Remove top padding */
}

.setup-header,
.battle-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 20px;
  box-sizing: border-box;
}

.setup-header h3,
.battle-header h3 {
  margin: 0;
  text-align: center;
  color: whitesmoke;
  padding: 0 50px;
}

/* Slots Layout */
.slots-container,
#current-guess-slots {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px auto;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

.guess-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
}

/* The Cages (Neon Glass) */
.slot.cage {
  width: 70px;
  height: 90px;
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #334155;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
  transition: all 0.3s ease;
}

.slot.cage.active-selection {
  border-color: var(--neon-cyan) !important;
  box-shadow:
    0 0 15px var(--neon-cyan),
    inset 0 0 15px rgba(0, 242, 254, 0.2) !important;
}

.slot.filled {
  background: rgba(0, 0, 0, 0.4) !important;
  border-color: #334155 !important;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8) !important;
}

@keyframes pulse-neon {
  0% {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
  }
  50% {
    border-color: #fff;
    box-shadow: 0 0 20px #fff;
  }
  100% {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
  }
}
.active-selection {
  animation: pulse-neon 1.5s infinite;
}

/* Locks */
.slot.cage.locked {
  border: 1px solid var(--neon-yellow) !important;
  box-shadow:
    0 0 10px rgba(241, 196, 15, 0.3),
    inset 0 0 10px rgba(241, 196, 15, 0.2) !important;
}

.lock-indicator {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #09090b;
  border: 1px solid var(--neon-yellow);
  color: var(--neon-yellow);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px var(--neon-yellow);
  z-index: 20;
}

.lock-toggle-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #475569;
  border-radius: 8px;
  margin: 5px;
  cursor: pointer;
  font-size: 1.2rem;
  width: 50%;
  box-shadow: none;
  padding: 5px;
}

.lock-toggle-btn.is-locked {
  background: rgba(241, 196, 15, 0.1);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
}

.bars {
  position: absolute;
  inset: 0;

  /* MATH: Block is 20px. Bar is 6px. 
    (20 - 6) / 2 = 7px transparent gap on BOTH sides!
  */
  background: linear-gradient(90deg, transparent 0px, transparent 7px, #333 7px, #555 10px, #333 13px, transparent 13px);

  border-radius: inherit; /* Inherits the exact curve from the slot so it never bleeds */
  background-size: 24px 100%;
  pointer-events: none;
  z-index: 10;
  opacity: 0.75;
}

/* Emojis */
.animal {
  font-size: 2.5rem;
  z-index: 1;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}
.sending-guess {
  transform: translateY(-50px);
  opacity: 0;
}

/* Animal Grid — in-game picker (use class .game-animal-grid in index.html) */
.game-animal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  gap: 12px;
  width: 100%;
  margin: 5px auto;
  max-width: 320px;
  box-sizing: border-box;
}

/* =========================================
   8. HISTORY LOG & RESULTS
   ========================================= */
/* =========================================
   FIXED BATTLE LOG UI
   ========================================= */

.battle-log-fixed {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #334155;
  border-radius: 12px;
  width: 95%;
  max-width: 500px;
  margin: 15px auto;
  overflow: visible;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid #334155;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  font-weight: bold;
  font-size: 0.9rem;
  color: #94a3b8;
}

.neon-text-yellow {
  color: var(--neon-yellow);
  text-shadow: 0 0 5px rgba(241, 196, 15, 0.4);
}

/* The actual scrolling area */
.log-content {
  height: 250px; /* Fixed height so it doesn't push the screen down endlessly */
  overflow-y: scroll;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* CUSTOM NEON SCROLLBAR */
.log-content::-webkit-scrollbar {
  width: 6px;
}
.log-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}
.log-content::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 10px;
  box-shadow: 0 0 8px var(--neon-cyan);
}

#history-log {
  z-index: 1000;
  height: 220px !important;
  overflow-y: scroll !important;
  background: rgba(9, 9, 11, 0.9);
  padding: 8px;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#history-log::-webkit-scrollbar {
  width: 4px;
}
#history-log::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 10px;
}

.guess-num-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
  margin-right: 4px;
}

.history-row.dragging {
  opacity: 0.4;
}

.history-row.new-guess {
  animation: guess-highlight 3s ease forwards;
}

@keyframes guess-highlight {
  0% {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.5);
  }
  70% {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.5);
  }
  100% {
    border-color: var(--neon-border);
    box-shadow: none;
  }
}

.history-row {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--neon-card-bg);
  border: 1px solid var(--neon-border);
  /*margin-bottom: 8px;*/
  border-radius: 25px;
  width: 100%;
  padding: 5px 8px;
  box-sizing: border-box;
}

.history-animals-side {
  display: flex;
  align-items: center;
  font-size: 1.8rem;
  letter-spacing: 2px;
}

.result-circles {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
}
.circle.green {
  background-color: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
}
.circle.red {
  background-color: var(--neon-red);
  box-shadow: 0 0 10px var(--neon-red);
}
.circle.none {
  border-radius: 4px !important;
  background: rgba(255, 60, 60, 0.12);
  border: 1.5px solid rgba(255, 60, 60, 0.45) !important;
  position: relative;
}
.circle.none::before,
.circle.none::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  background: rgba(255, 60, 60, 0.9);
  border-radius: 1px;
}
.circle.none::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.circle.none::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Blacklisted card — red X overlay */
.card.blacklisted::before {
  content: "";
  position: absolute;
  inset: 25%;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(
      to bottom right,
      transparent calc(50% - 1.5px),
      rgba(255, 60, 60, 0.85) calc(50% - 1.5px),
      rgba(255, 60, 60, 0.85) calc(50% + 1.5px),
      transparent calc(50% + 1.5px)
    ),
    linear-gradient(
      to bottom left,
      transparent calc(50% - 1.5px),
      rgba(255, 60, 60, 0.85) calc(50% - 1.5px),
      rgba(255, 60, 60, 0.85) calc(50% + 1.5px),
      transparent calc(50% + 1.5px)
    );
}

/* =========================================
   9. MODAL INTERNALS (Settings, Stats, Lobby)
   ========================================= */
.welcome-header {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  color: #ffffff;
}

#user-greeting {
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

/* Settings Toggles */
.setting-group {
  margin-bottom: 15px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  color: #cbd5e1;
  font-size: 1rem;
}
.divider {
  border: 0;
  height: 1px;
  background: #334155;
  margin: 15px 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: 0.4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(0, 255, 135, 0.4);
}
input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #fff;
}

.setting-select {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid #334155;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
}
.version-display {
  text-align: center;
  font-size: 0.7rem;
  color: #475569;
  margin-top: 10px;
  letter-spacing: 1px;
}

/* Stats Tabs */
.stats-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.3);
  padding: 5px;
  border-radius: 10px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 8px 15px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: none;
  width: auto;
}
.tab-btn.active {
  background: rgba(0, 242, 254, 0.1);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
  border: 1px solid var(--neon-cyan);
}

.stats-bar.single-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 15px;
  border-radius: 10px;
  border-left: 2px solid var(--neon-cyan);
  border-right: 2px solid var(--neon-cyan);
  margin: 10px 0;
}

/* Room Code Display */
.room-code {
  font-size: 2.2rem;
  font-weight: bold;
  letter-spacing: 8px;
  color: var(--neon-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 10px 20px;
  border-radius: 12px;
  margin: 10px 0;
  border: 1px dashed var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
  display: inline-block;
}

/* =========================================
   10. TOASTS, LOADERS & BANNERS
   ========================================= */
#notification-toast {
  display: none;
  opacity: 0;
  width: auto;
  position: fixed;
  top: 19%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 12px 12px;
  border-radius: 15px;
  font-weight: bold;
  text-align: center;
  z-index: 10000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--neon-green);
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#notification-toast.show {
  display: block;
  opacity: 1;
}

#notification-toast.hidden {
  display: none;
  opacity: 0;
}

#notification-toast.warning {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
}

#notification-toast.error {
  border-color: var(--neon-red);
  box-shadow: 0 0 15px rgba(255, 0, 60, 0.3);
}

/* Matchmaking Loader */
.loader-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 40px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoo-loader {
  font-size: 4rem;
  animation: pulse 1.5s infinite ease-in-out;
}
.scanning-bar {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--neon-cyan);
  top: 50%;
  left: 0;
  box-shadow: 0 0 15px var(--neon-cyan);
  animation: scan 2s infinite linear;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
    filter: drop-shadow(0 0 15px var(--neon-cyan));
  }
}
@keyframes scan {
  0% {
    transform: translateY(-60px);
  }
  50% {
    transform: translateY(60px);
  }
  100% {
    transform: translateY(-60px);
  }
}

/* =========================================
   FIX: WIDER HORIZONTAL UPDATE BANNER
   ========================================= */
.update-banner {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--neon-cyan);
  color: white;
  padding: 10px 10px;
  border-radius: 25px;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
  z-index: 9999;

  /* Make it wider */
  width: 80%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#update-banner {
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

/* Force the inner content to be a perfect horizontal row */
.update-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.update-progress-row {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 5px;
}

.update-progress-label {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.update-progress-label::after {
  content: attr(data-pct);
  color: var(--neon-cyan);
  font-weight: 700;
}

.update-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.update-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--neon-cyan);
  border-radius: 3px;
  transition: none;
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.6);
}

.update-complete-msg {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.update-complete-msg span:first-child {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

.update-restart-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 400;
}

/* Remove default paragraph margins and let it fill the space */
.update-content p {
  margin: 0 !important;
  flex: 1; /* Pushes the button to the right */
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
}

.update-icon {
  font-size: 1.2rem;
}

#btn-update-now {
  background: var(--neon-cyan);
  color: #09090b;
  width: auto;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
  margin: 0;
  border: none;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0; /* Prevents the button from shrinking if the text gets long */
}

#btn-update-now:active {
  transform: scale(0.95);
  background: #fff;
}

/* =========================================
   11. DARK GLASS BOTTOM NAVIGATION
   ========================================= */
.bottom-nav {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  background: rgba(9, 9, 11, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 10px;
  z-index: 100;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.bottom-nav.hidden {
  display: flex !important; /* Keep it in the DOM but... */
  transform: translate(-50%, 100px); /* Slide it off screen */
  opacity: 0;
  pointer-events: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #475569;
  cursor: pointer;
  width: 60px;
  transition: all 0.3s ease;
}

/* Fixed-height icon slot so all items align regardless of svg size */
.nav-item svg {
  display: block;
  width: 20px;
  height: 32px; /* all icons occupy same vertical space */
  transition: all 0.3s ease;
}

#nav-btn-animals svg {
  width: 32px;
  height: 32px;
  position: relative;
  top: -2px;
}

.nav-item span {
  font-size: 0.65rem;
  letter-spacing: 1px;
  font-weight: 600;
  line-height: 1;
  transition: all 0.3s ease;
}

/* Neon Glow Nav Hover Effect */
.nav-item:hover,
.nav-item.active {
  color: var(--neon-cyan);
}
.nav-item:hover svg,
.nav-item.active svg {
  transform: translateY(-8px);
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.8));
}
.nav-item:hover span,
.nav-item.active span {
  opacity: 1;
  transform: translateY(-4px);
}

/* =========================================
   12. DYNAMIC GAME MODES (EASY / HARD)
   ========================================= */

/* --- EASY MODE (3 Slots, 9 Animals - 3x3 Grid) --- */
.mode-easy .game-animal-grid {
  grid-template-columns: repeat(3, 1fr);
  max-width: 240px;
}

/* --- HARD MODE (5 Slots, 15 Animals) --- */
.mode-hard .slot.cage {
  width: 70px;
}
.mode-hard .animal {
  font-size: 2rem;
}

.mode-hard .bars {
  background-size: 24px 100%;
  /* Remove the negative left shift entirely so it stays inside the cage 
  left: 2px;*/
}

.mode-hard .slots-container {
  max-width: 100%;
  justify-content: center;
  gap: 12px;
}

.mode-hard #current-guess-slots {
  max-width: 100%;
  justify-content: center;
  gap: 20px;
}

.mode-hard .guess-column {
  width: 60px;
}

.mode-hard .lock-toggle-btn {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  margin: 5px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mode-hard .game-animal-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 420px;
  gap: 10px;
}

.mode-hard .history-animals-side {
  font-size: 1.7rem;
  letter-spacing: 0;
}

.mode-hard .circle {
  width: 16px;
  height: 16px;
  margin: 0 2px;
}

/* =========================================
   FIX: NEON IOS INSTALL PROMPT (TOP CENTER)
   ========================================= */
#ios-install-prompt {
  position: fixed;
  top: 20px; /* Pushes it to the top instead of the bottom! */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 320px;

  /* Neon Glassmorphism styling */
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--neon-cyan);
  color: #f8fafc;

  padding: 15px 20px;
  border-radius: 16px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.8),
    0 0 15px rgba(0, 242, 254, 0.2);
  z-index: 9999; /* Forces it above absolutely everything */
  text-align: center;
  font-size: 0.95rem;
}

/* Fix the close button inside the prompt */
#close-ios-prompt {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: #475569;
  cursor: pointer;
  box-shadow: none; /* Removes the neon button glow from the X */
  padding: 5px;
  width: auto;
}

#close-ios-prompt:active {
  color: var(--neon-cyan);
  transform: scale(0.9);
  background: transparent;
  box-shadow: none;
}

/* FIX: Matchmaking Screen Layout */
#matchmaking-screen {
  flex-direction: column;
  text-align: center;
  gap: 15px; /* Adds nice breathing room between the text and the loader */
}

/* Ensure the text glows nicely in the dark theme */
#matchmaking-screen h2 {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
  margin-bottom: 10px;
}

#matchmaking-screen p {
  color: #94a3b8;
  font-size: 1.1rem;
  margin-top: 10px;
}

#cancel-matchmaking-btn {
  width: auto;
  padding: 12px 30px;
  margin-top: 20px;
}

#secret-reveal {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 10px 20px;
  margin: 10px auto;
  border: 1px solid #e74c3c;
  width: 85%;
  box-sizing: border-box;
  text-align: center;
}

.secret-reveal-label {
  font-size: 0.75rem;
  color: #e74c3c;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 6px 0;
}

.secret-reveal-animals {
  font-size: 1.4rem;
  letter-spacing: 4px;
}

#secret-reveal,
#final-guess-display {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#final-guess-display {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 10px 20px;
  margin: 10px auto;
  border: 1px solid #4ade80;
  width: 85%;
  box-sizing: border-box;
}

#final-guess-label {
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 1px;
  margin: 0 0 6px 0;
  padding: 0;
}

.final-guess-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

#final-guess-animals {
  font-size: 1.2rem;
  letter-spacing: 2px;
}

#final-guess-score {
  display: flex;
  gap: 6px; /* Space between individual circles */
}

/* Assuming you already have these, but just in case: */
#final-guess-score .circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

#game-over-recent-results {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 5px;
  margin-bottom: 15px;
}

.result-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.result-dot.w {
  background-color: #2ecc71;
} /* Green Win */
.result-dot.l {
  background-color: #e74c3c;
} /* Blue Loss */
.result-dot.d {
  background-color: #3498db;
} /* Orange Draw */

#last-games-prg {
  color: #bbb;
  margin: 10px;
  font-size: 0.9rem;
}

/* =========================================
   AUTHENTICATION UI
   THE LOGIN GATE (FULL SCREEN OVERLAY)
   ========================================= */
#auth-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(ellipse at 50% 60%, #0d1f1a 0%, #09090b 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

#auth-screen.hidden {
  display: none !important;
}

.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 90%;
  max-width: 360px;
  position: relative;
}

.auth-back-btn {
  position: absolute;
  top: 0;
  left: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.auth-btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.auth-option-btn {
  width: 240px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.8);
  font-family: "Rajdhani", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.auth-option-btn:active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.auth-option-guest {
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.45);
}

.auth-logo {
  font-family: "Rajdhani", sans-serif;
  font-size: 3.5rem;
  font-weight: 900;
  text-align: center;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 20px rgba(0, 242, 254, 0.8),
    0 0 40px rgba(0, 242, 254, 0.4);
  letter-spacing: 4px;
}

.auth-subtitle {
  font-family: "Rajdhani", sans-serif;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  letter-spacing: 1.5px;
}

.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-divider span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#google-signin-btn {
  width: 100%;
  display: flex;
  justify-content: center;
}

.auth-guest-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.5);
  font-family: "Rajdhani", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 24px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-guest-btn:hover,
.auth-guest-btn:active {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.6);
}

.auth-lang-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  overflow: hidden;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.auth-lang-opt {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.25);
  font-family: "Share Tech Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 2px;
  padding: 5px 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-lang-opt.auth-lang-active {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
}
.auth-lang-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
}

#auth-returning-guest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.auth-guest-sections {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.auth-guest-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.auth-guest-return-btn {
  width: 75%;
  border-color: rgba(0, 242, 254, 0.3) !important;
  color: var(--neon-cyan) !important;
}
.auth-guest-return-meta {
  font-size: 0.78rem;
  font-family: "Share Tech Mono", monospace;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}
.auth-guest-new-btn {
  background: none;
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: var(--neon-cyan);
  font-family: "Rajdhani", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 1px;
}
.auth-guest-reset-warn {
  font-size: 0.85rem;
  color: #ff003c99;
  margin: 0;
  letter-spacing: 0.5px;
}
.auth-footer {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 1);
  text-align: center;
  letter-spacing: 0.5px;
}

/* =========================================
   INSTALL BANNER & CLOSE BUTTON
   ========================================= */

/* Make the install banner glow yellow instead of cyan */
#install-banner {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 20px rgba(241, 196, 15, 0.4);
}

#btn-install-now {
  background: var(--neon-yellow);
  color: #09090b;
  width: auto;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
  margin: 0;
  border: none;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
}

#btn-install-now:active {
  transform: scale(0.95);
  background: #fff;
}

/* The simple "X" Close Button inside the banner */
.close-floating-btn {
  position: absolute;
  top: -10px; /* Tucked just inside the top edge */
  right: 0; /* Tucked just inside the right edge */

  background: #09090b;
  border: none; /* No border */
  color: var(--neon-yellow); /* Subtle gray color */
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: none; /* No glowing shadow */
  z-index: 10;

  /* Make it a perfect circle to mask the border cleanly */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Make it light up when they tap/hover it */
.close-floating-btn:hover {
  background-color: transparent;
}

.close-floating-btn:active {
  transform: scale(0.9);
}

/* How to Play styles → rules.css */

/* =========================================
   CCG CARD STYLING (The Deck & Pool)
   ========================================= */
.card {
  width: 70px; /* Width of a standard trading card */
  height: 70px;
  border-radius: 8px;
  background-color: #1e293b;
  border: 2px solid #334155;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  flex-shrink: 0;
}

/* Hover effect: Pop out and glow */
.card:hover {
  z-index: 10;
}
.card[data-rarity="common"]:hover {
  border-color: var(--common-color);
  box-shadow: 0 10px 20px rgba(126, 207, 255, 0.4);
}
.card[data-rarity="rare"]:hover {
  border-color: var(--rare-color);
  box-shadow: 0 10px 20px rgba(192, 132, 252, 0.4);
}
.card[data-rarity="epic"]:hover {
  border-color: var(--epic-color);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.4);
}

/* Selected state for the active pool */
.card.selected[data-rarity="common"] {
  border-color: var(--common-color);
  box-shadow:
    0 0 14px rgba(126, 207, 255, 0.5),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
}
.card.selected[data-rarity="rare"] {
  border-color: var(--rare-color);
  box-shadow:
    0 0 14px rgba(192, 132, 252, 0.5),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
}
.card.selected[data-rarity="epic"] {
  border-color: var(--epic-color);
  box-shadow:
    0 0 14px rgba(249, 115, 22, 0.5),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* THE HOLOGRAPHIC FOIL EFFECT 
  This creates a shiny light sweep across the card when you hover over it
*/
.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%; /* Start off-screen */
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0) 100%);
  transform: skewX(-25deg);
  transition: left 0.5s ease;
  pointer-events: none; /* Let clicks pass through to the card */
}

.card:hover::after {
  left: 200%; /* Sweep across the card on hover */
}

/* =========================================
   EMOJI STYLING
   ========================================= */

/* The emojis inside the cages */
.emoji-art {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem; /* Adjust this to make it fit your cage size perfectly */
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

.slot.filled .emoji-art {
  opacity: 1;
}

/* The emojis in the bottom picker grid */
.emoji-pool-card {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem; /* Adjust to fit inside your bottom cards */
}

/* ── PAGE SHELL ── */
#collection-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  overflow-y: scroll; /* always, not auto */
}

/* ═══════════════════════════════════════
       HEADER
    ═══════════════════════════════════════ */
.col-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  background: rgba(9, 9, 11, 0.97);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.col-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 12px;
  padding: 7px 14px;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.col-back-btn:active {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.06);
}

.col-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text);
}

.col-coins {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(241, 196, 15, 0.08);
  border: 1px solid rgba(241, 196, 15, 0.22);
  border-radius: 20px;
  padding: 6px 12px;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.82rem;
  color: var(--neon-yellow);
  font-weight: 400;
}

/* ═══════════════════════════════════════
       SCROLLABLE BODY
    ═══════════════════════════════════════ */
.col-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 32px;
}
.col-body::-webkit-scrollbar {
  display: none;
}

/* ═══════════════════════════════════════
       POOL SECTION
    ═══════════════════════════════════════ */
.pool-section {
  padding: 16px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}

.pool-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pool-section-label {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.pool-counter {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.82rem;
  color: var(--neon-green);
  transition: color 0.3s;
  letter-spacing: 1px;
}
.pool-counter.full {
  color: var(--neon-yellow);
}

/* ── MODE LEGEND ROW ── */
.pool-mode-legend {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.pool-mode-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 7px;
  border-radius: 6px;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}
.pool-mode-pill.easy {
  border: 1.5px solid rgba(0, 255, 135, 0.45);
  color: var(--neon-green);
  background: rgba(0, 255, 135, 0.05);
}
.pool-mode-pill.medium {
  border: 1.5px solid rgba(241, 196, 15, 0.45);
  color: var(--neon-yellow);
  background: rgba(241, 196, 15, 0.05);
}
.pool-mode-pill.hard {
  border: 1.5px solid rgba(255, 60, 60, 0.45);
  color: var(--neon-red);
  background: rgba(255, 60, 60, 0.05);
}
.pool-mode-pill-sq {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}
.pool-mode-pill.easy .pool-mode-pill-sq {
  background: var(--neon-green);
  box-shadow: 0 0 5px var(--neon-green);
}
.pool-mode-pill.medium .pool-mode-pill-sq {
  background: var(--neon-yellow);
  box-shadow: 0 0 5px var(--neon-yellow);
}
.pool-mode-pill.hard .pool-mode-pill-sq {
  background: var(--neon-red);
  box-shadow: 0 0 5px var(--neon-red);
}

/* ── 5×3 POOL GRID ── */
.pool-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
}

.pool-slot {
  aspect-ratio: 1;
  border-radius: 11px;
  border: 1.5px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.2s,
    border-color 0.2s,
    background 0.2s;
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  will-change: transform;
  overflow: hidden;
  padding-bottom: 4px;
}

/* Empty slot — mode coloured dashed border */
.pool-slot.mode-easy {
  border-color: rgba(0, 255, 135, 0.18);
}
.pool-slot.mode-medium {
  border-color: rgba(241, 196, 15, 0.18);
}
.pool-slot.mode-hard {
  border-color: rgba(255, 60, 60, 0.18);
}

.pool-slot-num {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.5rem;
  color: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.pool-slot-emoji {
  font-size: 2rem;
  line-height: 1;
  pointer-events: none;
}

/* Rarity dot inside filled pool slot — 8px, bigger than animal-grid pip (5px) */
.pool-rarity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  pointer-events: none;
}
.pool-rarity-dot.common {
  background: var(--common-color);
  box-shadow: 0 0 6px var(--common-color);
}
.pool-rarity-dot.rare {
  background: var(--rare-color);
  box-shadow: 0 0 6px var(--rare-color);
}
.pool-rarity-dot.epic {
  background: var(--epic-color);
  box-shadow: 0 0 7px var(--epic-color);
}

/* Filled slot — solid mode border + rarity glow */
.pool-slot.filled {
  border-style: solid;
}
.pool-slot.filled .pool-slot-num {
  display: none;
}

.pool-slot.filled.mode-easy {
  border-color: rgba(0, 255, 135, 0.5);
  background: rgba(0, 255, 135, 0.04);
}
.pool-slot.filled.mode-medium {
  border-color: rgba(241, 196, 15, 0.5);
  background: rgba(241, 196, 15, 0.04);
}
.pool-slot.filled.mode-hard {
  border-color: rgba(255, 60, 60, 0.5);
  background: rgba(255, 60, 60, 0.04);
}

.pool-slot.slot-selected {
  border-style: solid !important;
  border-color: var(--neon-cyan) !important;
  background: rgba(0, 242, 254, 0.07) !important;
  animation: slotPulse 1s ease-in-out infinite;
}

@keyframes slotPulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
  }
  50% {
    box-shadow:
      0 0 18px rgba(0, 242, 254, 0.7),
      0 0 30px rgba(0, 242, 254, 0.2);
  }
}

.pool-slot:active {
  transform: scale(0.88);
}

/* ── SAVE BUTTON ── */
#save-pool-btn {
  transition:
    transform 0.15s ease,
    background 0.2s;
}

.save-pool-btn {
  width: 100%;
  margin-top: 13px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #00ff87 0%, #00d4ff 100%);
  color: #07070a;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.save-pool-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
  border-radius: 12px;
}
.save-pool-btn:active {
  transform: scale(0.97);
  filter: brightness(1.08);
}
.save-pool-btn:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.2);
  cursor: not-allowed;
  transform: none;
}
.save-pool-btn:disabled::after {
  display: none;
}

/* ═══════════════════════════════════════
       HINT BAR
    ═══════════════════════════════════════ */
.hint-bar {
  height: 52px; /* fixed px, completely immune to content */
  flex-shrink: 0; /* prevents flexbox from squeezing it */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 14px;
  margin-top: 10px;

  background: rgba(0, 242, 254, 0.04);
  border: 1px solid rgba(0, 242, 254, 0.1);
  border-radius: 11px;
  font-size: 0.74rem;
  color: rgba(0, 242, 254, 0.6);
  letter-spacing: 0.3px;
  line-height: 1.5;
  transition:
    opacity 0.3s,
    border-color 0.3s;
}

.hint-bar.dimmed {
  opacity: 0.55;
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
       FILTER TABS
    ═══════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 3px;
  padding: 14px 10px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  width: auto !important;
  flex-shrink: 0;
  padding: 6px 15px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-family: "Rajdhani", sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.18s;
  text-transform: uppercase;
}

.filter-tab.tab-active-all {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}
.filter-tab.tab-active-common {
  border-color: var(--common-color);
  color: var(--common-color);
  background: rgba(126, 207, 255, 0.08);
  box-shadow: 0 0 10px rgba(126, 207, 255, 0.12);
}
.filter-tab.tab-active-rare {
  border-color: var(--rare-color);
  color: var(--rare-color);
  background: rgba(192, 132, 252, 0.08);
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.12);
}
.filter-tab.tab-active-epic {
  border-color: var(--epic-color);
  color: var(--epic-color);
  background: rgba(251, 146, 60, 0.08);
  box-shadow: 0 0 10px rgba(251, 146, 60, 0.12);
}

/* ═══════════════════════════════════════
       ANIMALS SECTION
    ═══════════════════════════════════════ */
.animals-label {
  padding: 16px 14px 8px;
  font-size: 0.62rem;
  letter-spacing: 3.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.animal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 0 14px;
}

/* ── ANIMAL CARD ── */
.animal-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0;
  aspect-ratio: 1;
  display: block;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.animal-card:active {
  will-change: transform;
}

/* top glow sweep on all cards */
.animal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 14px 14px 0 0;
  pointer-events: none;
}

/* rarity tints */
.animal-card[data-rarity="common"] {
  border-color: rgba(126, 207, 255, 0.12);
}
.animal-card[data-rarity="common"]::before {
  background: linear-gradient(180deg, rgba(126, 207, 255, 0.1) 0%, transparent 100%);
}

.animal-card[data-rarity="rare"] {
  border-color: rgba(192, 132, 252, 0.12);
}
.animal-card[data-rarity="rare"]::before {
  background: linear-gradient(180deg, rgba(192, 132, 252, 0.1) 0%, transparent 100%);
}

.animal-card[data-rarity="epic"] {
  border-color: rgba(251, 146, 60, 0.12);
}
.animal-card[data-rarity="epic"]::before {
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.1) 0%, transparent 100%);
}

/* selected state */
.animal-card.selected::before {
  opacity: 1;
}

.animal-card[data-rarity="common"].selected {
  border-color: rgba(126, 207, 255, 0.55);
  background: rgba(126, 207, 255, 0.06);
  box-shadow:
    0 0 16px rgba(126, 207, 255, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.3);
}
.animal-card[data-rarity="rare"].selected {
  border-color: rgba(192, 132, 252, 0.55);
  background: rgba(192, 132, 252, 0.06);
  box-shadow:
    0 0 16px rgba(192, 132, 252, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.3);
}
.animal-card[data-rarity="epic"].selected {
  border-color: rgba(251, 146, 60, 0.55);
  background: rgba(251, 146, 60, 0.06);
  box-shadow:
    0 0 18px rgba(251, 146, 60, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

.animal-card:active {
  transform: scale(0.93);
}

.animal-card.locked {
  cursor: pointer;
}
.animal-card.locked:active {
  transform: scale(0.93);
}

/* ── LOCK OVERLAY ── */
.lock-overlay {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  pointer-events: none;
}

/* Lock icon — top right corner */
.lock-icon {
  position: absolute;
  top: 5px;
  right: 4px;
  font-size: 1.3rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

/* ── CARD CONTENT — all absolutely pinned ── */
.animal-emoji {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 2rem;
  line-height: 1;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
.animal-name {
  position: absolute;
  top: 50px;
  left: 4px;
  right: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
  color: var(--text-dim);
  text-transform: uppercase;
  z-index: 1;
  line-height: 1.2;
  pointer-events: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.animal-card.selected .animal-name {
  color: var(--text);
}

/* rarity pip — always 5px from bottom center */
.rarity-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}
.rarity-pip.common {
  background: var(--common-color);
  box-shadow: 0 0 5px var(--common-color);
}
.rarity-pip.rare {
  background: var(--rare-color);
  box-shadow: 0 0 5px var(--rare-color);
}
.rarity-pip.epic {
  background: var(--epic-color);
  box-shadow: 0 0 6px var(--epic-color);
}

/* check badge */
.selected-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--neon-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: #07070a;
  font-weight: 700;
  z-index: 3;
  opacity: 0;
  transform: scale(0) rotate(-45deg);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgba(0, 255, 135, 0.5);
}
.animal-card.selected .selected-check {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* ═══════════════════════════════════════
       UNLOCK MODAL (bottom sheet)
    ═══════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.unlock-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 44px;
  width: 100%;
  max-width: 430px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
  text-align: center;
}
.modal-backdrop.open .unlock-modal {
  transform: translateY(0);
}

.modal-drag {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 auto 20px;
}

.modal-emoji {
  font-size: 3.2rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}
.modal-name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--text);
}
.modal-rarity-badge {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.modal-desc {
  font-size: 0.87rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 20px;
  padding: 0 4px;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.modal-btn {
  width: 50%;
  flex: 1;
  padding: 13px;
  border-radius: 13px;
  border: none;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.18s;
  text-transform: uppercase;
}
.modal-btn.cancel {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.modal-btn.unlock-coins {
  background: linear-gradient(135deg, #f1c40f 0%, #e67e22 100%);
  color: #07070a;
  box-shadow: 0 4px 14px rgba(241, 196, 15, 0.25);
}
.modal-btn.unlock-pay {
  background: linear-gradient(135deg, #818cf8 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.25);
}
.modal-btn:active {
  transform: scale(0.96);
  filter: brightness(1.1);
}

/* ═══════════════════════════════════════
       TOAST
    ═══════════════════════════════════════ */
.col-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(15, 15, 20, 0.97);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.83rem;
  letter-spacing: 0.8px;
  opacity: 0;
  transition:
    opacity 0.24s,
    transform 0.24s;
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.col-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.col-toast.success {
  border-color: rgba(0, 255, 135, 0.4);
  color: var(--neon-green);
}
.col-toast.error {
  border-color: rgba(255, 0, 60, 0.4);
  color: var(--neon-red);
}
.col-toast.warning {
  border-color: rgba(241, 196, 15, 0.4);
  color: var(--neon-yellow);
}
.col-toast.info {
  border-color: rgba(0, 242, 254, 0.4);
  color: var(--neon-cyan);
}

/* =========================================
   LEADERBOARD
   ========================================= */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 24px;
}

.leaderboard-loading {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}

.leaderboard-rank {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.leaderboard-rank.top1 {
  color: #ffd700;
}
.leaderboard-rank.top2 {
  color: #c0c0c0;
}
.leaderboard-rank.top3 {
  color: #cd7f32;
}

.leaderboard-info {
  flex: 1;
  min-width: 0;
}

.leaderboard-nick {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-badge {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
}

.leaderboard-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.leaderboard-elo {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

.leaderboard-wdl {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* =========================================
   FULL-PAGE OVERLAY SHELL
   Shared by Settings, Stats (collection-style)
   ========================================= */

:root {
  --surface: #111114;
  --surface-2: #18181c;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f0f0f5;
  --text-muted: #55556a;
  --text-dim: #888899;
  --common-color: #7ecfff;
  --common-bg: rgba(126, 207, 255, 0.05);
  --common-glow: rgba(126, 207, 255, 0.25);
  --rare-color: #c084fc;
  --rare-bg: rgba(192, 132, 252, 0.05);
  --rare-glow: rgba(192, 132, 252, 0.25);
  --epic-color: #fb923c;
  --epic-bg: rgba(251, 146, 60, 0.05);
  --epic-glow: rgba(251, 146, 60, 0.25);
}

.page-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

/* ── PAGE HEADER (matches col-header) ── */
.page-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  background: rgba(9, 9, 11, 0.97);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.page-back-btn {
  display: flex !important;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  border-radius: 12px !important;
  padding: 7px 14px !important;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  letter-spacing: 1.5px !important;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.page-back-btn:active {
  border-color: var(--neon-cyan) !important;
  color: var(--neon-cyan) !important;
  background: rgba(0, 242, 254, 0.06) !important;
}

.page-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text);
  font-family: "Rajdhani", sans-serif;
  pointer-events: none;
}

.page-header-right {
  width: 100px;
}

/* ── PAGE BODY ── */
.page-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 16px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.page-body::-webkit-scrollbar {
  display: none;
}

/* ── SECTION LABEL (matches pool-section-label) ── */
.page-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-section-label {
  font-size: 0.85rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
  padding: 0 2px;
}

/* =========================================
   STATS PAGE
   ========================================= */
.stats-record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-record-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
  font-family: "Rajdhani", sans-serif;
  text-align: center;
}

.stats-record-scores {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.stats-score-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid;
}

.stats-score-pill.win {
  background: rgba(0, 255, 135, 0.06);
  border-color: rgba(0, 255, 135, 0.2);
}
.stats-score-pill.draw {
  background: rgba(241, 196, 15, 0.06);
  border-color: rgba(241, 196, 15, 0.2);
}
.stats-score-pill.loss {
  background: rgba(255, 0, 60, 0.06);
  border-color: rgba(255, 0, 60, 0.2);
}

.stats-score-num {
  font-family: "Share Tech Mono", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.stats-score-pill.win .stats-score-num {
  color: var(--neon-green);
}
.stats-score-pill.draw .stats-score-num {
  color: var(--neon-yellow);
}
.stats-score-pill.loss .stats-score-num {
  color: var(--neon-red);
}

.stats-score-label {
  font-size: 0.6rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
}
.stats-score-pill.win .stats-score-label {
  color: rgba(0, 255, 135, 0.6);
}
.stats-score-pill.draw .stats-score-label {
  color: rgba(241, 196, 15, 0.6);
}
.stats-score-pill.loss .stats-score-label {
  color: rgba(255, 0, 60, 0.6);
}

.stats-recent-results-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.stats-recent-results-row #profile-recent-results {
  display: flex;
  gap: 4px;
}
.stats-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.stats-total-label {
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: "Rajdhani", sans-serif;
}
.stats-total-num {
  font-family: "Share Tech Mono", monospace;
  font-size: 1rem;
  color: var(--text);
}

/* Rivals list rows */
.rivals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rival-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}

.rival-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  flex: 1;
  text-align: left;
}

.rival-score {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.w-text,
.d-text,
.l-text {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: "Rajdhani", sans-serif;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 32px;
  text-align: center;
}

.w-text {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.d-text {
  color: #facc15;
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.25);
}

.l-text {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.stats-bar.single-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 1px;
  padding: 24px 0;
  font-family: "Rajdhani", sans-serif;
}

/* =========================================
   SETTINGS PAGE
   ========================================= */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.elo-rank-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rank-badge {
  font-size: 0.72rem;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 6px;
  padding: 2px 7px;
}
.setting-row-new {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 0 18px;
}

.setting-select-new {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  letter-spacing: 1px;
  outline: none;
  cursor: pointer;
}

.settings-row-btn {
  width: 100% !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 15px 18px !important;
  background: none !important;
  border: none !important;
  color: var(--text) !important;
  font-size: 0.92rem !important;
  font-family: "Rajdhani", sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  cursor: pointer !important;
  text-transform: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transition: background 0.15s !important;
}
.settings-row-btn:active {
  background: rgba(255, 255, 255, 0.04) !important;
}
.settings-row-btn.danger {
  color: var(--neon-red) !important;
}
.settings-row-btn.hidden {
  display: none !important;
}
.settings-row-btn.danger:active {
  background: rgba(255, 0, 60, 0.06) !important;
}

.settings-row-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1;
}

/* Inline nickname edit */
.nickname-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: default !important;
}
.nickname-display-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--neon-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-nickname-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 2px 0;
  outline: none;
}
.inline-nickname-input:focus {
  border-bottom-color: var(--theme-color, #00ff87);
}
.nickname-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.nickname-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.15s;
}
.nickname-icon-btn svg {
  width: 20px;
  height: 20px;
}
.nickname-icon-btn:active {
  color: #fff;
}

/* ── Magic Link Auth Section ── */
#magic-link-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#magic-step-email,
#magic-step-code {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.auth-nickname-input,
#magic-email-input,
#magic-code-input {
  width: 85%;
  box-sizing: border-box;
  height: 40px;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-family: "Rajdhani", sans-serif;
  text-align: center;
  outline: none;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

.auth-nickname-input:focus,
#magic-email-input:focus,
#magic-code-input:focus {
  border-color: rgba(0, 242, 254, 0.8);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

#magic-code-input {
  letter-spacing: 10px;
  font-size: 1.5rem;
  font-weight: 700;
}

#magic-code-hint {
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

#magic-code-hint span {
  color: #00f2fe;
  font-weight: 600;
}

.magic-code-actions {
  width: 100%;
  display: flex;
  gap: 8px;
}

.auth-confirm-btn,
#btn-magic-send,
#btn-magic-verify {
  height: 40px;
  padding: 0 24px;
  font-family: "Rajdhani", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition:
    transform 0.2s,
    opacity 0.2s;
  width: 100%;
}

#btn-magic-send {
  background: #7ecfff;
  color: #000;
  width: fit-content;
}

#btn-magic-verify {
  background: #4ade80;
  color: #000;
  flex: 1;
}

#btn-magic-resend {
  height: 40px;
  padding: 0 16px;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

#btn-magic-resend:not(:disabled) {
  border-color: rgba(0, 242, 254, 0.4);
  color: #00f2fe;
  cursor: pointer;
}

#btn-magic-resend:not(:disabled):active {
  transform: scale(0.96);
}

#btn-magic-send:active,
#btn-magic-verify:active {
  transform: scale(0.96);
}

#magic-sent-msg {
  text-align: center;
  color: #4ade80;
  font-size: 0.85rem;
}

/* =========================================
   SAFE AREA INSETS (notch / Dynamic Island)
   ========================================= */

/* Battle & Setup headers sit at the very top */
.setup-header,
.battle-header {
  margin-top: calc(20px + env(safe-area-inset-top));
}

/* All overlay page headers (Profile, Settings, Menu, Collection) */
.page-header {
  padding-top: calc(16px + env(safe-area-inset-top));
}

.col-header {
  padding-top: calc(16px + env(safe-area-inset-top));
}

/* Main menu card */
.app-container {
  padding-top: calc(20px + env(safe-area-inset-top));
}

/* Matchmaking screen */
#matchmaking-screen {
  padding-top: calc(40px + env(safe-area-inset-top));
}

/* =========================================
   FORFEIT / QUIT CONFIRM MODAL
   ========================================= */
.quit-confirm-modal {
  width: 88%;
  max-width: 360px;
  background: rgba(12, 12, 18, 0.97);
  border: 1px solid rgba(255, 60, 60, 0.35);
  border-radius: 24px;
  padding: 32px 24px 24px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(255, 60, 60, 0.1),
    0 24px 60px rgba(0, 0, 0, 0.8),
    inset 0 0 40px rgba(255, 60, 60, 0.04);
  animation: modal-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.quit-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 12px rgba(255, 80, 80, 0.5));
}

.quit-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  margin: 0 0 10px;
}

.quit-msg {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 28px;
  line-height: 1.5;
}

.quit-actions {
  display: flex;
  gap: 10px;
}

.quit-btn {
  flex: 1;
  padding: 14px 0;
  border: none;
  border-radius: 14px;
  -webkit-appearance: none;
  appearance: none;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.15s;
}

.quit-btn:active {
  opacity: 0.8;
  transform: scale(0.97);
}

.quit-btn-cancel {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.quit-btn-confirm {
  background: linear-gradient(135deg, #ff3c3c, #c0392b);
  color: #000;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(255, 60, 60, 0.35);
}

/* Bottom nav — keep it above the home indicator */
.bottom-nav {
  bottom: 10px;
}

/* =========================================
   REACTION MENU
   ========================================= */

.battle-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
}

.battle-actions-row #submit-guess-btn {
  width: auto !important;
  flex: 1 !important;
  margin: 10px 0 !important;
}

/* ── Trigger button ── */
.reaction-menu {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
}

.reaction-trigger {
  position: absolute;
  inset: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--neon-bg);
  border: none;
  color: #fff;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  touch-action: manipulation;
}

.reaction-trigger::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(red, orange, yellow, lime, cyan, blue, violet, red);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), black calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), black calc(100% - 2px));
  transform: rotate(var(--rainbow-angle, 0deg));
}

#reaction-trigger-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  line-height: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.4, 0, 1, 1);
}

.reaction-menu.open .reaction-trigger {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
  transform: scale(1.08);
}

/* ── Viewport — 210° sector clip (JS sets clip-path polygon) ── */
.reaction-viewport {
  position: absolute;
  right: -14px; /* extends 40px past trigger center to the right */
  top: 50%;
  transform: translateY(-50%);
  width: 150px; /* 110 left + 40 right of trigger center */
  height: 220px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.reaction-menu.open .reaction-viewport {
  pointer-events: all;
  opacity: 1;
}

/* ── Ring — origin at 110px from viewport left = trigger center ── */
.reaction-ring {
  position: absolute;
  left: 110px; /* SLICE_HALF — trigger center x within viewport */
  top: 50%; /* viewport center = trigger center y */
  width: 0;
  height: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

.reaction-menu.open .reaction-ring {
  pointer-events: all;
}

/* ── Individual items — full-size divs clipped to wedge via clip-path in JS ── */
.reaction-item {
  position: absolute;
  background: rgba(15, 15, 20, 0.92);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    background 0.15s;
  touch-action: none;
  user-select: none;
}

.reaction-ring-bg {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.reaction-ring-outline {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.reaction-menu.open .reaction-ring-outline {
  opacity: 1;
}

.reaction-menu.open .reaction-item {
  opacity: 1;
}

.reaction-item:active {
  background: rgba(0, 242, 254, 0.15);
}

/* ── Emoji label centered within its wedge ── */
.reaction-emoji {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* ── Opponent reaction bubble ── */
.reaction-bubble {
  position: fixed;
  top: 160px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(15, 15, 20, 0.92);
  border: 1.5px solid var(--neon-cyan);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
  z-index: 999;
  pointer-events: none;
  animation: bubble-in-out 2.5s ease forwards;
}

.reaction-bubble.hidden {
  display: none;
}

@keyframes bubble-in-out {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  15% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  75% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }
}
