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

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

.morph {
  position: relative;
  display: grid;
  place-items: center;
  width: 200px;
  height: 56px;
  border: 0;
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
  background: #fff7e6;
  color: #ff4d1f;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
}

.morph__label,
.morph__spin,
.morph__check {
  grid-area: 1/1;
}

.morph__spin {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 77, 31, 0.25);
  border-top-color: #ff4d1f;
  border-radius: 50%;
  opacity: 0;
}

.morph__check {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #ff4d1f;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  opacity: 0;
}

.morph.is-demo {
  animation: morph-box 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.morph.is-demo .morph__label {
  animation: morph-label 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.morph.is-demo .morph__spin {
  animation: morph-spin-in 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite, morph-turn 800ms linear infinite;
}

.morph.is-demo .morph__check {
  animation: morph-draw 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes morph-box {
  0%, 10% {
    width: 200px;
  }
  28%, 62% {
    width: 56px;
  }
  84%, 100% {
    width: 200px;
  }
}
@keyframes morph-label {
  0%, 8% {
    opacity: 1;
  }
  20%, 80% {
    opacity: 0;
  }
  92%, 100% {
    opacity: 1;
  }
}
@keyframes morph-spin-in {
  0%, 22% {
    opacity: 0;
  }
  30%, 56% {
    opacity: 1;
  }
  62%, 100% {
    opacity: 0;
  }
}
@keyframes morph-turn {
  to {
    rotate: 360deg;
  }
}
@keyframes morph-draw {
  0%, 60% {
    stroke-dashoffset: 26;
    opacity: 0;
  }
  64% {
    stroke-dashoffset: 26;
    opacity: 1;
  }
  76%, 86% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  94%, 100% {
    stroke-dashoffset: 26;
    opacity: 0;
  }
}
.morph.is-busy {
  width: 56px;
}

.morph.is-busy .morph__label {
  opacity: 0;
}

.morph.is-busy .morph__spin {
  opacity: 1;
  animation: morph-turn 800ms linear infinite;
}

.morph.is-done .morph__check {
  opacity: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.morph.is-done .morph__label {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .morph.is-demo,
  .morph.is-demo .morph__label,
  .morph.is-demo .morph__spin,
  .morph.is-demo .morph__check {
    animation: none;
  }
  .morph.is-busy .morph__spin {
    animation: none;
  }
}
