/* ═══════════════════════════════════════════════════════════════════
   Whirr.io — Cyberpunk Redesign
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --font-heading: "Orbitron", sans-serif;
  --font-body: "Rajdhani", sans-serif;

  --color-primary: #00f0ff; /* Neon Cyan */
  --color-primary-dim: rgba(0, 240, 255, 0.3);
  --color-secondary: #bc13fe; /* Neon Purple */
  --color-accent: #ffd700; /* Gold */
  --color-danger: #ff0055;
  --color-success: #00ff9d;

  --bg-dark: #050510;
  --bg-panel: rgba(10, 15, 30, 0.75);
  --bg-input: rgba(0, 240, 255, 0.05);

  --text-main: #ffffff;
  --text-dim: #a0a0b0;

  --shadow-neon:
    0 0 10px var(--color-primary), 0 0 20px var(--color-primary-dim);
  --border-neon: 1px solid var(--color-primary);
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
}

canvas {
  display: block;
  z-index: 0;
  position: absolute;
  top: 0;
  left: 0;
}

/* ─── Typography ────────────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 2px;
}

button {
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ─── Utility Classes ───────────────────────────────────────────── */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 240, 255, 0.2);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

.neon-text {
  color: var(--color-primary);
  text-shadow: 0 0 5px var(--color-primary-dim);
}

.btn-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  filter: brightness(0) invert(1);
  margin-right: 8px;
}

/* ─── Lobby ─────────────────────────────────────────────────────── */
#lobby {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1a1a2e 0%, #000 100%);
  display: flex;
  flex-direction: row;
  z-index: 100;
  overflow: hidden;
}

.lobby-inner {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 40px;
  gap: 100px;
  align-items: center;
  justify-content: center;
}

.lobby-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.lobby-right {
  flex: 0 0 350px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lobby-left h1 {
  font-size: 6rem;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.3));
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-dim);
  margin-bottom: 3rem;
  letter-spacing: 1px;
}

input[type="text"] {
  background: var(--bg-input);
  border: 1px solid var(--color-primary);
  border-left: 5px solid var(--color-primary);
  color: var(--color-primary);
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  width: 100%;
  max-width: 320px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

input[type="text"]:focus {
  outline: none;
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 15px var(--color-primary-dim);
  transform: translateX(5px);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-body);
}

button {
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

#playBtn {
  width: 320px;
  padding: 15px;
  font-size: 1.5rem;
  background: var(--color-primary);
  color: #000;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}

#playBtn:hover {
  background: #fff;
  box-shadow: 0 0 20px var(--color-primary);
}

#lobbySpectateBtn {
  width: 320px;
  padding: 12px;
  font-size: 1rem;
  background: transparent;
  border: 1px solid var(--color-secondary);
  color: var(--color-secondary);
  margin-top: 10px;
}

#lobbySpectateBtn:hover {
  background: rgba(188, 19, 254, 0.1);
  box-shadow: 0 0 15px rgba(188, 19, 254, 0.3);
}

.lobby-audio-controls {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.lobby-offline-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  align-items: center;
}

.offline-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}

.cyber-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.cyber-checkbox input {
  display: none;
}

.checkbox-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--color-primary);
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cyber-checkbox input:checked + .checkbox-box {
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.cyber-checkbox input:checked + .checkbox-box::after {
  content: "✔";
  color: #000;
  font-size: 12px;
}

.checkbox-label {
  font-size: 1rem;
  color: var(--text-dim);
}

#highScoresPanel {
  width: 100%;
  height: 400px;
  background: rgba(0, 10, 20, 0.8);
  border: 1px solid var(--color-secondary);
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(188, 19, 254, 0.1);
}

#highScoresPanel h3 {
  background: rgba(188, 19, 254, 0.1);
  padding: 15px;
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-secondary);
  text-align: center;
  border-bottom: 1px solid var(--color-secondary);
}

#highScoresList {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

#highScoresList::-webkit-scrollbar {
  width: 6px;
}

#highScoresList::-webkit-scrollbar-thumb {
  background: var(--color-secondary);
}

