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

.ex {
  --h: clamp(148px, 58vh, 176px);
  width: min(340px, 92vw);
}

.ex__scroller {
  height: var(--h);
  overflow-y: auto;
  scrollbar-width: none;
}
.ex__scroller::-webkit-scrollbar {
  display: none;
}

.ex__pad {
  height: calc(var(--h) * 2.2);
}

.ex__pin {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  height: var(--h);
}

.ex__stack {
  position: relative;
  width: 184px;
  height: 120px;
}

.ex__part {
  position: absolute;
  top: 48px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 184px;
  height: 24px;
  border: 2px solid #17141a;
  border-radius: 8px;
  background: #fff7e6;
  color: #17141a;
  animation-duration: 1s;
  animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1);
  animation-fill-mode: both;
  animation-timeline: scroll(nearest block);
}

.ex__part--1 {
  animation-name: ex-p1;
  background: #ff9ebb;
}

.ex__part--2 {
  animation-name: ex-p2;
}

.ex__part--3 {
  animation-name: ex-p3;
}

.ex__part--4 {
  animation-name: ex-p4;
  background: #6ec8ff;
}

@keyframes ex-p1 {
  from {
    transform: translate(0, -6px) rotate(0deg);
  }
  to {
    transform: translate(-16px, -54px) rotate(-7deg);
  }
}
@keyframes ex-p2 {
  from {
    transform: translate(0, -2px) rotate(0deg);
  }
  to {
    transform: translate(12px, -18px) rotate(4deg);
  }
}
@keyframes ex-p3 {
  from {
    transform: translate(0, 2px) rotate(0deg);
  }
  to {
    transform: translate(-12px, 18px) rotate(-4deg);
  }
}
@keyframes ex-p4 {
  from {
    transform: translate(0, 6px) rotate(0deg);
  }
  to {
    transform: translate(16px, 54px) rotate(7deg);
  }
}
.ex__tag {
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  opacity: 0;
  animation-name: ex-tag;
  animation-duration: 1s;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(nearest block);
}

@keyframes ex-tag {
  0%, 10% {
    opacity: 0;
  }
  38%, 100% {
    opacity: 1;
  }
}
.ex.is-demo .ex__part,
.ex.is-demo .ex__tag {
  animation-duration: 1s;
  animation-direction: alternate;
  animation-iteration-count: infinite;
  animation-timeline: auto;
}

@media (prefers-reduced-motion: reduce) {
  .ex__part {
    animation: none !important;
  }
  .ex__part--1 {
    transform: translate(-16px, -54px);
  }
  .ex__part--2 {
    transform: translate(12px, -18px);
  }
  .ex__part--3 {
    transform: translate(-12px, 18px);
  }
  .ex__part--4 {
    transform: translate(16px, 54px);
  }
  .ex__tag {
    animation: none !important;
    opacity: 1;
  }
}
