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

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

@property --bg {
  syntax: "<color>";
  inherits: true;
  initial-value: #2f6df6;
}
@property --rw {
  syntax: "<integer>";
  inherits: true;
  initial-value: 4;
}
@property --rf {
  syntax: "<integer>";
  inherits: true;
  initial-value: 53;
}
@property --aa {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}
@property --aaa {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@counter-style dd {
  system: numeric;
  symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9";
  pad: 2 "0";
}
.cc {
  position: relative;
  box-sizing: border-box;
  width: 288px;
  max-width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: #fff7e6;
  color: #17141a;
  font-family: inherit;
}

.cc * {
  box-sizing: border-box;
}

.cc__prev {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg);
  color: #ffffff;
}

.cc__sample {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.cc__ratio {
  counter-set: cw calc(var(--rw)) cf calc(var(--rf));
  white-space: nowrap;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.cc__ratio::after {
  content: counter(cw) "." counter(cf, dd) " : 1";
}

.cc__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cc__badge {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(23, 20, 26, 0.72);
  color: #ffffff;
}

.cc__badge::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #2f6df6;
}

.cc__badge--aa::before {
  opacity: var(--aa);
}

.cc__badge--aaa::before {
  opacity: var(--aaa);
}

.cc__grade {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.cc__grade::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: currentColor;
  transform-origin: left center;
}

.cc__badge--aa .cc__grade::after {
  transform: scaleX(calc(1 - var(--aa)));
}

.cc__badge--aaa .cc__grade::after {
  transform: scaleX(calc(1 - var(--aaa)));
}

.cc__state {
  position: relative;
  z-index: 1;
  display: grid;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.cc__state > i {
  grid-area: 1/1;
  font-style: normal;
  white-space: nowrap;
}

.cc__badge--aa .cc__pass {
  opacity: var(--aa);
}

.cc__badge--aa .cc__fail {
  opacity: calc(1 - var(--aa));
}

.cc__badge--aaa .cc__pass {
  opacity: var(--aaa);
}

.cc__badge--aaa .cc__fail {
  opacity: calc(1 - var(--aaa));
}

.cc__input {
  margin-left: auto;
  width: 32px;
  height: 26px;
  padding: 0;
  border: 2px solid rgba(23, 20, 26, 0.16);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.cc__sws {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.cc__sw {
  width: 100%;
  padding: 4px 0;
  border: 0;
  border-radius: 4px;
  background: rgba(23, 20, 26, 0.08);
  color: #17141a;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
}

.cc__sw:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 2px;
}

.cc__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cc.is-demo {
  animation-name: ccStep;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.cc.is-demo .cc__badge {
  animation-name: ccPop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.cc.is-demo .cc__badge--aaa {
  animation-delay: 80ms;
}

@keyframes ccStep {
  0% {
    --bg: #8aa9ff;
    --rw: 2;
    --rf: 28;
    --aa: 0;
    --aaa: 0;
  }
  18% {
    --bg: #4d8bf0;
    --rw: 3;
    --rf: 35;
    --aa: 0;
    --aaa: 0;
  }
  36% {
    --bg: #2f6df6;
    --rw: 4;
    --rf: 53;
    --aa: 1;
    --aaa: 0;
  }
  54% {
    --bg: #1f4fb8;
    --rw: 7;
    --rf: 32;
    --aa: 1;
    --aaa: 1;
  }
  72% {
    --bg: #17141a;
    --rw: 18;
    --rf: 24;
    --aa: 1;
    --aaa: 1;
  }
  90%, 100% {
    --bg: #8aa9ff;
    --rw: 2;
    --rf: 28;
    --aa: 0;
    --aaa: 0;
  }
}
@keyframes ccPop {
  0% {
    transform: scale(0.8);
  }
  6% {
    transform: scale(1.06);
  }
  11%, 16% {
    transform: scale(1);
  }
  18% {
    transform: scale(0.8);
  }
  24% {
    transform: scale(1.06);
  }
  29%, 34% {
    transform: scale(1);
  }
  36% {
    transform: scale(0.8);
  }
  42% {
    transform: scale(1.06);
  }
  47%, 52% {
    transform: scale(1);
  }
  54% {
    transform: scale(0.8);
  }
  60% {
    transform: scale(1.06);
  }
  65%, 70% {
    transform: scale(1);
  }
  72% {
    transform: scale(0.8);
  }
  78% {
    transform: scale(1.06);
  }
  83%, 88% {
    transform: scale(1);
  }
  90% {
    transform: scale(0.8);
  }
  96% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cc.is-demo,
  .cc.is-demo .cc__badge {
    animation: none !important;
  }
}
