/* 두더지 잡기 — 3x3 그리드 30초 반사 게임 */

.board-wrap {
  position: relative;
  width: min(92vw, 420px);
  margin: 0 auto;
}

.whack-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 22px;
  background: linear-gradient(135deg, #d97c4c, #a55a32);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(217, 124, 76, 0.25);
  aspect-ratio: 1 / 1;
}

.hole {
  position: relative;
  background: radial-gradient(ellipse at 50% 60%, #4a2818 0%, #2b1408 70%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.08s;
  padding: 0;
}

.hole:active { transform: scale(0.96); }

/* 두더지·폭탄 — JS가 .hole 안에 .pop 요소를 넣음 */
.hole .pop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 8vw, 2.8rem);
  transform: translateY(100%);
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.4, 1.4);
  pointer-events: none; /* 부모 .hole 이 클릭 받음 */
}

.hole .pop.up   { transform: translateY(0); }
.hole .pop.down { transform: translateY(100%); transition: transform 0.12s ease-in; }

.hole .pop.hit {
  animation: pop-hit 0.3s ease;
}

.hole .pop.bombed {
  animation: pop-bomb 0.4s ease;
}

@keyframes pop-hit {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-8px) scale(1.2); }
  100% { transform: translateY(100%) scale(0.7); opacity: 0; }
}

@keyframes pop-bomb {
  0%, 100% { transform: translateY(0) scale(1); }
  20%      { transform: translateY(0) scale(1.3) rotate(-10deg); }
  40%      { transform: translateY(0) scale(1.3) rotate(10deg); }
  60%      { transform: translateY(0) scale(1.3) rotate(-10deg); }
}

.whack-board.shake {
  animation: board-shake 0.4s ease;
}

@keyframes board-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* +1 / -2 점수 떠오르는 효과 */
.whack-board .floater {
  position: absolute;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  pointer-events: none;
  animation: floater-up 0.7s ease-out forwards;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 4;
}
.whack-board .floater.minus { color: #ffd1d1; }

@keyframes floater-up {
  from { transform: translate(-50%, 0); opacity: 1; }
  to   { transform: translate(-50%, -40px); opacity: 0; }
}

/* ===== 시작 오버레이 ===== */

.whack-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 41, 0.78);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  z-index: 5;
  transition: opacity 0.2s;
}
.whack-overlay.hidden { opacity: 0; pointer-events: none; }

.overlay-content { text-align: center; padding: 24px; }
.overlay-icon { font-size: 3.5rem; margin-bottom: 12px; }
.overlay-content h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.overlay-content p { color: var(--text-dim); margin-bottom: 18px; line-height: 1.5; }

.hint {
  text-align: center;
  margin-top: 20px;
  color: var(--text-dim);
  font-size: 0.88rem;
  padding: 0 16px;
}

/* ===== 결과 모달 — math 게임과 동일 ===== */

.result-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 41, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fadeIn 0.25s ease;
}
.result-modal.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.result-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-emoji { font-size: 4rem; margin-bottom: 8px; }
.result-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.result-msg { color: var(--text-dim); margin-bottom: 24px; }

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.result-stats > div {
  background: rgba(255,255,255,0.05);
  padding: 14px;
  border-radius: 12px;
}
.result-stats span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.result-stats strong {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-rank {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 8px 0 4px;
  color: var(--accent);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.result-actions .btn {
  padding: 12px 16px;
  text-align: center;
  font-size: 0.95rem;
}
