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

.cs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 260px);
}

.cs__cap {
  margin: 0;
  font-weight: 700;
  font-size: clamp(11px, 3vw, 12px);
  color: #fff7e6;
}

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

.cs__then {
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  color: rgba(255, 247, 230, 0.56);
}

.cs__key {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 247, 230, 0.1);
  border: 2px solid rgba(255, 247, 230, 0.28);
  color: #fff7e6;
  font-family: inherit;
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
  transition: transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1), background 140ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cs.is-pending .cs__key--first,
.cs.is-done .cs__key--second {
  background: #4cd4a6;
  border-color: #4cd4a6;
  color: #17141a;
  transform: translateY(3px);
}

.cs__meter {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 247, 230, 0.14);
  overflow: hidden;
}

.cs__fill {
  border-radius: 999px;
  background: #4cd4a6;
  transform-origin: left center;
  transform: scaleX(0);
}

.cs.is-pending .cs__fill {
  animation: csDrain 1200ms linear both;
}

@keyframes csDrain {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}
.cs__dest {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs__destLabel {
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 11px);
  color: rgba(255, 247, 230, 0.78);
}

.cs__destBox {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 88px;
  height: 22px;
  border-radius: 4px;
  padding: 0 8px;
  background: rgba(255, 247, 230, 0.12);
  color: #fff7e6;
  font-weight: 800;
  font-size: clamp(10px, 2.8vw, 11px);
  line-height: 1;
}

.cs__destBox span {
  grid-area: 1/1;
}

.cs__destDone {
  visibility: hidden;
  color: #4cd4a6;
}

.cs.is-done .cs__destIdle {
  visibility: hidden;
}

.cs.is-done .cs__destDone {
  visibility: visible;
}

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

@keyframes csFirst {
  0%, 7% {
    transform: translateY(0);
    background: rgba(255, 247, 230, 0.1);
    border-color: rgba(255, 247, 230, 0.28);
    color: #fff7e6;
  }
  12%, 84% {
    transform: translateY(3px);
    background: #4cd4a6;
    border-color: #4cd4a6;
    color: #17141a;
  }
  90%, 100% {
    transform: translateY(0);
    background: rgba(255, 247, 230, 0.1);
    border-color: rgba(255, 247, 230, 0.28);
    color: #fff7e6;
  }
}
.cs.is-demo .cs__key--second {
  animation-name: csSecond;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@keyframes csSecond {
  0%, 55% {
    transform: translateY(0);
    background: rgba(255, 247, 230, 0.1);
    border-color: rgba(255, 247, 230, 0.28);
    color: #fff7e6;
  }
  60%, 84% {
    transform: translateY(3px);
    background: #4cd4a6;
    border-color: #4cd4a6;
    color: #17141a;
  }
  90%, 100% {
    transform: translateY(0);
    background: rgba(255, 247, 230, 0.1);
    border-color: rgba(255, 247, 230, 0.28);
    color: #fff7e6;
  }
}
.cs.is-demo .cs__fill {
  animation-name: csDrainLoop;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@keyframes csDrainLoop {
  0%, 8% {
    transform: scaleX(0);
  }
  9% {
    transform: scaleX(1);
  }
  56%, 100% {
    transform: scaleX(0.42);
  }
}
.cs.is-demo .cs__destIdle,
.cs.is-demo .cs__destDone {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.cs.is-demo .cs__destIdle {
  animation-name: csIdleText;
}

.cs.is-demo .cs__destDone {
  animation-name: csDoneText;
}

@keyframes csIdleText {
  0%, 59% {
    visibility: visible;
  }
  60%, 87% {
    visibility: hidden;
  }
  88%, 100% {
    visibility: visible;
  }
}
@keyframes csDoneText {
  0%, 59% {
    visibility: hidden;
  }
  60%, 87% {
    visibility: visible;
  }
  88%, 100% {
    visibility: hidden;
  }
}
@media (max-width: 340px) {
  .cs {
    gap: 8px;
  }
  .cs__key {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs.is-demo .cs__key--first,
  .cs.is-demo .cs__key--second,
  .cs.is-demo .cs__fill,
  .cs.is-demo .cs__destIdle,
  .cs.is-demo .cs__destDone,
  .cs.is-pending .cs__fill {
    animation: none !important;
  }
  .cs.is-demo .cs__fill {
    transform: scaleX(0.42) !important;
  }
  .cs__key {
    transition: none !important;
  }
}
