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

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

.hd {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

.hd__dial {
  position: relative;
  width: 88px;
  height: 88px;
}

.hd__ring {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  transform: rotate(-90deg);
}

.hd__track {
  fill: none;
  stroke: #fff7e6;
  stroke-width: 6;
}

.hd__arc {
  fill: none;
  stroke: #ff4d1f;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 251.33;
  stroke-dashoffset: 251.33;
}

.hd__btn {
  position: absolute;
  left: 12px;
  top: 12px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background-color: #17141a;
  color: #fff7e6;
  cursor: pointer;
  touch-action: none;
}

.hd__btn:focus-visible {
  outline: 3px solid #17141a;
  outline-offset: 3px;
}

.hd__ic {
  display: inline-flex;
}

.hd__ic svg {
  display: block;
}

.hd:not(.is-demo) .hd__arc {
  transition: stroke-dashoffset 1200ms ease-out;
}

.hd:not(.is-demo).is-holding .hd__arc {
  stroke-dashoffset: 0;
}

.hd:not(.is-demo).is-holding .hd__btn {
  background-color: #ff4d1f;
}

.hd:not(.is-demo)[data-state=done] .hd__btn {
  background-color: #ff4d1f;
}

.hd:not(.is-demo)[data-state=done] .hd__arc {
  stroke-dashoffset: 0;
}

.hd__log {
  position: relative;
  margin: 0;
  width: 160px;
  height: 18px;
}

.hd__word {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  color: #17141a;
  opacity: 0;
}

.hd:not(.is-demo) .hd__word[data-word=idle] {
  opacity: 1;
}

.hd:not(.is-demo)[data-state=done] .hd__word[data-word=idle] {
  opacity: 0;
}

.hd:not(.is-demo)[data-state=done] .hd__word[data-word=done] {
  opacity: 1;
}

.hd.is-demo .hd__arc {
  animation-name: hd-draw;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes hd-draw {
  0% {
    stroke-dashoffset: 251.33;
  }
  10% {
    stroke-dashoffset: 251.33;
  }
  62% {
    stroke-dashoffset: 0;
  }
  84% {
    stroke-dashoffset: 0;
  }
  90% {
    stroke-dashoffset: 251.33;
  }
  100% {
    stroke-dashoffset: 251.33;
  }
}
.hd.is-demo .hd__btn {
  animation-name: hd-press;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes hd-press {
  0% {
    background-color: #17141a;
    transform: scale(1);
  }
  10% {
    background-color: #17141a;
    transform: scale(0.92);
  }
  68% {
    background-color: #ff4d1f;
    transform: scale(1.06);
  }
  86% {
    background-color: #17141a;
    transform: scale(1);
  }
  100% {
    background-color: #17141a;
    transform: scale(1);
  }
}
.hd.is-demo .hd__word {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.hd.is-demo .hd__word[data-word=idle] {
  animation-name: hd-idle;
}

.hd.is-demo .hd__word[data-word=done] {
  animation-name: hd-done;
}

@keyframes hd-idle {
  0% {
    opacity: 1;
  }
  68% {
    opacity: 0;
  }
  86% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@keyframes hd-done {
  0% {
    opacity: 0;
  }
  68% {
    opacity: 1;
  }
  86% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@media (max-width: 340px) {
  .hd {
    gap: 8px;
  }
  .hd__word {
    font-size: 11px;
    line-height: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hd.is-demo .hd__arc,
  .hd.is-demo .hd__btn,
  .hd.is-demo .hd__word {
    animation: none !important;
  }
  .hd:not(.is-demo) .hd__arc {
    transition: none !important;
  }
  .hd.is-demo .hd__word[data-word=idle] {
    opacity: 1;
  }
}