.hs-row {
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.hs-rank {
  width: 30px;
  color: var(--color-accent);
  font-weight: bold;
}

.hs-name {
  flex: 1;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hs-score {
  color: var(--color-primary);
  font-family: var(--font-heading);
}

/* ─── Modals ────────────────────────────────────────────────────── */
#pauseMenu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow-y: auto;
  padding: 40px 0;
  -webkit-overflow-scrolling: touch;
}

#pauseMenu h1 {
  font-size: 3rem;
  color: var(--color-primary);
  text-shadow: 0 0 10px var(--color-primary-dim);
  margin-bottom: 30px;
}

#infoModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2100;
  overflow-y: auto;
}

.info-content {
  width: 90%;
  max-width: 1000px;
  margin: 40px auto;
  background: var(--bg-panel);
  border: 1px solid var(--color-primary);
  padding: 30px;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.1);
  position: relative;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--color-primary-dim);
  padding-bottom: 20px;
}

.info-header h2 {
  color: var(--color-primary);
  font-size: 2rem;
  margin: 0;
  text-shadow: 0 0 10px var(--color-primary-dim);
}

#closeInfoBtn {
  background: transparent;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  font-size: 1.2rem;
  padding: 5px 15px;
  cursor: pointer;
}

#closeInfoBtn:hover {
  background: var(--color-danger);
  color: #fff;
}

.info-section-title {
  color: var(--color-accent);
  font-size: 1.4rem;
  margin: 20px 0 15px 0;
  border-left: 4px solid var(--color-accent);
  padding-left: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s;
}

.info-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-primary-dim);
}

.info-item .icon {
  font-size: 2rem;
}

.combo-item {
  font-size: 0.9rem;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-footer {
  margin-top: 30px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

kbd {
  background: #333;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #666;
  font-family: monospace;
}

.pause-btn {
  width: 280px;
  padding: 15px;
  font-size: 1.2rem;
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  margin: 10px 0;
  text-align: center;
}

.pause-btn:hover {
  background: var(--color-primary);
  color: #000;
  box-shadow: 0 0 15px var(--color-primary-dim);
}

.pause-btn.primary {
  background: var(--color-primary);
  color: #000;
}

.pause-btn.primary:hover {
  background: #fff;
  box-shadow: 0 0 20px var(--color-primary);
}

.pause-btn.danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
  margin-top: 30px;
}

.pause-btn.danger:hover {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 0 15px var(--color-danger);
}

.pause-audio-group {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pause-section-label {
  font-size: 0.9rem;
  color: var(--color-primary);
  letter-spacing: 2px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.audio-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: 4px;
  cursor: pointer;
  min-width: 160px;
  justify-content: center;
}

.audio-btn:hover {
  background: rgba(0, 240, 255, 0.2);
}

/* ─── HUD ───────────────────────────────────────────────────────── */
#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  padding: 20px;
  z-index: 10;
}

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

.hud-stats {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.6);
  border-left: 3px solid var(--color-primary);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 1.1rem;
}

.hud-mass {
  font-size: 1.2rem;
  color: #fff;
}

.hud-mass span {
  color: var(--color-primary);
  font-family: var(--font-heading);
}

.hud-rank {
  font-size: 0.95rem;
}

.hud-rank span {
  color: var(--color-accent);
}

.weather-box {
  display: flex;
  gap: 12px;
  font-size: clamp(0.5rem, 1.5vw, 0.75rem);
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 8px;
  border-radius: 4px;
}

#weatherStatus,
#timeOfDay {
  transition: opacity 0.4s ease;
}

#weatherStatus.fading,
#timeOfDay.fading {
  opacity: 0;
}

#weatherStatus.hazard {
  color: #ff4444;
  text-shadow: 0 0 6px rgba(255, 68, 68, 0.6);
}

#barContainer {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, 85vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.hud-bar-track {
  width: 100%;
  height: 12px;
  background: #222;
  border: 1px solid #444;
  transform: skewX(-20deg);
  overflow: hidden;
  position: relative;
}

#boostBarInner {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--color-secondary),
    var(--color-primary)
  );
  box-shadow: 0 0 10px var(--color-primary);
}

.hud-bar-label {
  font-size: 0.8rem;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 2px;
  text-align: center;
}

#powerUpContainer {
  width: 100%;
  margin-bottom: 10px;
  display: none;
}

.powerup-header {
  display: flex;
  justify-content: space-between;
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 4px;
  text-shadow: 0 0 5px var(--color-accent);
}

