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 --n {
  syntax: "<integer>";
  inherits: true;
  initial-value: 0;
}
.sg {
  --n: 0;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 12px;
  color: #fff7e6;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

.sg__dial {
  position: relative;
  display: grid;
  place-items: center;
}

.sg__svg {
  width: clamp(92px, 28vw, 104px);
  height: clamp(92px, 28vw, 104px);
  transform: rotate(-90deg);
}

.sg__seg {
  fill: none;
  stroke: #fff7e6;
  stroke-width: 10;
  stroke-linecap: butt;
  stroke-dasharray: 26 250.46;
  stroke-dashoffset: calc(var(--i) * -34.5575);
  opacity: 0.18;
  transition: opacity 220ms ease-out;
}

.sg__seg.is-on {
  opacity: 1;
}

.sg__center {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 4px;
  pointer-events: none;
}

.sg__ic {
  display: inline-flex;
  opacity: 0.7;
}

.sg__frac {
  font-size: clamp(18px, 6vw, 22px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.sg__frac::after {
  counter-reset: n var(--n);
  content: counter(n) "/8";
}

.sg__cap {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.66;
}

.sg__btn {
  border: 0;
  border-radius: 999px;
  background: #17141a;
  color: #fff7e6;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.sg__btn:hover, .sg__btn:focus-visible {
  transform: translateY(-2px);
}

.sg.is-demo .sg__seg {
  animation: 2s linear infinite;
}

.sg.is-demo .sg__seg:nth-child(1) {
  animation-name: sg-seg-0;
}

@keyframes sg-seg-0 {
  0% {
    opacity: 0.18;
  }
  2% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  87% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(2) {
  animation-name: sg-seg-1;
}

@keyframes sg-seg-1 {
  0% {
    opacity: 0.18;
  }
  5% {
    opacity: 0.18;
  }
  7% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  82% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(3) {
  animation-name: sg-seg-2;
}

@keyframes sg-seg-2 {
  0% {
    opacity: 0.18;
  }
  10% {
    opacity: 0.18;
  }
  12% {
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  77% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(4) {
  animation-name: sg-seg-3;
}

@keyframes sg-seg-3 {
  0% {
    opacity: 0.18;
  }
  15% {
    opacity: 0.18;
  }
  17% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  72% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(5) {
  animation-name: sg-seg-4;
}

@keyframes sg-seg-4 {
  0% {
    opacity: 0.18;
  }
  20% {
    opacity: 0.18;
  }
  22% {
    opacity: 1;
  }
  65% {
    opacity: 1;
  }
  67% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(6) {
  animation-name: sg-seg-5;
}

@keyframes sg-seg-5 {
  0% {
    opacity: 0.18;
  }
  25% {
    opacity: 0.18;
  }
  27% {
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  62% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(7) {
  animation-name: sg-seg-6;
}

@keyframes sg-seg-6 {
  0% {
    opacity: 0.18;
  }
  30% {
    opacity: 0.18;
  }
  32% {
    opacity: 1;
  }
  55% {
    opacity: 1;
  }
  57% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo .sg__seg:nth-child(8) {
  animation-name: sg-seg-7;
}

@keyframes sg-seg-7 {
  0% {
    opacity: 0.18;
  }
  35% {
    opacity: 0.18;
  }
  37% {
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  52% {
    opacity: 0.18;
  }
  100% {
    opacity: 0.18;
  }
}
.sg.is-demo {
  animation: sg-count 2s linear infinite;
}

@keyframes sg-count {
  0% {
    --n: 0;
  }
  37%, 50% {
    --n: 8;
  }
  87%, 100% {
    --n: 0;
  }
}
@media (max-width: 340px) {
  .sg__cap {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sg.is-demo, .sg.is-demo .sg__seg {
    animation: none !important;
  }
  .sg.is-demo {
    --n: 5;
  }
  .sg.is-demo .sg__seg:nth-child(-n+5) {
    opacity: 1;
  }
  .sg__seg, .sg__btn {
    transition: none;
  }
}
