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

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

.stage {
  align-items: stretch;
}

.wg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
  height: 100%;
}

.wg__bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wg__title {
  flex: 1 1 auto;
  margin: 0;
  font-weight: 800;
  font-size: clamp(12px, 3vw, 15px);
  color: #17141a;
}

.wg__best {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #17141a;
}

.wg__trophy {
  width: clamp(12px, 3vw, 15px);
  height: clamp(12px, 3vw, 15px);
}

.wg__restart {
  display: grid;
  place-items: center;
  width: clamp(22px, 5vw, 28px);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(23, 20, 26, 0.32);
  border-radius: 12px;
  background: none;
  color: #17141a;
  cursor: pointer;
}

.wg__restart svg {
  width: 62%;
  height: 62%;
}

.wg__restart:focus-visible {
  outline: 2px solid #17141a;
  outline-offset: 2px;
}

.wg__meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wg__clock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #17141a;
}

.wg__timer {
  width: clamp(11px, 2.8vw, 14px);
  height: clamp(11px, 2.8vw, 14px);
}

.wg__num {
  font-weight: 800;
  font-size: clamp(11px, 2.8vw, 14px);
  color: #17141a;
  font-variant-numeric: tabular-nums;
}

.wg__num--score {
  font-size: clamp(13px, 3.4vw, 17px);
}

.wg__unit {
  font-weight: 700;
  font-size: clamp(8px, 2.2vw, 10px);
  color: #17141a;
}

.wg__score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.wg__track {
  flex: 1 1 auto;
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background-color: rgba(23, 20, 26, 0.24);
}

.wg__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background-color: #17141a;
  transform-origin: left center;
  transform: scaleX(1);
}

.wg__field {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template: repeat(3, 1fr)/repeat(3, 1fr);
  gap: 8px;
}

.wg__hole {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.wg__hole:focus-visible {
  outline: 2px solid #17141a;
  outline-offset: 2px;
}

.wg__window {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  background-color: #17141a;
}

.wg__rim {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  border: 2px solid rgba(255, 247, 230, 0.18);
  border-radius: inherit;
}

.wg__mole {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 0;
  height: 76%;
  display: grid;
  place-items: center;
  border-radius: 999px 999px 0 0;
  background-color: #fff7e6;
  color: #17141a;
  transform: translateY(100%);
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.wg__mole svg {
  width: 66%;
  height: 66%;
}

.wg__hole.is-up .wg__mole {
  transform: translateY(0);
}

.wg__flash {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  border-radius: inherit;
  background-color: #fff7e6;
  opacity: 0;
}

.wg__hole.is-hit .wg__flash {
  animation-name: wgFlashHit;
  animation-duration: 380ms;
  animation-timing-function: ease-out;
  animation-iteration-count: 1;
  animation-fill-mode: both;
}

@keyframes wgFlashHit {
  from {
    opacity: 0.8;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.22);
  }
}
.wg__veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 16px;
  background-color: rgba(23, 20, 26, 0.72);
}

.wg__veil[hidden] {
  display: none;
}

.wg__veilMsg {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 13px);
  color: #fff7e6;
}

.wg__veilMsg[hidden] {
  display: none;
}

.wg__start {
  padding: 8px 20px;
  border: 0;
  border-radius: 999px;
  background-color: #fff7e6;
  color: #17141a;
  font-weight: 800;
  font-size: clamp(11px, 2.8vw, 14px);
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transition: transform 140ms ease-out;
}

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

.wg__start:focus-visible {
  outline: 2px solid #fff7e6;
  outline-offset: 2px;
}

.wg.is-demo .wg__veil {
  opacity: 0;
}

.wg.is-demo .wg__mole,
.wg.is-demo .wg__flash {
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: both;
  animation-delay: calc(var(--i) * -220ms);
}

.wg.is-demo .wg__mole {
  animation-name: wgMoleRise;
  transition: none;
}

.wg.is-demo .wg__flash {
  animation-name: wgHitLoop;
}

@keyframes wgMoleRise {
  0% {
    transform: translateY(100%);
  }
  8% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(100%);
  }
  100% {
    transform: translateY(100%);
  }
}
@keyframes wgHitLoop {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  17% {
    opacity: 0;
    transform: scale(0.92);
  }
  21% {
    opacity: 0.8;
    transform: scale(1);
  }
  34% {
    opacity: 0;
    transform: scale(1.18);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}
@media (max-width: 340px) {
  .wg {
    gap: 4px;
  }
  .wg__field {
    gap: 4px;
  }
  .wg__veil {
    padding: 4px;
  }
  .wg__track {
    height: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wg.is-demo .wg__mole {
    animation: none !important;
    transform: translateY(0) !important;
  }
  .wg.is-demo .wg__flash {
    animation: none !important;
    opacity: 0 !important;
  }
  .wg__hole.is-hit .wg__flash {
    animation: none !important;
  }
  .wg__mole {
    transition: none !important;
  }
  .wg__start {
    transition: none !important;
  }
}
