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

.cs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 432px;
}

.cs__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cs__title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(12px, 3vw, 15px);
  color: #17141a;
}

.cs__state {
  margin: 0;
  font-weight: 700;
  font-size: clamp(9px, 2.4vw, 11px);
  color: rgba(23, 20, 26, 0.72);
}

.cs__rail {
  position: relative;
  width: 100%;
  height: clamp(104px, 33.5vw, 161px);
}

.cs__card {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc((100% - 8px * 5) / 6);
  aspect-ratio: 3/4;
  --step: calc(100% + 8px);
  --slot: 0;
  --slotAlt: 0;
  --lift: 0%;
  translate: calc(var(--step) * var(--slot)) 0;
  transition: translate 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
  display: grid;
  place-items: center;
  border-radius: 12px;
  background-color: #0a4fe8;
  color: #fff7e6;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  font-weight: 800;
  font-size: clamp(14px, 4vw, 22px);
  user-select: none;
}

.cs__card {
  pointer-events: none;
}

.cs__card:nth-child(1) {
  --slot: 0;
  --slotAlt: 1;
  animation-delay: 160ms;
}

.cs__card:nth-child(2) {
  --slot: 1;
  --slotAlt: 2;
  animation-delay: 120ms;
}

.cs__card:nth-child(3) {
  --slot: 2;
  --slotAlt: 3;
  animation-delay: 80ms;
}

.cs__card:nth-child(4) {
  --slot: 3;
  --slotAlt: 4;
  animation-delay: 40ms;
}

.cs__card:nth-child(5) {
  --slot: 4;
  --slotAlt: 5;
  animation-delay: 0ms;
}

.cs__card:nth-child(6) {
  --slot: 5;
  --slotAlt: 0;
  --lift: -80%;
  z-index: 3;
  animation-delay: 400ms;
}

.cs__acts {
  display: flex;
  gap: 8px;
}

.cs__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid #17141a;
  border-radius: 999px;
  background-color: #17141a;
  color: #fff7e6;
  font-weight: 700;
  font-size: clamp(10px, 2.6vw, 12px);
  cursor: pointer;
}

.cs__btn--ghost {
  background-color: #ffffff;
  color: #17141a;
}

.cs__btn:focus-visible {
  outline: 2px solid #0a4fe8;
  outline-offset: 2px;
}

.cs__kbd {
  padding: 0 4px;
  border-radius: 4px;
  background-color: rgba(255, 247, 230, 0.22);
  color: inherit;
  font-weight: 700;
  font-size: clamp(8px, 2.2vw, 10px);
}

.cs__btn--ghost .cs__kbd {
  background-color: rgba(23, 20, 26, 0.12);
}

.cs.is-moving .cs__btn {
  pointer-events: none;
}

.cs.is-demo .cs__card {
  animation-name: csSwap;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}

@keyframes csSwap {
  0%, 6% {
    translate: calc(var(--step) * var(--slot)) 0%;
  }
  26% {
    translate: calc(var(--step) * (var(--slot) + var(--slotAlt)) / 2) var(--lift);
  }
  46%, 54% {
    translate: calc(var(--step) * var(--slotAlt)) 0%;
  }
  74% {
    translate: calc(var(--step) * (var(--slot) + var(--slotAlt)) / 2) var(--lift);
  }
  94%, 100% {
    translate: calc(var(--step) * var(--slot)) 0%;
  }
}
@media (max-width: 340px) {
  .cs {
    gap: 8px;
  }
  .cs__acts {
    gap: 4px;
  }
  .cs__btn {
    padding: 4px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs__card {
    transition: none !important;
  }
  .cs.is-demo .cs__card {
    animation: none !important;
  }
}
