@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Black+Ops+One&display=swap');

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

body {
  background: #0a0a0a;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  color: #e0e0e0;
  height: 100vh;
  width: 100vw;
}

/* ─── Lobby ─── */
#lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(180deg, #1a1510 0%, #2a1f14 40%, #1c2a1a 100%);
  position: relative;
  z-index: 100;
}

#lobby::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23n)" opacity="0.06"/></svg>')
    repeat,
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.08) 3px, rgba(0,0,0,0.08) 4px);
  pointer-events: none;
  z-index: 1;
}

#lobby::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(180,140,60,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

#lobby > * {
  position: relative;
  z-index: 2;
}

.lobby-title {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 36px;
  color: #d4a84b;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8), 0 0 20px rgba(212,168,75,0.3);
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: 4px;
  -webkit-text-stroke: 1px rgba(0,0,0,0.3);
}

.lobby-subtitle {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 14px;
  color: #c0392b;
  text-shadow: 0 2px 8px rgba(192,57,43,0.5), 0 0 20px rgba(192,57,43,0.2);
  margin-bottom: 50px;
  letter-spacing: 8px;
}

.lobby-box {
  background: rgba(20, 15, 10, 0.85);
  border: 2px solid #5a4a2a;
  border-top: 3px solid #8a7a50;
  border-radius: 2px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  min-width: 400px;
  position: relative;
}

/* Mode Selection */
.mode-select {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.mode-option {
  flex: 1;
  background: linear-gradient(180deg, rgba(90,74,42,0.2) 0%, rgba(40,30,15,0.3) 100%);
  border: 2px solid #5a4a2a;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.mode-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(212,168,75,0.4), transparent);
}

.mode-option:hover {
  background: linear-gradient(180deg, rgba(90,74,42,0.35) 0%, rgba(40,30,15,0.4) 100%);
  border-color: #8a7a50;
  transform: scale(1.02);
}

.mode-option.selected {
  background: linear-gradient(180deg, rgba(192,57,43,0.15) 0%, rgba(40,30,15,0.4) 100%);
  border-color: #c0392b;
  box-shadow: 0 0 20px rgba(192,57,43,0.2), inset 0 0 30px rgba(192,57,43,0.05);
}

.mode-option.cooldown-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  border-color: #3a3a2a;
}

.mode-title {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 20px;
  color: #d4a84b;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.mode-desc {
  font-size: 10px;
  color: #8a7a60;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.mode-players {
  font-size: 12px;
  color: #b89d5a;
}

.lobby-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.action-btn {
  background: linear-gradient(180deg, #c0392b 0%, #962d22 100%);
  color: #fff;
  border: 1px solid #e74c3c;
  border-bottom: 3px solid #7a2019;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  padding: 12px 24px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.action-btn:hover {
  background: linear-gradient(180deg, #d44637 0%, #a83328 100%);
  box-shadow: 0 0 20px rgba(192,57,43,0.4);
  transform: scale(1.05);
  border-color: #ff6b5a;
}

.action-divider {
  color: #555;
  font-size: 10px;
}

.rooms-list {
  width: 100%;
}

.rooms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 15px;
  font-size: 11px;
  color: #8a7a60;
  letter-spacing: 2px;
}

.rooms-count {
  color: #d4a84b;
}

.rooms-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 5px;
}

