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

body {
  font-family: 'Inter', sans-serif;
  background: #050810;
  color: white;
  overflow: hidden;
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* ════════ WAITING SCREEN ════════ */
#waiting-screen {
  background: 
    radial-gradient(ellipse at top, rgba(0, 224, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(255, 123, 0, 0.1) 0%, transparent 50%),
    #050810;
  padding: 30px;
}

.back-btn {
  position: absolute;
  top: 30px;
  left: 30px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s;
}

.back-btn:hover {
  color: #00e0ff;
  border-color: #00e0ff;
}

.waiting-content {
  max-width: 800px;
  margin: 60px auto;
  text-align: center;
}

.game-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 3.5rem;
  margin-bottom: 12px;
  letter-spacing: -2px;
  color: white;
  text-shadow: 
    0 0 20px rgba(0, 224, 255, 0.6),
    0 0 40px rgba(0, 224, 255, 0.4);
  animation: titlePulse 2s ease-in-out infinite;
}

.game-title span {
  background: linear-gradient(135deg, #ff7b00, #ff3860);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.game-subtitle {
  color: #94a3b8;
  font-size: 1rem;
  margin-bottom: 50px;
}

.room-display {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(0, 224, 255, 0.3);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 40px;
  box-shadow: 0 0 40px rgba(0, 224, 255, 0.1);
}

.room-label {
  font-size: 0.8rem;
  color: #94a3b8;
  letter-spacing: 3px;
  margin-bottom: 10px;
}

.room-code-big {
  font-family: 'Press Start 2P', monospace;
  font-size: 4rem;
  letter-spacing: 12px;
  background: linear-gradient(135deg, #00e0ff, #aaff00);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 15px;
}

.room-hint {
  color: #94a3b8;
  font-size: 0.85rem;
}

.room-hint span {
  color: #00e0ff;
  font-family: monospace;
  font-weight: 600;
}

.players-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-bottom: 40px;
}

.player-slot {
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s;
}

.player-slot.filled {
  background: rgba(0, 224, 255, 0.08);
  border-style: solid;
  border-color: #00e0ff;
  box-shadow: 0 0 30px rgba(0, 224, 255, 0.2);
}

.player-slot.filled .slot-icon {
  background: linear-gradient(135deg, #00e0ff, #0099ff);
  color: #050810;
}

.slot-icon {
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #94a3b8;
}

.player-slot p {
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 600;
}

.player-slot.filled p {
  color: white;
}

.vs-divider {
  font-family: 'Press Start 2P', monospace;
  font-size: 2rem;
  background: linear-gradient(135deg, #ff7b00, #ff3860);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: vsGlow 1.5s ease-in-out infinite;
}

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

.bot-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #ff7b00, #ff3860);
  color: white;
  border: none;
  padding: 16px 40px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 8px 25px rgba(255, 123, 0, 0.3);
}

.bot-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(255, 123, 0, 0.5);
}

/* ════════ FIGHT SCREEN ════════ */
#fight-screen {
  background: #000;
  display: none;
  flex-direction: column;
  height: 100vh;
}

#fight-screen.active {
  display: flex;
}

/* HUD - Top */
.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 30px;
  padding: 25px 40px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent);
  z-index: 10;
}

.player-hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-hud.right .player-info {
  flex-direction: row-reverse;
}

.player-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.rounds-won {
  display: flex;
  gap: 6px;
}

.round-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.round-dot.won {
  background: #aaff00;
  border-color: #aaff00;
  box-shadow: 0 0 12px #aaff00;
}

.hp-bar {
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e0ff, #aaff00);
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.6);
}

.hp-fill.low {
  background: linear-gradient(90deg, #ff7b00, #ff3860);
  box-shadow: 0 0 12px rgba(255, 56, 96, 0.8);
}

.hp-fill.right-hp {
  margin-left: auto;
  background: linear-gradient(270deg, #00e0ff, #aaff00);
}

.hp-fill.right-hp.low {
  background: linear-gradient(270deg, #ff7b00, #ff3860);
}

/* Center HUD - Timer */
.center-hud {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer {
  font-family: 'Press Start 2P', monospace;
  font-size: 2.5rem;
  color: #ffaa00;
  text-shadow: 
    0 0 20px rgba(255, 170, 0, 0.8),
    0 4px 12px rgba(0, 0, 0, 0.8);
  min-width: 80px;
}

.timer.warning {
  color: #ff3860;
  animation: timerPulse 0.5s ease-in-out infinite;
}

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

.round-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: #94a3b8;
  letter-spacing: 2px;
}

/* Arena */
.arena {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: 
    linear-gradient(180deg, #0a0f1c 0%, #1a2540 60%, #0a0f1c 100%);
}

.arena::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(0, 224, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 224, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.arena::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: 
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8));
  pointer-events: none;
}

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

/* Announcement Overlay */
.announcement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
}

.announcement.show {
  animation: announceShow 2s ease-out;
}

.announcement h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 5rem;
  background: linear-gradient(135deg, #ffaa00, #ff3860);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 60px rgba(255, 170, 0, 0.8);
  letter-spacing: 4px;
}

@keyframes announceShow {
  0% { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1.2);
  }
  40% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% { 
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Bottom Info */
.bottom-info {
  padding: 15px 30px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.9), transparent);
  display: flex;
  justify-content: center;
}

.control-hint {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.85rem;
  color: #94a3b8;
}

.key {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: #00e0ff;
  margin-right: 4px;
}

/* Screen Shake */
.shake {
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) translateY(-4px); }
  40% { transform: translateX(8px) translateY(4px); }
  60% { transform: translateX(-6px) translateY(2px); }
  80% { transform: translateX(6px) translateY(-2px); }
}

/* Game Over */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
}

.game-over-overlay h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 4rem;
  background: linear-gradient(135deg, #aaff00, #00e0ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  text-shadow: 0 0 40px rgba(170, 255, 0, 0.6);
}

.game-over-overlay p {
  font-size: 1.5rem;
  color: white;
  margin-bottom: 40px;
}

.game-over-buttons {
  display: flex;
  gap: 15px;
}

.go-btn {
  padding: 14px 32px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.go-btn.primary {
  background: linear-gradient(135deg, #00e0ff, #0099ff);
  color: #050810;
  box-shadow: 0 8px 20px rgba(0, 224, 255, 0.4);
}

.go-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.go-btn:hover {
  transform: translateY(-2px);
}