/* Survivor Arena - In-Game HUD */

/* ============================================================
   10. IN-GAME HUD
   ============================================================ */

#hud {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  font-family: var(--font-display);
  transition: opacity 0.4s ease;
}

#hud.hidden {
  opacity: 0;
  pointer-events: none !important;
}

#hud.hud-visible {
  opacity: 1;
}

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

/* ---- Top section (unified bar) ---- */

#hud-top,
.hud-top-bar,
#hud-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 20px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.25) 55%, transparent 100%);
}

#hud-top-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#hud-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Character portrait in HUD */
#hud-char-portrait {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(0, 240, 255, 0.4);
  box-shadow:
    0 0 12px rgba(0, 240, 255, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 0 6px rgba(0, 0, 0, 0.3);
  background: rgba(0, 5, 15, 0.9);
  flex-shrink: 0;
}

#hud-char-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hud-top-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

/* ---- Health Bar ---- */

#hud-health-container,
.health-bar-container,
#health-bar-container {
  position: relative;
  width: 280px;
  height: 26px;
  background: rgba(0, 5, 15, 0.92);
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.15);
  overflow: hidden;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 4px rgba(0, 0, 0, 0.4);
}

/* Segmented tick marks overlay */
#hud-health-container::before,
.health-bar-container::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 25px,
    rgba(0, 0, 0, 0.15) 25px,
    rgba(0, 0, 0, 0.15) 26px
  );
}

#hud-health-bar,
.health-bar,
#health-bar {
  height: 100%;
  border-radius: 11px;
  background: linear-gradient(90deg, #00ff88, #44ffaa);
  transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  min-width: 0;
  will-change: width;
}

/* Glass sheen on top of the health fill */
#hud-health-bar::after,
.health-bar::after,
#health-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    transparent 50%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
}

/* Animated shimmer on health bar fill */
#hud-health-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 100%
  );
  animation: healthShimmer 3s ease-in-out infinite;
  pointer-events: none;
}

/* Low HP pulsing glow */
#hud-health-bar.low,
.health-bar.low,
#health-bar.low {
  animation: healthLowPulse 0.8s ease-in-out infinite;
}

/* Low HP glow effect on the container */
#hud-health-container.health-critical {
  border-color: rgba(255, 51, 68, 0.5);
  box-shadow:
    0 0 16px rgba(255, 51, 68, 0.25),
    0 0 32px rgba(255, 51, 68, 0.1),
    0 2px 12px rgba(0, 0, 0, 0.5),
    inset 0 0 8px rgba(255, 51, 68, 0.1);
  animation: healthContainerPulse 1.2s ease-in-out infinite;
}

/* Damage flash on health bar */
#hud-health-bar.damage-flash {
  animation: damageFlash 0.3s ease;
}

#hud-health-text,
.health-text,
#health-text {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.06em;
}

/* ---- XP Bar ---- */

#hud-xp-container,
.xp-bar-container,
#xp-bar-container {
  position: relative;
  width: 280px;
  height: 18px;
  background: rgba(0, 5, 15, 0.92);
  border-radius: 8px;
  border: 1px solid rgba(0, 240, 255, 0.12);
  overflow: hidden;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 -1px 3px rgba(0, 0, 0, 0.3);
}

#hud-xp-bar,
.xp-bar,
#xp-bar {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, #6366f1, #a855f7, var(--primary));
  background-size: 200% 100%;
  animation: xpGradientFlow 4s ease-in-out infinite;
  transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  min-width: 0;
  will-change: width;
}

/* Glass sheen on XP bar */
#hud-xp-bar::after,
.xp-bar::after,
#xp-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 45%,
    rgba(0, 0, 0, 0.08) 100%
  );
  pointer-events: none;
}

/* Level up flash */
#hud-xp-bar.levelup,
.xp-bar.levelup,
#xp-bar.levelup {
  animation: xpLevelUpFlash 0.6s ease;
}

#hud-xp-container.levelup-flash {
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow:
    0 0 20px rgba(0, 240, 255, 0.3),
    0 0 40px rgba(168, 85, 247, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.4);
  animation: xpContainerFlash 0.8s ease;
}

#hud-xp-text,
.xp-text,
#xp-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 800;
  color: #fff;
  text-shadow:
    0 0 8px rgba(0, 240, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.08em;
}

.level-indicator,
#level-indicator {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-dim);
  letter-spacing: 0.06em;
}

/* ---- Timer ---- */