.room-item {
  background: rgba(90,74,42,0.1);
  border: 1px solid #5a4a2a;
  border-left: 3px solid #8a7a50;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}

.room-item::after {
  content: attr(data-mode);
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 8px;
  color: #d4a84b;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 2px;
}

.room-item:hover {
  background: rgba(90,74,42,0.2);
  border-left-color: #c0392b;
  transform: scale(1.02);
}

.room-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.room-id {
  font-size: 14px;
  color: #d4a84b;
  letter-spacing: 3px;
}

.room-status {
  font-size: 8px;
  color: #8a7a60;
  letter-spacing: 1px;
}

.room-players {
  font-size: 12px;
  color: #b89d5a;
  letter-spacing: 2px;
}

/* Scrollbar for rooms list */
.rooms-grid::-webkit-scrollbar {
  width: 6px;
}

.rooms-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.rooms-grid::-webkit-scrollbar-thumb {
  background: #5a4a2a;
  border-radius: 3px;
}

.rooms-grid::-webkit-scrollbar-thumb:hover {
  background: #8a7a50;
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.countdown-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.countdown-title {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 28px;
  color: #d4a84b;
  text-shadow: 0 2px 8px rgba(212,168,75,0.5);
  letter-spacing: 6px;
}

.countdown-number {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 80px;
  color: #c0392b;
  text-shadow: 0 0 40px rgba(192,57,43,0.6), 0 4px 8px rgba(0,0,0,0.8);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}


.lobby-teams {
  display: flex;
  gap: 40px;
  margin-top: 30px;
  font-size: 11px;
  align-items: center;
  padding: 10px 24px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(90,74,42,0.2);
  border-radius: 2px;
}

.team-label-usa {
  color: #3b82f6;
  text-shadow: 0 2px 6px rgba(59,130,246,0.4);
  letter-spacing: 2px;
}

.team-label-iran {
  color: #ef4444;
  text-shadow: 0 2px 6px rgba(239,68,68,0.4);
  letter-spacing: 2px;
}

/* ─── Game Container ─── */
#game-container {
  display: none;
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #0a0a0a;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* ─── CRT + Grain Overlay ─── */
#crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* Scanlines */
#crt-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  z-index: 51;
}

/* Grain noise */
#crt-overlay::after {
  content: '';
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="200" height="200" filter="url(%23n)" opacity="0.12"/></svg>');
  background-size: 200px 200px;
  animation: grain 0.3s steps(4) infinite;
  z-index: 52;
  opacity: 0.6;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-5%, -5%); }
  50% { transform: translate(5%, 5%); }
  75% { transform: translate(-2%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Vignette */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 53;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.6) 100%);
}

/* ─── Scoreboard ─── */
#scoreboard {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: none;
  align-items: center;
  gap: 24px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #333;
  padding: 10px 30px;
  border-radius: 4px;
}

.score-team {
  font-size: 14px;
  letter-spacing: 2px;
}

.score-usa {
  color: #3b82f6;
  text-shadow: 0 0 8px #3b82f6;
}

.score-iran {
  color: #ef4444;
  text-shadow: 0 0 8px #ef4444;
}

.score-divider {
  font-size: 18px;
  color: #555;
}

.score-num {
  font-size: 20px;
}

/* ─── HUD ─── */
#hud {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: none;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 24px;
  border-radius: 4px;
  border: 1px solid #333;
}

.hp-bar-bg {
  width: 200px;
  height: 14px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  background: #00ff41;
  transition: width 0.2s;
  border-radius: 2px;
}

.hp-text {
  font-size: 10px;
  color: #ccc;
  min-width: 70px;
}

.team-badge {
  font-size: 9px;
  padding: 4px 10px;
  border-radius: 2px;
  letter-spacing: 1px;
}

.badge-usa {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border: 1px solid #3b82f6;
}

.badge-iran {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid #ef4444;
}

/* ─── Kill Feed ─── */
#kill-feed {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kill-msg {
  font-size: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 2px;
  animation: fadeOut 4s forwards;
  white-space: nowrap;
}

@keyframes fadeOut {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ─── Respawn Overlay ─── */
#respawn-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(139, 0, 0, 0.3);
}

#respawn-overlay span {
  font-size: 20px;
  color: #ff4444;
  text-shadow: 0 0 20px #ff4444;
  animation: pulse 1s infinite;
}

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

/* ─── Round Timer Overlay ─── */
.round-timer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.round-timer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.round-winner {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 32px;
  color: #d4a84b;
  text-shadow: 0 2px 8px rgba(212,168,75,0.5);
  letter-spacing: 4px;
}

.round-scores {
  font-size: 24px;
  color: #fff;
  letter-spacing: 2px;
  margin: 10px 0;
}

.round-timer {
  font-size: 18px;
  color: #888;
}

