@property --n {
  syntax: "<integer>";
  inherits: false;
  initial-value: 0;
}
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);
}

.cp {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 164px;
  justify-content: center;
}

.cp__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cp__label {
  font-weight: 500;
  font-size: 11px;
  line-height: 1.3;
  color: rgba(23, 20, 26, 0.78);
}

.cp__done {
  font-weight: 700;
  font-size: 11px;
  color: #17141a;
  position: relative;
}

.is-demo .cp__done {
  color: transparent;
  counter-reset: cpn var(--n);
}

.is-demo .cp__done::after {
  content: counter(cpn);
  position: absolute;
  inset: 0;
  color: #17141a;
}

.cp__toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 20, 26, 0.1);
  color: #17141a;
  cursor: pointer;
  padding: 0;
}

.cp__icon-pause, .cp__icon-play {
  position: absolute;
  inset: 0;
  margin: auto;
}

.cp__icon-play {
  opacity: 0;
}

.cp.is-paused .cp__icon-pause {
  opacity: 0;
}

.cp.is-paused .cp__icon-play {
  opacity: 1;
}

.cp__segs {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cp__seg {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 4px;
  background: rgba(23, 20, 26, 0.14);
  overflow: hidden;
}

.cp__segfill {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: #4cd4a6;
  opacity: 0;
}

.cp.is-paused .cp__seg {
  animation: cpPausePulse 2s ease-out infinite;
}

.cp__bar {
  display: flex;
  justify-content: flex-end;
}

.cp__meta {
  font-weight: 500;
  font-size: 10px;
  color: rgba(23, 20, 26, 0.6);
}

@keyframes cpPausePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(23, 20, 26, 0);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(23, 20, 26, 0.18);
  }
}
@keyframes cpSeg1 {
  0% {
    opacity: 0;
  }
  4% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  91% {
    opacity: 1;
  }
  92% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpSeg2 {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  91% {
    opacity: 1;
  }
  92% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpSeg3 {
  0% {
    opacity: 0;
  }
  16% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  91% {
    opacity: 1;
  }
  92% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpSeg4 {
  0% {
    opacity: 0;
  }
  60% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  91% {
    opacity: 1;
  }
  92% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpSeg5 {
  0% {
    opacity: 0;
  }
  68% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  91% {
    opacity: 1;
  }
  92% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpSeg6 {
  0% {
    opacity: 0;
  }
  76% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  91% {
    opacity: 1;
  }
  92% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpCount {
  0% {
    --n: 0;
  }
  4% {
    --n: 1;
    animation-timing-function: steps(1, end);
  }
  10% {
    --n: 2;
    animation-timing-function: steps(1, end);
  }
  16% {
    --n: 3;
    animation-timing-function: steps(1, end);
  }
  54% {
    --n: 3;
  }
  60% {
    --n: 4;
    animation-timing-function: steps(1, end);
  }
  68% {
    --n: 5;
    animation-timing-function: steps(1, end);
  }
  76% {
    --n: 6;
    animation-timing-function: steps(1, end);
  }
  88% {
    --n: 6;
  }
  92% {
    --n: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    --n: 0;
  }
}
@keyframes cpIconPause {
  0% {
    opacity: 1;
  }
  18% {
    opacity: 1;
  }
  18.1% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  54% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  54.1% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  88.1% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 0;
  }
}
@keyframes cpIconPlay {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 0;
  }
  18.1% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  54% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  54.1% {
    opacity: 0;
  }
  88% {
    opacity: 0;
  }
  88.1% {
    opacity: 1;
    animation-timing-function: steps(1, end);
  }
  100% {
    opacity: 1;
  }
}
.is-demo .cp__seg:nth-child(1) .cp__segfill {
  animation: cpSeg1 2s linear infinite;
}

.is-demo .cp__seg:nth-child(2) .cp__segfill {
  animation: cpSeg2 2s linear infinite;
}

.is-demo .cp__seg:nth-child(3) .cp__segfill {
  animation: cpSeg3 2s linear infinite;
}

.is-demo .cp__seg:nth-child(4) .cp__segfill {
  animation: cpSeg4 2s linear infinite;
}

.is-demo .cp__seg:nth-child(5) .cp__segfill {
  animation: cpSeg5 2s linear infinite;
}

.is-demo .cp__seg:nth-child(6) .cp__segfill {
  animation: cpSeg6 2s linear infinite;
}

.is-demo .cp__done {
  animation: cpCount 2s steps(1, end) infinite;
}

.is-demo .cp__icon-pause {
  animation: cpIconPause 2s linear infinite;
}

.is-demo .cp__icon-play {
  animation: cpIconPlay 2s linear infinite;
}

@media (max-width: 340px) {
  .cp__toggle {
    width: 22px;
    height: 22px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .is-demo .cp__segfill, .is-demo .cp__done, .is-demo .cp__icon-pause, .is-demo .cp__icon-play {
    animation: none !important;
  }
  .is-demo .cp__seg:nth-child(-n+3) .cp__segfill {
    opacity: 1 !important;
  }
}
