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

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

.fan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.fan__stack {
  position: relative;
  width: min(72%, 224px);
  aspect-ratio: 224/108;
}

.fan__card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  border: 0;
  cursor: pointer;
  border-radius: 16px;
  padding: 8px 12px;
  background: #17141a;
  color: #fff7e6;
  font-family: inherit;
  text-align: left;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.fan__card--1 {
  z-index: 3;
}

.fan__card--2 {
  z-index: 2;
  background: #3a3346;
}

.fan__card--3 {
  z-index: 1;
  background: #5b5270;
  align-items: flex-end;
  text-align: right;
}

.fan__tag {
  background: #ffd23f;
  color: #17141a;
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(8px, 2.4vw, 10px);
  padding: 0 8px;
  line-height: 1.6;
}

.fan__pct {
  margin-top: 4px;
  font-weight: 800;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1;
  color: #ffd23f;
}

.fan__pct i {
  font-style: normal;
  font-size: 0.5em;
}

.fan__name {
  margin-top: 4px;
  font-weight: 700;
  font-size: clamp(10px, 3vw, 12px);
  color: rgba(255, 247, 230, 0.8);
}

.fan__stack:hover .fan__card--1,
.fan__stack:focus-within .fan__card--1,
.fan__stack.is-fanned .fan__card--1 {
  transform: rotate(-8deg) translateX(min(-34px, -9vw)) translateY(-4px);
}

.fan__stack:hover .fan__card--2,
.fan__stack:focus-within .fan__card--2,
.fan__stack.is-fanned .fan__card--2 {
  transform: translateY(-12px);
}

.fan__stack:hover .fan__card--3,
.fan__stack:focus-within .fan__card--3,
.fan__stack.is-fanned .fan__card--3 {
  transform: rotate(8deg) translateX(min(40px, 11vw)) translateY(8px);
}

.fan__card[aria-pressed=true] {
  transform: translateY(-8px);
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  z-index: 4;
}

.fan.is-demo .fan__card {
  transform: rotate(calc((var(--i) - 1) * 9deg)) translateX(calc((var(--i) - 1) * min(58px, 16vw))) translateY(calc(var(--i) * -4px));
}

.fan.is-demo .fan__card--1 {
  animation-name: fanSideL;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.fan.is-demo .fan__card--3 {
  animation-name: fanSideR;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes fanSideL {
  0%, 100% {
    transform: rotate(-9deg) translateX(min(-58px, -16vw)) translateY(0px);
  }
  50% {
    transform: rotate(-13deg) translateX(min(-72px, -20vw)) translateY(-4px);
  }
}
@keyframes fanSideR {
  0%, 100% {
    transform: rotate(9deg) translateX(min(76px, 21vw)) translateY(12px);
  }
  50% {
    transform: rotate(13deg) translateX(min(88px, 24vw)) translateY(8px);
  }
}
.fan.is-demo .fan__card--2 {
  animation-name: fanPick, fanPickZ;
  animation-duration: 2s, 2s;
  animation-timing-function: ease-in-out, steps(1, end);
  animation-iteration-count: infinite, infinite;
}

@keyframes fanPickZ {
  0%, 24% {
    z-index: 2;
  }
  24.5%, 84% {
    z-index: 5;
  }
  84.5%, 100% {
    z-index: 2;
  }
}
@keyframes fanPick {
  0%, 16% {
    transform: translateY(-4px) scale(1);
  }
  40%, 70% {
    transform: translateY(-26px) scale(1.06);
  }
  88%, 100% {
    transform: translateY(-4px) scale(1);
  }
}
.fan__live {
  margin: 0;
  min-height: 1.2em;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 11px);
  color: #17141a;
}

@media (max-width: 340px) {
  .fan__stack {
    width: 140px;
  }
  .fan__card {
    padding: 4px 8px;
  }
  .fan {
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fan.is-demo .fan__card {
    animation: none !important;
    transform: rotate(calc((var(--i) - 1) * 9deg)) translateX(calc((var(--i) - 1) * min(58px, 16vw))) translateY(calc(var(--i) * -4px));
  }
  .fan__card {
    transition: none !important;
  }
}
