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

body {
  overflow: hidden;
  background: #0a0505;
  font-family: 'Orbitron', sans-serif;
  color: #f5f5f5;
}

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

#game-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;
}

/* Fire Background */
.fire-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 50% 100%, #ff4400 0%, transparent 50%),
    radial-gradient(ellipse at 20% 80%, #ff2200 0%, transparent 40%),
    radial-gradient(ellipse at 80% 80%, #ff3300 0%, transparent 40%),
    linear-gradient(180deg, #0a0505 0%, #1a0a0a 100%);
  animation: firePulse 3s ease-in-out infinite;
  z-index: -1;
}

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

/* Menu Styles */
.menu-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
}

.menu-content {
  text-align: center;
  z-index: 1;
}

.game-title {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(2rem, 8vw, 5rem);
  color: #ff4400;
  text-shadow: 
    0 0 20px #ff4400,
    0 0 40px #ff2200,
    4px 4px 0 #8B0000;
  margin-bottom: 0.5rem;
  animation: titleGlow 2s ease-in-out infinite;
}

.title-sub {
  color: #ffd700;
  text-shadow: 
    0 0 20px #ffd700,
    0 0 40px #ff8800;
}

@keyframes titleGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

.doom-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.7rem, 2vw, 1rem);
  padding: 1rem 2rem;
  background: linear-gradient(180deg, #4a4a4a 0%, #2d2d2d 50%, #1a1a1a 100%);
  border: 3px solid #666;
  border-top-color: #888;
  border-left-color: #888;
  border-bottom-color: #333;
  border-right-color: #333;
  color: #f5f5f5;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s;
  min-width: 200px;
  max-width: 100%;
}

.doom-btn:hover {
  background: linear-gradient(180deg, #5a5a5a 0%, #3d3d3d 50%, #2a2a2a 100%);
  border-color: #ff4400;
  color: #ff4400;
  text-shadow: 0 0 10px #ff4400;
}

.doom-btn:active {
  transform: translateY(2px);
  border-top-color: #333;
  border-left-color: #333;
  border-bottom-color: #888;
  border-right-color: #888;
}

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

.doom-btn.small {
  font-size: clamp(0.5rem, 1.5vw, 0.7rem);
  padding: 0.5rem 1rem;
  min-width: 0;
}

.doom-btn.large {
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
  padding: 1.2rem 3rem;
}

.doom-btn.back {
  background: linear-gradient(180deg, #3a2020 0%, #2a1010 50%, #1a0505 100%);
  margin-top: 1rem;
}

.player-name-input {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.player-name-input label {
  font-family: 'JetBrains Mono', monospace;
  color: #888;
}

.player-name-input input {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  background: #1a1a1a;
  border: 2px solid #ff4400;
  color: #ff4400;
  text-align: center;
  text-transform: uppercase;
  max-width: 100%;
}

.menu-footer {
  position: absolute;
  bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #666;
}

.menu-footer a {
  color: #ff4400;
  text-decoration: none;
}

/* Controls Panel */
.controls-panel {
  background: rgba(26, 26, 26, 0.95);
  padding: 2rem;
  border: 3px solid #ff4400;
  max-width: 500px;
  width: 100%;
}

.controls-panel h2 {
  font-family: 'Press Start 2P', cursive;
  color: #ff4400;
  margin-bottom: 1.5rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.key {
  background: #333;
  padding: 0.3rem 0.6rem;
  border: 2px solid #555;
  border-radius: 4px;
  font-size: clamp(0.6rem, 1.5vw, 0.8rem);
  color: #ffd700;
  min-width: 60px;
  text-align: center;
  flex-shrink: 0;
}

/* Lobby Styles */
.lobby-container {
  min-height: 100vh;
  padding: 1rem;
  position: relative;
  overflow-y: auto;
}

.lobby-content {
  max-width: 1000px;
  margin: 0 auto;
  z-index: 1;
  position: relative;
}

.lobby-content h2 {
  font-family: 'Press Start 2P', cursive;
  color: #ff4400;
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: clamp(1rem, 4vw, 1.5rem);
}

.lobby-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .lobby-main {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.qr-section, .settings-section {
  background: rgba(26, 26, 26, 0.9);
  padding: 1rem;
  border: 2px solid #444;
}

.qr-display {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background: #1a1a1a;
  margin-bottom: 1rem;
  overflow: hidden;
}

.qr-loading, .qr-error {
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  text-align: center;
  padding: 1rem;
}

.qr-instruction {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  margin-bottom: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.lobby-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.settings-section h3 {
  color: #ffd700;
  margin-bottom: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.setting-row label {
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.setting-row select {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.5rem, 1.5vw, 0.7rem);
  padding: 0.5rem;
  background: #2d2d2d;
  border: 2px solid #ff4400;
  color: #ff4400;
}

/* Loadout Panel */
.loadout-panel {
  background: rgba(26, 26, 26, 0.9);
  padding: 1rem;
  border: 2px solid #444;
  margin-top: 1rem;
}

.loadout-panel h3 {
  color: #ffd700;
  margin-bottom: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.slot-label {
  color: #888;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 1.5vw, 0.8rem);
  margin: 0.5rem 0;
}

.weapon-cards {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.weapon-card {
  background: #2d2d2d;
  border: 2px solid #444;
  padding: 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
  flex: 1;
  max-width: 120px;
}

.weapon-card:hover {
  border-color: #ff4400;
}

.weapon-card.selected {
  border-color: #39ff14;
  box-shadow: 0 0 10px #39ff14;
}

.weapon-name {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.5rem, 1.5vw, 0.7rem);
  color: #f5f5f5;
  margin-bottom: 0.5rem;
}

.weapon-stats {
  font-size: 0.6rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}

.stat span {
  color: #888;
  width: 25px;
  font-size: clamp(0.4rem, 1vw, 0.6rem);
}

.stat-bar {
  flex: 1;
  height: 4px;
  background: #1a1a1a;
  border: 1px solid #333;
}

.stat-bar div {
  height: 100%;
  background: linear-gradient(90deg, #ff4400, #ffd700);
}

/* Player List */
.player-list {
  background: rgba(26, 26, 26, 0.9);
  padding: 1rem;
  border: 2px solid #444;
  margin-bottom: 1rem;
}

.player-list h3 {
  color: #ffd700;
  margin-bottom: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.player-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  margin-bottom: 0.3rem;
  background: #1a1a1a;
  border-left: 3px solid;
}

.player-item.attacker {
  border-color: #ff4400;
}

.player-item.defender {
  border-color: #0066ff;
}

.player-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.player-team {
  font-size: clamp(0.5rem, 1.5vw, 0.7rem);
  color: #888;
}

/* Join Screen */
.join-section {
  background: rgba(26, 26, 26, 0.9);
  padding: 1rem;
  border: 2px solid #444;
  margin-bottom: 1rem;
}

.join-section p {
  color: #888;
  margin-bottom: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.join-section textarea {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 1.5vw, 0.8rem);
  padding: 1rem;
  background: #1a1a1a;
  border: 2px solid #444;
  color: #39ff14;
  margin-bottom: 1rem;
  resize: vertical;
}

#answer-display {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #444;
}

#answer-display.hidden {
  display: none;
}

#answer-qr {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

/* HUD Styles */
.hud {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.5rem;
  gap: 0.5rem;
}

.team-score {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.6rem, 2vw, 1.2rem);
  padding: 0.3rem 0.6rem;
  background: rgba(0, 0, 0, 0.7);
}

.team-score.attackers {
  color: #ff4400;
  border-left: 4px solid #ff4400;
}

.team-score.defenders {
  color: #0066ff;
  border-right: 4px solid #0066ff;
}

.round-info {
  text-align: center;
}

.round-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.5rem, 1.5vw, 0.8rem);
  color: #888;
}

.timer {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(1rem, 3vw, 2rem);
  color: #f5f5f5;
  text-shadow: 0 0 10px #000;
}

.hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0.5rem;
  gap: 0.5rem;
}

.health-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.doom-face {
  font-size: clamp(1.5rem, 4vw, 3rem);
  background: #2d2d2d;
  border: 2px solid #444;
  padding: 0.3rem;
  line-height: 1;
}

.health-bar {
  width: clamp(100px, 25vw, 200px);
  height: clamp(20px, 4vw, 30px);
  background: #1a1a1a;
  border: 2px solid #444;
  position: relative;
}

.health-fill {
  height: 100%;
  background: linear-gradient(180deg, #ff0000, #880000);
  transition: width 0.2s;
}

.health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.5rem, 1.5vw, 0.8rem);
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

.ammo-section {
  text-align: right;
}

.ammo-section .weapon-name {
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  margin-bottom: 0.3rem;
  font-size: clamp(0.6rem, 1.5vw, 0.9rem);
}

.ammo-count {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.8rem, 2.5vw, 1.5rem);
  color: #ffd700;
}

.ammo-sep {
  color: #666;
  margin: 0 0.3rem;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 0 5px #000;
  pointer-events: none;
}

.kill-feed {
  position: absolute;
  top: 60px;
  right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 250px;
}

.kill-item {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 1.5vw, 0.8rem);
  background: rgba(0, 0, 0, 0.7);
  padding: 0.3rem 0.6rem;
  color: #ff4400;
  animation: killFade 5s forwards;
}

@keyframes killFade {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; }
}