#powerUpBar {
  width: 100%;
  height: 100%;
  background: var(--color-accent);
  transition: width 0.1s linear;
}

#minimap {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 250px;
  height: 250px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--color-primary-dim);
  overflow: hidden;
  display: none;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

#minimapCanvas {
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

#comboToast {
  max-width: 90vw;
}

#fpsCounter {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--color-success);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
  display: none;
  z-index: 1000;
}

#debugInfo {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 12px;
  border-radius: 4px;
  border-left: 2px solid var(--color-primary);
  display: none;
  grid-template-columns: auto auto;
  column-gap: 12px;
  row-gap: 1px;
  z-index: 1000;
  pointer-events: none;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.7rem;
  line-height: 1.4;
}

#debugInfo .dbg-label {
  color: var(--text-dim);
  text-align: left;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#debugInfo .dbg-val {
  color: var(--color-success);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  width: 100px;
}

#debugInfo .dbg-sep {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(0, 240, 255, 0.15);
  margin: 2px 0;
}

/* ─── Task List ─────────────────────────────────────────────────── */
#taskContainer {
  position: absolute;
  bottom: 290px;
  right: 20px;
  width: 248px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  z-index: 100;
  transition: all 0.3s ease;
}

.task-item {
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--color-primary);
  padding: 12px 15px;
  border-radius: 4px;
  font-family: var(--font-body);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: right center;
  animation: taskSlideIn 0.5s ease-out;
}

@keyframes taskSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.task-item.removing {
  opacity: 0;
  transform: translateX(50px) scale(0.8);
}

.task-desc {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  font-weight: 500;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.task-progress-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #fff);
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--color-primary);
}

.task-item.completed {
  border-left-color: var(--color-success);
  background: rgba(0, 255, 157, 0.15);
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.2);
}

.task-item.completed .task-desc {
  color: var(--color-success);
  text-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

.task-item.completed .task-progress-fill {
  background: var(--color-success);
  box-shadow: 0 0 15px var(--color-success);
}

/* ─── Spectator UI ──────────────────────────────────────────────── */
#spectatorUI {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

#spectatorUI > * {
  pointer-events: auto;
}

#deathBanner {
  position: absolute;
  top: clamp(80px, 12vh, 15%);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2000;
  display: none;
  opacity: 0;
  pointer-events: none;
  max-width: 90vw;
}

#deathBanner h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 6vw, 3rem);
  margin: 0;
  color: #e74c3c;
  text-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
  letter-spacing: clamp(2px, 0.5vw, 4px);
  text-transform: uppercase;
  animation: pulseText 2s infinite;
}

#deathBanner p {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  color: #fff;
  margin-top: clamp(4px, 1vh, 8px);
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

#bannerKillerName {
  color: var(--color-accent);
  font-weight: bold;
}

@keyframes pulseText {
  0% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
  }
  50% {
    transform: scale(1.05);
    text-shadow: 0 0 30px rgba(231, 76, 60, 1);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
  }
}

#specRespawn {
  position: absolute;
  bottom: 30px; /* Moved to bottom on mobile */
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-success);
  color: #000;
  border: none;
  padding: clamp(4px, 1vh, 6px) clamp(10px, 2vw, 14px);
  font-family: var(--font-heading);
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  cursor: pointer;
  z-index: 100;
}

.spec-label {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-accent);
  letter-spacing: 2px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 10px;
  border-radius: 4px;
}

.spec-controls {
  position: absolute;
  bottom: 80px; /* Moved to bottom on mobile */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 15px);
  background: rgba(0, 0, 0, 0.8);
  padding: clamp(6px, 1.5vh, 10px) clamp(12px, 3vw, 20px);
  border: 1px solid var(--color-primary-dim);
}

.spec-controls button {
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  width: clamp(32px, 6vw, 40px);
  height: clamp(32px, 6vw, 40px);
  border-radius: 4px;
  cursor: pointer;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spec-controls button:hover {
  background: var(--color-primary);
  color: #000;
}

#specTarget {
  min-width: clamp(100px, 20vw, 150px);
  text-align: center;
  color: #fff;
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 2vw, 1rem);
}

.medal-buttons {
  display: flex;
  gap: clamp(8px, 2vw, 15px);
  margin: 0;
}

