*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --surface: rgba(15, 15, 25, 0.92);
  --surface-light: rgba(30, 30, 50, 0.85);
  --accent: #00ffc8;
  --accent-dim: #00aa88;
  --danger: #ff2244;
  --danger-glow: #ff224488;
  --warning: #ffaa00;
  --text: #e8e8f0;
  --text-dim: #888899;
  --green: #00ff66;
  --red: #ff1133;
  --font-display: 'Orbitron', monospace;
  --font-body: 'Inter', sans-serif;
  --radius: 8px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  touch-action: none;
}

.hidden { display: none !important; }

/* Loading screen */
#loading-screen {
  position: fixed; inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}
#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.loader-content { text-align: center; }
.game-title {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-shadow: 0 0 60px var(--accent), 0 0 120px rgba(0, 255, 200, 0.3);
  animation: titlePulse 3s ease-in-out infinite;
}
.game-subtitle {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.8em;
  color: var(--text-dim);
  margin-top: 0.5rem;
}
.loader-bar {
  width: 300px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  margin: 2rem auto;
  border-radius: 2px;
  overflow: hidden;
}
.loader-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
  box-shadow: 0 0 15px var(--accent);
}
.loader-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 60px var(--accent), 0 0 120px rgba(0, 255, 200, 0.3); }
  50% { text-shadow: 0 0 80px var(--accent), 0 0 160px rgba(0, 255, 200, 0.5); }
}

/* UI Overlay */
#ui-overlay {
  position: fixed; inset: 0;
  z-index: 10;
  pointer-events: none;
}
#ui-overlay > * { pointer-events: auto; }

/* Lobby */
#lobby-screen {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 480px;
  max-width: 90vw;
}
.game-title-sm {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent);
}
.tagline {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.6em;
  color: var(--danger);
  margin-top: 0.25rem;
  animation: blink 2s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0.3; }
}

.lobby-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 2rem 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  min-width: 100px;
  backdrop-filter: blur(10px);
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.lobby-name {
  margin: 1.5rem 0;
}
.lobby-name input {
  width: 100%;
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
  text-align: center;
}
.lobby-name input {
  -webkit-user-select: text;
  user-select: text;
}
.lobby-name input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 200, 0.15);
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}
.btn-primary:hover {
  background: #33ffd6;
  box-shadow: 0 0 30px rgba(0, 255, 200, 0.4);
  transform: translateY(-1px);
}
.btn-secondary {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: all 0.3s;
}
.btn-secondary:hover {
  background: rgba(0, 255, 200, 0.1);
  border-color: var(--accent);
}
.btn-danger {
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: transparent;
  color: var(--danger);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-top: 0.75rem;
}

#queue-status {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 255, 200, 0.2);
}
#queue-status p {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* Player HUD */
#player-hud {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
#phase-banner {
  text-align: center;
  padding: 1.2rem;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  transition: all 0.3s;
}
#phase-banner.green {
  color: var(--green);
  text-shadow: 0 0 40px var(--green), 0 0 80px rgba(0, 255, 100, 0.3);
}
#phase-banner.red {
  color: var(--red);
  text-shadow: 0 0 40px var(--red), 0 0 80px rgba(255, 17, 51, 0.3);
  animation: redFlash 0.5s ease-out;
}
@keyframes redFlash {
  0% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
#phase-banner.panic {
  animation: panicPulse 0.4s ease-in-out infinite alternate;
}
#phase-banner.panic.green {
  color: #ff9900;
  text-shadow: 0 0 40px #ff6600, 0 0 80px rgba(255, 100, 0, 0.4);
}
@keyframes panicPulse {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(1.08); opacity: 1; }
}

#hud-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem;
}
.hud-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem;
  text-align: center;
  backdrop-filter: blur(8px);
}
.hud-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}
.hud-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}
.progress-bar {
  width: 120px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.3rem;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
  box-shadow: 0 0 8px var(--accent);
}

.jump-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #8ff;
  transition: all 0.2s;
  white-space: nowrap;
}
.jump-indicator.jumping {
  color: #ffe44d;
  border-color: #ffe44d;
  background: rgba(255,228,77,0.15);
  animation: jumpPulse 0.3s ease-in-out infinite alternate;
}
.jump-indicator.stabilizing {
  color: #ff4444;
  border-color: #ff4444;
  background: rgba(255,68,68,0.15);
  animation: stabWobble 0.15s ease-in-out infinite alternate;
}
.jump-indicator.cooldown {
  color: #888;
  border-color: #555;
}
@keyframes jumpPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}
@keyframes stabWobble {
  from { transform: translateX(-2px); }
  to { transform: translateX(2px); }
}

