:root {
  --charcoal: #0d0d0d;
  --charcoal-light: #1a1a1a;
  --rust: #8b4513;
  --rust-dark: #5c2e0d;
  --toxic: #39ff14;
  --toxic-dim: #1a7a0a;
  --blood: #8b0000;
  --blood-bright: #cc0000;
  --ember: #ff6600;
  --ash: #2a2a2a;
  --bone: #d4c5a9;
  --smoke: #4a4a4a;
}

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

body {
  background: var(--charcoal);
  color: var(--bone);
  font-family: 'Rajdhani', sans-serif;
  overflow: hidden;
  min-height: 100vh;
  /* Prevent pull-to-refresh and overscroll on mobile */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html {
  overflow: hidden;
  overscroll-behavior: none;
}

.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen.hidden {
  display: none;
}

/* Menu Screen */
#menu {
  background: var(--charcoal);
}

.menu-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(139, 69, 19, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 0, 0, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(57, 255, 20, 0.03) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,0.01) 2px,
      rgba(255,255,255,0.01) 4px
    );
  animation: pulse 8s ease-in-out infinite;
}

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

.menu-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
}

.title {
  font-family: 'Orbitron', monospace;
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  text-shadow: 
    0 0 10px rgba(255, 102, 0, 0.5),
    0 0 30px rgba(255, 102, 0, 0.3),
    0 4px 0 var(--rust-dark);
}

.fire {
  color: var(--ember);
  animation: flicker 2s ease-in-out infinite;
}

.dot {
  color: var(--toxic);
  text-shadow: 
    0 0 10px var(--toxic),
    0 0 30px var(--toxic-dim),
    0 4px 0 var(--toxic-dim);
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; }
  25%, 75% { opacity: 0.95; }
}

.subtitle {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  color: var(--smoke);
  letter-spacing: 0.5em;
  margin-bottom: 3rem;
}

.menu-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

#playerName {
  width: 300px;
  padding: 1rem 1.5rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--charcoal-light);
  border: 2px solid var(--ash);
  color: var(--bone);
  outline: none;
  transition: all 0.3s;
  /* Enable touch on input */
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
  border-radius: 0; /* Prevent iOS styling */
  -webkit-appearance: none;
  appearance: none;
}

#playerName:focus {
  border-color: var(--toxic);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.2);
}

#playerName::placeholder {
  color: var(--smoke);
}

/* Toggle Option */
.toggle-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  background: rgba(26, 26, 26, 0.6);
  border: 1px solid var(--ash);
  cursor: pointer;
  transition: all 0.3s;
}

.toggle-option:hover {
  border-color: var(--smoke);
  background: rgba(42, 42, 42, 0.6);
}

.toggle-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bone);
  letter-spacing: 0.1em;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--charcoal-light);
  border: 2px solid var(--ash);
  border-radius: 26px;
  transition: all 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--smoke);
  border-radius: 50%;
  transition: all 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--toxic-dim);
  border-color: var(--toxic);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(26px);
  background: var(--toxic);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
}

.btn-play {
  position: relative;
  padding: 1rem 3rem;
  font-family: 'Orbitron', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--charcoal);
  background: linear-gradient(135deg, var(--toxic), #2ecc40);
  border: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s;
  letter-spacing: 0.1em;
  /* Mobile touch support */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-play:hover {
  transform: scale(1.05);
  box-shadow: 
    0 0 30px rgba(57, 255, 20, 0.5),
    0 0 60px rgba(57, 255, 20, 0.3);
}

.btn-play:active {
  transform: scale(0.98);
}

.btn-play::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.btn-play:hover::before {
  left: 100%;
}

.controls-info {
  display: flex;
  gap: 2rem;
  justify-content: center;
  opacity: 0.7;
}

.control {
  font-size: 0.9rem;
  color: var(--smoke);
}

kbd {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  background: var(--ash);
  border: 1px solid var(--smoke);
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

/* Game Screen */
#game {
  background: var(--charcoal);
  overflow: hidden;
}

#gameCanvasContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 100;
}

.hud-left, .hud-center, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hud-center {
  align-items: center;
}

.hud-right {
  align-items: flex-end;
}

