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

.cm {
  display: grid;
  place-items: center;
  width: 100%;
}

.cm__panel {
  box-sizing: border-box;
  width: clamp(196px, 60vw, 228px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(23, 20, 26, 0.14), inset 0 0 0 1px rgba(23, 20, 26, 0.1);
}

.cm__label {
  margin: 0;
  font-weight: 700;
  font-size: clamp(12px, 3vw, 14px);
  line-height: 1;
  color: #17141a;
}

.cm__switch {
  --travel: 48px;
  position: relative;
  box-sizing: border-box;
  width: 96px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  background: rgba(23, 20, 26, 0.16);
  box-shadow: inset 0 2px 4px rgba(23, 20, 26, 0.22);
  transition: background-color 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cm__switch:focus-visible {
  outline: 2px solid #0a4fe8;
  outline-offset: 2px;
}

.cm__knob {
  position: absolute;
  left: 4px;
  top: 4px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(23, 20, 26, 0.34);
  transform: translateX(0);
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cm__check {
  width: 22px;
  height: 22px;
  overflow: visible;
}

.cm__check polyline {
  fill: none;
  stroke: #0a4fe8;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  transition: stroke-dashoffset 220ms ease-out;
}

.cm.is-agreed .cm__switch {
  background: #0a4fe8;
}

.cm.is-agreed .cm__knob {
  transform: translateX(var(--travel));
}

.cm.is-agreed .cm__check polyline {
  stroke-dashoffset: 0;
  transition-delay: 300ms;
}

.cm.is-agreed .cm__wordOff {
  display: none;
}

.cm.is-agreed .cm__wordOn {
  display: flex;
}

.cm__state {
  position: relative;
  margin: 0;
  width: 128px;
  height: 18px;
}

.cm__wordOff, .cm__wordOn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(11px, 2.8vw, 13px);
  line-height: 1;
  color: #17141a;
}

.cm__wordOn {
  display: none;
}

.cm.is-demo .cm__knob {
  animation-name: cmSlide;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes cmSlide {
  0% {
    transform: translateX(0);
  }
  8% {
    transform: translateX(0);
  }
  28% {
    transform: translateX(var(--travel));
  }
  76% {
    transform: translateX(var(--travel));
  }
  88% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(0);
  }
}
.cm.is-demo .cm__switch {
  animation-name: cmFill;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes cmFill {
  0% {
    background: rgba(23, 20, 26, 0.16);
  }
  28% {
    background: #0a4fe8;
  }
  76% {
    background: #0a4fe8;
  }
  88% {
    background: rgba(23, 20, 26, 0.16);
  }
  100% {
    background: rgba(23, 20, 26, 0.16);
  }
}
.cm.is-demo .cm__check polyline {
  animation-name: cmDraw;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-delay: 300ms;
  animation-fill-mode: backwards;
}

@keyframes cmDraw {
  0% {
    stroke-dashoffset: 26;
  }
  16% {
    stroke-dashoffset: 0;
  }
  62% {
    stroke-dashoffset: 0;
  }
  70% {
    stroke-dashoffset: 26;
  }
  100% {
    stroke-dashoffset: 26;
  }
}
.cm.is-demo .cm__wordOn {
  display: flex;
  opacity: 0;
}

.cm.is-demo .cm__wordOff {
  opacity: 1;
}

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

@keyframes cmWordOn {
  0% {
    opacity: 0;
  }
  46% {
    opacity: 1;
  }
  80% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
.cm.is-demo .cm__wordOff {
  animation-name: cmWordOff;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes cmWordOff {
  0% {
    opacity: 1;
  }
  46% {
    opacity: 0;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@media (max-width: 340px) {
  .cm__panel {
    gap: 8px;
    padding: 12px;
    width: clamp(164px, 84vw, 196px);
  }
  .cm__switch {
    --travel: 40px;
    width: 80px;
    height: 40px;
  }
  .cm__knob {
    width: 32px;
    height: 32px;
  }
  .cm__check {
    width: 18px;
    height: 18px;
  }
  .cm__state {
    width: 112px;
    height: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cm .cm__knob {
    transition: none !important;
  }
  .cm .cm__switch {
    transition: none !important;
  }
  .cm .cm__check polyline {
    transition: none !important;
  }
  .cm.is-demo .cm__knob {
    animation: none !important;
    transform: translateX(0) !important;
  }
  .cm.is-demo .cm__switch {
    animation: none !important;
  }
  .cm.is-demo .cm__check polyline {
    animation: none !important;
    stroke-dashoffset: 26 !important;
  }
  .cm.is-demo .cm__wordOn {
    animation: none !important;
    opacity: 0 !important;
  }
  .cm.is-demo .cm__wordOff {
    animation: none !important;
    opacity: 1 !important;
  }
}