/* Spectator UI */
#spectator-header {
  position: absolute;
  top: 1rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.spec-badge {
  background: var(--warning);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  letter-spacing: 0.15em;
}
.spec-phase {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}
.spec-timer {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  min-width: 3rem;
  text-align: center;
}
.spec-timer.urgent {
  color: var(--danger);
  animation: blink 0.6s step-end infinite;
}
.spec-cycles {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.hud-value.urgent {
  color: var(--danger) !important;
  animation: blink 0.6s step-end infinite;
}

#spec-sidebar {
  position: absolute;
  top: 4rem; right: 1rem;
  width: 240px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.06);
}
#spec-sidebar h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}
#spec-sidebar h4 {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.contestant-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.25rem;
}
.contestant-entry:hover { background: rgba(255,255,255,0.06); }
.contestant-entry.eliminated { opacity: 0.35; text-decoration: line-through; }
.contestant-entry.predicted { border: 1px solid var(--warning); }
.contestant-num {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2rem;
}
.contestant-name {
  font-size: 0.8rem;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contestant-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.contestant-status.dead { background: var(--red); }
.contestant-status.finished { background: var(--warning); }

#prediction-status {
  font-size: 0.75rem;
  color: var(--text-dim);
}

#elimination-feed {
  position: absolute;
  bottom: 5rem; left: 1rem;
  width: 320px;
}
#spec-play-again {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  text-align: center;
}
#spec-play-again .btn-primary {
  font-size: 1.2rem;
  padding: 0.8rem 2.5rem;
  animation: pulse-glow 1.5s infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 255, 200, 0.3); }
  50% { box-shadow: 0 0 20px rgba(0, 255, 200, 0.6); }
}
.elim-entry {
  background: rgba(255, 17, 51, 0.15);
  border-left: 3px solid var(--danger);
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.4rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.8rem;
  animation: slideIn 0.4s ease-out;
  backdrop-filter: blur(5px);
}
@keyframes slideIn {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.elim-entry .elim-name { color: var(--danger); font-weight: 600; }
.elim-entry .elim-reason { color: var(--text-dim); font-size: 0.7rem; }

#spec-camera-controls {
  position: absolute;
  bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
#camera-angles {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.cam-btn {
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.25s;
  backdrop-filter: blur(5px);
  white-space: nowrap;
}
.cam-btn:hover { border-color: var(--accent); color: var(--text); background: rgba(0,255,200,0.05); }
.cam-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 255, 200, 0.12);
  box-shadow: 0 0 12px rgba(0,255,200,0.15);
}

#follow-player-panel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.follow-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
#follow-select {
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  min-width: 140px;
  backdrop-filter: blur(5px);
}
#follow-select:focus { border-color: var(--accent); }
#follow-select option { background: #1a1a2a; color: var(--text); }

#player-camera-controls {
  position: absolute;
  bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
}
.cam-row {
  display: flex;
  gap: 0.4rem;
}
.zoom-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(5px);
}
.zoom-btn {
  width: 26px; height: 26px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.zoom-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,255,200,0.08);
}
.zoom-slider {
  width: 90px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(0,0,0,0.3);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,255,200,0.3);
}
.zoom-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(0,0,0,0.3);
  cursor: pointer;
}
.zoom-label {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  min-width: 32px;
  text-align: center;
}
.cam-btn-sm {
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.25s;
  backdrop-filter: blur(5px);
}
.cam-btn-sm:hover { border-color: var(--accent); color: var(--text); }
.cam-btn-sm.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 255, 200, 0.1);
}

/* Countdown */
#countdown-overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.countdown-number {
  font-family: var(--font-display);
  font-size: 12rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 80px var(--accent);
  animation: countPulse 1s ease-out;
  line-height: 1;
}
.countdown-label {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.5em;
  color: var(--text-dim);
  margin-top: 1rem;
}
@keyframes countPulse {
  0% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Results */
#results-screen {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
}
.results-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 2rem;
}
.results-section {
  margin-bottom: 1.5rem;
  text-align: center;
}
.results-section h3 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.winner-entry {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent);
  margin: 0.3rem 0;
}
.dead-entry {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0.2rem 0;
}
.results-next {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2rem;
  animation: blink 2s step-end infinite;
}

