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

.sp {
  display: flex;
  justify-content: center;
  width: 100%;
}

.sp__card {
  width: min(100%, 330px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  padding: 12px 16px;
  overflow: hidden;
}

.sp__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sp__title {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 800;
  font-size: clamp(11px, 3.2vw, 13px);
  color: #17141a;
}

.sp__ico {
  width: 16px;
  height: 16px;
  color: #2f6df6;
}

.sp__count {
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 11px);
  color: rgba(23, 20, 26, 0.72);
}

.sp__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.sp__slot {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 2px dashed rgba(23, 20, 26, 0.18);
  border-radius: 50%;
  min-width: 0;
}

.sp__stamp {
  display: flex;
  width: 88%;
  height: 88%;
  color: #2f6df6;
}

.sp__stamp svg {
  width: 100%;
  height: 100%;
}

.sp__stamp--in {
  transform: rotate(-8deg);
}

.sp__slot:nth-child(3n) .sp__stamp--in {
  transform: rotate(5deg);
}

.sp__slot:nth-child(4n) .sp__stamp--in {
  transform: rotate(-3deg);
}

.sp__stamp--new {
  animation: spStampIn 300ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
  transform-origin: 50% 50%;
}

@keyframes spStampIn {
  0% {
    transform: scale(1.6) rotate(-14deg);
  }
  70% {
    transform: scale(0.94) rotate(-6deg);
  }
  100% {
    transform: scale(1) rotate(-8deg);
  }
}
.sp__foot {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 12px;
  min-height: 32px;
}

.sp__btn {
  border: 0;
  cursor: pointer;
  background: #17141a;
  color: #ffd23f;
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(11px, 3vw, 12px);
  padding: 8px 20px;
  font-family: inherit;
  line-height: 1.2;
  transition: transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sp__btn:active {
  transform: scale(0.94);
}

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

.sp__btn:disabled {
  cursor: default;
}

.sp__issued {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  visibility: hidden;
}

.sp__issued.is-on {
  visibility: visible;
}

.sp__issuedChip {
  background: #a86253;
  color: #fff7e6;
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(11px, 3vw, 12px);
  padding: 8px 16px;
  animation: spBadgeIn 300ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes spBadgeIn {
  0% {
    transform: scale(0.4);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
.sp.is-demo .sp__stamp--in {
  visibility: hidden;
}

.sp.is-demo .sp__slot:nth-child(n) .sp__stamp--in {
  animation: spLoop 2s ease-out infinite;
  animation-delay: calc(var(--k, 0) * 120ms);
  animation-fill-mode: backwards;
}

.sp.is-demo .sp__slot:nth-child(1) .sp__stamp--in {
  --k: 0;
}

.sp.is-demo .sp__slot:nth-child(2) .sp__stamp--in {
  --k: 1;
}

.sp.is-demo .sp__slot:nth-child(3) .sp__stamp--in {
  --k: 2;
}

.sp.is-demo .sp__slot:nth-child(4) .sp__stamp--in {
  --k: 3;
}

.sp.is-demo .sp__slot:nth-child(5) .sp__stamp--in {
  --k: 4;
}

.sp.is-demo .sp__slot:nth-child(6) .sp__stamp--in {
  --k: 5;
}

.sp.is-demo .sp__slot:nth-child(7) .sp__stamp--in {
  --k: 6;
}

.sp.is-demo .sp__slot:nth-child(8) .sp__stamp--in {
  --k: 7;
}

.sp.is-demo .sp__slot:nth-child(9) .sp__stamp--in {
  --k: 8;
}

.sp.is-demo .sp__slot:nth-child(10) .sp__stamp--in {
  --k: 9;
}

.sp:not(.is-demo) .sp__stamp--idle {
  visibility: hidden;
}

@keyframes spLoop {
  0% {
    visibility: hidden;
    transform: scale(1.6) rotate(-14deg);
  }
  1.5% {
    visibility: visible;
  }
  8% {
    transform: scale(0.94) rotate(-6deg);
  }
  12%, 96% {
    visibility: visible;
    transform: scale(1) rotate(-8deg);
  }
  96.5%, 100% {
    visibility: hidden;
    transform: scale(1) rotate(-8deg);
  }
}
.sp.is-demo .sp__btn {
  animation: spBtnHide 2s steps(1, end) infinite;
}

@keyframes spBtnHide {
  0%, 72% {
    visibility: visible;
  }
  72.5%, 96% {
    visibility: hidden;
  }
  96.5%, 100% {
    visibility: visible;
  }
}
.sp.is-demo .sp__issued {
  visibility: visible;
}

.sp.is-demo .sp__issuedChip {
  animation: spBadgeLoop 2s ease-out infinite;
}

@keyframes spBadgeLoop {
  0%, 71% {
    transform: scale(0);
  }
  74% {
    transform: scale(1.1);
  }
  77%, 95% {
    transform: scale(1);
  }
  97%, 100% {
    transform: scale(0);
  }
}
@media (max-width: 340px) {
  .sp__card {
    padding: 8px 12px;
  }
  .sp__grid {
    gap: 4px;
    margin-top: 4px;
  }
  .sp__foot {
    margin-top: 4px;
    min-height: 24px;
  }
  .sp__slot {
    border-width: 1px;
  }
  .sp__btn {
    padding: 4px 16px;
  }
  .sp__issuedChip {
    padding: 4px 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sp.is-demo .sp__slot .sp__stamp--in,
  .sp.is-demo .sp__btn,
  .sp.is-demo .sp__issuedChip,
  .sp__stamp--new,
  .sp__issuedChip {
    animation: none !important;
  }
  .sp.is-demo .sp__stamp--in {
    visibility: visible !important;
  }
  .sp__btn {
    transition: none !important;
  }
}