.damage-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(transparent 30%, #ff0000);
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

.scoreboard {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26, 26, 26, 0.95);
  border: 3px solid #ff4400;
  padding: 1.5rem;
  min-width: 250px;
  max-width: 90vw;
}

.scoreboard.hidden {
  display: none;
}

.scoreboard h3 {
  font-family: 'Press Start 2P', cursive;
  color: #ff4400;
  margin-bottom: 1rem;
  text-align: center;
  font-size: clamp(0.7rem, 2vw, 1rem);
}

.sb-row {
  padding: 0.5rem;
  margin-bottom: 0.3rem;
  background: #1a1a1a;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 1.5vw, 0.9rem);
}

.sb-row.attacker {
  border-left: 3px solid #ff4400;
}

.sb-row.defender {
  border-left: 3px solid #0066ff;
}

/* Muzzle Flash */
.muzzle-flash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(255, 200, 100, 0.3), transparent 50%);
  pointer-events: none;
  z-index: 1000;
}

/* Round End / Game Over */
.round-end-screen, .game-over-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  background: rgba(10, 5, 5, 0.95);
  padding: 1rem;
}

.round-end-screen h1, .game-over-screen h1 {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(1.5rem, 6vw, 4rem);
  margin-bottom: 2rem;
}

.round-end-screen h1.attacker, .round-end-screen h1.attackers {
  color: #ff4400;
  text-shadow: 0 0 30px #ff4400;
}

.round-end-screen h1.defender, .round-end-screen h1.defenders {
  color: #0066ff;
  text-shadow: 0 0 30px #0066ff;
}

.game-over-screen h1 {
  color: #ffd700;
  text-shadow: 0 0 30px #ffd700;
}

.final-score {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.8rem, 3vw, 1.5rem);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.final-score .attackers {
  color: #ff4400;
}

.final-score .defenders {
  color: #0066ff;
}

.final-score .vs {
  color: #666;
}