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);
}

@property --pt-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 360deg;
}
.pt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
}

.pt__ring {
  position: relative;
  width: clamp(120px, 34vw, 158px);
  height: clamp(120px, 34vw, 158px);
}

.pt__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  --pt-angle: 360deg;
  --pt-fill: #17141a;
  background-image: conic-gradient(var(--pt-fill) 0deg var(--pt-angle), rgba(23, 20, 26, 0.18) var(--pt-angle) 360deg);
  animation-name: ptDrain;
  animation-duration: 25s;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: both;
  animation-play-state: paused;
}

.pt.is-running .pt__disc {
  animation-play-state: running;
}

.pt.is-break .pt__disc {
  --pt-fill: #0a4fe8;
}

@keyframes ptDrain {
  from {
    --pt-angle: 360deg;
  }
  to {
    --pt-angle: 0deg;
  }
}
.pt__hole {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  background-color: #fff7e6;
  display: grid;
  place-items: center;
  align-content: center;
}

.pt__timeWrap, .pt__phaseWrap {
  position: relative;
  display: grid;
  place-items: center;
}

.pt__time {
  font-weight: 800;
  font-size: clamp(24px, 7.2vw, 32px);
  line-height: 1.1;
  color: #17141a;
  font-variant-numeric: tabular-nums;
}

.pt__phase {
  font-weight: 700;
  font-size: clamp(9px, 2.6vw, 12px);
  color: rgba(23, 20, 26, 0.72);
}

.pt__ctrls {
  display: flex;
  gap: 8px;
}

.pt__btn {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background-color: #fff7e6;
  color: #17141a;
  font-weight: 700;
  font-size: clamp(10px, 2.6vw, 12px);
  line-height: 1;
}

.pt__btn--go {
  background-color: #17141a;
  color: #fff7e6;
}

.pt__btn:focus-visible {
  outline: 2px solid #17141a;
  outline-offset: 2px;
}

.pt__time--cut2, .pt__time--cut3, .pt__phase--cut2 {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
}

.pt.is-demo .pt__time--cut2,
.pt.is-demo .pt__time--cut3,
.pt.is-demo .pt__phase--cut2 {
  display: grid;
}

.pt.is-demo .pt__time--cut1 {
  animation-name: ptCut1;
}

.pt.is-demo .pt__time--cut2 {
  animation-name: ptCut2;
}

.pt.is-demo .pt__time--cut3 {
  animation-name: ptCut3;
}

.pt.is-demo .pt__phase--cut1 {
  animation-name: ptPhase1;
}

.pt.is-demo .pt__phase--cut2 {
  animation-name: ptPhase2;
}

.pt.is-demo .pt__time,
.pt.is-demo .pt__phase {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@keyframes ptCut1 {
  0% {
    opacity: 1;
  }
  18% {
    opacity: 0;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@keyframes ptCut2 {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  34% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@keyframes ptCut3 {
  0% {
    opacity: 0;
  }
  34% {
    opacity: 1;
  }
  88% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@keyframes ptPhase1 {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@keyframes ptPhase2 {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  88% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
.pt.is-demo .pt__disc {
  animation-name: ptLoop;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-fill-mode: none;
  animation-delay: 0s;
  animation-play-state: running;
}

@keyframes ptLoop {
  0% {
    --pt-angle: 360deg;
    animation-timing-function: linear;
  }
  44% {
    --pt-angle: 0deg;
    animation-timing-function: linear;
  }
  50% {
    --pt-angle: 0deg;
    animation-timing-function: ease-out;
  }
  88%, 100% {
    --pt-angle: 360deg;
  }
}
@media (max-width: 340px) {
  .pt {
    gap: 8px;
  }
  .pt__btn {
    padding: 4px 12px;
  }
  .pt__ctrls {
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pt__disc {
    animation: none !important;
  }
  .pt.is-demo .pt__disc,
  .pt.is-demo .pt__time,
  .pt.is-demo .pt__phase {
    animation: none !important;
  }
  .pt.is-demo .pt__time--cut2,
  .pt.is-demo .pt__time--cut3,
  .pt.is-demo .pt__phase--cut2 {
    display: none !important;
  }
}
