/* ============================================
   SPACE ACE - Game Styles
   ============================================ */

:root {
  /* Color Palette */
  --bg-deep: #0a0a12;
  --bg-space: #0d0d1a;
  --accent-primary: #00ff88;
  --accent-secondary: #00ccff;
  --accent-warning: #ffcc00;
  --accent-danger: #ff4466;
  --text-primary: #e0ffe0;
  --text-dim: #607060;
  --ui-border: #2a4a3a;
  --ui-glow: rgba(0, 255, 136, 0.3);
  
  /* Player Colors */
  --p1-color: #00ff88;
  --p2-color: #00ccff;
  
  /* Typography */
  --font-display: 'Orbitron', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  
  /* Sizing */
  --control-size: 80px;
  --hud-padding: 16px;
  
  /* Safe area insets for notched/dynamic island devices (iPhone, Android punch-hole) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  font-family: var(--font-mono);
  color: var(--text-primary);
  touch-action: none;
  user-select: none;
}

/* ============================================
   SCREENS
   ============================================ */

#game-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

/* Game screen uses its own safe area handling via HUD/controls */
#game-screen {
  padding: 0;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

.screen.overlay {
  background: rgba(10, 10, 18, 0.9);
  backdrop-filter: blur(4px);
  z-index: 100;
}

/* ============================================
   STARFIELD BACKGROUND
   ============================================ */

.starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(0, 100, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(100, 0, 255, 0.06) 0%, transparent 50%),
    var(--bg-space);
  overflow: hidden;
}

.starfield::before,
.starfield::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, white, transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 90px 40px, white, transparent),
    radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 230px 80px, white, transparent),
    radial-gradient(2px 2px at 300px 200px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 350px 150px, white, transparent),
    radial-gradient(1px 1px at 400px 50px, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 450px 180px, white, transparent),
    radial-gradient(1px 1px at 500px 100px, rgba(255,255,255,0.8), transparent);
  background-size: 550px 250px;
  animation: stars 60s linear infinite;
}

.starfield::after {
  background-size: 350px 200px;
  animation: stars 90s linear infinite reverse;
  opacity: 0.5;
}

@keyframes stars {
  from { transform: translate(0, 0); }
  to { transform: translate(-550px, -250px); }
}

/* Aurora Curtains - Vertical curtains that fade in/out, two active at a time */

/* Aurora 1 - Green/Cyan curtain (left side) */
.starfield .aurora-1 {
  position: absolute;
  left: -5%;
  top: 0;
  width: 60%;
  height: 50%;
  background: linear-gradient(180deg,
    transparent 0%,
    hsla(160, 90%, 50%, 0.25) 20%,
    hsla(150, 85%, 45%, 0.4) 50%,
    hsla(160, 80%, 40%, 0.3) 75%,
    hsla(170, 70%, 35%, 0.15) 90%,
    transparent 100%
  );
  filter: blur(70px);
  animation: aurora-curtain-1 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aurora-curtain-1 {
  0%, 100% { transform: translateX(-20px) scaleX(1); opacity: 0.9; }
  20% { transform: translateX(50px) scaleX(1.1); opacity: 0; }
  40% { transform: translateX(30px) scaleX(0.95); opacity: 0; }
  60% { transform: translateX(0px) scaleX(1.05); opacity: 0; }
  80% { transform: translateX(-10px) scaleX(1); opacity: 0.9; }
}

/* Aurora 2 - Purple/Violet curtain (right side) */
.starfield .aurora-2 {
  position: absolute;
  left: 30%;
  top: 0;
  width: 65%;
  height: 50%;
  background: linear-gradient(180deg,
    transparent 0%,
    hsla(280, 85%, 55%, 0.2) 20%,
    hsla(290, 80%, 50%, 0.4) 50%,
    hsla(285, 75%, 45%, 0.3) 75%,
    hsla(280, 65%, 40%, 0.15) 90%,
    transparent 100%
  );
  filter: blur(75px);
  animation: aurora-curtain-2 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aurora-curtain-2 {
  0%, 100% { transform: translateX(30px) scaleX(1.05); opacity: 0.9; }
  20% { transform: translateX(-40px) scaleX(0.92); opacity: 0.9; }
  40% { transform: translateX(-20px) scaleX(1.08); opacity: 0; }
  60% { transform: translateX(10px) scaleX(1); opacity: 0; }
  80% { transform: translateX(20px) scaleX(1.02); opacity: 0.9; }
}

/* Aurora 3 - Blue/Cyan curtain (center-left) */
.starfield .aurora-3 {
  position: absolute;
  left: 10%;
  top: 0;
  width: 55%;
  height: 50%;
  background: linear-gradient(180deg,
    transparent 0%,
    hsla(200, 90%, 55%, 0.22) 20%,
    hsla(210, 85%, 50%, 0.4) 50%,
    hsla(205, 80%, 45%, 0.3) 75%,
    hsla(200, 70%, 40%, 0.15) 90%,
    transparent 100%
  );
  filter: blur(72px);
  animation: aurora-curtain-3 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aurora-curtain-3 {
  0%, 100% { transform: translateX(-25px) scaleX(0.98); opacity: 0; }
  20% { transform: translateX(45px) scaleX(1.12); opacity: 0.9; }
  40% { transform: translateX(20px) scaleX(0.95); opacity: 0.9; }
  60% { transform: translateX(-10px) scaleX(1.02); opacity: 0; }
  80% { transform: translateX(-15px) scaleX(0.98); opacity: 0; }
}

/* Aurora 4 - Pink/Magenta curtain (center-right) */
.starfield .aurora-4 {
  position: absolute;
  left: 45%;
  top: 0;
  width: 60%;
  height: 50%;
  background: linear-gradient(180deg,
    transparent 0%,
    hsla(320, 85%, 55%, 0.2) 20%,
    hsla(330, 80%, 50%, 0.4) 50%,
    hsla(325, 75%, 45%, 0.3) 75%,
    hsla(320, 65%, 40%, 0.15) 90%,
    transparent 100%
  );
  filter: blur(78px);
  animation: aurora-curtain-4 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aurora-curtain-4 {
  0%, 100% { transform: translateX(35px) scaleX(1.02); opacity: 0; }
  20% { transform: translateX(-35px) scaleX(0.94); opacity: 0; }
  40% { transform: translateX(-15px) scaleX(1.1); opacity: 0.9; }
  60% { transform: translateX(20px) scaleX(1); opacity: 0.9; }
  80% { transform: translateX(30px) scaleX(1.04); opacity: 0; }
}

/* Aurora 5 - Teal curtain (far left) */
.starfield .aurora-5 {
  position: absolute;
  left: -10%;
  top: 0;
  width: 58%;
  height: 50%;
  background: linear-gradient(180deg,
    transparent 0%,
    hsla(175, 88%, 48%, 0.24) 20%,
    hsla(180, 82%, 44%, 0.42) 50%,
    hsla(178, 76%, 40%, 0.3) 75%,
    hsla(175, 68%, 36%, 0.15) 90%,
    transparent 100%
  );
  filter: blur(68px);
  animation: aurora-curtain-5 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aurora-curtain-5 {
  0%, 100% { transform: translateX(-15px) scaleX(1); opacity: 0; }
  20% { transform: translateX(55px) scaleX(1.08); opacity: 0; }
  40% { transform: translateX(40px) scaleX(0.96); opacity: 0; }
  60% { transform: translateX(20px) scaleX(1.04); opacity: 0.9; }
  80% { transform: translateX(-5px) scaleX(1); opacity: 0.9; }
}

/* Twinkling stars (dynamically generated by JS) */
.starfield .stars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.starfield .star {
  position: absolute;
  border-radius: 50%;
  animation: twinkle var(--duration, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* Shooting star effect - controlled by JavaScript */
.starfield .shooting-star {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
  opacity: 0;
  pointer-events: none;
}

.starfield .shooting-star.active {
  animation: shooting-star-fly var(--duration, 1.5s) ease-out forwards;
}

@keyframes shooting-star-fly {
  0% { opacity: 0; }
  5% { opacity: 1; }
  85% { opacity: 1; }
  100% { 
    opacity: 0;
    transform: translate(var(--travel-x, 800px), var(--travel-y, 400px));
  }
}

/* Ambient glow at bottom */
.starfield .ambient-glow {
  position: absolute;
  inset: 0;
  bottom: 0;
  height: 40%;
  top: auto;
  background: radial-gradient(ellipse 100% 80% at 50% 100%, 
    hsla(260, 50%, 15%, 0.4) 0%, 
    transparent 60%
  );
  pointer-events: none;
}

/* ============================================
   MENU SCREEN
   ============================================ */

.menu-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  font-weight: 900;
  color: var(--accent-primary);
  text-shadow: 
    0 0 20px var(--ui-glow),
    0 0 40px var(--ui-glow),
    0 4px 0 #004422;
  letter-spacing: 0.05em;
  margin-bottom: 40px;
  line-height: 1;
}

.title-sub {
  display: block;
  font-size: 0.22em;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: none;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.menu-buttons.compact {
  gap: 12px;
}

.menu-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.menu-group.primary .menu-btn,
.menu-group.secondary .menu-btn {
  flex: 1;
  max-width: 220px;
}

.menu-group.tertiary {
  gap: 8px;
}

.menu-group.tertiary .menu-btn {
  padding: 12px 24px;
  min-width: auto;
  font-size: 0.85rem;
}

.menu-btn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 16px 48px;
  min-width: 220px;
  background: transparent;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  overflow: hidden;
}

.menu-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--ui-glow), transparent);
  transition: left 0.4s ease;
}

.menu-btn:hover::before,
.menu-btn:active::before {
  left: 100%;
}

.menu-btn:hover,
.menu-btn:active {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-primary);
  box-shadow: 0 0 20px var(--ui-glow);
}

.menu-btn.secondary {
  border-color: var(--text-dim);
  color: var(--text-dim);
}

.menu-btn.secondary:hover,
.menu-btn.secondary:active {
  background: rgba(136, 136, 136, 0.15);
  color: var(--text-dim);
  box-shadow: 0 0 15px rgba(136, 136, 136, 0.3);
}

/* ============================================
   GAME SCREEN
   ============================================ */

#game-screen {
  background: var(--bg-deep);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ============================================
   HUD
   ============================================ */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: calc(var(--hud-padding) + var(--safe-top)) calc(var(--hud-padding) + var(--safe-right)) var(--hud-padding) calc(var(--hud-padding) + var(--safe-left));
  pointer-events: none;
  z-index: 10;
}

#hud-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.player-indicator {
  font-size: 1rem;
}

