html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ffffff;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.totop {
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 999px;
  background: #17141a;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  cursor: pointer;
}

.totop__rocket {
  width: 26px;
  height: 30px;
  transform-origin: center bottom;
}

.totop__body {
  fill: #ffffff;
}

.totop__window {
  fill: #17141a;
}

.totop__fin {
  fill: #fff7e6;
}

.totop__flame {
  fill: #ff4d1f;
  transform-origin: center top;
  opacity: 0;
}

.totop:hover .totop__rocket,
.totop:focus-visible .totop__rocket {
  animation: rocket-launch 700ms ease-out 1;
}

.totop:hover .totop__flame,
.totop:focus-visible .totop__flame {
  animation: flame-flicker 700ms ease-out 1;
}

.totop.is-demo .totop__rocket {
  animation: rocket-launch-loop 2s ease-out infinite;
}

.totop.is-demo .totop__flame {
  animation: flame-flicker-loop 2s ease-out infinite;
}

@keyframes rocket-launch {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  40% {
    transform: translateY(-9px) rotate(-9deg);
  }
  100% {
    transform: translateY(-2px) rotate(-4deg);
  }
}
@keyframes flame-flicker {
  0%, 100% {
    opacity: 0;
    transform: scaleY(0.6);
  }
  40% {
    opacity: 1;
    transform: scaleY(1.3);
  }
  70% {
    opacity: 0.7;
    transform: scaleY(0.9);
  }
}
@keyframes rocket-launch-loop {
  0%, 55% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(-9px) rotate(-9deg);
  }
  100% {
    transform: translateY(-2px) rotate(-4deg);
  }
}
@keyframes flame-flicker-loop {
  0%, 55%, 100% {
    opacity: 0;
    transform: scaleY(0.6);
  }
  75% {
    opacity: 1;
    transform: scaleY(1.3);
  }
  90% {
    opacity: 0.7;
    transform: scaleY(0.9);
  }
}
@media (prefers-reduced-motion: reduce) {
  .totop:hover .totop__rocket, .totop:focus-visible .totop__rocket,
  .totop.is-demo .totop__rocket,
  .totop:hover .totop__flame, .totop:focus-visible .totop__flame,
  .totop.is-demo .totop__flame {
    animation: none;
  }
}
