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

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

.hk {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: clamp(288px, 94vw, 432px);
  text-align: center;
}

.hk__title {
  margin: 0;
  color: #17141a;
  font-weight: 800;
  font-size: clamp(17px, 4.6vw, 28px);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hk__word {
  position: relative;
  z-index: 1;
  overflow: hidden;
  display: inline-block;
  padding-bottom: 4px;
  margin-bottom: -4px;
  vertical-align: bottom;
}

.hk__wi {
  display: inline-block;
}

.hk__key {
  position: relative;
  display: inline-block;
}

.hk__band {
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: 3px;
  height: 0.78em;
  border-radius: 4px;
  background: #ffd23f;
  transform: scaleX(1);
  transform-origin: left center;
}

.hk__lead {
  margin: 0;
  color: #56505e;
  font-weight: 500;
  font-size: clamp(10px, 2.4vw, 13px);
  line-height: 1.35;
}

.hk__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hk__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 2px solid #9791c9;
  border-radius: 12px;
  background: #9791c9;
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(10px, 2.2vw, 12px);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.hk__again {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px 8px;
  border: 2px solid #56505e;
  border-radius: 999px;
  background: transparent;
  color: #56505e;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(9px, 2vw, 11px);
  line-height: 1.2;
  cursor: pointer;
}

.hk__btn:focus-visible,
.hk__again:focus-visible {
  outline: 2px solid #9791c9;
  outline-offset: 4px;
}

.hk.is-demo .hk__wi {
  animation-name: hkRise;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.hk.is-demo .hk__word--2 .hk__wi {
  animation-delay: 0.16s;
}

.hk.is-demo .hk__word--3 .hk__wi {
  animation-delay: 0.32s;
}

.hk.is-demo .hk__band {
  animation-name: hkBand;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-delay: 0.55s;
  animation-fill-mode: backwards;
}

@keyframes hkRise {
  0% {
    transform: translateY(115%);
  }
  16%, 72% {
    transform: translateY(0);
  }
  86%, 100% {
    transform: translateY(115%);
  }
}
@keyframes hkBand {
  0% {
    transform: scaleX(0);
  }
  12%, 50% {
    transform: scaleX(1);
  }
  60%, 100% {
    transform: scaleX(0);
  }
}
.hk.is-replay .hk__wi {
  animation-name: hkEnter;
  animation-duration: 600ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: 1;
  animation-fill-mode: backwards;
}

.hk.is-replay .hk__word--2 .hk__wi {
  animation-delay: 0.16s;
}

.hk.is-replay .hk__word--3 .hk__wi {
  animation-delay: 0.32s;
}

.hk.is-replay .hk__band {
  animation-name: hkFill;
  animation-duration: 600ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: 1;
  animation-delay: 0.55s;
  animation-fill-mode: backwards;
}

@keyframes hkEnter {
  from {
    transform: translateY(115%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes hkFill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@media (max-width: 340px), (max-height: 220px) {
  .hk {
    gap: 8px;
    width: 100%;
  }
  .hk__band {
    bottom: 2px;
  }
  .hk__actions {
    gap: 8px;
  }
  .hk__btn {
    padding: 4px 8px;
  }
  .hk__again {
    padding: 0 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hk__wi, .hk__band {
    animation: none !important;
    transform: none !important;
  }
  .hk__band {
    transform: scaleX(1) !important;
  }
}
