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

.stage {
  position: relative;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 20, 26, 0.35);
  transition: background 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(78vw, 300px);
  padding: clamp(12px, 4.5vmin, 22px);
  border-radius: 16px;
  background: #ffffff;
  color: #17141a;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
.modal h2 {
  margin: 0 0 6px;
  font-size: clamp(13px, 4.2vmin, 17px);
}
.modal p {
  margin: 0 0 14px;
  font-size: clamp(10px, 3.2vmin, 13px);
  color: rgba(23, 20, 26, 0.65);
}

.modal__next, .modal__back {
  border: 0;
  border-radius: 12px;
  background: #2f6df6;
  color: #ffffff;
  padding: clamp(7px, 2.6vmin, 9px) clamp(14px, 4.6vmin, 18px);
  font-weight: 600;
  font-size: clamp(11px, 3.4vmin, 13px);
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
}

.modal--1 {
  transform: translate(-50%, -50%);
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal--2 {
  transform: translate(-50%, -50%) translateY(10px) scale(0.9);
  opacity: 0;
  pointer-events: none;
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stage.is-stacked .overlay {
  background: rgba(23, 20, 26, 0.6);
}

.stage.is-stacked .modal--1 {
  transform: translate(-50%, calc(-50% - 16px)) scale(0.95);
  opacity: 0.55;
}

.stage.is-stacked .modal--2 {
  transform: translate(-50%, -50%) translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.stage.is-demo .overlay {
  animation: overlay-loop 2s ease-in-out infinite;
}

.stage.is-demo .modal--1 {
  animation: back-loop 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.stage.is-demo .modal--2 {
  animation: front-loop 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes overlay-loop {
  0%, 40% {
    background: rgba(23, 20, 26, 0.35);
  }
  55%, 80% {
    background: rgba(23, 20, 26, 0.6);
  }
  95%, 100% {
    background: rgba(23, 20, 26, 0.35);
  }
}
@keyframes back-loop {
  0%, 40% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  55%, 80% {
    transform: translate(-50%, calc(-50% - 16px)) scale(0.95);
    opacity: 0.55;
  }
  95%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}
@keyframes front-loop {
  0%, 40% {
    transform: translate(-50%, -50%) translateY(10px) scale(0.9);
    opacity: 0;
  }
  55%, 80% {
    transform: translate(-50%, -50%) translateY(0) scale(1);
    opacity: 1;
  }
  95%, 100% {
    transform: translate(-50%, -50%) translateY(10px) scale(0.9);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage.is-demo .overlay, .stage.is-demo .modal--1, .stage.is-demo .modal--2 {
    animation: none;
  }
  .overlay, .modal--1, .modal--2 {
    transition-duration: 1ms;
  }
}
