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

.tb {
  box-sizing: border-box;
  width: 100%;
  max-width: 432px;
}

.tb__band {
  box-sizing: border-box;
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(251, 247, 239, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(164, 156, 206, 0.2), rgba(71, 144, 137, 0.16));
}

.tb__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tb__cell {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.tb__label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #b3dad5;
  font-weight: 600;
  font-size: clamp(9px, 2.2vw, 11px);
  line-height: 1.2;
  white-space: nowrap;
}

.tb__cell--2 .tb__label {
  color: #ffd23f;
}

.tb__stack {
  display: grid;
  margin: 0;
}

.tb__n {
  grid-area: 1/1;
  opacity: 0;
  color: #fbf7ef;
  font-weight: 800;
  font-size: clamp(17px, 5.2vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.tb__n:last-child {
  opacity: 1;
}

.tb__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tb__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tb__badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 2px solid rgba(179, 218, 213, 0.45);
  border-radius: 999px;
  background: rgba(179, 218, 213, 0.1);
  color: #fbf7ef;
  font-weight: 600;
  font-size: clamp(8px, 2vw, 10px);
  line-height: 1.2;
  white-space: nowrap;
}

.tb__badge svg {
  flex: 0 0 auto;
  color: #b3dad5;
}

.tb__replay {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(251, 247, 239, 0.28);
  border-radius: 50%;
  background: rgba(28, 27, 34, 0.55);
  color: #b3dad5;
  cursor: pointer;
}

.tb__replay:focus-visible {
  outline: 2px solid #b3dad5;
  outline-offset: 2px;
}

.tb.is-demo .tb__n,
.tb.is-count .tb__n {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.tb.is-demo .tb__n:nth-child(1), .tb.is-count .tb__n:nth-child(1) {
  animation-name: tbSlot1;
}

.tb.is-demo .tb__n:nth-child(2), .tb.is-count .tb__n:nth-child(2) {
  animation-name: tbSlot2;
}

.tb.is-demo .tb__n:nth-child(3), .tb.is-count .tb__n:nth-child(3) {
  animation-name: tbSlot3;
}

.tb.is-demo .tb__n:nth-child(4), .tb.is-count .tb__n:nth-child(4) {
  animation-name: tbSlot4;
}

.tb.is-demo .tb__cell--2 .tb__n, .tb.is-count .tb__cell--2 .tb__n {
  animation-delay: -0.09s;
}

.tb.is-demo .tb__cell--3 .tb__n, .tb.is-count .tb__cell--3 .tb__n {
  animation-delay: -0.18s;
}

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

.tb.is-demo .tb__badge--2, .tb.is-count .tb__badge--2 {
  animation-delay: 0.18s;
}

.tb.is-demo .tb__badge--3, .tb.is-count .tb__badge--3 {
  animation-delay: 0.36s;
}

.tb.is-count .tb__n,
.tb.is-count .tb__badge {
  animation-iteration-count: 1;
  animation-fill-mode: both;
}

@keyframes tbSlot1 {
  0% {
    opacity: 1;
  }
  22%, 100% {
    opacity: 0;
  }
}
@keyframes tbSlot2 {
  0% {
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  44%, 100% {
    opacity: 0;
  }
}
@keyframes tbSlot3 {
  0% {
    opacity: 0;
  }
  44% {
    opacity: 1;
  }
  66%, 100% {
    opacity: 0;
  }
}
@keyframes tbSlot4 {
  0% {
    opacity: 0;
  }
  66%, 100% {
    opacity: 1;
  }
}
@keyframes tbStamp {
  0% {
    transform: translateY(-8px) scale(0.6);
    opacity: 0;
  }
  5% {
    transform: translateY(-4px) scale(0.82);
    opacity: 1;
  }
  14% {
    transform: translateY(0) scale(1.08);
    opacity: 1;
  }
  22%, 100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@media (max-width: 340px), (max-height: 220px) {
  .tb__band {
    gap: 8px;
    padding: 8px;
  }
  .tb__metrics {
    gap: 4px;
  }
  .tb__foot {
    gap: 4px;
  }
  .tb__badges {
    gap: 4px;
  }
  .tb__badge {
    padding: 0 4px;
  }
  .tb__label svg, .tb__badge svg {
    width: 12px;
    height: 12px;
  }
  .tb__replay {
    width: 20px;
    height: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tb__n, .tb__badge {
    animation: none !important;
  }
}