.player-indicator.p1 {
  color: var(--p1-color);
}

.player-indicator.p2 {
  color: var(--p2-color);
}

.stat {
  min-width: 60px;
}

.stat.speed {
  color: var(--accent-primary);
}

.stat.checkpoints {
  color: var(--text-primary);
  opacity: 0.8;
}

#hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}

.time-display {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--ui-border);
}

.time-display .time-icon {
  font-size: 1rem;
  opacity: 0.8;
}

.time-display .time-remaining {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-primary);
  min-width: 50px;
  text-align: center;
}

.time-display.warning .time-remaining {
  color: #ff4444;
  animation: time-pulse 0.5s infinite;
}

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

#hud-right {
  display: flex;
  align-items: flex-start;
}

#minimap-canvas {
  width: 140px;
  height: 140px;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
}

/* ============================================
   TOUCH CONTROLS - Virtual Joystick
   ============================================ */

#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  pointer-events: none;
  z-index: 10;
}

/* Joystick Zone - left side of screen */
#joystick-zone {
  pointer-events: auto;
  flex: 1;
  height: 200px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding-left: 20px;
  padding-bottom: 20px;
}

/* Joystick Base - outer ring */
#joystick-base {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(0, 255, 136, 0.08);
  border: 3px solid rgba(0, 255, 136, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    inset 0 0 30px rgba(0, 255, 136, 0.1),
    0 0 20px rgba(0, 255, 136, 0.1);
}

/* Joystick Stick - inner movable circle */
#joystick-stick {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0, 255, 136, 0.6), rgba(0, 255, 136, 0.2));
  border: 2px solid var(--accent-primary);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 
    0 0 15px var(--ui-glow),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
  transition: box-shadow 0.1s ease;
  will-change: left, top;
}

#joystick-stick.active {
  background: radial-gradient(circle at 30% 30%, rgba(0, 255, 136, 0.9), rgba(0, 255, 136, 0.5));
  box-shadow: 
    0 0 30px var(--accent-primary),
    0 0 60px var(--ui-glow),
    inset 0 0 15px rgba(255, 255, 255, 0.2);
}

/* Right controls container - power-up + action buttons */
#action-zone {
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  padding-right: 20px;
  padding-bottom: 40px;
}

/* Action buttons column (thrust + fire) */
.action-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/* Control buttons */
.control-btn {
  width: var(--control-size);
  height: var(--control-size);
  border-radius: 50%;
  background: rgba(0, 255, 136, 0.1);
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
}

.control-btn span {
  font-size: 0.6rem;
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.control-btn:active,
.control-btn.pressed {
  background: var(--accent-primary);
  color: var(--bg-deep);
  box-shadow: 0 0 30px var(--ui-glow);
  transform: scale(0.95);
}

/* Thrust button - larger, primary green */
.control-btn.thrust {
  width: calc(var(--control-size) * 1.3);
  height: calc(var(--control-size) * 1.3);
}

/* Shoot button - red accent */
.control-btn.shoot {
  width: calc(var(--control-size) * 1.1);
  height: calc(var(--control-size) * 1.1);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  background: rgba(255, 68, 102, 0.1);
}

.control-btn.shoot:active,
.control-btn.shoot.pressed {
  background: var(--accent-danger);
  color: var(--bg-deep);
  box-shadow: 0 0 30px rgba(255, 68, 102, 0.5);
}

/* Power-up Selector Zone (circle with switch button) */
#powerup-zone {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#powerup-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Main power-up use button (circle) */
.powerup-use-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 204, 0, 0.1);
  border: 2px solid var(--accent-warning);
  color: var(--accent-warning);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}

.powerup-use-btn:active,
.powerup-use-btn.pressed {
  background: var(--accent-warning);
  color: var(--bg-deep);
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.5);
  transform: scale(0.95);
}

.powerup-use-btn.empty {
  opacity: 0.3;
  border-color: var(--text-dim);
  color: var(--text-dim);
}

.powerup-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.powerup-name {
  font-size: 0.5rem;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  margin-top: 2px;
  text-transform: uppercase;
}

/* Switch power-up button */
.powerup-switch-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 204, 255, 0.1);
  border: 2px solid var(--accent-secondary);
  color: var(--accent-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}

.powerup-switch-btn:active {
  background: var(--accent-secondary);
  color: var(--bg-deep);
  box-shadow: 0 0 15px rgba(0, 204, 255, 0.5);
  transform: scale(0.9);
}

.powerup-switch-btn.hidden {
  display: none;
}

/* Hide touch controls on desktop by default */
@media (hover: hover) and (pointer: fine) {
  #touch-controls {
    display: none;
  }
  
  /* Show only power-up wheel on desktop when wheel mode is enabled */
  #touch-controls.wheel-mode {
    display: flex;
    justify-content: flex-end;
  }
  
  /* Hide joystick on desktop (keyboard handles movement) */
  #touch-controls.wheel-mode #joystick-zone {
    display: none;
  }
  
  /* Hide action buttons on desktop, only show power-up */
  #touch-controls.wheel-mode .action-buttons {
    display: none;
  }
  
  /* Center the power-up zone on desktop wheel mode */
  #touch-controls.wheel-mode #action-zone {
    padding-bottom: 20px;
  }
}

/* ============================================
   PAUSE BUTTON & TIMER CONTAINER
   ============================================ */

