.gate-key-star {
  --gate-star-flight-x: 82vw;
  --gate-star-flight-y: -68vh;
  position: relative;
  width: clamp(5.5rem, 18vw, 7.5rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.gate-key-star::before {
  content: "";
  position: absolute;
  inset: 14%;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.24);
  transform: rotate(45deg);
  transition: border-color 180ms ease, transform 180ms ease;
}

.gate-key-star:hover::before,
.gate-key-star:focus-visible::before {
  border-color: rgba(255, 255, 255, 0.75);
  transform: rotate(135deg);
}

.gate-key-star:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.4rem;
}

.gate-key-star-symbol {
  width: 64%;
  aspect-ratio: 1;
  display: block;
  color: inherit;
  background: currentColor;
  clip-path: polygon(50% 0, 59% 40%, 100% 50%, 59% 60%, 50% 100%, 41% 60%, 0 50%, 41% 40%);
  transform-origin: 50% 50%;
}

.gate-key-star.is-claiming {
  pointer-events: none;
}

.gate-key-star.is-claiming .gate-key-star-symbol {
  animation: gateKeyStarClaim 1.35s cubic-bezier(0.34, 0.02, 0.52, 0.98) forwards;
}

.gate-key-star.is-claiming::before {
  opacity: 0;
  transition: opacity 220ms ease;
}

.gate-key-star.is-claimed,
.gate-key-star:disabled {
  color: #6f7778;
  cursor: default;
}

.gate-key-star.is-claimed::before,
.gate-key-star:disabled::before {
  border-color: rgba(111, 119, 120, 0.32);
  transform: rotate(45deg);
}

.gate-key-star.is-claimed .gate-key-star-symbol,
.gate-key-star:disabled .gate-key-star-symbol {
  opacity: 0.52;
  animation: none;
  transform: none;
}

@keyframes gateKeyStarClaim {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0) scale(1); }
  16% { transform: translate3d(-0.35rem, 0.15rem, 0) rotate(-28deg) scale(1.08); }
  34% { transform: translate3d(0.45rem, -0.28rem, 0) rotate(112deg) scale(0.96); }
  52% { transform: translate3d(-0.2rem, -0.5rem, 0) rotate(270deg) scale(1.16); }
  66% { opacity: 1; transform: translate3d(0.4rem, -0.65rem, 0) rotate(480deg) scale(1.04); }
  100% { opacity: 0; transform: translate3d(var(--gate-star-flight-x), var(--gate-star-flight-y), 0) rotate(1080deg) scale(0.18); }
}

html[data-mode="1999"] .gate-key-star,
html[data-pixel="1"] .gate-key-star {
  color: #fff;
}

html[data-mode="1999"] .gate-key-star::before,
html[data-pixel="1"] .gate-key-star::before {
  border: 3px dashed var(--encounter-accent, #00ffff);
}

html[data-mode="1999"] .gate-key-star-symbol,
html[data-pixel="1"] .gate-key-star-symbol {
  filter: drop-shadow(3px 3px 0 #000);
}

html[data-mode="1999"] .gate-key-star.is-claimed,
html[data-pixel="1"] .gate-key-star.is-claimed {
  color: #808080;
}

@media (prefers-reduced-motion: reduce) {
  .gate-key-star.is-claiming .gate-key-star-symbol {
    animation: gateKeyStarClaimReduced 300ms ease forwards;
  }
}

@keyframes gateKeyStarClaimReduced {
  to { opacity: 0; transform: scale(0.72); }
}
