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

body {
  background: #0a0a0a;
  font-family: 'Press Start 2P', monospace;
  color: #FFFFFF;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#game-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: calc(100vh - 40px);
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#ui-overlay > * {
  pointer-events: auto;
}

#footer {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #666;
  background: #0a0a0a;
}

#footer a {
  color: #FF9500;
  text-decoration: none;
  margin-left: 5px;
}

/* Menu Screen */
.menu-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  background: linear-gradient(180deg, rgba(10,10,10,0.9) 0%, rgba(10,10,10,0.95) 100%);
}

.title-container {
  text-align: center;
  margin-bottom: 50px;
}

.game-title {
  font-size: clamp(16px, 4vw, 32px);
  color: #FF9500;
  text-shadow: 0 0 20px #FF9500, 0 0 40px #FF9500;
  margin-bottom: 10px;
  animation: glow 2s ease-in-out infinite alternate;
}

.game-subtitle {
  font-size: clamp(24px, 6vw, 48px);
  color: #FFFF00;
  text-shadow: 0 0 20px #FFFF00, 0 0 40px #FFFF00;
  animation: glow 2s ease-in-out infinite alternate;
  animation-delay: 1s;
}

@keyframes glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.3); }
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 300px;
}

.menu-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 15px 30px;
  border: 3px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.host-btn {
  color: #FF9500;
  border-color: #FF9500;
}

.host-btn:hover {
  background: #FF9500;
  color: #0a0a0a;
  box-shadow: 0 0 20px #FF9500;
}

.join-btn {
  color: #007AFF;
  border-color: #007AFF;
}

.join-btn:hover {
  background: #007AFF;
  color: #0a0a0a;
  box-shadow: 0 0 20px #007AFF;
}

.help-btn {
  color: #FFFFFF;
  border-color: #FFFFFF;
}

.help-btn:hover {
  background: #FFFFFF;
  color: #0a0a0a;
}

.menu-decoration {
  display: flex;
  gap: 40px;
  margin-top: 50px;
}

.pac-tactical {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  animation: bounce 1s ease-in-out infinite;
}

.pac-tactical.attacker {
  background: #FF9500;
  clip-path: polygon(100% 50%, 50% 0%, 0% 0%, 0% 100%, 50% 100%);
}

.pac-tactical.defender {
  background: #007AFF;
  clip-path: polygon(100% 50%, 50% 0%, 0% 0%, 0% 100%, 50% 100%);
  animation-delay: 0.5s;
}

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

/* Lobby Screen */
.lobby-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 20px;
  background: rgba(10,10,10,0.95);
  overflow-y: auto;
}

.lobby-title {
  font-size: 14px;
  color: #00FFFF;
  margin-bottom: 20px;
  text-shadow: 0 0 10px #00FFFF;
}

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

#qr-container {
  background: #0a0a0a;
  padding: 10px;
  border: 2px solid #2121DE;
}

.qr-instruction {
  font-size: 10px;
  color: #FFFF00;
  margin-top: 10px;
}

.qr-error {
  color: #FF3B30;
  font-size: 10px;
  padding: 20px;
}

.players-section {
  width: 100%;
  max-width: 300px;
  margin-bottom: 20px;
}

.players-section h3 {
  font-size: 10px;
  color: #FFFFFF;
  margin-bottom: 10px;
}

.player-list {
  background: rgba(33, 33, 222, 0.1);
  border: 1px solid #2121DE;
  padding: 10px;
  min-height: 60px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  font-size: 10px;
}

.player-item.attacker { color: #FF9500; }
.player-item.defender { color: #007AFF; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}

.status-dot.connected {
  background: #30D158;
  box-shadow: 0 0 5px #30D158;
}

.no-players {
  font-size: 8px;
  color: #666;
  text-align: center;
}

.lobby-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.scan-btn, .next-btn {
  color: #FFFF00;
  border-color: #FFFF00;
  font-size: 10px;
  padding: 10px 20px;
}

.start-btn {
  color: #30D158;
  border-color: #30D158;
  font-size: 10px;
  padding: 10px 20px;
}

.start-btn:hover:not(.disabled) {
  background: #30D158;
  color: #0a0a0a;
}

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

.back-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #666;
  background: none;
  border: none;
  cursor: pointer;
  margin-top: auto;
}

.back-btn:hover {
  color: #FFFFFF;
}

/* Joiner Scanner */
.lobby-screen.joiner .scanner-section {
  width: 100%;
  max-width: 300px;
  height: 300px;
  position: relative;
  border: 2px solid #2121DE;
  overflow: hidden;
  margin-bottom: 20px;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border: 2px solid #00FFFF;
  box-shadow: 0 0 0 1000px rgba(0,0,0,0.5);
}

.scan-instruction {
  font-size: 10px;
  color: #FFFF00;
  margin-bottom: 20px;
}

#answer-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.connection-status {
  font-size: 10px;
  color: #00FFFF;
}

