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

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

.dt__panel {
  box-sizing: border-box;
  width: clamp(196px, 62vw, 232px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 247, 230, 0.07);
  border: 1px solid rgba(255, 247, 230, 0.18);
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.dt__label {
  margin: 0;
  font-weight: 700;
  font-size: clamp(11px, 2.8vw, 13px);
  line-height: 1;
  letter-spacing: 0.14em;
  color: #fff7e6;
}

.dt__track {
  position: relative;
  box-sizing: border-box;
  width: 168px;
  height: 48px;
  border-radius: 999px;
  background: rgba(23, 20, 26, 0.8);
  box-shadow: inset 0 3px 6px rgba(23, 20, 26, 0.9), inset 0 -1px 0 rgba(255, 247, 230, 0.18);
}

.dt__fill {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 160px;
  height: 40px;
  border-radius: 999px;
  background: #0a4fe8;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 300ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.dt__knob {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 2;
  box-sizing: border-box;
  width: 44px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: grab;
  border-radius: 999px;
  touch-action: none;
  background: linear-gradient(180deg, #fff7e6, rgba(255, 247, 230, 0.72) 62%, rgba(23, 20, 26, 0.45));
  box-shadow: 0 4px 8px rgba(23, 20, 26, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateX(0);
  transition: transform 300ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

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

.dt.is-dragging .dt__knob {
  transition: none;
  cursor: grabbing;
}

.dt.is-dragging .dt__fill {
  transition: none;
}

.dt__grip {
  position: absolute;
  left: calc(50% - 7px);
  top: calc(50% - 7px);
  width: 14px;
  height: 14px;
  background: linear-gradient(90deg, rgba(23, 20, 26, 0.38) 2px, transparent 2px) 0 0/6px 100% repeat-x;
}

.dt__hint {
  margin: 0;
  font-weight: 500;
  font-size: clamp(10px, 2.4vw, 11px);
  line-height: 1;
  color: rgba(255, 247, 230, 0.78);
}

.dt__state {
  position: relative;
  margin: 0;
  width: 96px;
  height: 18px;
}

.dt__wordOff, .dt__wordOn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(12px, 3vw, 14px);
  line-height: 1;
  color: #fff7e6;
}

.dt__wordOn {
  display: none;
  color: #ffd23f;
}

.dt.is-open .dt__knob {
  transform: translateX(116px);
}

.dt.is-open .dt__fill {
  transform: scaleX(1);
}

.dt.is-open .dt__wordOff {
  display: none;
}

.dt.is-open .dt__wordOn {
  display: flex;
}

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

@keyframes dtDrag {
  0% {
    transform: translateX(0);
  }
  8% {
    transform: translateX(0);
  }
  28% {
    transform: translateX(64px);
  }
  40% {
    transform: translateX(122px);
  }
  46% {
    transform: translateX(116px);
  }
  72% {
    transform: translateX(116px);
  }
  84% {
    transform: translateX(-4px);
  }
  88% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(0);
  }
}
.dt.is-demo .dt__fill {
  animation-name: dtFill;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes dtFill {
  0% {
    transform: scaleX(0);
  }
  8% {
    transform: scaleX(0);
  }
  28% {
    transform: scaleX(0.42);
  }
  40% {
    transform: scaleX(1);
  }
  72% {
    transform: scaleX(1);
  }
  84% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(0);
  }
}
.dt.is-demo .dt__wordOn {
  display: flex;
  opacity: 0;
}

.dt.is-demo .dt__wordOff {
  opacity: 1;
}

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

@keyframes dtWordOn {
  0% {
    opacity: 0;
  }
  42% {
    opacity: 1;
  }
  82% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
.dt.is-demo .dt__wordOff {
  animation-name: dtWordOff;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes dtWordOff {
  0% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@media (max-width: 340px) {
  .dt__panel {
    gap: 4px;
    padding: 12px;
    width: clamp(168px, 86vw, 196px);
  }
  .dt__track {
    width: 144px;
    height: 40px;
  }
  .dt__fill {
    width: 136px;
    height: 32px;
  }
  .dt__knob {
    width: 40px;
    height: 32px;
  }
  .dt.is-open .dt__knob {
    transform: translateX(96px);
  }
  .dt__state {
    width: 84px;
    height: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dt .dt__knob {
    transition: none !important;
  }
  .dt .dt__fill {
    transition: none !important;
  }
  .dt.is-demo .dt__knob {
    animation: none !important;
    transform: translateX(0) !important;
  }
  .dt.is-demo .dt__fill {
    animation: none !important;
    transform: scaleX(0) !important;
  }
  .dt.is-demo .dt__wordOn {
    animation: none !important;
    opacity: 0 !important;
  }
  .dt.is-demo .dt__wordOff {
    animation: none !important;
    opacity: 1 !important;
  }
}