/* Kill Banner */
#kill-banner {
  position: fixed;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--danger);
  text-shadow: 0 0 30px var(--danger);
  letter-spacing: 0.15em;
  padding: 0.5rem 2rem;
  background: rgba(255, 17, 51, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  backdrop-filter: blur(5px);
  animation: killSlam 0.4s ease-out;
}
@keyframes killSlam {
  0% { transform: translateX(-50%) scale(2); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Eliminated overlay */
.eliminated-title {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--danger);
  text-shadow: 0 0 60px var(--danger);
  letter-spacing: 0.2em;
  animation: killSlam 0.5s ease-out;
}
.eliminated-reason {
  font-size: 1rem;
  color: var(--text-dim);
  margin: 1rem 0;
}
#eliminated-overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
}

/* Death effects */
#death-flash {
  position: fixed; inset: 0;
  z-index: 200;
  background: rgba(255, 0, 20, 0.7);
  pointer-events: none;
  animation: deathFlashAnim 0.6s ease-out forwards;
}
@keyframes deathFlashAnim {
  0% { opacity: 1; }
  30% { opacity: 0.8; }
  100% { opacity: 0; }
}
#death-vignette {
  position: fixed; inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(80,0,0,0.6) 70%, rgba(40,0,0,0.9) 100%);
  animation: vignetteIn 0.5s ease-out forwards;
}
@keyframes vignetteIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
#death-vignette.fade-out {
  animation: vignetteFade 1.5s ease-in forwards;
}
@keyframes vignetteFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
#game-canvas.shake {
  animation: screenShake 0.5s ease-out;
}
@keyframes screenShake {
  0% { transform: translate(0,0); }
  10% { transform: translate(-8px, 6px); }
  20% { transform: translate(7px, -5px); }
  30% { transform: translate(-6px, 4px); }
  40% { transform: translate(5px, -3px); }
  50% { transform: translate(-4px, 2px); }
  60% { transform: translate(3px, -2px); }
  70% { transform: translate(-2px, 1px); }
  80% { transform: translate(1px, -1px); }
  90% { transform: translate(-1px, 0); }
  100% { transform: translate(0,0); }
}

/* Players needed */
.players-needed-text {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--warning);
  margin-top: 1rem;
  min-height: 1.2em;
}

/* Winner Photo Modal */
#winner-photo-modal {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 60;
}
.winner-modal-content {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 90vw;
  box-shadow: 0 0 60px rgba(0, 255, 200, 0.15);
}
.winner-modal-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 0.3rem;
}
.winner-modal-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}
.photo-preview-container {
  width: 200px;
  height: 200px;
  margin: 0 auto 1.5rem;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
}
.photo-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}
#photo-placeholder {
  color: var(--text-dim);
  font-size: 0.8rem;
}
.photo-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.photo-buttons .btn-secondary {
  width: auto;
  padding: 0.6rem 1.2rem;
  margin-top: 0;
  font-size: 0.75rem;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.modal-actions .btn-primary {
  width: auto;
  padding: 0.7rem 2rem;
  font-size: 0.85rem;
}
.modal-actions .btn-danger {
  margin-top: 0;
}

/* Play Again / Results Actions */
.results-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.btn-play-again {
  width: auto;
  padding: 0.8rem 3rem;
  font-size: 1rem;
  animation: playAgainPulse 1.5s ease-in-out infinite;
}
.btn-play-again #requeue-countdown {
  display: inline-block;
  min-width: 1.2em;
  font-weight: 900;
}
@keyframes playAgainPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(0, 255, 200, 0.3); }
  50% { box-shadow: 0 0 35px rgba(0, 255, 200, 0.6); }
}
.btn-back-lobby {
  width: auto;
  padding: 0.5rem 1.5rem;
  font-size: 0.7rem;
  margin-top: 0;
}

/* My Stats Card */
.my-stats-card {
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.my-stats-card h4 {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}
.stats-row {
  display: flex;
  justify-content: space-around;
  gap: 0.3rem;
}
.ms-item { text-align: center; }
.ms-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}
.ms-val.ms-streak { color: var(--warning); }
.ms-lbl {
  display: block;
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-top: 0.15rem;
}
.xp-bar-outer {
  margin-top: 0.5rem;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.5s ease;
}