/* Scanner Modal */
.scanner-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.scanner-content h3 {
  font-size: 12px;
  color: #FFFFFF;
}

.video-container {
  width: 300px;
  height: 300px;
  border: 2px solid #2121DE;
  overflow: hidden;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-content button {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 10px 20px;
  background: transparent;
  border: 2px solid #FF3B30;
  color: #FF3B30;
  cursor: pointer;
}

/* Game HUD */
.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.team-indicator {
  font-size: 10px;
  text-shadow: 0 0 10px currentColor;
}

.round-timer {
  font-size: 16px;
  color: #FFFFFF;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.score-display {
  font-size: 8px;
  color: #FFFFFF;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.ammo-display {
  font-size: 16px;
}

.ammo-icon {
  color: #FFFF00;
  text-shadow: 0 0 5px #FFFF00;
  margin-right: 5px;
}

.ammo-icon.empty {
  color: #333;
  text-shadow: none;
}

.action-prompt {
  text-align: center;
  pointer-events: auto;
}

.action-prompt p {
  font-size: 10px;
  color: #FFFF00;
  text-shadow: 0 0 10px #FFFF00;
}

.progress-bar {
  width: 200px;
  height: 10px;
  background: rgba(255,255,255,0.2);
  border: 1px solid #FFFFFF;
  margin-bottom: 5px;
}

.progress-fill {
  height: 100%;
  background: #FF9500;
  transition: width 0.1s;
}

.progress-fill.defuse {
  background: #007AFF;
}

.minimap {
  width: 80px;
  height: 60px;
  background: rgba(0,0,0,0.5);
  border: 1px solid #2121DE;
}

.bomb-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: #FF3B30;
  text-shadow: 0 0 20px #FF3B30;
  animation: pulse 0.5s ease-in-out infinite;
}

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

/* Round End Screen */
.round-end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: rgba(10,10,10,0.9);
}

.winner-text {
  font-size: clamp(20px, 5vw, 40px);
  text-shadow: 0 0 30px currentColor;
  animation: glow 0.5s ease-in-out infinite alternate;
}

.win-reason {
  font-size: 12px;
  color: #FFFFFF;
  margin-top: 20px;
}

.next-round {
  font-size: 10px;
  color: #00FFFF;
  margin-top: 40px;
}

/* Game End Screen */
.game-end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: rgba(10,10,10,0.95);
  gap: 20px;
}

.game-end-screen h1 {
  font-size: clamp(16px, 4vw, 32px);
  color: #FFFF00;
  text-shadow: 0 0 20px #FFFF00;
}

.game-end-screen p {
  font-size: 12px;
  color: #FFFFFF;
}

/* Help Screen */
.help-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 20px;
  background: rgba(10,10,10,0.95);
  overflow-y: auto;
}

.help-screen h2 {
  font-size: 16px;
  color: #00FFFF;
  margin-bottom: 30px;
}

.help-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 400px;
  width: 100%;
  margin-bottom: 30px;
}

.help-section {
  background: rgba(33, 33, 222, 0.1);
  border: 1px solid #2121DE;
  padding: 15px;
}

.help-section h3 {
  font-size: 12px;
  color: #FFFF00;
  margin-bottom: 10px;
}

.help-section p {
  font-size: 9px;
  color: #FFFFFF;
  line-height: 1.8;
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .menu-buttons {
    max-width: 260px;
  }
  
  .menu-btn {
    font-size: 10px;
    padding: 12px 20px;
  }
  
  .game-title {
    font-size: 14px;
  }
  
  .game-subtitle {
    font-size: 28px;
  }
  
  .hud-top, .hud-bottom {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .round-timer {
    font-size: 14px;
  }
  
  .minimap {
    display: none;
  }
}