#pause-timer-container {
  position: absolute;
  top: calc(var(--hud-padding) + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.game-timer {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Share Tech Mono', monospace;
}

.game-timer .timer-icon {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.game-timer .timer-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-primary);
  min-width: 45px;
  text-align: center;
}

.game-timer.warning .timer-value {
  color: #ff4444;
  animation: pulse-warning 1s infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#btn-pause {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#btn-pause:hover {
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-primary);
}

/* ============================================
   GAME MESSAGES
   ============================================ */

#game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 50;
  background: rgba(10, 10, 18, 0.95);
  padding: 40px 60px;
  border: 2px solid var(--accent-primary);
  border-radius: 8px;
  box-shadow: 0 0 60px var(--ui-glow);
}

#game-message.hidden {
  display: none;
}

#game-message h2 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--accent-primary);
  margin-bottom: 30px;
  text-shadow: 0 0 20px var(--ui-glow);
}

#game-message .menu-btn {
  margin-top: 10px;
}

/* ============================================
   PAUSE SCREEN
   ============================================ */

.pause-content,
.controls-content {
  text-align: center;
  padding: 40px;
}

.pause-content h2,
.controls-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 40px;
}

.pause-content .menu-btn {
  margin: 10px;
}

.pause-content.hidden {
  display: none;
}

/* Pause Settings Submenu */
.pause-settings {
  text-align: center;
  padding: 40px;
}

.pause-settings.hidden {
  display: none;
}

.pause-settings h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-primary);
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
  font-size: 1.1rem;
}

.setting-row label {
  color: var(--text-primary);
  font-family: var(--font-display);
  min-width: 120px;
  text-align: right;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent-primary);
  border-radius: 8px;
  background: transparent;
  color: var(--accent-primary);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  color: var(--bg-deep);
  box-shadow: 0 0 15px var(--ui-glow);
}

.zoom-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.zoom-indicator {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 60px;
  justify-content: center;
}

.zoom-level {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--accent-primary);
  text-shadow: 0 0 10px var(--ui-glow);
}

.zoom-label {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-dim);
}

.pause-settings .menu-btn {
  margin-top: 30px;
}

/* Toggle control for settings */
.toggle-control {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 4px;
}

.toggle-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn:hover {
  color: var(--text-primary);
}

.toggle-btn[data-active="true"] {
  background: var(--accent-primary);
  color: var(--bg-deep);
  box-shadow: 0 0 10px var(--ui-glow);
}

/* Hide power-up control setting and ship control mode on mobile */
@media (hover: none) {
  #powerup-control-setting,
  #control-mode-setting {
    display: none;
  }
}

/* ============================================
   CONTROLS SCREEN
   ============================================ */

#controls-screen {
  background: var(--bg-space);
}

.control-info {
  margin-bottom: 40px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 1.1rem;
}

.key {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  min-width: 50px;
  text-align: center;
}

.action {
  color: var(--text-dim);
  min-width: 100px;
  text-align: left;
}

/* Mobile: Hide desktop-only controls info */
@media (hover: none) {
  .desktop-only {
    display: none;
  }
}

/* ============================================
   LEVEL SELECT SCREEN
   ============================================ */

#level-screen {
  background: var(--bg-space);
}

.level-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
}

.level-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  max-width: 600px;
  width: 100%;
  margin-bottom: 30px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px;
}

.level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 15px;
  background: rgba(0, 255, 136, 0.05);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.level-btn:hover,
.level-btn:active {
  background: rgba(0, 255, 136, 0.15);
  border-color: var(--accent-primary);
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--ui-glow);
}

.level-btn .level-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.level-btn .level-name {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   TUTORIAL SCREEN
   ============================================ */

#tutorial-screen {
  background: var(--bg-space);
}

.tutorial-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
  max-width: 500px;
}

.tutorial-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.tutorial-intro {
  color: var(--text-dim);
  margin-bottom: 30px;
  text-align: center;
}

.tutorial-lessons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 30px;
}

.tutorial-lesson {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: rgba(0, 255, 136, 0.05);
  border: 2px solid var(--ui-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.tutorial-lesson:hover {
  background: rgba(0, 255, 136, 0.1);
  border-color: var(--accent-primary);
  transform: translateX(5px);
}

.tutorial-lesson.completed {
  border-color: var(--accent-primary);
  opacity: 0.8;
}

.lesson-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(0, 255, 136, 0.1);
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.lesson-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.lesson-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.lesson-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.lesson-status {
  font-size: 1.2rem;
  color: var(--accent-primary);
}

.lesson-status::after {
  content: '';
}

.tutorial-lesson.completed .lesson-status::after {
  content: '✓';
}

.menu-btn.tutorial {
  background: linear-gradient(135deg, rgba(255, 200, 0, 0.2), rgba(255, 150, 0, 0.1));
  border-color: #ffaa00;
  color: #ffcc00;
}

.menu-btn.tutorial:hover {
  background: linear-gradient(135deg, rgba(255, 200, 0, 0.3), rgba(255, 150, 0, 0.2));
  box-shadow: 0 0 25px rgba(255, 200, 0, 0.3);
}

/* Tutorial HUD overlay */
.tutorial-hud {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--accent-warning);
  border-radius: 10px;
  padding: 15px 25px;
  text-align: center;
  z-index: 50;
  max-width: 400px;
}

.tutorial-hud h3 {
  font-family: var(--font-display);
  color: var(--accent-warning);
  font-size: 1rem;
  margin-bottom: 8px;
}

.tutorial-hud p {
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.tutorial-hud .key-hint {
  display: inline-block;
  background: rgba(255, 204, 0, 0.2);
  border: 1px solid var(--accent-warning);
  border-radius: 4px;
  padding: 2px 8px;
  margin: 0 3px;
  font-family: var(--font-mono);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
  :root {
    --control-size: 70px;
    --hud-padding: 12px;
  }
  
  .game-title {
    margin-bottom: 40px;
  }
  
  .menu-btn {
    padding: 14px 36px;
    min-width: 180px;
    font-size: 1rem;
  }
  
  .player-stats {
    font-size: 1.1rem;
    gap: 10px;
  }
  
  #minimap-canvas {
    width: 100px;
    height: 100px;
  }
  
  #game-message {
    padding: 30px 40px;
  }
  
  #game-message h2 {
    font-size: 1.8rem;
  }
}

/* Landscape phone adjustments */
@media (max-height: 500px) {
  .menu-content {
    padding: 20px;
  }
  
  .game-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
  }
  
  .menu-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .menu-btn {
    padding: 12px 24px;
    min-width: auto;
  }
}

/* ============================================
   LOAD LEVEL CODE SCREEN
   ============================================ */

#load-code-screen {
  background: rgba(0, 0, 0, 0.9);
}

.load-code-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  max-width: 700px;
  width: 90%;
}

.load-code-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

#level-code-input {
  width: 100%;
  height: 300px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  color: var(--accent-primary);
  font-family: 'Fira Code', 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  padding: 15px;
  resize: none;
  margin-bottom: 20px;
}

#level-code-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--ui-glow);
}

#level-code-input::placeholder {
  color: var(--text-dim);
}

.load-code-actions {
  display: flex;
  gap: 15px;
}

/* ============================================
   ONLINE MULTIPLAYER STYLES
   ============================================ */

/* Online Button Style */
.menu-btn.online {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  background: linear-gradient(135deg, rgba(0, 204, 255, 0.1) 0%, transparent 100%);
}

.menu-btn.online:hover,
.menu-btn.online:active {
  background: rgba(0, 204, 255, 0.2);
  color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(0, 204, 255, 0.4);
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.75rem;
  margin-bottom: 12px;
}

.connection-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.connection-status.disconnected {
  background: rgba(255, 68, 102, 0.2);
  border: 1px solid var(--accent-danger);
}

.connection-status.disconnected .status-dot {
  background: var(--accent-danger);
}

.connection-status.connecting {
  background: rgba(255, 204, 0, 0.2);
  border: 1px solid var(--accent-warning);
}

