@property --n {
  syntax: "<integer>";
  initial-value: 29;
  inherits: false;
}
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);
}

.bt {
  --travel: 24px;
  box-sizing: border-box;
  width: min(300px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border: 2px solid #17141a;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  color: #17141a;
}

.bt__plan {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.bt__price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: #2f6df6;
}

.bt__cur {
  font-size: 20px;
  line-height: 28px;
  font-weight: 800;
}

.bt__num {
  --n: 29;
  counter-reset: n var(--n);
  font-size: 40px;
  line-height: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bt__num::after {
  content: counter(n);
}

.bt__unit {
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
  color: #17141a;
}

.bt__badgerow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
}

.bt__badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #2f6df6;
  color: #ffffff;
  font-size: 11px;
  line-height: 14px;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.7) translateY(6px);
}

.bt__switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bt__lab {
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  opacity: 0.45;
}

.bt__pill {
  position: relative;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  width: 52px;
  height: 28px;
  border: 2px solid #17141a;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
}

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

.bt__knob {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #17141a;
}

.bt__pill[aria-checked=true] {
  background: #2f6df6;
  border-color: #2f6df6;
}

.bt__pill[aria-checked=true] .bt__knob {
  transform: translateX(var(--travel));
  background: #ffffff;
}

.bt[data-period=month] .bt__lab[data-side=m],
.bt[data-period=year] .bt__lab[data-side=y] {
  opacity: 1;
}

.bt[data-period=year] .bt__num {
  --n: 23;
}

.bt[data-period=year] .bt__badge {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.bt:not(.is-demo) .bt__num {
  transition-property: --n;
  transition-duration: 520ms;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bt:not(.is-demo) .bt__knob {
  transition-property: transform, background-color;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bt:not(.is-demo) .bt__badge {
  transition-property: transform, opacity;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
}

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

@keyframes bt-roll {
  0% {
    --n: 29;
  }
  12% {
    --n: 29;
  }
  36% {
    --n: 23;
  }
  64% {
    --n: 23;
  }
  88% {
    --n: 29;
  }
  100% {
    --n: 29;
  }
}
.bt.is-demo .bt__knob {
  animation-name: bt-knob, bt-knobc;
  animation-duration: 2s, 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1), steps(1, end);
  animation-iteration-count: infinite, infinite;
}

@keyframes bt-knob {
  0%, 12% {
    transform: translateX(0);
  }
  36%, 64% {
    transform: translateX(var(--travel));
  }
  88%, 100% {
    transform: translateX(0);
  }
}
@keyframes bt-knobc {
  0% {
    background-color: #17141a;
  }
  24% {
    background-color: #ffffff;
  }
  76% {
    background-color: #ffffff;
  }
  88% {
    background-color: #17141a;
  }
  100% {
    background-color: #17141a;
  }
}
.bt.is-demo .bt__pill {
  animation-name: bt-pill;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes bt-pill {
  0% {
    background-color: #ffffff;
    border-color: #17141a;
  }
  24% {
    background-color: #2f6df6;
    border-color: #2f6df6;
  }
  76% {
    background-color: #2f6df6;
    border-color: #2f6df6;
  }
  88% {
    background-color: #ffffff;
    border-color: #17141a;
  }
  100% {
    background-color: #ffffff;
    border-color: #17141a;
  }
}
.bt.is-demo .bt__lab {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.bt.is-demo .bt__lab[data-side=m] {
  animation-name: bt-lab-m;
}

.bt.is-demo .bt__lab[data-side=y] {
  animation-name: bt-lab-y;
}

@keyframes bt-lab-m {
  0% {
    opacity: 1;
  }
  24% {
    opacity: 0.45;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@keyframes bt-lab-y {
  0% {
    opacity: 0.45;
  }
  24% {
    opacity: 1;
  }
  82% {
    opacity: 0.45;
  }
  100% {
    opacity: 0.45;
  }
}
.bt.is-demo .bt__badge {
  animation-name: bt-badge-face, bt-badge-pop;
  animation-duration: 2s, 2s;
  animation-timing-function: steps(1, end), cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite, infinite;
}

@keyframes bt-badge-face {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  82% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@keyframes bt-badge-pop {
  0%, 30% {
    transform: scale(0.7) translateY(6px);
  }
  44% {
    transform: scale(1.06) translateY(0);
  }
  54%, 100% {
    transform: scale(1) translateY(0);
  }
}
.bt.is-demo .bt__price {
  animation-name: bt-pop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes bt-pop {
  0%, 10% {
    transform: scale(1);
  }
  22% {
    transform: scale(1.06);
  }
  34%, 74% {
    transform: scale(1);
  }
  84% {
    transform: scale(1.05);
  }
  94%, 100% {
    transform: scale(1);
  }
}
@media (max-width: 340px) {
  .bt {
    width: min(260px, 90vw);
    gap: 4px;
    padding: 12px;
  }
  .bt__plan {
    font-size: 12px;
    line-height: 16px;
  }
  .bt__cur {
    font-size: 16px;
    line-height: 22px;
  }
  .bt__num {
    font-size: 30px;
    line-height: 34px;
  }
  .bt__badgerow {
    height: 20px;
  }
  .bt {
    --travel: 22px;
  }
  .bt__pill {
    width: 46px;
    height: 24px;
  }
  .bt__knob {
    width: 16px;
    height: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bt.is-demo .bt__num,
  .bt.is-demo .bt__knob,
  .bt.is-demo .bt__pill,
  .bt.is-demo .bt__lab,
  .bt.is-demo .bt__badge,
  .bt.is-demo .bt__price {
    animation: none !important;
  }
  .bt:not(.is-demo) .bt__num,
  .bt:not(.is-demo) .bt__knob,
  .bt:not(.is-demo) .bt__badge {
    transition: none !important;
  }
  .bt.is-demo .bt__lab[data-side=m] {
    opacity: 1;
  }
}
