/* Shared Neon Arcade Over-Game Score HUD & Milestone Celebrations — VidDazzle Arcade */

.arcade-top-hud {
  --ahud-cyan: #2cf5ff;
  --ahud-gold: #ffd447;
  --ahud-pink: #ff38c7;
  --ahud-emerald: #3dff9e;
  --ahud-bg: rgba(8, 4, 22, 0.92);

  position: relative;
  z-index: 24;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  box-sizing: border-box;
}

.arcade-top-hud.ahud-dock-above {
  width: min(100%, 540px);
  margin: 0 auto 3px;
}

.arcade-top-hud.ahud-top-overlay {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 460px);
  z-index: 28;
}

.arcade-top-hud.ahud-hidden {
  opacity: 0;
  visibility: hidden;
}

.ahud-bar {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 12px 7px;
  min-height: 36px;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(18, 9, 44, 0.94) 0%, var(--ahud-bg) 100%);
  border: 1.5px solid rgba(44, 245, 255, 0.65);
  box-shadow:
    0 0 16px rgba(44, 245, 255, 0.28),
    0 4px 14px rgba(0, 0, 0, 0.65),
    inset 0 0 12px rgba(255, 56, 199, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ahud-bar.ahud-tier-glow {
  border-color: var(--ahud-gold);
  box-shadow:
    0 0 24px rgba(255, 212, 71, 0.65),
    0 0 40px rgba(44, 245, 255, 0.35),
    inset 0 0 16px rgba(255, 212, 71, 0.25);
}

.ahud-solo {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ahud-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ahud-cyan);
  text-shadow: 0 0 8px rgba(44, 245, 255, 0.55);
  white-space: nowrap;
}

.ahud-score {
  font-size: clamp(1.18rem, 4.4vw, 1.72rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ahud-gold);
  text-shadow:
    0 0 12px rgba(255, 212, 71, 0.72),
    0 0 24px rgba(255, 160, 32, 0.35),
    0 2px 3px rgba(0, 0, 0, 0.95);
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), color 0.18s ease;
  white-space: nowrap;
}

.ahud-score.ahud-pop {
  transform: scale(1.1);
  color: #fff6b8;
}

.ahud-next {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(44, 245, 255, 0.1);
  border: 1px solid rgba(44, 245, 255, 0.35);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #d9f9ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ahud-next b {
  color: var(--ahud-emerald);
}

/* 2-Player / Vs-AI Split */
.ahud-dual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.ahud-pbox {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 1px 6px;
  border-radius: 7px;
  transition: background 0.18s ease, opacity 0.18s ease;
}

.ahud-pbox.ahud-active {
  background: rgba(255, 212, 71, 0.13);
  box-shadow: inset 0 0 8px rgba(255, 212, 71, 0.2);
}

.ahud-pbox.ahud-dim {
  opacity: 0.72;
}

.ahud-pbox .ahud-score {
  font-size: clamp(1.02rem, 3.8vw, 1.48rem);
}

.ahud-pbox.ahud-p2 .ahud-label {
  color: var(--ahud-pink);
  text-shadow: 0 0 8px rgba(255, 56, 199, 0.55);
}

.ahud-pbox.ahud-p2 .ahud-score {
  color: #7bf4ff;
  text-shadow: 0 0 10px rgba(44, 245, 255, 0.65), 0 2px 3px rgba(0, 0, 0, 0.95);
}

.ahud-vs {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

/* Slim milestone progress bar along bottom edge */
.ahud-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
}

.ahud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ahud-cyan), var(--ahud-emerald), var(--ahud-gold));
  box-shadow: 0 0 8px rgba(44, 245, 255, 0.8);
  transition: width 0.22s ease-out;
}

/* Mobile 390px refinements */
@media (max-width: 520px) {
  .ahud-bar {
    padding: 4px 10px 6px;
    min-height: 33px;
    border-radius: 9px;
    gap: 6px;
  }
  .ahud-label {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }
  .ahud-next {
    font-size: 0.6rem;
    padding: 1px 6px;
  }
  .arcade-top-hud.ahud-top-overlay {
    width: calc(100% - 12px);
    top: 3px;
  }
}

/* Non-blocking Milestone Celebration FX */
#arcade-milestone-fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9996;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  filter: none !important;
}

#arcade-milestone-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9995;
  opacity: 0;
}

#arcade-milestone-glow.ahud-glow-run {
  animation: ahudEdgeGlow 1.15s ease-out forwards;
}

@keyframes ahudEdgeGlow {
  0% {
    opacity: 0;
    box-shadow: inset 0 0 0 0 var(--ahud-fx-color, #2cf5ff);
  }
  18% {
    opacity: 1;
    box-shadow:
      inset 0 0 42px 6px var(--ahud-fx-color, #2cf5ff),
      inset 0 0 90px 10px rgba(255, 212, 71, 0.35);
  }
  100% {
    opacity: 0;
    box-shadow: inset 0 0 12px 0 transparent;
  }
}

#arcade-milestone-banner {
  position: fixed;
  top: clamp(54px, 11vh, 96px);
  left: 50%;
  transform: translate(-50%, -14px) scale(0.8);
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 22px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 25%, rgba(36, 14, 72, 0.96), rgba(9, 4, 22, 0.96));
  border: 2px solid var(--ahud-fx-color, #ffd447);
  box-shadow:
    0 0 28px var(--ahud-fx-color, #ffd447),
    0 0 60px rgba(44, 245, 255, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.75);
  text-align: center;
  max-width: min(92vw, 380px);
}

#arcade-milestone-banner.ahud-banner-run {
  animation: ahudBannerPop 1.25s cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
}

.ahud-banner-title {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: clamp(1.15rem, 5vw, 1.65rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff6c9;
  text-shadow:
    0 0 12px var(--ahud-fx-color, #ffd447),
    0 0 24px #ff38c7,
    0 2px 4px rgba(0, 0, 0, 0.9);
  line-height: 1.05;
}

.ahud-banner-sub {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: clamp(0.72rem, 2.8vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2cf5ff;
  text-shadow: 0 0 8px rgba(44, 245, 255, 0.65);
}

@keyframes ahudBannerPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.72);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, 0px) scale(1.07);
  }
  26% {
    opacity: 1;
    transform: translate(-50%, 0px) scale(1);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -2px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -16px) scale(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ahud-score {
    transition: none;
  }
  #arcade-milestone-glow.ahud-glow-run,
  #arcade-milestone-banner.ahud-banner-run {
    animation-duration: 0.45s;
  }
}