.connection-status.connecting .status-dot {
  background: var(--accent-warning);
  animation: pulse 0.5s infinite;
}

.connection-status.connected {
  background: rgba(0, 255, 136, 0.2);
  border: 1px solid var(--accent-primary);
}

.connection-status.connected .status-dot {
  background: var(--accent-primary);
}

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

/* Online Screen */
#online-screen {
  background: var(--bg-space);
}

.online-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  max-width: 360px;
  width: 100%;
}

.online-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--accent-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

/* Connection Status - more compact */
#online-screen .connection-status {
  margin-bottom: 14px;
}

/* Name Input */
.name-input-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
}

.name-input-section label {
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
  min-width: 70px;
}

.name-input-section input {
  flex: 1;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.name-input-section input:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

.name-input-section input[readonly] {
  cursor: default;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.3);
}

.menu-btn.small {
  padding: 8px 12px;
  min-width: auto;
  font-size: 0.75rem;
}

/* Matchmaking Section */
.matchmaking-section {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
}

.matchmaking-section label {
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
  min-width: 70px;
}

.matchmaking-select {
  flex: 1;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
}

.matchmaking-select:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

/* Room Actions - stacked full width */
.room-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  width: 100%;
}

.room-actions .menu-btn {
  width: 100%;
  padding: 10px 18px;
  font-size: 0.85rem;
}

.room-actions .menu-btn.primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: var(--accent-primary);
  color: var(--bg-deep);
  font-weight: bold;
}

.room-actions .menu-btn.primary:hover {
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.join-room-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.join-room-group input {
  width: 100px;
  flex-shrink: 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--accent-primary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 2px;
}

.join-room-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.join-room-group input::placeholder {
  color: var(--text-dim);
  font-size: 0.6rem;
  letter-spacing: 1px;
}

.join-room-group .menu-btn {
  flex: 1;
}

/* Room List */
.room-list-section {
  width: 100%;
  margin-bottom: 14px;
}

.room-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.room-list-section h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.refresh-btn {
  background: none;
  border: 1px solid var(--ui-border);
  color: var(--text-dim);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.room-list {
  max-height: 140px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  padding: 6px;
}

.room-list-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 12px;
  font-size: 0.75rem;
  font-style: italic;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(0, 204, 255, 0.05);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.room-item:last-child {
  margin-bottom: 0;
}

.room-item:hover {
  background: rgba(0, 204, 255, 0.15);
  border-color: var(--accent-secondary);
}

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

.room-item .room-name {
  font-family: var(--font-display);
  color: var(--accent-secondary);
  font-size: 0.8rem;
}

.room-item .room-mode {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.room-item .room-players {
  color: var(--text-dim);
  font-size: 0.7rem;
  white-space: nowrap;
}

/* Back button in online screen - full width */
#online-screen .menu-btn.secondary {
  width: 100%;
  padding: 10px 24px;
  font-size: 0.8rem;
}

/* ============================================
   LOBBY SCREEN
   ============================================ */

#lobby-screen {
  background: var(--bg-space);
}

.lobby-content {
  display: flex;
  flex-direction: column;
  padding: 15px 20px;
  max-width: 1100px;
  width: 100%;
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.lobby-header {
  text-align: center;
  margin-bottom: 10px;
}

/* Two-column layout for lobby */
.lobby-main {
  display: flex;
  gap: 15px;
  flex: 1;
  min-height: 0;
}

.lobby-left {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.lobby-right {
  flex: 1;
  min-width: 220px;
  max-width: 320px;
  flex-shrink: 0;
}

/* Map Preview */
.map-preview-section {
  background: rgba(0, 20, 40, 0.6);
  border: 1px solid var(--accent-primary);
  border-radius: 6px;
  padding: 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Map preview header with title and info inline */
.map-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.map-preview-section h3 {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.map-preview-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  flex-wrap: wrap;
}

.preview-mode {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.preview-name {
  color: var(--accent-secondary);
  font-family: var(--font-display);
  font-size: 0.75rem;
}

.map-preview-container {
  flex: 1;
  background: var(--bg-deep);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

#map-preview-canvas {
  width: 100%;
  height: 100%;
  max-height: 280px;
  object-fit: contain;
}

.lobby-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--accent-secondary);
  margin-bottom: 6px;
}

.room-code-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--accent-primary);
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 3px;
}

.room-code-display span {
  color: var(--accent-primary);
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.copy-btn:hover {
  opacity: 1;
}

/* Player List */
.player-list-section {
  margin-bottom: 8px;
}

.player-list-section h3,
.lobby-level-section h3,
.lobby-chat-section h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.lobby-player-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lobby-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
}

.lobby-player.is-you {
  border-color: var(--accent-primary);
  background: rgba(0, 255, 136, 0.1);
}

.lobby-player.is-host {
  border-color: var(--accent-warning);
}

.lobby-player .player-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-player .player-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.lobby-player .player-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.lobby-player .player-badges {
  display: flex;
  gap: 5px;
}

.lobby-player .badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lobby-player .badge.host {
  background: rgba(255, 204, 0, 0.2);
  color: var(--accent-warning);
  border: 1px solid var(--accent-warning);
}

.lobby-player .badge.ready {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.lobby-player .badge.not-ready {
  background: rgba(255, 68, 102, 0.2);
  color: var(--accent-danger);
  border: 1px solid var(--accent-danger);
}

/* Team Sections */
.team-section {
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--ui-border);
}

.team-section.team-red {
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.3);
}

.team-section.team-blue {
  background: rgba(68, 68, 255, 0.1);
  border-color: rgba(68, 68, 255, 0.3);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.team-name {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.team-red .team-name {
  color: #ff6666;
}

.team-blue .team-name {
  color: #6666ff;
}

.team-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.team-join-btn {
  width: 100%;
  margin-top: 4px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.team-join-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-style: solid;
  color: var(--text-primary);
}

.team-red .team-join-btn:hover {
  background: rgba(255, 68, 68, 0.3);
  border-color: #ff6666;
  color: #ff6666;
}

.team-blue .team-join-btn:hover {
  background: rgba(68, 68, 255, 0.3);
  border-color: #6666ff;
  color: #6666ff;
}

.team-empty {
  padding: 6px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.75rem;
}

/* Level Selection */
.lobby-level-section {
  margin-bottom: 8px;
}

/* Game Mode and Level on one row */
.lobby-mode-level-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-level-item {
  flex: 1;
  min-width: 140px;
}

.mode-level-item h3 {
  margin: 0 0 4px 0;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.level-select,
.mode-select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
}

.level-select:focus,
.mode-select:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

.level-select:disabled,
.mode-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Checkbox labels for game options */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.checkbox-label:hover {
  color: var(--text-primary);
}

#game-options-section {
  margin-bottom: 8px;
}

/* Options row for dropdowns */
.lobby-options-row {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.option-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.option-label span {
  color: var(--text-muted);
}

.option-select {
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  min-width: 55px;
}

.option-select:hover {
  border-color: var(--accent-primary);
}

.option-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
}

.option-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#score-limit-label {
  /* Hidden by default, shown for combat modes */
}

/* Chat */
.lobby-chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 80px;
  margin-bottom: 8px;
}

.lobby-chat {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  padding: 6px;
  overflow-y: auto;
  font-size: 0.75rem;
  min-height: 50px;
  max-height: 100px;
}

.chat-message {
  margin-bottom: 3px;
  line-height: 1.3;
}

.chat-message .chat-name {
  font-weight: bold;
  margin-right: 6px;
}

.chat-message .chat-text {
  color: var(--text-dim);
}

.chat-message.system {
  color: var(--accent-secondary);
  font-style: italic;
}