/* Health Container */
.health-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.health-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-heart {
  width: 100%;
  height: 100%;
  fill: var(--blood-bright);
  filter: drop-shadow(0 0 6px var(--blood));
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
  60% { transform: scale(1); }
}

/* Health Bar */
.health-bar {
  position: relative;
  width: 160px;
  height: 22px;
  background: var(--charcoal-light);
  border: 2px solid var(--rust);
  overflow: hidden;
}

.health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--blood), var(--blood-bright));
  transition: width 0.3s;
}

.health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--bone);
  text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

/* Ammo Container */
.ammo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.ammo-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-bullet {
  width: 100%;
  height: 100%;
  fill: var(--ember);
  filter: drop-shadow(0 0 5px rgba(255, 102, 0, 0.6));
}

.icon-bullet rect {
  fill: var(--ember);
}

.icon-bullet circle {
  fill: var(--rust);
}

.ammo-count {
  font-family: 'Orbitron', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ember);
  text-shadow: 0 0 8px rgba(255, 102, 0, 0.4);
  min-width: 45px;
}

/* Wave Display */
.wave-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--ash);
}

.wave-label {
  font-size: 0.7rem;
  color: var(--smoke);
  letter-spacing: 0.3em;
}

.wave-number {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  font-weight: 900;
  color: var(--toxic);
  text-shadow: 0 0 10px var(--toxic-dim);
}

.zombies-remaining {
  font-size: 0.8rem;
  color: var(--blood-bright);
  letter-spacing: 0.1em;
}

#zombieCount {
  font-family: 'Orbitron', monospace;
  font-weight: 700;
}

/* Score & Kills */
.score-display, .kills-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(0,0,0,0.5);
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--ash);
}

.score-label, .kills-label {
  font-size: 0.6rem;
  color: var(--smoke);
  letter-spacing: 0.2em;
}

.score-value, .kills-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ember);
}

.kills-value {
  color: var(--blood-bright);
}

/* Restart Button */
.restart-button {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.8rem;
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  background: rgba(139, 0, 0, 0.6);
  border: 1px solid var(--blood);
  color: var(--bone);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.restart-button:hover {
  background: rgba(139, 0, 0, 0.9);
  border-color: var(--blood-bright);
  box-shadow: 0 0 15px rgba(139, 0, 0, 0.5);
  transform: scale(1.02);
}

.restart-button:active {
  transform: scale(0.98);
  background: var(--blood);
}

/* Leaderboard */
#leaderboard {
  position: fixed;
  top: 80px;
  right: 1rem;
  width: 180px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--ash);
  padding: 0.8rem;
  z-index: 100;
  pointer-events: none;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ash);
  padding-bottom: 0.3rem;
  margin-bottom: 0.5rem;
}

#leaderboard h3 {
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  color: var(--toxic);
  letter-spacing: 0.2em;
  margin: 0;
}

.leaderboard-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--toxic);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  pointer-events: auto;
  transition: transform 0.2s;
}

.leaderboard-toggle:hover {
  color: var(--bone);
}

#leaderboard.collapsed .leaderboard-toggle {
  transform: rotate(-90deg);
}

#leaderboard.collapsed #leaderboardList {
  display: none;
}

#leaderboardList {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 200px;
  overflow: hidden;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 0.2rem 0;
}

.leaderboard-entry.self {
  color: var(--toxic);
}

.leaderboard-entry.bot {
  color: var(--smoke);
}

.leaderboard-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-family: 'Orbitron', monospace;
  color: var(--ember);
}

/* Wave Announcement */
#waveAnnouncement {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 200;
  pointer-events: none;
}

#waveAnnouncement.hidden {
  display: none;
}

.wave-announce-text {
  font-family: 'Orbitron', monospace;
  font-size: 4rem;
  font-weight: 900;
  color: var(--blood-bright);
  text-shadow: 
    0 0 20px rgba(139, 0, 0, 0.8),
    0 0 40px rgba(139, 0, 0, 0.5);
  animation: waveIn 0.5s ease-out;
}