.round-timer-number {
  color: #c0392b;
  font-size: 24px;
  text-shadow: 0 0 10px rgba(192,57,43,0.5);
  animation: pulse 1s infinite;
}

/* ─── Room Info ─── */
#room-info {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  font-size: 8px;
  color: #555;
  display: none;
}

/* ─── Controls Info ─── */
#controls-info {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  background: rgba(20, 15, 10, 0.85);
  border: 1px solid #5a4a2a;
  padding: 12px;
  border-radius: 2px;
  display: none;
}

.controls-title {
  color: #d4a84b;
  font-size: 12px;
  margin-bottom: 8px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.control-item {
  color: #e0e0e0;
  font-size: 8px;
  margin: 4px 0;
  letter-spacing: 1px;
}

/* ─── Chat Interface ─── */
#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 300px;
  height: 300px;
  z-index: 100;
  background: rgba(20, 15, 10, 0.9);
  border: 2px solid #5a4a2a;
  border-top: 3px solid #8a7a50;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid #333;
}

.chat-message {
  font-size: 8px;
  color: #e0e0e0;
  padding: 4px 8px;
  background: rgba(90,74,42,0.1);
  border-radius: 2px;
  word-wrap: break-word;
}

.chat-message .player-name {
  color: #d4a84b;
  margin-right: 5px;
}

.chat-input-container {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: none;
}

#chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #3a3020;
  color: #e0e0e0;
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  border-radius: 2px;
}

#chat-input:focus {
  outline: none;
  border-color: #d4a84b;
}

#chat-send {
  background: linear-gradient(180deg, #c0392b, #962d22);
  color: #fff;
  border: none;
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

#chat-send:hover {
  background: linear-gradient(180deg, #d44637, #a83328);
}

#chat-messages::-webkit-scrollbar {
  width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #5a4a2a;
  border-radius: 2px;
}

/* Hide chat when game is active */
body.in-game #chat-container {
  display: none !important;
}

#game-container[style*="display: block"] ~ #chat-container,
#game-container[style*="display: block"] + #chat-container {
  display: none !important;
}

/* Alternative: Hide chat when lobby is hidden */
#lobby[style*="display: none"] ~ #chat-container {
  display: none !important;
}

/* ─── Auth Screen ─── */
#auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(180deg, #1a1510 0%, #2a1f14 40%, #1c2a1a 100%);
  position: relative;
  z-index: 100;
}

#auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23n)" opacity="0.06"/></svg>')
    repeat,
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.08) 3px, rgba(0,0,0,0.08) 4px);
  pointer-events: none;
  z-index: 1;
}

#auth-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(180,140,60,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

#auth-screen > * {
  position: relative;
  z-index: 2;
}

.auth-box {
  background: rgba(20, 15, 10, 0.85);
  border: 2px solid #5a4a2a;
  border-top: 3px solid #8a7a50;
  border-radius: 2px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  min-width: 360px;
  align-items: center;
  margin-top: 40px;
}

.auth-buttons {
  display: flex;
  gap: 20px;
}

.auth-btn {
  padding: 16px 36px;
  font-size: 13px;
}

.login-variant {
  background: transparent;
  color: #d4a84b;
  border: 2px solid #5a4a2a;
  border-bottom: 3px solid #3a2a15;
}

.login-variant:hover {
  background: rgba(90,74,42,0.2);
  color: #d4a84b;
  border-color: #8a7a50;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #5a4a2a;
  color: #e0e0e0;
  padding: 10px 14px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  border-radius: 2px;
  width: 100%;
}

.auth-input:focus {
  outline: none;
  border-color: #d4a84b;
  box-shadow: 0 0 10px rgba(212,168,75,0.3);
}

.auth-cancel-btn {
  background: transparent;
  color: #8a7a60;
  border: 1px solid #5a4a2a;
  padding: 8px 16px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-cancel-btn:hover {
  color: #c0392b;
  border-color: #c0392b;
}

.auth-error {
  color: #c0392b;
  font-size: 8px;
  text-align: center;
  min-height: 16px;
  text-shadow: 0 0 6px rgba(192,57,43,0.3);
}

/* ─── Lobby Top Bar ─── */
.lobby-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin-bottom: 10px;
  padding: 0 4px;
}