.chat-input-group {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.chat-input-group input {
  flex: 1;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.chat-input-group input:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

/* Mobile Chat Toggle Button - hidden by default, shown on mobile in lobby */
.mobile-chat-toggle {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--accent-secondary);
  border: 2px solid var(--accent-primary);
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, background 0.2s;
}

.mobile-chat-toggle:hover,
.mobile-chat-toggle:active {
  transform: scale(1.1);
  background: var(--accent-primary);
}

.mobile-chat-toggle.has-unread {
  animation: pulse-chat 1s infinite;
}

@keyframes pulse-chat {
  0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 4px 20px rgba(0, 255, 136, 0.6); }
}

/* Mobile Chat Modal */
.mobile-chat-modal {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  max-height: 400px;
  background: var(--bg-deep);
  border-top: 2px solid var(--accent-primary);
  border-radius: 15px 15px 0 0;
  z-index: 200;
  flex-direction: column;
  padding: 15px;
  animation: slide-up 0.3s ease-out;
}

.mobile-chat-modal.open {
  display: flex;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulse-warning {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.1); opacity: 0.9; }
}

.mobile-chat-modal .chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ui-border);
}

.mobile-chat-modal .chat-header h3 {
  margin: 0;
  color: var(--accent-primary);
  font-size: 1rem;
}

.mobile-chat-modal .chat-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
}

.mobile-chat-modal .chat-close-btn:hover {
  color: var(--accent-danger);
}

.mobile-chat-modal .lobby-chat {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.mobile-chat-modal .chat-input-group {
  margin-top: 10px;
  flex-shrink: 0;
}

/* Mobile Settings Toggle Button - hidden by default, shown on mobile for host */
.mobile-settings-toggle {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--bg-lighter);
  border: 2px solid var(--accent-primary);
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, background 0.2s;
}

.mobile-settings-toggle:hover,
.mobile-settings-toggle:active {
  transform: scale(1.1);
  background: var(--accent-secondary);
}

/* Mobile Settings Bottom Sheet */
.mobile-settings-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 250;
}

.mobile-settings-sheet.open {
  display: block;
}

.settings-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.settings-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  animation: slide-up-full 0.3s ease-out;
  touch-action: pan-y;
}

@keyframes slide-up-full {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.settings-sheet-content.closing {
  animation: slide-down-full 0.25s ease-in forwards;
}

@keyframes slide-down-full {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

.settings-sheet-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
  gap: 12px;
  background: var(--bg-space);
}

.settings-back-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-back-btn:hover,
.settings-back-btn:active {
  color: var(--text-primary);
}

.settings-sheet-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  flex: 1;
}

/* Swipe indicator bar */
.settings-swipe-indicator {
  width: 40px;
  height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  margin: 8px auto 0;
  opacity: 0.5;
}

.settings-close-btn {
  display: none; /* Hidden - use back button instead */
}

.settings-sheet-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-group.settings-row {
  flex-direction: row;
  gap: 12px;
}

.settings-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-lighter);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
}

.settings-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.settings-select-small {
  padding: 10px 8px;
  background: var(--bg-lighter);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
}

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-lighter);
  border-radius: 8px;
  cursor: pointer;
}

.settings-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

.settings-checkbox span {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Lobby Actions - sticky at bottom so always visible */
.lobby-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 8px;
  background: var(--bg-space);
  position: sticky;
  bottom: 0;
}

.lobby-actions .menu-btn {
  padding: 8px 20px;
  font-size: 0.85rem;
}

.ready-btn {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.ready-btn.is-ready {
  background: var(--accent-primary);
  color: var(--bg-deep);
}

/* ============================================
   COUNTDOWN OVERLAY
   ============================================ */

#countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#countdown-overlay.hidden {
  display: none !important;
}

.countdown-display {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.countdown-label {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

#countdown-number {
  font-family: var(--font-display);
  font-size: 20rem;
  font-weight: 900;
  color: var(--accent-secondary);
  text-shadow: 
    0 0 50px rgba(0, 204, 255, 0.8),
    0 0 100px rgba(0, 204, 255, 0.5),
    0 0 150px rgba(0, 204, 255, 0.3);
  animation: countdown-pop 1s ease-out;
  line-height: 1;
}

#countdown-overlay.animate #countdown-number {
  animation: countdown-pop 1s ease-out;
}

@keyframes countdown-pop {
  0% { 
    transform: scale(1.5);
    opacity: 0;
  }
  20% {
    transform: scale(1);
    opacity: 1;
  }
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% { 
    transform: scale(0.8);
    opacity: 0.5;
  }
}

.countdown-go {
  font-size: 12rem !important;
  color: var(--accent-primary) !important;
  text-shadow: 
    0 0 50px rgba(0, 255, 136, 0.8),
    0 0 100px rgba(0, 255, 136, 0.5),
    0 0 150px rgba(0, 255, 136, 0.3) !important;
}

/* ============================================
   SCROLLBARS
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--ui-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* ============================================
   PRACTICE MODE SELECTION
   ============================================ */

.mode-select-section {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.mode-select-section label {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.mode-select {
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
}

.mode-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ============================================
   LOBBY MODE CHECKBOXES
   ============================================ */

.mode-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: normal;
}

.mode-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mode-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-checkbox:hover {
  border-color: var(--accent-secondary);
}

.mode-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
}

.mode-checkbox input[type="checkbox"]:checked + .mode-label {
  color: var(--accent-primary);
}

.mode-checkbox .mode-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: color 0.2s;
}

/* ============================================
   MAP VOTING SCREEN
   ============================================ */

#vote-screen {
  background: rgba(5, 5, 15, 0.95);
  backdrop-filter: blur(8px);
}

.vote-content {
  width: 90%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.vote-header {
  text-align: center;
  width: 100%;
}

.vote-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.vote-mode-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: var(--accent-secondary);
  color: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: bold;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.vote-timer {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-warning);
}

#vote-timer-display {
  font-size: 2rem;
  font-weight: bold;
}

.vote-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.vote-option {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  background: rgba(20, 20, 40, 0.8);
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.vote-option:hover {
  border-color: var(--accent-secondary);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 204, 255, 0.2);
}

.vote-option.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.vote-option.selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: var(--bg-deep);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.vote-preview {
  width: 100%;
  height: 120px;
  background: var(--bg-space);
  position: relative;
  overflow: hidden;
}

.vote-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vote-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--accent-secondary);
  opacity: 0.5;
}

.vote-info {
  padding: 0.8rem;
}

.vote-map-mode {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.vote-map-name {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0.3rem 0;
}

.vote-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vote-count-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-primary);
}

.vote-count-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Random option special styling */
.vote-option.random-option .vote-preview-placeholder {
  font-size: 2.5rem;
  color: var(--accent-warning);
}

.vote-option.random-option:hover {
  border-color: var(--accent-warning);
}

.vote-option.random-option.selected {
  border-color: var(--accent-warning);
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.4);
}

.vote-option.random-option.selected::after {
  background: var(--accent-warning);
}

/* ============================================
   LOBBY INTEGRATED VOTING
   ============================================ */

.lobby-vote-section {
  background: rgba(0, 20, 40, 0.6);
  border: 1px solid var(--accent-primary);
  border-radius: 8px;
  padding: 15px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lobby-vote-section.hidden {
  display: none;
}

.map-preview-section.hidden {
  display: none;
}

.lobby-vote-header {
  text-align: center;
}

.lobby-vote-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent-primary);
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.lobby-vote-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.lobby-vote-mode {
  padding: 0.2rem 0.6rem;
  background: var(--accent-secondary);
  color: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: bold;
  border-radius: 3px;
}

.lobby-vote-timer {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent-warning);
}

.lobby-vote-timer span {
  font-size: 1.2rem;
  font-weight: bold;
}

.lobby-vote-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.lobby-vote-option {
  display: flex;
  gap: 0.75rem;
  background: rgba(20, 20, 40, 0.8);
  border: 2px solid var(--ui-border);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.lobby-vote-option:hover {
  border-color: var(--accent-secondary);
  background: rgba(30, 30, 60, 0.8);
}

.lobby-vote-option.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.lobby-vote-option.selected::before {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: var(--accent-primary);
  color: var(--bg-deep);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
}

.lobby-vote-option {
  position: relative;
}

.lobby-vote-preview {
  width: 100px;
  height: 60px;
  background: var(--bg-space);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.lobby-vote-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lobby-vote-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent-warning);
}