.wave-announce-sub {
  font-family: 'Orbitron', monospace;
  font-size: 1.5rem;
  color: var(--ember);
  letter-spacing: 0.5em;
  animation: waveIn 0.5s ease-out 0.1s both;
}

@keyframes waveIn {
  from {
    opacity: 0;
    transform: scale(2);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Death Screen */
#deathScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(139, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

#deathScreen.hidden {
  display: none;
}

.death-content {
  text-align: center;
}

.death-content h2 {
  font-family: 'Orbitron', monospace;
  font-size: 4rem;
  font-weight: 900;
  color: var(--blood-bright);
  text-shadow: 
    0 0 30px rgba(139, 0, 0, 0.8),
    0 0 60px rgba(139, 0, 0, 0.5);
  animation: deathPulse 1s ease-in-out infinite;
}

.death-content p {
  font-size: 1.5rem;
  color: var(--bone);
  margin-top: 1rem;
}

#respawnTimer {
  font-family: 'Orbitron', monospace;
  color: var(--ember);
}

@keyframes deathPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Animations */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 5px); }
  50% { transform: translate(5px, -5px); }
  75% { transform: translate(-5px, -5px); }
}

@keyframes shake-light {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 2px); }
  50% { transform: translate(2px, -2px); }
  75% { transform: translate(-2px, -2px); }
}

.shake {
  animation: shake 0.1s ease-in-out;
}

.shake-light {
  animation: shake-light 0.1s ease-in-out;
}

/* ============================================
   WEAPON DISPLAY
   ============================================ */

.weapon-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ash);
}

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

.weapon-name {
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.1em;
  transition: all 0.3s;
}

.weapon-name.weapon-flash {
  animation: weaponFlash 0.3s ease-out;
}

@keyframes weaponFlash {
  0% {
    transform: scale(1.3);
    color: #fff;
    text-shadow: 0 0 20px currentColor;
  }
  100% {
    transform: scale(1);
  }
}

/* ============================================
   GRENADE DISPLAY
   ============================================ */

.grenade-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ash);
}

.grenade-icon {
  font-size: 1rem;
}

.grenade-count {
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #44aa44;
  min-width: 20px;
}

.grenade-hint {
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  color: var(--smoke);
  opacity: 0.7;
}

/* Mobile grenade button */
.grenade-button {
  position: absolute;
  bottom: 200px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(68, 170, 68, 0.3);
  border: 3px solid rgba(68, 170, 68, 0.6);
  color: #fff;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 15px rgba(68, 170, 68, 0.3);
  -webkit-tap-highlight-color: transparent;
}

.grenade-button:active {
  transform: scale(0.95);
  background: rgba(68, 170, 68, 0.5);
}

.grenade-button.disabled {
  opacity: 0.3;
  pointer-events: none;
  border-color: var(--ash);
  background: rgba(42, 42, 42, 0.3);
}

/* ============================================
   BUFF INDICATORS
   ============================================ */

.buff-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.buff-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  animation: buffPulse 1s ease-in-out infinite;
}

.buff-icon.speed {
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.3), rgba(0, 150, 255, 0.5));
  border: 2px solid #00ccff;
  box-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
}

.buff-icon.shield {
  background: linear-gradient(135deg, rgba(255, 221, 0, 0.3), rgba(255, 180, 0, 0.5));
  border: 2px solid #ffdd00;
  box-shadow: 0 0 15px rgba(255, 221, 0, 0.5);
}

.buff-icon.damage {
  background: linear-gradient(135deg, rgba(255, 50, 50, 0.3), rgba(200, 0, 0, 0.5));
  border: 2px solid #ff3333;
  box-shadow: 0 0 15px rgba(255, 50, 50, 0.5);
}

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

/* ============================================
   BOSS WARNING
   ============================================ */

#bossWarning {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 250;
  pointer-events: none;
}

#bossWarning.hidden {
  display: none;
}

.boss-warning-text {
  font-family: 'Orbitron', monospace;
  font-size: 2.5rem;
  font-weight: 900;
  color: #ff0000;
  text-shadow: 
    0 0 20px rgba(255, 0, 0, 0.8),
    0 0 40px rgba(255, 0, 0, 0.5),
    0 0 60px rgba(255, 0, 0, 0.3);
  animation: bossWarn 0.3s ease-in-out infinite;
  letter-spacing: 0.1em;
}

