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

ul {
  margin: 0;
}

.ba {
  box-sizing: border-box;
  width: clamp(288px, 96vw, 448px);
}

.ba__list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0;
  list-style: none;
}

.ba__item {
  perspective: 720px;
}

.ba__item--2 {
  --d: -.2s;
}

.ba__item--3 {
  --d: -.4s;
}

.ba__card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.ba__card:focus-visible {
  outline: 2px solid #1c1b22;
  outline-offset: 4px;
}

.ba__inner {
  position: relative;
  display: block;
  height: 96px;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ba__card[aria-pressed=true] .ba__inner {
  transform: rotateY(180deg);
}

.ba__face {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  overflow: hidden;
  backface-visibility: hidden;
  text-align: left;
}

.ba__face--front {
  background: #fbf7ef;
  color: #1c1b22;
}

.ba__face--back {
  background: #1c1b22;
  color: #fbf7ef;
  transform: rotateY(180deg);
}

.ba__tag {
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.ba__face--front .ba__tag {
  color: #565062;
}

.ba__face--back .ba__tag {
  color: #b3dad5;
}

.ba__val {
  font-weight: 800;
  font-size: clamp(15px, 4.4vw, 19px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ba__cap {
  color: #565062;
  font-weight: 600;
  font-size: 10px;
  line-height: 1.2;
}

.ba__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #b3dad5;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  transform: translateY(0);
}

.ba__badge svg {
  display: block;
  flex: 0 0 auto;
}

.ba__bar {
  display: grid;
}

.ba__bar-bg, .ba__bar-fill {
  grid-area: 1/1;
  height: 4px;
  border-radius: 999px;
}

.ba__bar-bg {
  background: rgba(251, 247, 239, 0.4);
}

.ba__bar-fill {
  background: #fbf7ef;
  transform: scaleX(0);
  transform-origin: left center;
}

.ba__card[aria-pressed=true] .ba__bar-fill {
  transform: scaleX(1);
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ba.is-demo .ba__inner {
  animation-name: baFlip;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-delay: var(--d, 0s);
  animation-fill-mode: backwards;
  transition: none;
}

.ba.is-demo .ba__bar-fill {
  animation-name: baBar;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-delay: var(--d, 0s);
  animation-fill-mode: backwards;
  transition: none;
}

.ba.is-demo .ba__badge {
  animation-name: baPop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
  animation-delay: var(--d, 0s);
  animation-fill-mode: backwards;
}

@keyframes baFlip {
  0%, 29% {
    transform: rotateY(0deg);
  }
  30%, 79% {
    transform: rotateY(180deg);
  }
  80%, 100% {
    transform: rotateY(0deg);
  }
}
@keyframes baBar {
  0% {
    transform: scaleX(0);
  }
  30%, 72% {
    transform: scaleX(1);
  }
  80%, 100% {
    transform: scaleX(0);
  }
}
@keyframes baPop {
  0%, 29% {
    transform: translateY(12px);
  }
  46%, 100% {
    transform: translateY(0);
  }
}
@media (max-width: 340px), (max-height: 220px) {
  .ba {
    width: 100%;
  }
  .ba__list {
    gap: 8px;
  }
  .ba__inner {
    height: 88px;
  }
  .ba__face {
    gap: 4px;
    padding: 8px;
  }
  .ba__val {
    font-size: 14px;
  }
  .ba__tag, .ba__cap, .ba__badge {
    font-size: 9px;
  }
  .ba__badge {
    gap: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ba__inner, .ba__bar-fill, .ba__badge {
    animation: none !important;
  }
  .ba__inner, .ba__bar-fill {
    transition: none !important;
  }
}