#hud-timer,
.hud-timer {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow:
    0 0 12px rgba(0, 240, 255, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.12em;
  padding: 6px 24px;
  background: rgba(0, 5, 15, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 20px;
  min-width: 80px;
  text-align: center;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  pointer-events: auto;
  align-self: center;
}

/* Timer warning (30s before zone shrink) */
#hud-timer.timer-warning,
.hud-timer.timer-warning {
  animation: timerWarning 1.5s ease-in-out infinite;
}

/* Timer danger (zone is actively shrinking) */
#hud-timer.timer-danger,
.hud-timer.timer-danger {
  animation: timerDanger 1s ease-in-out infinite;
}

/* ---- Weapon Icons (bottom-left) ---- */

#hud-weapons,
.hud-weapons {
  position: absolute;
  bottom: 18px;
  left: 18px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.weapon-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: rgba(0, 5, 15, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  position: relative;
  transition:
    transform var(--transition-fast),
    border-color var(--transition-base),
    box-shadow var(--transition-base);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.weapon-icon:hover {
  transform: translateY(-3px) scale(1.05);
}

.weapon-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.weapon-icon.active {
  border-color: var(--primary-dim);
  box-shadow:
    0 0 12px rgba(0, 240, 255, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: scale(1.08);
}

/* Rarity border glow classes */
.weapon-icon.rarity-common {
  border-color: rgba(160, 160, 170, 0.4);
}
.weapon-icon.rarity-uncommon {
  border-color: rgba(68, 255, 136, 0.45);
  box-shadow: 0 0 8px rgba(68, 255, 136, 0.12), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.weapon-icon.rarity-rare {
  border-color: rgba(60, 130, 255, 0.5);
  box-shadow: 0 0 10px rgba(60, 130, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.weapon-icon.rarity-epic {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.18), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.weapon-icon.rarity-legendary {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: legendaryWeaponGlow 2s ease-in-out infinite;
}

.weapon-icon .weapon-level {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 5, 15, 0.9);
  border: 1.5px solid var(--primary-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: 0 0 4px rgba(0, 240, 255, 0.3);
}

.weapon-icon .weapon-cooldown {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.weapon-icon.on-cooldown .weapon-cooldown {
  opacity: 1;
}

/* Cooldown sweep animation (set --cd-pct from JS) */
.weapon-icon .weapon-cooldown-sweep {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  background: conic-gradient(
    rgba(0, 0, 0, 0.6) var(--cd-pct, 0%),
    transparent var(--cd-pct, 0%)
  );
}

/* ---- Gold Counter ---- */

#hud-gold {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px 6px 10px;
  background: linear-gradient(135deg, rgba(60, 45, 0, 0.95) 0%, rgba(30, 20, 0, 0.95) 100%);
  border-radius: 14px;
  border: 2px solid rgba(255, 200, 0, 0.55);
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(255, 200, 0, 0.2),
    0 0 6px rgba(255, 215, 0, 0.15),
    inset 0 1px 0 rgba(255, 215, 0, 0.15);
  pointer-events: auto;
}

.gold-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 6px rgba(255, 200, 0, 0.7));
  line-height: 1;
}

.gold-label {
  display: none;
}

.gold-count {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow:
    0 0 12px rgba(255, 200, 0, 0.6),
    0 0 4px rgba(255, 200, 0, 0.3),
    0 1px 3px rgba(0, 0, 0, 0.9);
  min-width: 22px;
}

#hud-gold.gold-bump {
  animation: goldBump 0.4s ease;
}

/* ---- Kill Counter ---- */

#hud-kills,
.hud-kills {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px 6px 10px;
  background: rgba(0, 5, 15, 0.95);
  border-radius: 14px;
  border: 2px solid rgba(255, 0, 102, 0.35);
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(255, 0, 102, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  pointer-events: auto;
}

.kills-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 5px rgba(255, 0, 102, 0.6));
  line-height: 1;
}

.kills-label {
  display: none;
}

.kills-count {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--secondary);
  text-shadow:
    0 0 10px var(--secondary-dim),
    0 1px 2px rgba(0, 0, 0, 0.8);
  min-width: 22px;
}

/* Kill counter bump animation */
#hud-kills.kill-bump {
  animation: killBump 0.3s ease;
}

/* Kill milestone animation (50/100 kills etc) */
#hud-kills.kill-milestone {
  animation: killMilestone 0.6s ease;
}

/* ---- Minimap (bottom-right) ---- */

#hud-minimap,
.hud-minimap {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(0, 5, 15, 0.8);
  border: 2px solid rgba(0, 240, 255, 0.2);
  box-shadow:
    0 0 20px rgba(0, 240, 255, 0.08),
    0 0 40px rgba(0, 0, 0, 0.5),
    inset 0 0 24px rgba(0, 0, 0, 0.5),
    inset 0 0 4px rgba(0, 240, 255, 0.05);
  overflow: hidden;
}

#hud-minimap canvas,
.hud-minimap canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* ---- Menu Button (top-right) ---- */

#hud-menu-btn {
  position: absolute;
  top: 56px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 240, 255, 0.25);
  background: rgba(0, 5, 15, 0.92);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s, color 0.2s;
  pointer-events: auto;
  z-index: 51;
}

#hud-menu-btn:hover {
  border-color: rgba(0, 240, 255, 0.5);
  color: #fff;
  transform: scale(1.1);
  box-shadow:
    0 0 12px rgba(0, 240, 255, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.4);
}

#hud-menu-btn:active {
  transform: scale(0.95);
}