#spectatorUI .medal-buttons {
  position: absolute;
  bottom: 140px; /* Moved to bottom on mobile */
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

.medal-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  width: clamp(40px, 7vw, 50px);
  height: clamp(40px, 7vw, 50px);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.medal-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* ─── Activity Feed ─────────────────────────────────────────────── */
#activityFeed {
  position: absolute;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: right;
  pointer-events: none;
  z-index: 100;
}

.kill-msg {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.6));
  padding: 6px 12px;
  color: #fff;
  font-size: 0.9rem;
  border-right: 2px solid var(--color-danger);
}

.kill-msg .k {
  color: var(--color-danger);
  font-weight: bold;
}

.kill-msg .v {
  color: var(--color-primary);
  font-weight: bold;
}

/* ─── Death Screen ──────────────────────────────────────────────── */
#deathScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 0, 10, 0.9);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  z-index: 200;
}

#deathScreen h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  color: var(--color-danger);
  text-shadow: 0 0 20px var(--color-danger);
  margin: 0;
}

.death-actions {
  display: flex;
  gap: clamp(10px, 3vw, 20px);
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
}

#respawnBtn {
  background: var(--color-success);
  color: #000;
  padding: clamp(10px, 2vh, 15px) clamp(25px, 6vw, 40px);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  border: none;
}

#respawnBtn:hover {
  background: #fff;
  box-shadow: 0 0 20px var(--color-success);
}

/* ─── Loading & Overlays ────────────────────────────────────────── */
#loadingScreen,
#syncOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  letter-spacing: 2px;
  gap: 20px;
}

#syncOverlay {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 1500;
  transition: opacity 0.5s ease-out;
  display: none;
}

#syncOverlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader,
.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 240, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#rotatePlease {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a1a2e 0%, #000 100%);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: #fff;
  font-family: var(--font-body);
  font-size: 1.2rem;
  text-align: center;
}

/* ─── Mobile Controls ───────────────────────────────────────────── */
#mobileControls {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

#joystickZone {
  position: absolute;
  bottom: 40px;
  left: 40px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
}

#joystickKnob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  background: rgba(0, 240, 255, 0.5);
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--color-primary);
  pointer-events: none;
}

#mobileBoostBtn {
  position: absolute;
  bottom: 40px;
  right: 40px;
  width: 80px;
  height: 80px;
  background: rgba(188, 19, 254, 0.3);
  border: 2px solid var(--color-secondary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  color: #fff;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  box-shadow: 0 0 15px rgba(188, 19, 254, 0.3);
  transition: all 0.1s;
}

#mobileBoostBtn:active {
  background: rgba(188, 19, 254, 0.6);
  transform: scale(0.95);
  box-shadow: 0 0 25px var(--color-secondary);
}

#mobileSettingsBtn {
  position: absolute;
  top: 200px; /* Position below .hud-stats (approximately 170px height + 20px padding) */
  left: 20px;
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: #fff;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 500;
}

