/* 두더지 잡기 전용 스타일. 판(잔디)과 그림 색은 밝은/어두운 화면에서 따로 정하고, 나머지는 공통 변수를 쓴다. */
.wm {
  --wm-grass1: #8fd16a;
  --wm-grass2: #5fae43;
  --wm-rim: #7a4f2a;
  --wm-pit: #24150a;
  --wm-cover: rgba(28, 54, 18, 0.86);
  margin-top: 22px;
}

/* 위 상태 줄 */
.wm-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  max-width: 560px;
  margin-inline: auto;
}
.wm-hud li {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 2px;
  line-height: 1.35;
}
.wm-hud b {
  display: block;
  color: var(--ink);
  font-size: 1.2rem;
}
.wm-timebar {
  max-width: 560px;
  margin: 8px auto 10px;
}

/* 판: 3x3 구멍 */
.wm-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(4px, 2vw, 14px);
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(8px, 3vw, 22px) clamp(6px, 2.5vw, 20px);
  border-radius: 26px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(0, 40, 0, 0.12)),
    url(/game/wm-grass.webp) center / cover,
    linear-gradient(160deg, var(--wm-grass1), var(--wm-grass2));
  box-shadow: var(--shadow);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wm-hole {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.wm-hole:focus-visible {
  outline: 3px solid #ffd34d;
  outline-offset: -2px;
}
/* 구멍(어두운 타원 + 흙 테두리) */
.wm-hole::before {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 9%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, var(--wm-pit) 0 58%, #3a2311 78%);
  box-shadow:
    0 0 0 5px var(--wm-rim),
    0 6px 0 5px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease;
}
.wm-hole.thud::before {
  animation: wm-thud 0.18s ease-out;
}
@keyframes wm-thud {
  50% {
    transform: scale(0.93);
  }
}
/* 두더지가 보이는 창: 구멍 가운데 선에서 잘라 구멍 속에서 올라오는 것처럼 보인다 */
.wm-win {
  position: absolute;
  left: 8%;
  right: 8%;
  top: -8%;
  bottom: 24%;
  overflow: hidden;
  pointer-events: none;
}
.wm-mole {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  transform: translateY(102%);
  transition: transform 0.11s ease-out;
}
.wm-mole .art {
  display: block;
  width: 100%;
  height: 100%;
}
.wm-hole.up .wm-mole {
  transform: translateY(0);
}
.wm-hole.up.hit .wm-mole {
  transform: translateY(14%) scaleY(0.9);
  transform-origin: 50% 100%;
}
.wm-key {
  position: absolute;
  left: 8px;
  top: 6px;
  z-index: 2;
  display: none;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .wm-key {
    display: block;
  }
}

/* 맞혔을 때 뜨는 글자(뿅! +1 등) */
.wm-pop {
  position: absolute;
  left: 50%;
  top: 6%;
  z-index: 3;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: clamp(0.78rem, 3.6vw, 1.15rem);
  font-weight: 900;
  white-space: nowrap;
  color: #fff;
  background: rgba(20, 24, 36, 0.72);
  transform: translate(-50%, 0);
  pointer-events: none;
  animation: wm-pop 0.65s ease-out forwards;
}
.wm-pop.gold {
  background: #a86b00;
}
.wm-pop.minus {
  background: #c2333f;
}
@keyframes wm-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 30%) scale(0.6);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1);
  }
}

/* 그림: 점토 그림(webp). 맞으면 눌리고(.wm-mole 의 scaleY) 잠깐 하얗게 번쩍인다 */
.art {
  object-fit: contain;
  object-position: 50% 100%;
  -webkit-user-drag: none;
  user-select: none;
}
.wm-hole.hit .wm-mole .art {
  animation: wm-flash 0.22s ease-out;
}
@keyframes wm-flash {
  40% {
    filter: brightness(1.7) saturate(0.6);
  }
}

/* 판을 덮는 안내 화면 */
.wm-cover {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: var(--wm-cover);
  color: #fff;
  border-radius: inherit;
}
.wm-cover[hidden] {
  display: none;
}
.wm-cover-icon {
  display: block;
  width: 84px;
  height: 84px;
  margin-inline: auto;
  line-height: 1;
}
.wm-cover-icon .art {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}
.wm-cover-title {
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.wm-cover-sub {
  font-size: 0.98rem;
  opacity: 0.94;
  max-width: 24em;
}
.wm-btn {
  margin-top: 10px;
  min-width: 160px;
  background: #fff;
  color: #2c4a12;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.wm-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.wm-btn:focus-visible {
  outline-color: #fff;
}

/* 점수 규칙 그림 설명 */
.wm-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 12px auto 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--muted);
}
.wm-legend li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wm-legend b {
  color: var(--ink);
}
.wm-legend-art {
  display: inline-block;
  width: 36px;
  height: 36px;
}
.wm-legend-art .art {
  width: 100%;
  height: 100%;
}
.wm-keys-help {
  margin-top: 4px;
}
.wm-newbest {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.9rem;
}
.wm-stats b {
  font-size: 1.1rem;
}

@media (prefers-reduced-motion: reduce) {
  .wm-mole,
  .wm-hole::before {
    transition: none;
  }
  .wm-hole.thud::before {
    animation: none;
  }
  .wm-pop {
    animation: none;
    opacity: 1;
  }
}
