html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ff4d1f;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.cs {
  box-sizing: border-box;
  width: min(280px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

.cs__btn {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #17141a;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  color: #fff7e6;
  font-family: inherit;
  cursor: pointer;
}

.cs__btn:disabled {
  cursor: default;
}

.cs__btn:focus-visible {
  outline: 3px solid #17141a;
  outline-offset: 3px;
}

.cs__face {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-left: 20px;
  padding-right: 20px;
  opacity: 0;
}

.cs__face[data-face=done] {
  color: #4cd4a6;
}

.cs__label {
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs__ic {
  display: inline-flex;
  flex: 0 0 auto;
}

.cs__ic svg {
  display: block;
}

.cs__ring {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff7e6;
  border-radius: 50%;
  animation-name: cs-spin;
  animation-duration: 600ms;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes cs-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.cs__live {
  position: relative;
  width: 100%;
  height: 20px;
  margin: 0;
}

.cs__msg {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
  color: #17141a;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
}

.cs:not(.is-demo)[data-state=idle] .cs__face[data-face=idle],
.cs:not(.is-demo)[data-state=busy] .cs__face[data-face=busy],
.cs:not(.is-demo)[data-state=done] .cs__face[data-face=done],
.cs:not(.is-demo)[data-state=idle] .cs__msg[data-face=idle],
.cs:not(.is-demo)[data-state=busy] .cs__msg[data-face=busy],
.cs:not(.is-demo)[data-state=done] .cs__msg[data-face=done] {
  opacity: 1;
}

.cs.is-demo .cs__face,
.cs.is-demo .cs__msg {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.cs.is-demo .cs__face[data-face=idle],
.cs.is-demo .cs__msg[data-face=idle] {
  animation-name: cs-idle;
}

.cs.is-demo .cs__face[data-face=busy],
.cs.is-demo .cs__msg[data-face=busy] {
  animation-name: cs-busy;
}

.cs.is-demo .cs__face[data-face=done],
.cs.is-demo .cs__msg[data-face=done] {
  animation-name: cs-done;
}

@keyframes cs-idle {
  0% {
    opacity: 1;
  }
  20% {
    opacity: 0;
  }
  86% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@keyframes cs-busy {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  62% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@keyframes cs-done {
  0% {
    opacity: 0;
  }
  62% {
    opacity: 1;
  }
  86% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
.cs.is-demo .cs__btn {
  animation-name: cs-pop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes cs-pop {
  0% {
    transform: scale(1);
  }
  16% {
    transform: scale(1);
  }
  24% {
    transform: scale(0.95);
  }
  34% {
    transform: scale(1);
  }
  58% {
    transform: scale(1);
  }
  67% {
    transform: scale(1.04);
  }
  78% {
    transform: scale(1);
  }
  80% {
    transform: scale(1);
  }
  86% {
    transform: scale(0.97);
  }
  90% {
    transform: scale(1);
  }
  100% {
    transform: scale(1);
  }
}
@media (max-width: 340px) {
  .cs {
    gap: 12px;
  }
  .cs__btn {
    height: 44px;
  }
  .cs__face {
    gap: 4px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .cs__label {
    font-size: 12px;
    line-height: 18px;
  }
  .cs__ring {
    width: 16px;
    height: 16px;
  }
  .cs__live {
    height: 18px;
  }
  .cs__msg {
    font-size: 11px;
    line-height: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cs.is-demo .cs__face,
  .cs.is-demo .cs__msg,
  .cs.is-demo .cs__btn,
  .cs__ring {
    animation: none !important;
  }
  .cs.is-demo .cs__face[data-face=idle],
  .cs.is-demo .cs__msg[data-face=idle] {
    opacity: 1;
  }
}
