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

@property --pct-a {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}
@property --pct-b {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}
@property --cc-n {
  syntax: "<integer>";
  inherits: true;
  initial-value: 0;
}
.cc {
  box-sizing: border-box;
  width: min(300px, 88vw);
  display: flex;
  align-items: center;
  gap: 20px;
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.cc__ring-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
}

.cc__ring {
  --pct-a: 48%;
  --pct-b: 72%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#2f6df6 0 var(--pct-a), #ffd23f var(--pct-a) var(--pct-b), rgba(23, 20, 26, 0.08) var(--pct-b) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent 60%, #000 61%);
  mask: radial-gradient(farthest-side, transparent 60%, #000 61%);
  transition: --pct-a 600ms ease-out, --pct-b 600ms ease-out;
}

.cc__center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #17141a;
}

.cc__num {
  font-size: 20px;
}

.cc__unit {
  font-size: 12px;
  margin-left: 4px;
}

.cc.is-demo .cc__num, .cc.is-demo .cc__unit {
  opacity: 0;
}

.cc__ghost {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #17141a;
}

.cc__ghost::before {
  content: counter(cc) "%";
  counter-reset: cc var(--cc-n);
}

.cc.is-demo .cc__ghost {
  display: flex;
}

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

.cc__legend-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  color: rgba(23, 20, 26, 0.4);
  transition: color 220ms ease-out;
}

.cc__legend-btn.is-on {
  color: #17141a;
}

.cc__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.cc__dot--a {
  background: #2f6df6;
}

.cc__dot--b {
  background: #ffd23f;
  border: 1px solid rgba(23, 20, 26, 0.25);
}

.cc.is-demo .cc__ring {
  animation: cc-draw 2s ease-out infinite;
}

.cc.is-demo .cc__ghost {
  animation: cc-count 2s linear infinite;
}

@keyframes cc-draw {
  0% {
    --pct-a: 0%;
    --pct-b: 0%;
  }
  65%, 100% {
    --pct-a: 48%;
    --pct-b: 72%;
  }
}
@keyframes cc-count {
  0% {
    --cc-n: 0;
  }
  65%, 100% {
    --cc-n: 72;
  }
}
@media (max-width: 340px) {
  .cc {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .cc__ring-wrap {
    width: 80px;
    height: 80px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cc.is-demo .cc__ring, .cc.is-demo .cc__ghost {
    animation: none !important;
  }
  .cc.is-demo .cc__ring {
    --pct-a: 48%;
    --pct-b: 72%;
  }
  .cc.is-demo .cc__ghost::before {
    content: "72%";
  }
  .cc__ring {
    transition: none;
  }
}
