.xp-popup {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  display: grid;
  gap: 2px;
  min-width: 180px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(20, 184, 166, 0.24);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
  transform: translate(0, -50%);
  animation: xp-float 3200ms cubic-bezier(.2,.8,.2,1) forwards;
}

.xp-popup.is-centered {
  left: 50%;
  top: 126px;
}

.xp-popup-burst {
  position: absolute;
  inset: -8px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 30%, rgba(20, 184, 166, 0.20), transparent 32%),
    radial-gradient(circle at 80% 25%, rgba(245, 158, 11, 0.18), transparent 28%),
    radial-gradient(circle at 50% 80%, rgba(59, 130, 246, 0.14), transparent 34%);
  opacity: 0.75;
}

.xp-popup-value,
.xp-popup-reason {
  position: relative;
  z-index: 1;
}

.xp-popup-value {
  font-size: 1rem;
  font-weight: 800;
  color: #0f766e;
}

.xp-popup-reason {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #577082;
}

.xp-level-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(240, 247, 252, 0);
  transition: background 0.28s ease;
}

.xp-level-overlay.is-visible {
  background: rgba(240, 247, 252, 0.44);
}

.xp-level-card {
  width: min(420px, calc(100vw - 32px));
  padding: 24px 24px 22px;
  border-radius: 24px;
  border: 1px solid rgba(197, 218, 234, 0.95);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,250,255,0.98) 100%);
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.16);
  text-align: center;
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.xp-level-overlay.is-visible .xp-level-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.xp-level-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4f6d86;
}

.xp-level-card h2 {
  margin: 10px 0 8px;
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  color: #16324f;
}

.xp-level-copy {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #557083;
}

@keyframes xp-float {
  0% {
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
  }
  14% {
    transform: translate(-50%, calc(-50% - 3px)) scale(1);
    opacity: 1;
  }
  72% {
    transform: translate(-50%, calc(-50% - 28px)) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, calc(-50% - 42px)) scale(0.98);
    opacity: 0;
  }
}
