.cursor-sparkle-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.cursor-sparkle {
  position: absolute;
  width: var(--sparkle-size);
  height: var(--sparkle-size);
  pointer-events: none;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 7px var(--sparkle-color));
  animation: cursor-sparkle-fade 900ms ease-out forwards;
  will-change: transform, opacity;
}

.cursor-sparkle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sparkle-color);
  clip-path: polygon(50% 0, 61% 37%, 100% 50%, 61% 63%, 50% 100%, 39% 63%, 0 50%, 39% 37%);
}

.cursor-sparkle::after {
  content: "";
  position: absolute;
  inset: 40%;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 5px 1px #ffffffb3;
}

@keyframes cursor-sparkle-fade {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--sparkle-rotation)) scale(.35); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--sparkle-rotation)) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sparkle-drift)), calc(-50% + 22px)) rotate(calc(var(--sparkle-rotation) + 60deg)) scale(.15); }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-sparkle-layer { display: none; }
}
