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

.pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

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

.pin__box {
  position: relative;
  width: 38px;
  height: 46px;
}

.pin__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(23, 20, 26, 0.28);
  border-radius: 12px;
  background: rgba(23, 20, 26, 0.08);
  color: #17141a;
  text-align: center;
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  outline: none;
  transition: border-color 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.pin__input:focus {
  border-color: #c2361a;
}

.pin__input.is-scrambling {
  color: rgba(23, 20, 26, 0.55);
}

.pin__input.is-settle {
  animation: pin-settle 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pin-settle {
  0% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}
.pin__ghost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #17141a;
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.pin__signal {
  position: relative;
  width: 22px;
  height: 22px;
  opacity: 0;
  transform: scale(0.6);
}

.pin__signal--error {
  border: 3px solid #c2361a;
  border-radius: 50%;
}

.pin__signal--error::before,
.pin__signal--error::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 10px;
  margin: -5px 0 0 -1px;
  background: #c2361a;
}

.pin__signal--error::before {
  transform: rotate(45deg);
}

.pin__signal--error::after {
  transform: rotate(-45deg);
}

.pin.is-demo .pin__ghost {
  animation: pin-ghost-fail 2s linear infinite;
}

.pin.is-demo .pin__box:nth-child(1) .pin__ghost {
  animation-delay: 0ms;
}

.pin.is-demo .pin__box:nth-child(2) .pin__ghost {
  animation-delay: 70ms;
}

.pin.is-demo .pin__box:nth-child(3) .pin__ghost {
  animation-delay: 140ms;
}

.pin.is-demo .pin__box:nth-child(4) .pin__ghost {
  animation-delay: 210ms;
}

.pin.is-demo .pin__box:nth-child(5) .pin__ghost {
  animation-delay: 280ms;
}

.pin.is-demo .pin__box:nth-child(6) .pin__ghost {
  animation-delay: 350ms;
}

@keyframes pin-ghost-fail {
  0%, 100% {
    opacity: 0;
  }
  7% {
    opacity: 1;
  }
  62% {
    opacity: 1;
  }
  68% {
    opacity: 0;
  }
}
.pin.is-demo .pin__row {
  animation: pin-shake 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes pin-shake {
  0%, 58%, 100% {
    transform: translateX(0);
  }
  61% {
    transform: translateX(-6px);
  }
  64% {
    transform: translateX(6px);
  }
  67% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
  73%, 100% {
    transform: translateX(0);
  }
}
.pin__confirm {
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  background: rgba(23, 20, 26, 0.14);
  color: #17141a;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pin__status {
  margin: 0;
  color: #c2361a;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.4;
  max-width: 220px;
  text-align: center;
}

.pin.is-demo .pin__signal--error {
  animation: pin-signal-err 2s linear infinite;
}

@keyframes pin-signal-err {
  0%, 60% {
    opacity: 0;
    transform: scale(0.6);
  }
  66% {
    opacity: 1;
    transform: scale(1.1);
  }
  73%, 84% {
    opacity: 1;
    transform: scale(1);
  }
  90%, 100% {
    opacity: 0;
    transform: scale(0.7);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pin__ghost, .pin__ghost--dot, .pin__ghost--digit, .pin__caret, .pin__signal,
  .pin__row, .pin__timer-n, .pin__resend, .pin__input {
    animation: none !important;
    transition: none !important;
  }
  .pin.is-demo .pin__ghost,
  .pin.is-demo .pin__ghost--digit {
    opacity: 1;
  }
  .pin.is-demo .pin__ghost--dot {
    opacity: 0;
  }
  .pin.is-demo .pin__caret {
    opacity: 0.9;
    transform: translateX(230px);
  }
  .pin.is-demo .pin__signal {
    opacity: 1;
    transform: scale(1);
  }
  .pin.is-demo .pin__signal--toggle::before {
    transform: translateX(16px);
  }
  .pin.is-demo .pin__resend {
    opacity: 1;
    transform: scale(1);
  }
}
