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

.ch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.ch__unit {
  position: relative;
  display: flex;
  gap: 8px;
}

.ch__input {
  position: absolute;
  inset: 0;
  z-index: 10;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ch__scale {
  position: relative;
  width: 14px;
  height: 160px;
}

.ch__num {
  position: absolute;
  left: 0;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  color: rgba(23, 20, 26, 0.72);
}

.ch__num--zero {
  top: 25px;
  color: #17141a;
}

.ch__num--one {
  bottom: 25px;
}

.ch__input:checked ~ .ch__scale .ch__num--zero {
  color: rgba(23, 20, 26, 0.72);
}

.ch__input:checked ~ .ch__scale .ch__num--one {
  color: #17141a;
}

.ch__track {
  --travel: 96px;
  position: relative;
  width: 64px;
  height: 160px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(23, 20, 26, 0.92), rgba(23, 20, 26, 0.8));
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(255, 247, 230, 0.25), 0 2px 0 rgba(255, 255, 255, 0.7);
}

.ch__input:focus-visible ~ .ch__track {
  outline: 2px solid #17141a;
  outline-offset: 3px;
}

.ch__detent {
  position: absolute;
  left: 26px;
  width: 12px;
  height: 2px;
  border-radius: 0;
  background: rgba(255, 247, 230, 0.5);
}

.ch__detent--top {
  top: 31px;
}

.ch__detent--bottom {
  bottom: 31px;
}

.ch__knob {
  position: absolute;
  left: 9px;
  top: 9px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 247, 230, 0.6) 45%, rgba(255, 255, 255, 0.35) 78%, rgba(23, 20, 26, 0.22));
  box-shadow: 0 3px 5px rgba(23, 20, 26, 0.4), inset 0 -3px 6px rgba(23, 20, 26, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(0);
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1), box-shadow 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.ch__knob::before {
  content: "";
  position: absolute;
  left: 16%;
  top: 12%;
  width: 44%;
  height: 32%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.ch__input:checked ~ .ch__track .ch__knob {
  transform: translateY(var(--travel));
  box-shadow: 0 9px 14px rgba(23, 20, 26, 0.34), inset 0 -3px 6px rgba(23, 20, 26, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ch.is-demo .ch__knob {
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

.ch.is-demo .ch__unit--a .ch__knob {
  animation-name: chSlideDown;
}

.ch.is-demo .ch__unit--b .ch__knob {
  animation-name: chSlideUp;
}

@keyframes chSlideDown {
  0%, 8% {
    transform: translateY(0);
  }
  36% {
    transform: translateY(calc(var(--travel) + 4px));
  }
  42% {
    transform: translateY(calc(var(--travel) - 3px));
  }
  46%, 60% {
    transform: translateY(var(--travel));
  }
  86% {
    transform: translateY(-4px);
  }
  90% {
    transform: translateY(2px);
  }
  94%, 100% {
    transform: translateY(0);
  }
}
@keyframes chSlideUp {
  0%, 8% {
    transform: translateY(var(--travel));
  }
  36% {
    transform: translateY(-4px);
  }
  42% {
    transform: translateY(3px);
  }
  46%, 60% {
    transform: translateY(0);
  }
  86% {
    transform: translateY(calc(var(--travel) + 4px));
  }
  90% {
    transform: translateY(calc(var(--travel) - 3px));
  }
  94%, 100% {
    transform: translateY(var(--travel));
  }
}
.ch.is-demo .ch__num {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.ch.is-demo .ch__unit--a .ch__num--zero {
  animation-name: chEmphA;
}

.ch.is-demo .ch__unit--a .ch__num--one {
  animation-name: chEmphB;
}

.ch.is-demo .ch__unit--b .ch__num--zero {
  animation-name: chEmphB;
}

.ch.is-demo .ch__unit--b .ch__num--one {
  animation-name: chEmphA;
}

@keyframes chEmphA {
  0% {
    color: #17141a;
  }
  46% {
    color: rgba(23, 20, 26, 0.72);
  }
  90% {
    color: #17141a;
  }
  100% {
    color: #17141a;
  }
}
@keyframes chEmphB {
  0% {
    color: rgba(23, 20, 26, 0.72);
  }
  46% {
    color: #17141a;
  }
  90% {
    color: rgba(23, 20, 26, 0.72);
  }
  100% {
    color: rgba(23, 20, 26, 0.72);
  }
}
@media (max-width: 340px) {
  .ch {
    gap: 12px;
  }
  .ch__unit {
    gap: 4px;
  }
  .ch__scale {
    width: 12px;
    height: 120px;
  }
  .ch__num {
    font-size: 12px;
  }
  .ch__num--zero {
    top: 18px;
  }
  .ch__num--one {
    bottom: 18px;
  }
  .ch__track {
    --travel: 72px;
    width: 48px;
    height: 120px;
  }
  .ch__detent {
    left: 18px;
  }
  .ch__detent--top {
    top: 23px;
  }
  .ch__detent--bottom {
    bottom: 23px;
  }
  .ch__knob {
    left: 7px;
    top: 7px;
    width: 34px;
    height: 34px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ch .ch__knob {
    transition: none !important;
  }
  .ch.is-demo .ch__knob {
    animation: none !important;
  }
  .ch.is-demo .ch__unit--a .ch__knob {
    transform: translateY(0) !important;
  }
  .ch.is-demo .ch__unit--b .ch__knob {
    transform: translateY(var(--travel)) !important;
  }
  .ch.is-demo .ch__num {
    animation: none !important;
  }
}