/* Leaderboard Card */
.leaderboard-card {
  margin-top: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  max-height: 200px;
  overflow-y: auto;
}
.leaderboard-card h4 {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.lb-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.75rem;
}
.lb-rank {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--warning);
  min-width: 1.5em;
  text-align: right;
}
.lb-rank.gold { color: #ffd700; }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }
.lb-name {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-name.is-me { color: var(--accent); font-weight: 600; }
.lb-score {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--accent);
}
.lb-streak-badge {
  font-size: 0.6rem;
  color: var(--warning);
}

/* Share Button */
.btn-share {
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  background: rgba(255, 170, 0, 0.1);
  color: var(--warning);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-share:hover {
  background: rgba(255, 170, 0, 0.2);
  box-shadow: 0 0 20px rgba(255, 170, 0, 0.2);
}
.share-copied {
  font-size: 0.7rem;
  color: var(--accent);
  margin-left: 0.5rem;
  animation: fadeInOut 2s forwards;
}
@keyframes fadeInOut {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Room Controls */
.room-controls {
  margin-top: 1rem;
  text-align: center;
}
.btn-room {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-room:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.room-info {
  margin-top: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
#room-code-display {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.15em;
}
.btn-room-copy {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-room-copy:hover {
  background: rgba(0,255,200,0.1);
}

/* Lobby Music Toggle */
.lobby-music-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.5);
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s;
  margin-top: 0.4rem;
}
.lobby-music-btn:hover {
  border-color: rgba(0,255,200,0.3);
  color: rgba(255,255,255,0.8);
  background: rgba(0,255,200,0.05);
}
.lobby-music-btn.playing {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,255,200,0.08);
  animation: musicPulse 2s ease-in-out infinite;
}
@keyframes musicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,255,200,0); }
  50% { box-shadow: 0 0 12px 2px rgba(0,255,200,0.15); }
}

/* Customize Button */
.btn-customize {
  width: 100%;
  max-width: 320px;
  padding: 0.6rem 1rem;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: rgba(0,255,200,0.05);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.25s;
  margin-bottom: 0.5rem;
}
.btn-customize:hover {
  background: rgba(0,255,200,0.15);
  box-shadow: 0 0 18px rgba(0,255,200,0.15);
}

/* Character Customization Panel */
#customize-panel {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(5,8,12,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.cust-layout {
  display: flex;
  gap: 2.5rem;
  max-width: 720px;
  width: 90vw;
  max-height: 90vh;
  align-items: flex-start;
}
.cust-preview-col {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#cust-preview-canvas {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: radial-gradient(ellipse at 50% 80%, rgba(0,255,200,0.04), transparent 70%),
              linear-gradient(180deg, rgba(15,18,25,1) 0%, rgba(10,12,18,1) 100%);
}
.cust-options-col {
  flex: 1;
  overflow-y: auto;
  max-height: 85vh;
  padding-right: 0.5rem;
}
.cust-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 1.2rem;
}
.cust-section {
  margin-bottom: 1.2rem;
}
.cust-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
}
.cust-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cust-swatch {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.cust-swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255,255,255,0.3);
}
.cust-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0,255,200,0.3);
}
.cust-swatch.locked {
  opacity: 0.3;
  cursor: not-allowed;
}
.cust-swatch.locked::after {
  content: '🔒';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
}
.cust-swatch .swatch-tooltip {
  display: none;
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  color: #fff;
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}
.cust-swatch:hover .swatch-tooltip {
  display: block;
}
.cust-acc-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cust-acc-btn {
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
}
.cust-acc-btn:hover {
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.cust-acc-btn.selected {
  border-color: var(--accent);
  background: rgba(0,255,200,0.1);
  color: var(--accent);
}
.cust-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}
.cust-actions .btn-primary,
.cust-actions .btn-secondary {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.65rem;
}

@media (max-width: 700px) {
  .cust-layout {
    flex-direction: column;
    align-items: center;
  }
  #cust-preview-canvas {
    width: 200px;
    height: 280px;
  }
  .cust-swatch { width: 28px; height: 28px; }
  .cust-acc-btn { padding: 0.35rem 0.55rem; font-size: 0.5rem; }
}