.lobby-vote-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lobby-vote-map-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.lobby-vote-votes {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.lobby-vote-votes .count {
  color: var(--accent-primary);
  font-size: 0.9rem;
}

.lobby-vote-option.random-option:hover {
  border-color: var(--accent-warning);
}

.lobby-vote-option.random-option.selected {
  border-color: var(--accent-warning);
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
}

.lobby-vote-option.random-option.selected::before {
  background: var(--accent-warning);
}

/* ============================================
   COMPACT UI - Pure CSS for small viewports
   Covers Discord Activity and small windows
   ============================================ */

@media (max-width: 800px), (max-height: 700px) {
  :root {
    --control-size: 60px;
    --hud-padding: 8px;
  }
  
  /* Main Menu */
  .menu-content {
    padding: 15px;
  }
  
  .game-title {
    font-size: 2rem;
    margin-bottom: 15px;
  }
  
  .title-sub {
    font-size: 0.18em;
  }
  
  .menu-buttons {
    gap: 8px;
  }
  
  .menu-btn {
    padding: 10px 20px;
    min-width: 150px;
    font-size: 0.85rem;
  }
  
  /* Online Screen */
  .online-content {
    padding: 15px;
    max-width: 100%;
  }
  
  .online-content h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
  }
  
  .name-input-section {
    margin-bottom: 15px;
  }
  
  .room-actions {
    margin-bottom: 15px;
    gap: 10px;
  }
  
  .room-actions .menu-btn {
    padding: 10px 16px;
    font-size: 0.8rem;
  }
  
  .join-room-group input {
    width: 100px;
  }
  
  .room-list-section h3 {
    font-size: 0.85rem;
  }
  
  .room-list {
    max-height: 140px;
  }
  
  .name-input-section {
    margin-bottom: 15px;
  }
  
  .name-input-section input {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  .room-actions {
    margin-bottom: 15px;
    gap: 10px;
  }
  
  .room-list-section h3 {
    font-size: 0.85rem;
  }
  
  .room-list {
    max-height: 150px;
  }
  
  .room-item {
    padding: 10px 12px;
  }
  
  /* Lobby Screen */
  .lobby-content {
    padding: 15px;
    max-width: 100%;
  }

  .lobby-main {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .lobby-left {
    flex: 1 1 300px;
    min-width: 280px;
  }

  .lobby-right {
    flex: 1 1 250px;
    min-width: 250px;
    max-width: none;
  }

  .map-preview-section {
    height: auto;
    min-height: 280px;
  }

  #map-preview-canvas {
    max-height: 250px;
  }

  .lobby-header {
    margin-bottom: 12px;
  }

  .lobby-header h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
  }

  .room-code-display {
    padding: 8px 15px;
    font-size: 1rem;
    letter-spacing: 3px;
  }
  
  .player-list-section {
    margin-bottom: 10px;
  }
  
  .player-list-section h3,
  .lobby-level-section h3,
  .lobby-chat-section h3 {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }
  
  .lobby-player-list {
    gap: 6px;
  }
  
  .lobby-player {
    padding: 8px 12px;
  }
  
  .lobby-player .player-name {
    font-size: 0.9rem;
  }
  
  .lobby-player .badge {
    font-size: 0.6rem;
    padding: 2px 6px;
  }
  
  .lobby-level-section {
    margin-bottom: 10px;
  }
  
  .lobby-mode-level-row {
    gap: 10px;
  }
  
  .mode-level-item h3 {
    font-size: 0.75rem;
    margin-bottom: 6px;
  }
  
  .level-select,
  .mode-select {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  .mode-checkbox-group {
    gap: 5px;
  }
  
  .mode-checkbox {
    padding: 4px 8px;
  }
  
  .mode-checkbox .mode-label {
    font-size: 0.8rem;
  }
  
  .lobby-chat-section {
    min-height: 100px;
    margin-bottom: 10px;
  }
  
  .lobby-chat {
    min-height: 60px;
    max-height: 100px;
    font-size: 0.8rem;
  }
  
  .chat-input-group input {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  
  .lobby-actions {
    gap: 10px;
  }
  
  .lobby-actions .menu-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }
  
  /* Game HUD */
  .player-stats {
    font-size: 1rem;
    gap: 8px;
  }
  
  #minimap-canvas {
    width: 90px;
    height: 90px;
  }
  
  /* Game Messages */
  #game-message {
    padding: 25px 35px;
  }
  
  #game-message h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
  }
  
  /* Countdown */
  #countdown-number {
    font-size: 12rem;
  }
  
  .countdown-label {
    font-size: 1.2rem;
  }
  
  /* Vote Screen */
  .vote-header h2 {
    font-size: 1.4rem;
  }
  
  .vote-timer {
    font-size: 1.1rem;
  }
  
  .vote-option {
    min-width: 160px;
  }
  
  .vote-preview {
    height: 90px;
  }
}