.lobby-username {
  font-size: 7px;
  color: #d4a84b;
  letter-spacing: 1px;
  word-break: break-all;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-btn-style {
  font-size: 9px;
  padding: 8px 16px;
  background: transparent;
  color: #d4a84b;
  border: 1px solid #5a4a2a;
  border-bottom: 2px solid #3a2a15;
}

.account-btn-style:hover {
  background: rgba(90,74,42,0.2);
  border-color: #8a7a50;
}

/* ─── Account Popup ─── */
.account-popup {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.account-popup-content {
  background: #1a1510;
  border: 2px solid #5a4a2a;
  border-top: 3px solid #8a7a50;
  border-radius: 2px;
  padding: 30px;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.7);
}

.account-popup-title {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 20px;
  color: #d4a84b;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: 4px;
}

.account-field {
  margin-bottom: 16px;
}

.account-field label {
  font-size: 8px;
  color: #8a7a60;
  letter-spacing: 2px;
  display: block;
  margin-bottom: 6px;
}

.account-key {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #3a3020;
  padding: 10px;
  font-size: 7px;
  color: #d4a84b;
  word-break: break-all;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.account-key:hover {
  border-color: #8a7a50;
}

.account-private-key {
  color: #888;
  font-style: italic;
}

.account-private-key.revealed {
  color: #ff4444;
  font-style: normal;
}

.account-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.stat-item {
  background: rgba(90,74,42,0.08);
  border: 1px solid #3a3020;
  padding: 12px;
  text-align: center;
  border-radius: 2px;
}

.stat-label {
  display: block;
  font-size: 7px;
  color: #8a7a60;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.stat-value {
  display: block;
  font-size: 16px;
  color: #d4a84b;
}

.account-popup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.logout-btn {
  background: #ff4444 !important;
  color: #fff !important;
}

.logout-btn:hover {
  background: #cc3333 !important;
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.5) !important;
}

/* ─── Leaderboard ─── */
.leaderboard-section {
  width: 100%;
  margin-top: 20px;
  border-top: 1px solid #3a3020;
  padding-top: 20px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  color: #8a7a60;
  letter-spacing: 2px;
}

.leaderboard-reward {
  font-size: 9px;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.leaderboard-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(90,74,42,0.05);
  border: 1px solid #2a2015;
  font-size: 8px;
  transition: all 0.2s;
}

.leaderboard-row:first-child {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.08);
}

.leaderboard-rank {
  color: #ffd700;
  min-width: 30px;
}

.leaderboard-row:not(:first-child) .leaderboard-rank {
  color: #888;
}

