.level-up-modal {
  width: min(440px, calc(100vw - 28px));
  max-width: none;
  padding: 0;
  overflow: visible;
  color: #f8f0dc;
  border: 1px solid #f2ce77;
  border-radius: 5px;
  background: transparent;
  box-shadow: 0 0 0 1px #f4d47a44, 0 0 34px #e8b94455, 0 24px 80px #000c;
  animation: level-up-glow 2.8s ease-in-out infinite;
}

.level-up-modal[open] {
  animation: level-up-enter .48s cubic-bezier(.18,.82,.22,1) both, level-up-glow 2.8s ease-in-out .48s infinite;
}

.level-up-modal::backdrop {
  background: #050711c9;
  backdrop-filter: blur(5px);
  animation: level-up-backdrop .35s ease-out both;
}

.level-up-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 30px 28px 24px;
  text-align: center;
  border-radius: 4px;
  background: radial-gradient(ellipse at 50% 4%, #b17a2630, transparent 52%), linear-gradient(150deg, #1c1c2b, #101522 68%, #171323);
}

.level-up-card::before,
.level-up-card::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.level-up-card::before {
  inset: 8px;
  border: 1px solid #eecb7660;
  border-radius: 2px;
}

.level-up-card::after {
  top: -100px;
  left: 50%;
  width: 280px;
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(circle, #ffd66a28, transparent 68%);
}

.level-up-rays {
  position: absolute;
  z-index: -1;
  top: 34px;
  left: 50%;
  width: 250px;
  height: 250px;
  transform: translateX(-50%);
  opacity: .42;
  background: repeating-conic-gradient(from 0deg, #ffe08b0c 0deg 8deg, transparent 8deg 20deg);
  mask-image: radial-gradient(circle, #000 0%, transparent 70%);
  animation: level-up-rays 24s linear infinite;
}

.level-up-card > .eyebrow {
  margin: 0 0 12px;
  color: #f1ce7d;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .2em;
}

.level-up-emblem {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 12px;
  color: #fff4ce;
  font: 700 43px/1 "DM Sans", sans-serif;
  border: 2px solid #ffe59a;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff0b6, #d99d36 48%, #70451e 100%);
  box-shadow: 0 0 0 5px #f1c96822, 0 0 24px #ffc84c99, inset 0 2px 7px #fff8;
  text-shadow: 0 2px 4px #57340d;
  animation: level-up-emblem 1.8s ease-in-out infinite;
}

.level-up-modal h2 {
  margin: 2px 0 8px;
  color: #ffe7a1;
  font: 700 clamp(30px, 8vw, 42px)/1.1 "Cinzel", Georgia, serif;
  text-shadow: 0 0 10px #f5c85d99, 0 2px 2px #000;
}

.level-up-copy {
  margin: 0 auto;
  max-width: 340px;
  color: #f2ead9;
  font-size: 15px;
  line-height: 1.55;
}

.level-up-points {
  width: fit-content;
  margin: 13px auto 0;
  padding: 7px 12px;
  color: #ffe49a;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #e9c56c66;
  border-radius: 3px;
  background: #d79b2a18;
  text-shadow: 0 0 9px #f1c44b66;
}

.level-up-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.level-up-actions .primary-button {
  min-width: 174px;
  border: 1px solid #ffe08a;
  color: #251b0e;
  background: linear-gradient(135deg, #ffe69b, #d79a37);
  box-shadow: 0 0 16px #e9b63e55;
}

.level-up-actions .primary-button:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 24px #ffcf5e99;
}

.level-up-actions .text-button {
  color: #d2c6ad;
}

@keyframes level-up-enter {
  from { opacity: 0; transform: translateY(22px) scale(.86); filter: blur(7px); }
  68% { opacity: 1; transform: translateY(-3px) scale(1.025); filter: blur(0); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes level-up-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes level-up-glow {
  0%, 100% { box-shadow: 0 0 0 1px #f4d47a33, 0 0 26px #e8b94444, 0 24px 80px #000c; }
  50% { box-shadow: 0 0 0 1px #ffe69b99, 0 0 42px #ffc84c88, 0 24px 80px #000c; }
}

@keyframes level-up-emblem {
  0%, 100% { transform: translateY(0) scale(1); filter: brightness(1); }
  50% { transform: translateY(-3px) scale(1.04); filter: brightness(1.15); }
}

@keyframes level-up-rays {
  to { transform: translateX(-50%) rotate(360deg); }
}

@media (max-width: 420px) {
  .level-up-card { padding: 26px 18px 20px; }
  .level-up-emblem { width: 68px; height: 68px; font-size: 38px; }
  .level-up-actions { flex-direction: column-reverse; }
  .level-up-actions button { width: 100%; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .level-up-modal,
  .level-up-modal[open],
  .level-up-modal::backdrop,
  .level-up-emblem,
  .level-up-rays { animation: none; }
}