/* Even smaller - typical Discord Activity size */
@media (max-width: 600px), (max-height: 550px) {
  :root {
    --control-size: 60px;
    --hud-padding: 8px;
  }
  
  .menu-content {
    padding: 10px;
  }
  
  .game-title {
    font-size: clamp(1.5rem, 8vw, 2.5rem);
    margin-bottom: 15px;
  }
  
  .title-sub {
    font-size: 0.2em;
    margin-bottom: 2px;
  }
  
  .menu-buttons {
    gap: 6px;
  }
  
  .menu-btn {
    padding: 8px 20px;
    min-width: 140px;
    font-size: 0.8rem;
  }
  
  .player-stats {
    font-size: 0.9rem;
    gap: 6px;
  }
  
  #minimap-canvas {
    width: 70px;
    height: 70px;
  }
  
  #game-message {
    padding: 15px 25px;
  }
  
  #game-message h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
  }
  
  /* Online Screen - complete compact styles */
  .online-content {
    padding: 12px;
    max-width: 100%;
  }
  
  .online-content h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }
  
  .connection-status {
    padding: 6px 12px;
    font-size: 0.75rem;
    margin-bottom: 12px;
  }
  
  .name-input-section {
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .name-input-section label {
    font-size: 0.8rem;
  }
  
  .name-input-section input {
    padding: 8px 10px;
    font-size: 0.85rem;
    flex: 1;
    min-width: 120px;
  }
  
  .room-actions {
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .room-actions .menu-btn {
    padding: 8px 14px;
    font-size: 0.75rem;
    min-width: auto;
  }
  
  .join-room-group {
    gap: 6px;
  }
  
  .join-room-group input {
    width: 90px;
    padding: 8px 10px;
    font-size: 0.85rem;
    letter-spacing: 1px;
  }
  
  .room-list-section {
    margin-bottom: 12px;
  }
  
  .room-list-section h3 {
    font-size: 0.75rem;
    margin-bottom: 6px;
  }
  
  .refresh-btn {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }
  
  .room-list {
    max-height: 120px;
    padding: 8px;
  }
  
  .room-list-empty {
    padding: 12px;
    font-size: 0.8rem;
  }
  
  .room-item {
    padding: 8px 10px;
    margin-bottom: 6px;
  }
  
  .room-item .room-name {
    font-size: 0.85rem;
  }
  
  .room-item .room-players {
    font-size: 0.75rem;
  }
  
  /* Lobby Screen - complete compact styles for mobile */
  .lobby-content {
    padding: 10px;
    padding-bottom: 70px; /* Space for action buttons */
    overflow-y: auto;
  }

  .lobby-main {
    flex-direction: column;
    gap: 10px;
  }

  .lobby-left {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .lobby-right {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    order: -1; /* Map preview at top on mobile */
  }

  .map-preview-section {
    min-height: 120px;
    margin-bottom: 5px;
  }

  #map-preview-canvas {
    max-height: 100px;
  }
  
  /* Compact player list on mobile */
  .lobby-player-list {
    max-height: 120px;
    overflow-y: auto;
  }
  
  /* Stack mode/level selects vertically on narrow screens */
  .lobby-mode-level-row {
    flex-direction: column;
  }
  
  .lobby-header {
    margin-bottom: 10px;
  }
  
  .lobby-header h2 {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
  
  .room-code-display {
    padding: 6px 12px;
    font-size: 0.9rem;
    letter-spacing: 2px;
  }
  
  .copy-btn {
    font-size: 0.9rem;
  }
  
  .player-list-section {
    margin-bottom: 8px;
  }
  
  .player-list-section h3,
  .lobby-level-section h3,
  .lobby-chat-section h3 {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }
  
  .lobby-player-list {
    gap: 4px;
  }
  
  .lobby-player {
    padding: 6px 10px;
  }
  
  .lobby-player .player-info {
    gap: 8px;
  }
  
  .lobby-player .player-color {
    width: 10px;
    height: 10px;
  }
  
  .lobby-player .player-name {
    font-size: 0.8rem;
  }
  
  .lobby-player .player-badges {
    gap: 4px;
  }
  
  .lobby-player .badge {
    font-size: 0.55rem;
    padding: 2px 5px;
  }
  
  .lobby-level-section {
    margin-bottom: 8px;
  }
  
  .lobby-mode-level-row {
    gap: 8px;
  }
  
  .mode-level-item {
    min-width: 120px;
  }
  
  .mode-level-item h3 {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }
  
  .level-select,
  .mode-select {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  
  .mode-hint {
    font-size: 0.6rem;
  }
  
  .mode-checkbox-group {
    gap: 4px;
    margin-top: 4px;
  }
  
  .mode-checkbox {
    padding: 3px 6px;
  }
  
  .mode-checkbox input[type="checkbox"] {
    width: 12px;
    height: 12px;
  }
  
  .mode-checkbox .mode-label {
    font-size: 0.7rem;
  }
  
  /* Hide inline chat on mobile, use toggle button instead */
  .lobby-chat-section {
    display: none;
  }
  
  /* Hide host settings sections on mobile (use bottom sheet instead) */
  #mode-level-section,
  #game-options-section {
    display: none !important;
  }
  
  /* Show mobile chat toggle button */
  .mobile-chat-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Mobile settings toggle button - only shown for host via .visible class */
  .mobile-settings-toggle.visible {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Mobile Settings Bottom Sheet - only shown when .open class is added */
  /* Base display:none is in the main styles, .open makes it visible */
  
  .lobby-actions {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .lobby-actions .menu-btn {
    padding: 6px 12px;
    font-size: 0.7rem;
    min-width: auto;
  }
  
  #countdown-number {
    font-size: 8rem;
  }
  
  .countdown-go {
    font-size: 5rem !important;
  }
  
  .countdown-label {
    font-size: 1rem;
  }
  
  .vote-header h2 {
    font-size: 1.1rem;
  }
  
  .vote-timer {
    font-size: 0.9rem;
  }
  
  #vote-timer-display {
    font-size: 1.2rem;
  }
  
  .vote-option {
    min-width: 120px;
  }
  
  .vote-preview {
    height: 60px;
  }
  
  .vote-info {
    padding: 0.5rem;
  }
  
  .vote-map-name {
    font-size: 0.85rem;
  }
  
  /* Mode selection in lobby */
  .mode-checkbox-group {
    gap: 4px;
  }
  
  .mode-checkbox {
    padding: 3px 6px;
    font-size: 0.75rem;
  }
  
  .mode-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }
}

/* Very small screens (small Discord Activity panels) */
@media (max-height: 400px), (max-width: 400px) {
  .menu-content {
    padding: 8px;
  }
  
  .game-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
  }
  
  .title-sub {
    display: none;
  }
  
  .menu-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
  
  .menu-btn {
    padding: 6px 12px;
    min-width: auto;
    font-size: 0.7rem;
  }
  
  /* Only hide secondary buttons in main menu, not in lobby */
  .menu-content .menu-btn.secondary {
    display: none;
  }
  
  /* Online Screen - very small */
  .online-content {
    padding: 8px;
  }
  
  .online-content h2 {
    font-size: 1rem;
    margin-bottom: 8px;
  }
  
  .connection-status {
    padding: 4px 8px;
    font-size: 0.7rem;
    margin-bottom: 8px;
  }
  
  .name-input-section {
    margin-bottom: 8px;
    gap: 6px;
  }
  
  .name-input-section label {
    font-size: 0.7rem;
  }
  
  .name-input-section input {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .room-actions {
    margin-bottom: 8px;
    gap: 4px;
  }
  
  .room-actions .menu-btn {
    padding: 6px 10px;
    font-size: 0.65rem;
  }
  
  .join-room-group {
    gap: 4px;
  }
  
  .join-room-group input {
    width: 70px;
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .room-list-section {
    margin-bottom: 8px;
  }
  
  .room-list-section h3 {
    font-size: 0.65rem;
  }
  
  .room-list {
    max-height: 80px;
    padding: 6px;
  }
  
  .room-item {
    padding: 6px 8px;
    margin-bottom: 4px;
  }
  
  .room-item .room-name {
    font-size: 0.75rem;
  }
  
  .room-item .room-players {
    font-size: 0.65rem;
  }
  
  /* Lobby - very small */
  .lobby-content {
    padding: 8px;
  }
  
  .lobby-header {
    margin-bottom: 6px;
  }
  
  .lobby-header h2 {
    font-size: 1rem;
  }
  
  .room-code-display {
    padding: 4px 10px;
    font-size: 0.8rem;
    letter-spacing: 2px;
  }
  
  .player-list-section,
  .lobby-level-section {
    margin-bottom: 6px;
  }
  
  .lobby-player-list {
    gap: 4px;
  }
  
  /* Chat is already hidden via mobile toggle on small screens */
  
  .lobby-actions {
    margin-top: auto;
    padding-top: 6px;
  }
  
  #countdown-number {
    font-size: 5rem;
  }
  
  .countdown-label {
    font-size: 0.8rem;
  }
}

/* Ensure content fits in iframe */
html, body, #game-container {
  max-width: 100vw;
  max-height: 100vh;
  min-height: 100%;
}

/* Make sure canvas fills available space */
#game-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Smooth scrolling when needed */
.screen::-webkit-scrollbar {
  width: 4px;
}

.screen::-webkit-scrollbar-track {
  background: transparent;
}

.screen::-webkit-scrollbar-thumb {
  background: var(--ui-border);
  border-radius: 2px;
}

/* ============================================
   AUTHENTICATION UI
   ============================================ */

/* User Badge (top right of menu) */
.user-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid var(--ui-border);
  border-radius: 50px;
  padding: 8px 16px 8px 8px;
  z-index: 10;
}

.user-badge.hidden {
  display: none;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  object-fit: cover;
  background: var(--bg-space);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.user-provider {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: capitalize;
}

.user-menu-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  transition: transform 0.2s;
}

.user-menu-btn:hover {
  transform: scale(1.1);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-space);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  overflow: hidden;
  min-width: 150px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.user-dropdown.hidden {
  display: none;
}

.user-dropdown button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.user-dropdown button:hover {
  background: rgba(0, 255, 136, 0.1);
}

.user-dropdown button:last-child {
  color: var(--accent-danger);
}

/* Sign In Button - in menu flow */
.sign-in-btn {
  background: transparent;
  border: 1px solid var(--text-dim);
  padding: 10px 32px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.sign-in-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 255, 136, 0.1);
  box-shadow: 0 0 20px var(--ui-glow);
}

.sign-in-btn.hidden {
  display: none;
}

.sign-in-icon {
  font-size: 1.2rem;
}

