body {
  margin: 0;
  padding: 0;
  background: #111;
  color: #fff;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#gameCanvas.active {
  pointer-events: auto;
}

/* Override main.css selfie mirror — arena uses overhead camera */
#video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  transform: none;
  -webkit-transform: none;
  filter: none;
  -webkit-filter: none;
}

/* Mode Picker */
.arena-picker {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #111;
  padding-top: calc(60px + env(safe-area-inset-top, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.arena-picker-content {
  text-align: center;
  max-width: 800px;
  padding: 2rem;
}
.arena-title { font-size: 3rem; margin-bottom: 0.5rem; }
.arena-subtitle { color: #aaa; margin-bottom: 2rem; font-size: 1.1rem; }
.arena-cards { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.arena-card {
  background: #222;
  border: 2px solid #444;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  cursor: pointer;
  text-align: center;
  width: 200px;
  transition: border-color 0.2s, transform 0.2s;
  color: #fff;
  font-family: inherit;
}
.arena-card:hover { border-color: #0088FF; transform: translateY(-4px); }
.arena-card-icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.arena-card-name { font-size: 1.3rem; font-weight: 700; display: block; }
.arena-card-desc { font-size: 0.85rem; color: #aaa; display: block; margin-top: 0.5rem; }
.arena-picker-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }

/* HUD */
.arena-hud { position: fixed; top: 0; left: 0; right: 0; z-index: 100; pointer-events: none; }
.arena-timer {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 3rem; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
.arena-scoreboard {
  position: absolute; top: 16px; right: 20px;
  font-size: 1.5rem; font-weight: 700; text-align: right;
}
.arena-exit-btn {
  position: absolute; top: 16px; left: 20px;
  pointer-events: all; background: rgba(255,0,0,0.6); color: white;
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 1rem;
  cursor: pointer;
}
.arena-announcement {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 5rem; font-weight: 900; text-shadow: 0 4px 16px rgba(0,0,0,0.9);
  animation: arena-pulse 0.5s ease-in-out;
}

/* Mobile HUD — move scoreboard to bottom to prevent overlap */
@media (max-width: 600px) {
  .arena-timer { font-size: 2rem; top: 10px; }
  .arena-scoreboard {
    position: fixed; top: auto; bottom: 16px; right: 10px; left: 10px;
    font-size: 1rem; text-align: center; z-index: 100;
    background: rgba(0,0,0,0.7); border-radius: 8px; padding: 6px 10px;
  }
  .arena-exit-btn { top: 10px; left: 10px; padding: 6px 12px; font-size: 0.85rem; }
  .arena-announcement { font-size: 3rem; }
}
@keyframes arena-pulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Calibration */
.arena-calibration {
  position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.arena-calibration-content { text-align: center; }
.calibration-feed {
  position: relative; width: 640px; height: 480px;
  border: 2px solid #444; border-radius: 8px; overflow: hidden; cursor: crosshair;
  margin: 1rem auto;
}
.calibration-feed video, .calibration-feed canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.calibration-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }

/* Game Over */
.arena-game-over {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 150;
  display: flex; align-items: center; justify-content: center;
}
.arena-game-over-content { text-align: center; max-width: 600px; }
.arena-results { margin: 1.5rem 0; font-size: 1.2rem; }
.arena-game-over-actions { display: flex; gap: 1rem; justify-content: center; }

/* Buttons */
.arena-btn-primary {
  background: #0088FF; color: white; border: none; border-radius: 12px;
  padding: 12px 32px; font-size: 1.2rem; cursor: pointer; font-weight: 700;
}
.arena-btn-primary:hover { background: #0077dd; }
.arena-btn-secondary {
  background: #333; color: white; border: 1px solid #555; border-radius: 12px;
  padding: 10px 24px; font-size: 1rem; cursor: pointer;
}
.arena-btn-secondary:hover { background: #444; }

/* Settings Panel */
.arena-settings {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.arena-settings-content {
  background: #1a1a1a; border-radius: 16px; padding: 2rem;
  min-width: 320px; max-width: 400px;
}
.arena-settings-content h2 { margin: 0 0 1.5rem; font-size: 1.5rem; }
.settings-group { margin-bottom: 1.5rem; }
.settings-group-title { margin: 0 0 0.5rem; font-weight: 700; color: #ccc; }
.settings-label {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; font-size: 1rem; cursor: pointer; color: #eee;
}
.settings-label input[type="checkbox"],
.settings-label input[type="radio"] {
  width: 18px; height: 18px; accent-color: #0088FF;
}
.settings-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* Registration Phase */
.arena-registration {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.arena-registration-bar {
  display: flex; align-items: center; gap: 1rem;
  font-size: 1.2rem; font-weight: 700;
}
.arena-registration-actions {
  display: flex; gap: 0.5rem;
}
.arena-team-picker {
  display: flex; align-items: center; gap: 0.5rem;
}
.team-label {
  font-size: 0.9rem; color: #aaa; margin-right: 0.25rem;
}
.arena-team-btn {
  background: #333; color: #fff; border: 2px solid #555;
  border-radius: 8px; padding: 6px 16px; font-size: 0.9rem;
  cursor: pointer; font-weight: 600; transition: all 0.15s;
}
.arena-team-btn:hover { border-color: #888; }
.arena-team-btn.active { background: #0088FF; border-color: #0088FF; }
.arena-btn-primary:disabled {
  opacity: 0.4; cursor: not-allowed;
}

.hidden { display: none !important; }