/* ---- Mobile Responsive ---- */
@media (max-width: 600px) {
  .game-title { font-size: 2.5rem; letter-spacing: 0.15em; }
  .game-subtitle { font-size: 0.7rem; letter-spacing: 0.4em; }
  .loader-bar { width: 200px; }

  .game-title-sm { font-size: 1.6rem; letter-spacing: 0.12em; }
  .tagline { font-size: 0.6rem; letter-spacing: 0.3em; }
  #lobby-screen { width: 100%; max-width: 95vw; }
  .lobby-stats { gap: 0.5rem; margin: 1rem 0; }
  .stat-card { padding: 0.6rem 0.8rem; min-width: 70px; }
  .stat-value { font-size: 1.3rem; }
  .stat-label { font-size: 0.55rem; }
  .lobby-name { margin: 1rem 0; }
  .lobby-name input { padding: 0.6rem 0.8rem; font-size: 0.9rem; }
  .btn-primary { padding: 0.8rem; font-size: 0.9rem; }
  .btn-secondary { padding: 0.6rem; font-size: 0.75rem; }
  .btn-customize { font-size: 0.6rem; padding: 0.5rem 0.8rem; }
  .my-stats-card { padding: 0.6rem 0.75rem; }
  .ms-val { font-size: 1rem; }
  .leaderboard-card { max-height: 150px; padding: 0.6rem 0.75rem; }

  #phase-banner { font-size: 1.5rem; padding: 0.8rem; }
  #hud-bar { gap: 0.8rem; padding: 0.3rem; flex-wrap: wrap; justify-content: center; }
  .hud-item { padding: 0.35rem 0.7rem; }
  .hud-label { font-size: 0.5rem; }
  .hud-value { font-size: 1rem; }
  .progress-bar { width: 80px; }
  .jump-indicator { font-size: 0.6rem; padding: 3px 8px; }
  #player-camera-controls { display: none; }

  #spectator-header { gap: 0.5rem; flex-wrap: wrap; justify-content: center; width: 95vw; }
  .spec-badge { font-size: 0.6rem; padding: 0.25rem 0.5rem; }
  .spec-phase { font-size: 1rem; }
  .spec-timer { font-size: 0.9rem; }
  #spec-sidebar { display: none; }
  #elimination-feed { width: 240px; bottom: 6rem; left: 0.5rem; }
  .elim-entry { font-size: 0.7rem; padding: 0.35rem 0.6rem; }
  #spec-camera-controls { display: none; }

  .countdown-number { font-size: 6rem; }
  .countdown-label { font-size: 0.7rem; letter-spacing: 0.3em; }

  .results-title { font-size: 1.5rem; letter-spacing: 0.12em; margin-bottom: 1rem; }
  .winner-entry { font-size: 0.9rem; }
  .dead-entry { font-size: 0.7rem; }
  .btn-play-again { padding: 0.6rem 2rem; font-size: 0.85rem; }

  .eliminated-title { font-size: 2.2rem; }
  .eliminated-reason { font-size: 0.8rem; }

  #kill-banner { font-size: 1rem; padding: 0.35rem 1.2rem; }

  .winner-modal-content { padding: 1.2rem 1rem; }
  .winner-modal-title { font-size: 1.3rem; }
  .photo-preview-container { width: 150px; height: 150px; }

  .room-controls { margin-top: 0.6rem; }
  .room-info { flex-wrap: wrap; gap: 0.4rem; }
  #room-code-display { font-size: 0.8rem; }
  .players-needed-text { font-size: 0.65rem; }
  .lobby-music-btn { font-size: 0.45rem; padding: 0.25rem 0.6rem; }
}

@media (max-width: 400px) {
  .game-title { font-size: 1.8rem; }
  .game-title-sm { font-size: 1.3rem; }
  .lobby-stats { flex-direction: column; align-items: center; }
  .stat-card { width: 80%; }
  #phase-banner { font-size: 1.2rem; }
  .countdown-number { font-size: 4.5rem; }
  .results-title { font-size: 1.2rem; }
  .eliminated-title { font-size: 1.8rem; }
}

/* Duplicate Tab Overlay */
#duplicate-tab-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dup-tab-content {
  text-align: center;
  max-width: 420px;
  padding: 2.5rem 2rem;
}
.dup-tab-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--danger);
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
}
.dup-tab-msg {
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.8rem;
}

/* Mobile Touch Controls */
#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
#joystick-zone {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 150px;
  height: 150px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
#joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(0, 255, 200, 0.25);
  position: relative;
  box-shadow: 0 0 20px rgba(0, 255, 200, 0.08);
}
#joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 255, 200, 0.25);
  border: 2px solid rgba(0, 255, 200, 0.5);
  box-shadow: 0 0 12px rgba(0, 255, 200, 0.2);
  transition: box-shadow 0.15s;
}
#jump-btn-zone {
  position: absolute;
  bottom: 30px;
  right: 30px;
  pointer-events: auto;
}
#jump-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 228, 77, 0.12);
  border: 2px solid rgba(255, 228, 77, 0.4);
  color: rgba(255, 228, 77, 0.8);
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(255, 228, 77, 0.1);
  transition: all 0.12s;
}
#jump-btn.active {
  background: rgba(255, 228, 77, 0.3);
  border-color: rgba(255, 228, 77, 0.8);
  transform: scale(0.92);
  box-shadow: 0 0 25px rgba(255, 228, 77, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