/* Modal Base */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: linear-gradient(145deg, var(--bg-space) 0%, #0f0f20 100%);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 32px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5), 
              0 0 100px rgba(0, 255, 136, 0.1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 68, 102, 0.2);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

/* Auth Modal */
.auth-modal {
  width: 420px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--accent-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.auth-header p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Provider Buttons */
.auth-providers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-provider-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-provider-btn:hover {
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.auth-provider-btn.google:hover {
  border-color: #4285F4;
  box-shadow: 0 0 20px rgba(66, 133, 244, 0.2);
}

.auth-provider-btn.meta:hover {
  border-color: #1877F2;
  box-shadow: 0 0 20px rgba(24, 119, 242, 0.2);
}

.auth-provider-btn.discord:hover {
  border-color: #5865F2;
  box-shadow: 0 0 20px rgba(88, 101, 242, 0.2);
}

.provider-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--ui-border), transparent);
}

/* Guest Section */
.guest-section {
  text-align: center;
}

.guest-text {
  color: var(--text-dim);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.guest-name-input {
  display: flex;
  gap: 10px;
}

.guest-name-input input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
}

.guest-name-input input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.guest-name-input .menu-btn {
  white-space: nowrap;
}

.guest-note {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.7;
}

/* Profile Modal */
.profile-modal {
  width: 450px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ui-border);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  object-fit: cover;
  background: var(--bg-space);
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-name-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--ui-border);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.4rem;
  padding: 4px 0;
  width: 100%;
}

.profile-name-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.provider-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(88, 101, 242, 0.2);
  border-radius: 12px;
  font-size: 0.75rem;
  color: #5865F2;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.provider-badge.google {
  background: rgba(66, 133, 244, 0.2);
  color: #4285F4;
}

.provider-badge.meta {
  background: rgba(24, 119, 242, 0.2);
  color: #1877F2;
}

/* Profile Stats */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-box {
  text-align: center;
  padding: 20px 12px;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent-primary);
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-actions {
  text-align: center;
}

/* Leaderboard Modal */
.leaderboard-modal {
  width: 520px;
  max-height: 80vh;
}

.leaderboard-modal h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent-primary);
  text-align: center;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.leaderboard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}

.leaderboard-tab {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.leaderboard-tab:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.leaderboard-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-deep);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all 0.2s;
}

.leaderboard-entry:hover {
  background: rgba(0, 255, 136, 0.05);
  border-color: var(--ui-border);
}

.leaderboard-entry.top-3 {
  border-color: var(--accent-primary);
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-dim);
  width: 32px;
  text-align: center;
}

.leaderboard-entry.top-3 .leaderboard-rank {
  color: var(--accent-warning);
}

.leaderboard-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-space);
}

.leaderboard-name {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.leaderboard-value {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent-primary);
}

/* Mobile Responsiveness for Auth */
@media (max-width: 480px) {
  .user-badge {
    top: 10px;
    right: 10px;
    padding: 6px 12px 6px 6px;
    gap: 8px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .user-name {
    font-size: 0.8rem;
  }
  
  .sign-in-btn {
    top: 10px;
    right: 10px;
    padding: 10px 18px;
    font-size: 0.85rem;
  }
  
  .auth-modal,
  .profile-modal,
  .leaderboard-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 24px;
  }
  
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .leaderboard-tabs {
    flex-wrap: wrap;
  }
  
  .leaderboard-tab {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
}

/* ============================================
   FRIENDS PANEL
   ============================================ */

.friends-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 100;
}

.friends-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.5);
}

.friends-badge,
.tab-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  background: var(--accent-danger);
  color: white;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.tab-badge {
  position: relative;
  top: 0;
  right: 0;
  margin-left: 5px;
}

.friends-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: var(--bg-space);
  border-left: 1px solid var(--ui-border);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.friends-panel:not(.hidden) {
  transform: translateX(0);
}

.friends-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: rgba(0, 255, 136, 0.05);
}

.friends-panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--accent-primary);
  margin: 0;
}

.friends-close-btn {
  width: 30px;
  height: 30px;
  background: none;
  border: 1px solid var(--ui-border);
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.friends-close-btn:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

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

.friends-tab {
  flex: 1;
  padding: 12px 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.friends-tab:hover {
  color: var(--text-primary);
  background: rgba(0, 255, 136, 0.05);
}

.friends-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.friends-tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  padding: 15px;
}

.friends-tab-content.active {
  display: flex;
}

.friends-tab-content h4 {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 10px 0 8px 0;
}

.friends-tab-content h4:first-child {
  margin-top: 0;
}

.friends-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.friends-list-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 10px;
  font-size: 0.85rem;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 255, 136, 0.03);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  transition: all 0.2s;
}

.friend-item:hover {
  background: rgba(0, 255, 136, 0.08);
  border-color: var(--accent-primary);
}

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

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

.friend-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-status {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.friend-status.online {
  color: var(--accent-primary);
}

.friend-status.offline {
  color: var(--text-dim);
}

.friend-status.in-game {
  color: var(--accent-warning);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.friend-actions {
  display: flex;
  gap: 5px;
}

.friend-action-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--ui-border);
  border-radius: 5px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.friend-action-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.friend-action-btn.invite:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.friend-action-btn.accept:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 255, 136, 0.1);
}

.friend-action-btn.decline:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.friend-action-btn.remove:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

/* Add Friend Search */
.friends-search {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.friends-search input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--ui-border);
  border-radius: 5px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.friends-search input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.friends-search-btn {
  padding: 10px 15px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: 5px;
  color: var(--bg-deep);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
}

.friends-search-btn:hover {
  transform: scale(1.05);
}

/* Game Invite Toast */
.invite-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--bg-space);
  border: 1px solid var(--accent-secondary);
  border-radius: 10px;
  padding: 15px 20px;
  box-shadow: 0 5px 25px rgba(0, 204, 255, 0.3);
  z-index: 300;
  min-width: 280px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.invite-toast.hidden {
  display: none;
}

.invite-toast-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invite-from {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent-secondary);
}

.invite-message {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.invite-actions {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.invite-btn {
  flex: 1;
  padding: 8px 15px;
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.invite-btn.accept {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  color: var(--bg-deep);
}

.invite-btn.accept:hover {
  transform: scale(1.05);
}

.invite-btn.decline {
  background: none;
  border: 1px solid var(--ui-border);
  color: var(--text-dim);
}

.invite-btn.decline:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

/* Add Friend Button in Lobby */
.lobby-add-friend-btn {
  margin-left: 8px;
  padding: 4px;
  background: none;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.lobby-add-friend-btn .add-friend-icon {
  filter: drop-shadow(0 0 2px currentColor);
  transition: filter 0.2s;
}

.lobby-add-friend-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 255, 136, 0.1);
}

.lobby-add-friend-btn:hover:not(:disabled) .add-friend-icon {
  filter: drop-shadow(0 0 4px var(--accent-primary)) drop-shadow(0 0 8px var(--accent-primary));
}

.lobby-add-friend-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.lobby-add-friend-btn.sent {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.lobby-add-friend-btn.sent .add-friend-icon {
  filter: drop-shadow(0 0 3px var(--accent-primary));
}

/* Friends Panel Mobile */
@media (max-width: 400px) {
  .friends-panel {
    width: 100%;
  }
  
  .friends-toggle-btn {
    bottom: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }
  
  .invite-toast {
    left: 10px;
    right: 10px;
    bottom: 70px;
    min-width: 0;
  }
}

/* Room item states */
.room-item.in-game {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: #ff6644;
}

.room-item.in-game:hover {
  background: rgba(255, 102, 68, 0.1);
  border-color: #ff6644;
}

.room-item.full {
  opacity: 0.7;
  cursor: not-allowed;
  border-color: #888;
}

.room-item.full:hover {
  background: rgba(128, 128, 128, 0.1);
  border-color: #888;
}

.room-item.joinable:hover {
  background: rgba(0, 255, 136, 0.15);
  border-color: var(--accent-primary);
}

.room-item .room-details {
  display: flex;
  gap: 8px;
  align-items: center;
}

.room-item .room-state {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
}

.room-item.in-game .room-state {
  color: #ff6644;
}

.room-item.full .room-state {
  color: #888;
}

.room-item.joinable .room-state {
  color: #00ff88;
}
