.gate-ufo {
  --ufo-duration: 8s;
  --ufo-distance: 100vw;
  --ufo-y: 28%;
  --ufo-drift: 1.5rem;
  position: absolute;
  left: 0;
  top: var(--ufo-y);
  z-index: 2;
  width: clamp(5.1rem, 8.5vw, 7.2rem);
  height: clamp(3.2rem, 5.5vw, 4.5rem);
  display: block;
  color: var(--arcade-primary);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-140%, 0, 0);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.75));
  text-decoration: none;
  will-change: transform, opacity;
}

.gate-ufo[hidden] { display: none !important; }

.gate-ufo.is-flying {
  opacity: 0.82;
  pointer-events: auto;
  animation: gateUfoFly var(--ufo-duration) linear forwards;
}

.gate-ufo.is-flying.from-right {
  animation-name: gateUfoFlyReverse;
}

.gate-ufo:hover,
.gate-ufo:focus-visible {
  opacity: 1;
  animation-play-state: paused;
  outline: 1px dashed var(--arcade-secondary);
  outline-offset: 0.3rem;
}

.gate-ufo-craft {
  position: absolute;
  inset: 0;
  display: block;
}

.gate-ufo-dome {
  position: absolute;
  left: 31%;
  top: 5%;
  width: 38%;
  height: 42%;
  display: block;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 50% 50% 18% 18%;
  background: linear-gradient(135deg, rgba(232, 248, 245, 0.78), rgba(53, 103, 106, 0.38) 44%, #050a0b 45%);
}

.gate-ufo-hull {
  position: absolute;
  left: 3%;
  top: 34%;
  width: 94%;
  height: 37%;
  display: block;
  border: 2px solid currentColor;
  background: linear-gradient(to bottom, #b8cbc7 0 18%, #243638 19% 54%, #071012 55% 100%);
  clip-path: polygon(12% 0, 88% 0, 100% 45%, 78% 100%, 22% 100%, 0 45%);
}

.gate-ufo-keel {
  position: absolute;
  left: 23%;
  top: 68%;
  width: 54%;
  height: 16%;
  display: block;
  border: 1px solid currentColor;
  background: #050a0b;
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
}

.gate-ufo-light {
  position: absolute;
  top: 55%;
  z-index: 2;
  width: 7%;
  aspect-ratio: 1;
  display: block;
  border: 1px solid #020506;
  background: var(--arcade-secondary);
}

.gate-ufo-light:nth-of-type(4) { left: 24%; }
.gate-ufo-light:nth-of-type(5) { left: 46.5%; }
.gate-ufo-light:nth-of-type(6) { right: 24%; }

@keyframes gateUfoFly {
  0% { opacity: 0; transform: translate3d(-140%, 0, 0) rotate(-2deg); }
  7% { opacity: 0.82; }
  48% { transform: translate3d(calc(var(--ufo-distance) * 0.48), var(--ufo-drift), 0) rotate(1deg); }
  93% { opacity: 0.82; }
  100% { opacity: 0; transform: translate3d(calc(var(--ufo-distance) + 140%), 0, 0) rotate(-1deg); }
}

@keyframes gateUfoFlyReverse {
  0% { opacity: 0; transform: translate3d(calc(var(--ufo-distance) + 140%), 0, 0) rotate(2deg) scaleX(-1); }
  7% { opacity: 0.82; }
  48% { transform: translate3d(calc(var(--ufo-distance) * 0.48), var(--ufo-drift), 0) rotate(-1deg) scaleX(-1); }
  93% { opacity: 0.82; }
  100% { opacity: 0; transform: translate3d(-140%, 0, 0) rotate(1deg) scaleX(-1); }
}

html[data-mode="1999"] .gate-ufo {
  color: var(--arcade-primary);
  filter: drop-shadow(3px 3px 0 #000);
}

html[data-mode="1999"] .gate-ufo.is-flying {
  opacity: 1;
  animation-timing-function: steps(96, end);
}

html[data-mode="1999"] .gate-ufo-dome {
  border: 3px solid var(--arcade-secondary);
  border-bottom: 0;
  border-radius: 0;
  background: var(--arcade-primary);
  clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%);
}

html[data-mode="1999"] .gate-ufo-hull {
  border: 3px outset var(--arcade-line-hard);
  background: #808080;
  clip-path: polygon(15% 0, 85% 0, 100% 45%, 78% 100%, 22% 100%, 0 45%);
}

html[data-mode="1999"] .gate-ufo-keel {
  border: 2px solid var(--arcade-secondary);
  background: #000080;
}

html[data-mode="1999"] .gate-ufo-light {
  border: 0;
  background: #ff00ff;
  box-shadow: 2px 2px 0 #000;
}

@media (max-width: 720px) {
  .gate-ufo {
    width: clamp(5.2rem, 24vw, 6.6rem);
    height: clamp(3.4rem, 15vw, 4.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gate-ufo.is-flying,
  .gate-ufo.is-flying.from-right {
    right: 1rem;
    left: auto;
    opacity: 0.9;
    transform: none;
    animation: none !important;
  }
}