@keyframes bossWarn {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.7;
    transform: scale(1.02);
  }
}

/* ============================================
   MOBILE TOUCH CONTROLS
   ============================================ */

#mobileControls {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.joystick-zone {
  position: absolute;
  bottom: 20px;
  width: 180px;
  height: 180px;
  pointer-events: auto;
  touch-action: none;
}

.joystick-zone.left {
  left: 20px;
}

.joystick-zone.right {
  right: 20px;
}

.joystick-base {
  position: absolute;
  bottom: 0;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(57, 255, 20, 0.1) 0%, rgba(13, 13, 13, 0.7) 100%);
  border: 3px solid rgba(57, 255, 20, 0.4);
  box-shadow: 
    0 0 20px rgba(57, 255, 20, 0.2),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.joystick-zone.left .joystick-base {
  left: 0;
}

.joystick-zone.right .joystick-base {
  right: 0;
}

.joystick-stick {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--toxic), var(--toxic-dim));
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 0 15px rgba(57, 255, 20, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.05s ease-out;
}

.joystick-zone.right .joystick-base {
  border-color: rgba(255, 102, 0, 0.4);
  background: radial-gradient(circle at center, rgba(255, 102, 0, 0.1) 0%, rgba(13, 13, 13, 0.7) 100%);
  box-shadow: 
    0 0 20px rgba(255, 102, 0, 0.2),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.joystick-zone.right .joystick-stick {
  background: radial-gradient(circle at 30% 30%, var(--ember), var(--rust));
  box-shadow: 
    0 0 15px rgba(255, 102, 0, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.5);
}

.joystick-zone.shooting .joystick-base {
  border-color: rgba(255, 200, 0, 0.8);
  box-shadow: 
    0 0 30px rgba(255, 200, 0, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.joystick-zone.shooting .joystick-stick {
  background: radial-gradient(circle at 30% 30%, #ffcc00, var(--ember));
}

/* Mobile controls visibility */
.touch-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  text-align: center;
  font-size: 1.2rem;
  color: var(--toxic);
  margin-right: 0.3rem;
}

.fire-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  text-align: center;
  font-size: 1.2rem;
  color: var(--ember);
  margin-right: 0.3rem;
}

/* Desktop/Mobile control visibility */
.mobile-controls {
  display: none;
}

.desktop-controls {
  display: flex;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  /* Show mobile UI */
  #mobileControls {
    display: block;
  }
  
  .mobile-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .desktop-controls {
    display: none;
  }
  
  /* Title adjustments */
  .title {
    font-size: 2.8rem;
    letter-spacing: 0.05em;
  }
  
  .subtitle {
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    margin-bottom: 2rem;
  }
  
  /* Input adjustments */
  #playerName {
    width: 260px;
    font-size: 1rem;
    padding: 0.8rem 1rem;
  }
  
  .toggle-option {
    padding: 0.6rem 1.2rem;
  }
  
  .toggle-label {
    font-size: 0.8rem;
  }
  
  .btn-play {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
  }
  
  /* Health/Ammo icons */
  .health-icon {
    width: 22px;
    height: 22px;
  }
  
  .health-bar {
    width: 100px;
    height: 18px;
  }
  
  .ammo-icon {
    width: 20px;
    height: 20px;
  }
  
  .ammo-count {
    font-size: 1rem;
    min-width: 35px;
  }
  
  /* HUD adjustments */
  #hud {
    padding: 0.5rem 0.8rem;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  
  .hud-left, .hud-right {
    flex: 0 0 auto;
  }
  
  .hud-center {
    flex: 1;
    min-width: 100px;
  }
  
  .health-bar {
    width: 120px;
    height: 18px;
  }
  
  .health-text {
    font-size: 0.7rem;
  }
  
  .ammo-display {
    font-size: 0.9rem;
  }
  
  .wave-display {
    padding: 0.3rem 0.8rem;
  }
  
  .wave-number {
    font-size: 1.4rem;
  }
  
  .wave-label {
    font-size: 0.6rem;
  }
  
  .zombies-remaining {
    font-size: 0.65rem;
  }
  
  .score-display, .kills-display {
    padding: 0.2rem 0.5rem;
  }
  
  .score-value, .kills-value {
    font-size: 0.9rem;
  }
  
  .score-label, .kills-label {
    font-size: 0.5rem;
  }
  
  /* Leaderboard adjustments */
  #leaderboard {
    top: 65px;
    right: 0.5rem;
    width: 130px;
    padding: 0.5rem;
    font-size: 0.7rem;
  }
  
  #leaderboard h3 {
    font-size: 0.6rem;
  }
  
  .leaderboard-entry {
    font-size: 0.65rem;
  }
  
  .leaderboard-name {
    max-width: 70px;
  }
  
  /* Wave announcement */
  .wave-announce-text {
    font-size: 2.5rem;
  }
  
  .wave-announce-sub {
    font-size: 1rem;
    letter-spacing: 0.3em;
  }
  
  /* Death screen */
  .death-content h2 {
    font-size: 2.5rem;
  }
  
  .death-content p {
    font-size: 1.1rem;
  }
}

