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

.sf {
  --k: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 424px;
}

.sf__hint {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  color: #fff7e6;
}

.sf__ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #ffd23f;
}

.sf__field {
  position: relative;
  height: 176px;
  border-radius: 16px;
  background: rgba(255, 247, 230, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 247, 230, 0.14);
  cursor: pointer;
  overflow: hidden;
  touch-action: none;
}

.sf__field:focus-visible {
  outline: 2px solid #ffd23f;
  outline-offset: 2px;
}

.sf__ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 247, 230, 0.65);
  opacity: 0;
}

.sf__ring.is-on {
  opacity: 1;
}

.sf__ghost, .sf__chip {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.sf__ghost {
  background: rgba(255, 210, 63, 0.3);
}

.sf__ghost[style*="--g:1"] {
  background: rgba(255, 210, 63, 0.18);
}

.sf__ghost[style*="--g:2"] {
  background: rgba(255, 210, 63, 0.1);
}

.sf__chip {
  display: grid;
  place-items: center;
  background: #ffd23f;
  color: #17141a;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

.sf__chipIco {
  width: 20px;
  height: 20px;
}

.sf__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sf__dial {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: clamp(10px, 2.6vw, 11px);
  color: rgba(255, 247, 230, 0.82);
}

.sf__dial input {
  width: 64px;
  accent-color: #ffd23f;
}

.sf__val {
  min-width: 12px;
  text-align: center;
  border-radius: 4px;
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 11px);
  color: #fff7e6;
}

.sf__reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 999px;
  padding: 4px 12px;
  background: #ffd23f;
  color: #17141a;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 11px);
  line-height: 1;
}

.sf__reset .sf__ico {
  color: #17141a;
}

.sf.is-demo .sf__chip {
  animation-name: sfChase;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.sf.is-demo .sf__ghost {
  animation-name: sfChase;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
  animation-delay: calc(var(--g) * -80ms - 80ms);
}

@keyframes sfChase {
  0% {
    transform: translate(24px, 24px);
  }
  10% {
    transform: translate(calc(var(--k) * 236px), calc(var(--k) * 58px));
  }
  20% {
    transform: translate(calc(var(--k) * 352px), calc(var(--k) * 66px));
  }
  30% {
    transform: translate(calc(var(--k) * 296px), calc(var(--k) * 96px));
  }
  38% {
    transform: translate(calc(var(--k) * 330px), calc(var(--k) * 74px));
  }
  46% {
    transform: translate(calc(var(--k) * 316px), calc(var(--k) * 84px));
  }
  50% {
    transform: translate(calc(var(--k) * 316px), calc(var(--k) * 84px));
  }
  58% {
    transform: translate(calc(var(--k) * 128px), calc(var(--k) * 4px));
  }
  64% {
    transform: translate(4px, 40px);
  }
  72% {
    transform: translate(36px, 12px);
  }
  80% {
    transform: translate(20px, 30px);
  }
  88% {
    transform: translate(25px, 21px);
  }
  90% {
    transform: translate(24px, 24px);
  }
  100% {
    transform: translate(24px, 24px);
  }
}
.sf.is-demo .sf__ring {
  opacity: 0;
}

.sf.is-demo .sf__ring--away {
  animation-name: sfRingAway;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  transform: translate(calc(var(--k) * 316px), calc(var(--k) * 84px));
}

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

@keyframes sfRingAway {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}
@keyframes sfRingHome {
  0%, 50% {
    opacity: 0;
  }
  51%, 100% {
    opacity: 1;
  }
}
@media (max-width: 340px) {
  .sf {
    --k: .55;
    gap: 8px;
  }
  .sf__field {
    height: 104px;
  }
  .sf__ghost, .sf__chip {
    width: 32px;
    height: 32px;
  }
  .sf__chipIco {
    width: 16px;
    height: 16px;
  }
  .sf__dial input {
    width: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sf.is-demo .sf__chip,
  .sf.is-demo .sf__ghost,
  .sf.is-demo .sf__ring--away,
  .sf.is-demo .sf__ring--home {
    animation: none !important;
  }
  .sf.is-demo .sf__chip {
    transform: translate(24px, 24px) !important;
  }
  .sf.is-demo .sf__ghost {
    opacity: 0 !important;
  }
  .sf.is-demo .sf__ring--away {
    opacity: 0 !important;
  }
  .sf.is-demo .sf__ring--home {
    opacity: 1 !important;
    transform: translate(24px, 24px) !important;
  }
}
