:where(.rescue-work, .rescue-results, .memory-results) { position: relative; isolation: isolate; }

.celebration {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  --celebration-center: 51%;
  --celebration-length: 1.82s;
}
.celebration-grand { --celebration-length: 2.25s; }
.celebration[data-placement='result'] { --celebration-center: 32%; }
.celebration[data-placement='memory'] { --celebration-center: 42%; }
.celebration-light {
  position: absolute;
  left: 50%;
  top: var(--celebration-center);
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8bc39, var(--celebration-accent) 36%, transparent 66%);
  animation: celebration-light 1s ease-out both;
}
.celebration-light::before, .celebration-light::after {
  content: '';
  position: absolute;
  inset: 19%;
  border: 3px solid #fff7b2;
  border-radius: 50%;
  box-shadow: 0 0 14px #fffad6c4, inset 0 0 8px #fff9cfbb;
}
.celebration-light::after { inset: 9%; border-width: 1px; }
.celebration-piece {
  position: absolute;
  left: 50%;
  top: var(--celebration-center);
  width: 7px;
  height: 12px;
  border-radius: 2px;
  background: var(--piece);
  box-shadow: 0 0 8px #fff8d58c;
  animation: celebration-piece var(--celebration-length) cubic-bezier(.16,.73,.31,1) var(--delay) both;
}
.celebration-star {
  width: 22px;
  height: 22px;
  clip-path: polygon(50% 0, 61% 36%, 100% 50%, 61% 64%, 50% 100%, 39% 64%, 0 50%, 39% 36%);
}
.celebration-grand .celebration-star { width: 28px; height: 28px; }
.celebration-badge {
  position: absolute;
  left: 50%;
  bottom: 8%;
  display: grid;
  gap: 3px;
  min-width: max-content;
  padding: 8px 17px;
  transform: translateX(-50%);
  border: 2px solid #ffe990;
  border-radius: 18px;
  color: #2b1936;
  background: linear-gradient(160deg, #fffef1, #ffe6aa);
  box-shadow: 0 5px 22px #60316165, 0 0 17px #fff19c63;
  text-align: center;
  animation: celebration-badge var(--celebration-length) ease-out both;
}
.celebration-badge strong { font-size: clamp(1.15rem, 5vw, 1.65rem); line-height: 1; }
.celebration[data-placement='slice'] .celebration-badge { top: 16%; bottom: auto; }
.color-reveal.is-success, #section-review.is-success { box-shadow: inset 0 0 0 2px #eac558, 0 0 16px #fff4bfad; }
.rescue-reveal.is-success { border-color: #aa8a48; }
.rescue-reveal.is-success h2 { color: #fff0b3; }
.celebrated-result #rescue-total, .celebrated-result #memory-verdict { display: inline-block; margin-block: 7px 12px; padding: 6px 13px; border: 1px solid #9f803c; border-radius: 999px; color: #fff0b3; background: #564522; font-weight: 800; }

@keyframes celebration-light {
  0% { transform: translate(-50%, -50%) scale(.16); opacity: .72; }
  45% { opacity: .45; }
  100% { transform: translate(-50%, -50%) scale(1.45); opacity: 0; }
}
@keyframes celebration-piece {
  0% { transform: translate(-50%, -50%) scale(.15); opacity: 0; }
  9% { opacity: 1; }
  71% { opacity: .92; }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--spin)); opacity: 0; }
}
@keyframes celebration-badge {
  0% { transform: translate(-50%, 12px) scale(.8); opacity: 0; }
  15% { transform: translate(-50%, 0) scale(1.05); opacity: 1; }
  25%, 78% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -5px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .celebration-light { display: none; }
  .celebration-badge { animation: none; }
}