#mobileSettingsBtn:hover,
#mobileSettingsBtn:active {
  background: rgba(0, 240, 255, 0.3);
  border-color: var(--color-primary);
  transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - All Mobile Overrides Consolidated
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Large Tablets & Small Laptops (max-width: 900px) ────────────── */
@media (max-width: 900px) {
  /* Combo Toast */
  #comboToast {
    top: 12% !important;
    padding: 8px 16px !important;
    font-size: clamp(12px, 3vw, 14px) !important;
  }

  #comboToast > div:first-child {
    font-size: clamp(16px, 4vw, 20px) !important;
  }

  #comboToast > div:last-child {
    font-size: clamp(10px, 2.5vw, 12px) !important;
  }

  /* HUD Stats */
  .hud-stats {
    top: 10px;
    left: 10px;
    gap: 4px;
  }

  .stat-box {
    padding: 4px 8px;
    gap: 6px;
  }

  .stat-icon {
    font-size: 0.85rem;
  }

  .hud-mass {
    font-size: 0.9rem;
  }

  .hud-rank {
    font-size: 0.75rem;
  }

  .weather-box {
    gap: 8px;
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  /* Minimap - Move to Top-Right */
  #minimap {
    top: 5px !important;
    right: 5px !important;
    bottom: auto !important;
    left: auto !important;
    width: 100px;
    height: 100px;
    transform: scale(0.9);
    transform-origin: top right;
  }

  /* Bar Container - Move to Top Center */
  #barContainer {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    bottom: auto;
    width: 25vw;
    max-width: 140px;
    z-index: 50;
  }

  /* Task Container - Above Boost Button */
  #taskContainer {
    top: 110px !important;
    right: 5px !important;
    bottom: auto !important;
    left: auto !important;
    width: 180px;
    gap: 4px;
    transform: scale(0.85);
    transform-origin: top right;
  }

  .task-item {
    padding: 5px 8px;
  }

  .task-desc {
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .task-progress-bg {
    height: 4px;
  }

  /* Spectator Controls */
  .spec-controls {
    gap: 10px;
    transform: scale(0.8);
    transform-origin: top left;
  }

  .medal-btn {
    width: 30px;
    height: 30px;
  }

  /* Mobile Settings Button - Below hud-stats */
  #mobileSettingsBtn {
    top: 150px; /* Adjusted for smaller hud-stats on mobile */
  }

  /* Activity Feed - Hide on Mobile */
  #activityFeed {
    display: none !important;
  }

  /* Lobby Layout */
  .lobby-inner {
    flex-direction: column;
    padding: 8px;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100vh;
    justify-content: flex-start;
  }

  .lobby-left {
    flex: unset;
    height: auto;
    margin-bottom: 10px;
    z-index: 200;
  }

  .lobby-left h1 {
    font-size: 1.8rem;
    margin-bottom: 0.1rem;
  }

  .subtitle {
    font-size: 0.75rem;
    margin-bottom: 0.6rem;
  }

  .lobby-right {
    flex: 0 0 auto;
    width: 100%;
    max-width: 400px;
  }

  #highScoresPanel {
    height: 160px;
    min-height: 130px;
  }

  .hs-row {
    padding: 4px 8px;
    font-size: 0.8rem;
  }

  #playBtn,
  #lobbySpectateBtn {
    padding: 8px;
    font-size: 0.95rem;
    margin-top: 5px;
    width: 260px;
  }

  .lobby-audio-controls {
    margin-top: 5px;
    gap: 10px;
  }

  input[type="text"] {
    font-size: 14px;
    touch-action: manipulation;
    padding: 8px 12px;
  }

  /* Pause Menu */
  #pauseMenu {
    padding: 15px 0;
  }

  #pauseMenu h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  .pause-btn {
    width: 200px;
    padding: 8px;
    font-size: 0.9rem;
    margin: 4px 0;
  }

  .pause-btn.danger {
    margin-top: 10px;
  }

  .pause-audio-group {
    margin: 5px 0;
    gap: 4px;
  }

  .pause-section-label {
    font-size: 0.7rem;
    margin-bottom: 2px;
  }

  .audio-btn {
    min-width: 120px;
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}

/* ─── Landscape Mobile (max-width: 900px AND landscape) ──────────── */
@media (max-width: 900px) and (orientation: landscape) {
  #deathScreen {
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: auto;
    padding: 15px;
  }

  #deathScreen h1 {
    font-size: clamp(2rem, 7vw, 2.2rem);
    margin-bottom: 5px;
  }

  .subtitle {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  .death-actions {
    flex-direction: row;
    gap: 10px;
    margin-top: 15px;
  }

  #respawnBtn,
  #spectateBtn {
    padding: clamp(8px, 1.5vh, 10px) clamp(15px, 4vw, 20px);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
  }

  .medal-buttons {
    margin-top: 10px;
    gap: 10px;
  }

  .medal-btn {
    width: clamp(35px, 6vw, 40px);
    height: clamp(35px, 6vw, 40px);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
  }
}

/* ─── Small Mobile (max-width: 600px) ─────────────────────────────── */
@media (max-width: 600px) {
  .lobby-left h1 {
    font-size: 3rem;
  }

  #playBtn,
  #lobbySpectateBtn,
  input[type="text"] {
    width: 100%;
    max-width: none;
  }

  #barContainer {
    width: min(400px, 85vw);
    bottom: 80px;
  }
}

/* ─── Portrait Mobile Warning ──────────────────────────────────────── */
@media (orientation: portrait) and (max-height: 600px) {
  #rotatePlease {
    opacity: 0.3;
    pointer-events: none;
  }
}
