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

@property --c {
  syntax: "<color>";
  inherits: false;
  initial-value: #2f6df6;
}
.rc {
  box-sizing: border-box;
  width: 288px;
  max-width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: #17141a;
  color: #fff7e6;
  font-family: inherit;
}

.rc * {
  box-sizing: border-box;
}

.rc__top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rc__now {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid rgba(255, 247, 230, 0.28);
  border-radius: 8px;
  background: var(--c);
  cursor: pointer;
}

.rc__now:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 3px;
}

.rc__add {
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #fff7e6;
  color: #17141a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.rc__add:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 3px;
}

.rc__cap {
  margin: 12px 0 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 247, 230, 0.66);
}

.rc__hist {
  display: grid;
  grid-template-columns: repeat(8, 26px);
  gap: 8px;
}

.rc__cell {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--c);
  cursor: pointer;
}

.rc__cell[aria-pressed=true] {
  box-shadow: 0 0 0 2px #fff7e6;
}

.rc__cell:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 3px;
}

.rc.is-demo .rc__cell,
.rc.is-demo .rc__now {
  animation-name: histRoll;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.rc.is-demo .rc__cell:nth-child(1) {
  animation-delay: -2s;
}

.rc.is-demo .rc__cell:nth-child(2) {
  animation-delay: -1.75s;
}

.rc.is-demo .rc__cell:nth-child(3) {
  animation-delay: -1.5s;
}

.rc.is-demo .rc__cell:nth-child(4) {
  animation-delay: -1.25s;
}

.rc.is-demo .rc__cell:nth-child(5) {
  animation-delay: -1s;
}

.rc.is-demo .rc__cell:nth-child(6) {
  animation-delay: -0.75s;
}

.rc.is-demo .rc__cell:nth-child(7) {
  animation-delay: -0.5s;
}

.rc.is-demo .rc__cell:nth-child(8) {
  animation-delay: -0.25s;
}

.rc.is-demo .rc__cell:nth-child(1),
.rc.is-demo .rc__now {
  animation-name: histRoll, histPop;
  animation-duration: 2s, 0.25s;
  animation-timing-function: steps(1, end), cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite, infinite;
  animation-delay: -2s, 0s;
  animation-fill-mode: backwards, backwards;
}

@keyframes histRoll {
  0% {
    --c: #2f6df6;
  }
  12.5% {
    --c: #6ec8ff;
  }
  25% {
    --c: #4cd4a6;
  }
  37.5% {
    --c: #ffd23f;
  }
  50% {
    --c: #ff4d1f;
  }
  62.5% {
    --c: #ff9ebb;
  }
  75% {
    --c: #b9a0ff;
  }
  87.5% {
    --c: #fff7e6;
  }
  100% {
    --c: #2f6df6;
  }
}
@keyframes histPop {
  0% {
    transform: scale(0.86);
  }
  60%, 100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rc.is-demo .rc__cell,
  .rc.is-demo .rc__now {
    animation: none !important;
  }
}
