/* public/css/hud.css - In-Game HUD, Chaos Banners, Touch Controls */

#game-screen {
  padding: 0;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #05070d;
}

.canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* HUD Overlay Layer */
.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 18px;
}

/* TOP HUD BAR */
.hud-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
}

.hud-player-badge {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-color-pill {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 8px currentColor;
}

.hud-player-meta {
  display: flex;
  flex-direction: column;
}

.hud-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.hud-score-display {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--neon-cyan);
  line-height: 1;
}

.hud-score-display small {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* TIMER */
.hud-timer-badge {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.hud-time {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  line-height: 1.1;
}

.hud-time.urgent {
  color: #ff3366;
  text-shadow: 0 0 12px #ff3366;
  animation: pulseTimer 0.6s infinite alternate;
}

@keyframes pulseTimer {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

/* MINI LEADERBOARD */
.hud-leaderboard-badge {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 6px 12px;
  min-width: 140px;
}

.hud-lb-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  color: var(--neon-yellow);
  margin-bottom: 2px;
}

.hud-lb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
}

.hud-lb-name {
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-lb-pts {
  color: var(--neon-cyan);
}

.hud-icon-btn {
  background: rgba(10, 15, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CHAOS EVENT BANNER */
.chaos-banner {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 540px;
  background: rgba(12, 16, 28, 0.94);
  backdrop-filter: blur(12px);
  border: 2px solid var(--neon-magenta);
  box-shadow: 0 0 35px rgba(255, 0, 127, 0.5);
  border-radius: 12px;
  padding: 14px 20px;
  text-align: center;
  animation: dropBanner 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: auto;
}

@keyframes dropBanner {
  from { opacity: 0; transform: translate(-50%, -30px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.chaos-badge {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--neon-magenta);
  text-shadow: 0 0 8px var(--neon-magenta);
  margin-bottom: 2px;
}

.chaos-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
  line-height: 1.1;
}

.chaos-desc {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--neon-cyan);
  margin-top: 4px;
}

.chaos-timer-bar {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.chaos-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  transition: width 0.1s linear;
}

/* ACTIVE POWER-UPS BAR */
.hud-powerups-bar {
  display: flex;
  gap: 8px;
  align-self: center;
  margin-bottom: 8px;
  pointer-events: auto;
}

.pw-indicator {
  background: rgba(10, 15, 28, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid #fff;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  animation: pulsePowerup 1.5s infinite alternate;
}

.pw-speed { border-color: var(--neon-cyan); color: var(--neon-cyan); box-shadow: 0 0 12px rgba(0, 240, 255, 0.4); }
.pw-shield { border-color: #38b6ff; color: #38b6ff; box-shadow: 0 0 12px rgba(56, 182, 255, 0.4); }
.pw-magnet { border-color: var(--neon-magenta); color: var(--neon-magenta); box-shadow: 0 0 12px rgba(255, 0, 127, 0.4); }
.pw-double { border-color: var(--neon-yellow); color: var(--neon-yellow); box-shadow: 0 0 12px rgba(255, 230, 0, 0.4); }

@keyframes pulsePowerup {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

/* 3.. 2.. 1.. GO! COUNTDOWN OVERLAY */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.4);
}

.countdown-big-text {
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 40px rgba(255, 230, 0, 0.8), 0 0 80px rgba(255, 0, 127, 0.6);
  animation: popScale 0.8s ease-out;
}

@keyframes popScale {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

/* MOBILE TOUCH VIRTUAL JOYSTICK */
.mobile-controls {
  position: absolute;
  bottom: 24px;
  left: 24px;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.joystick-touch-zone {
  width: 140px;
  height: 140px;
  position: relative;
  touch-action: none;
}

.joystick-base {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
  border-radius: 50%;
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-thumb {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--neon-cyan), #0077b6);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.7);
  border-radius: 50%;
  position: absolute;
  transform: translate(0px, 0px);
  pointer-events: none;
  transition: transform 0.04s ease-out;
}

/* MEDIA QUERIES FOR PHONES & NARROW SCREENS */
@media (max-width: 640px) {
  .hud-top-bar {
    gap: 6px;
  }
  .hud-player-badge {
    padding: 6px 10px;
  }
  .hud-name {
    font-size: 0.75rem;
  }
  .hud-score-display {
    font-size: 1rem;
  }
  .hud-timer-badge {
    padding: 6px 12px;
  }
  .hud-time {
    font-size: 1.2rem;
  }
  .hud-leaderboard-badge {
    display: none; /* Hide mini-lb on ultra narrow phones to preserve game view */
  }
  .chaos-banner {
    top: 64px;
    width: 95%;
    padding: 10px 14px;
  }
  .chaos-title {
    font-size: 1.25rem;
  }
  .mobile-controls {
    bottom: 16px;
    left: 16px;
  }
}