/* Very small screens */
@media (max-width: 400px) {
  .title {
    font-size: 2.2rem;
  }
  
  .subtitle {
    font-size: 0.7rem;
  }
  
  #playerName {
    width: 220px;
  }
  
  .joystick-zone {
    width: 140px;
    height: 140px;
  }
  
  .joystick-base {
    width: 110px;
    height: 110px;
  }
  
  .joystick-stick {
    width: 50px;
    height: 50px;
  }
  
  .health-bar {
    width: 90px;
  }
  
  /* Mobile leaderboard - collapsible */
  #leaderboard {
    display: block;
    top: auto;
    bottom: 200px;
    right: 0.5rem;
    width: 120px;
    padding: 0.5rem;
    background: rgba(0,0,0,0.8);
  }
  
  #leaderboard.collapsed {
    width: auto;
    min-width: 90px;
  }
  
  .leaderboard-toggle {
    display: block;
  }
  
  .leaderboard-header {
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
  }
  
  #leaderboard.collapsed .leaderboard-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }
  
  #leaderboard h3 {
    font-size: 0.55rem;
  }
  
  .leaderboard-entry {
    font-size: 0.6rem;
  }
  
  .leaderboard-name {
    max-width: 55px;
  }
  
  #leaderboardList {
    max-height: 120px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .joystick-zone {
    bottom: 10px;
    width: 120px;
    height: 120px;
  }
  
  .joystick-base {
    width: 100px;
    height: 100px;
  }
  
  .joystick-stick {
    width: 45px;
    height: 45px;
  }
  
  #hud {
    padding: 0.3rem 0.5rem;
  }
  
  .health-bar {
    width: 100px;
    height: 14px;
  }
  
  .wave-display {
    padding: 0.2rem 0.5rem;
  }
  
  .wave-number {
    font-size: 1.2rem;
  }
  
  /* Landscape mobile leaderboard - collapsible */
  #leaderboard {
    display: block;
    top: 50px;
    bottom: auto;
    right: 0.5rem;
    width: 110px;
    padding: 0.4rem;
    background: rgba(0,0,0,0.8);
  }
  
  #leaderboard.collapsed {
    width: auto;
    min-width: 80px;
  }
  
  .leaderboard-toggle {
    display: block;
  }
  
  #leaderboard h3 {
    font-size: 0.5rem;
  }
  
  .leaderboard-entry {
    font-size: 0.55rem;
  }
  
  .leaderboard-name {
    max-width: 50px;
  }
  
  #leaderboardList {
    max-height: 80px;
  }
}

/* Mobile canvas - no CSS transform, zoom handled by JavaScript */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  #gameCanvasContainer {
    /* Zoom is handled by the game engine's zoomScale property */
    /* This ensures proper coordinate mapping for touch controls */
  }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .joystick-zone.left {
    left: calc(20px + env(safe-area-inset-left));
  }
  
  .joystick-zone.right {
    right: calc(20px + env(safe-area-inset-right));
  }
  
  .joystick-zone {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