.leaderboard-name {
  color: #d4a84b;
  flex: 1;
  margin: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.leaderboard-stats {
  display: flex;
  gap: 12px;
  color: #aaa;
}

.leaderboard-stats span {
  min-width: 30px;
  text-align: right;
}

.lb-wins { color: #6abf6a; }
.lb-losses { color: #ff4444; }

.leaderboard-empty {
  color: #5a4a30;
  font-size: 8px;
  text-align: center;
  padding: 20px;
  letter-spacing: 1px;
}

.leaderboard-grid::-webkit-scrollbar {
  width: 4px;
}

.leaderboard-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.leaderboard-grid::-webkit-scrollbar-thumb {
  background: #5a4a2a;
  border-radius: 2px;
}

/* ─── Balance Display ─── */
.balance-display {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #3a3020;
  border-radius: 2px;
}

.balance-icon {
  color: #9945FF;
  font-size: 14px;
}

.balance-amount {
  color: #ffd700;
  font-size: 12px;
  font-family: 'Press Start 2P', monospace;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.balance-label {
  color: #8a7a60;
  font-size: 7px;
  letter-spacing: 1px;
}

.deposit-btn {
  background: linear-gradient(180deg, #9945FF 0%, #7a35d4 100%);
  color: #fff;
  border: 1px solid #b366ff;
  border-bottom: 2px solid #5a20a0;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 4px 10px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
  margin-left: 6px;
}

.deposit-btn:hover {
  background: linear-gradient(180deg, #b366ff 0%, #9945FF 100%);
  box-shadow: 0 0 15px rgba(153, 69, 255, 0.4);
  transform: scale(1.05);
}

/* ─── Entry Fee Section ─── */
.entry-fee-section {
  width: 100%;
  padding: 15px 0;
  border-top: 1px solid #3a3020;
  border-bottom: 1px solid #3a3020;
}

.entry-fee-title {
  font-size: 11px;
  color: #8a7a60;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 15px;
}

.entry-fee-options {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.fee-option {
  background: linear-gradient(180deg, rgba(90,74,42,0.15) 0%, rgba(40,30,15,0.25) 100%);
  border: 2px solid #3a3020;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 70px;
}

.fee-option:hover {
  border-color: #8a7a50;
  background: rgba(90,74,42,0.25);
  transform: scale(1.05);
}

.fee-option.selected {
  border-color: #9945FF;
  background: linear-gradient(180deg, rgba(153,69,255,0.15) 0%, rgba(40,30,15,0.3) 100%);
  box-shadow: 0 0 15px rgba(153,69,255,0.2), inset 0 0 20px rgba(153,69,255,0.05);
}

.fee-option.insufficient {
  opacity: 0.4;
  cursor: not-allowed;
}

.fee-option.insufficient:hover {
  transform: none;
  border-color: #3a3020;
}

.fee-amount {
  font-family: 'Black Ops One', 'Press Start 2P', monospace;
  font-size: 18px;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
  margin-bottom: 4px;
}

.fee-option.selected .fee-amount {
  color: #b366ff;
  text-shadow: 0 0 8px rgba(153, 69, 255, 0.5);
}

.fee-label {
  font-size: 7px;
  color: #8a7a60;
  letter-spacing: 2px;
}

.fee-error {
  color: #c0392b;
  font-size: 8px;
  text-align: center;
  min-height: 16px;
  margin-top: 8px;
  text-shadow: 0 0 6px rgba(192,57,43,0.3);
}

.create-room-btn {
  width: 100%;
  margin-top: 10px;
  background: linear-gradient(180deg, #9945FF 0%, #7a35d4 100%);
  border-color: #b366ff;
  border-bottom-color: #5a20a0;
}

.create-room-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #b366ff 0%, #9945FF 100%);
  box-shadow: 0 0 20px rgba(153,69,255,0.4);
}

.create-room-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.create-room-btn:disabled:hover {
  box-shadow: none;
  transform: none;
}

/* ─── Prize Pool HUD ─── */
#prize-pool-hud {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #9945FF;
  padding: 8px 20px;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(153, 69, 255, 0.3);
}

.prize-icon {
  color: #9945FF;
  font-size: 16px;
}

#prize-pool-amount {
  color: #ffd700;
  font-size: 14px;
  font-family: 'Press Start 2P', monospace;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.prize-label {
  color: #9945FF;
  font-size: 8px;
  letter-spacing: 2px;
}

/* ─── Deposit Modal ─── */
.deposit-modal-content {
  max-width: 400px;
}

.deposit-info {
  font-size: 8px;
  color: #8a7a60;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.6;
}

.deposit-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.deposit-amount-btn {
  background: linear-gradient(180deg, rgba(153,69,255,0.2) 0%, rgba(40,30,15,0.3) 100%);
  border: 2px solid #5a3d8a;
  color: #ffd700;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.deposit-amount-btn:hover {
  background: linear-gradient(180deg, rgba(153,69,255,0.35) 0%, rgba(40,30,15,0.4) 100%);
  border-color: #9945FF;
  box-shadow: 0 0 15px rgba(153,69,255,0.3);
  transform: scale(1.03);
}

.deposit-status {
  font-size: 8px;
  text-align: center;
  min-height: 16px;
  margin-bottom: 10px;
  color: #4caf50;
}

.deposit-status.error {
  color: #c0392b;
}

/* ─── Deposit Address Section (Step 2) ─── */
.deposit-address-section {
  padding: 10px 0;
}

.deposit-selected-amount {
  font-size: 12px;
  color: #c0b080;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.deposit-highlight {
  color: #ffd700;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.deposit-address-label {
  font-size: 8px;
  color: #8a7a60;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.deposit-address-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #9945FF;
  padding: 10px 12px;
  margin-bottom: 15px;
  word-break: break-all;
}

.deposit-wallet-text {
  flex: 1;
  font-size: 9px;
  color: #b366ff;
  font-family: 'Press Start 2P', monospace;
  line-height: 1.6;
  user-select: all;
}

.copy-btn {
  background: linear-gradient(180deg, #9945FF 0%, #7a35d4 100%);
  color: #fff;
  border: 1px solid #b366ff;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: linear-gradient(180deg, #b366ff 0%, #9945FF 100%);
  box-shadow: 0 0 10px rgba(153, 69, 255, 0.4);
}

.deposit-instructions {
  margin-bottom: 15px;
}

.deposit-instruction-item {
  font-size: 7px;
  color: #8a7a60;
  line-height: 2.2;
  padding-left: 5px;
}

.verify-btn {
  width: 100%;
  background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
  border: 1px solid #2ecc71;
  border-bottom: 2px solid #196f3d;
  color: #fff;
  margin-bottom: 10px;
}

.verify-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
}

.verify-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.back-btn {
  width: 100%;
  background: transparent;
  border: 1px solid #3a3020;
  color: #8a7a60;
  font-size: 8px;
}

.back-btn:hover {
  border-color: #8a7a60;
  color: #c0b080;
}

/* ─── Room Item Entry Fee Display ─── */
.room-fee {
  font-size: 9px;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
  margin-top: 4px;
}

.room-prize {
  font-size: 8px;
  color: #9945FF;
  margin-top: 2px;
}

/* ─── Account Balance in Popup ─── */
.stat-balance {
  margin-top: 10px;
  background: rgba(153, 69, 255, 0.08);
  border-color: #5a3d8a;
}

/* ─── Match End Prize Info ─── */
.match-prize-info {
  font-size: 14px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  margin-top: 10px;
}

.match-payout {
  font-size: 11px;
  color: #4caf50;
  text-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
  margin-top: 5px;
}

/* ─── How It Works Button ─── */
.how-it-works-btn {
  background: transparent;
  color: #8a7a60;
  border: 1px solid #5a4a2a;
  border-bottom: 2px solid #3a2a15;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 10px 20px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
  margin-top: 20px;
}

.how-it-works-btn:hover {
  color: #d4a84b;
  border-color: #8a7a50;
  background: rgba(90,74,42,0.15);
  box-shadow: 0 0 12px rgba(212,168,75,0.15);
}

/* ─── How It Works Popup ─── */
.how-it-works-content {
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
}

.hiw-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.hiw-section {
  border-left: 2px solid #5a4a2a;
  padding-left: 12px;
}

.hiw-section-title {
  font-size: 10px;
  color: #d4a84b;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.hiw-step {
  font-size: 7px;
  color: #b0a080;
  line-height: 2;
  letter-spacing: 0.5px;
}

.how-it-works-content::-webkit-scrollbar {
  width: 4px;
}

.how-it-works-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.how-it-works-content::-webkit-scrollbar-thumb {
  background: #5a4a2a;
  border-radius: 2px;
}

/* ─── X (Twitter) Button ─── */
.x-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #5a4a2a;
  border-radius: 50%;
  color: #e0e0e0;
  text-decoration: none;
  transition: all 0.2s;
  margin-top: 16px;
}

.x-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #d4a84b;
  color: #fff;
  box-shadow: 0 0 14px rgba(212, 168, 75, 0.3);
  transform: scale(1.1);
}

.lobby-x-btn {
  margin-top: 12px;
  margin-bottom: -8px;
}
