:root {
  --bg: #FFF8F3;
  --primary: #FF6B9D;
  --primary-light: #FF8FB3;
  --primary-dark: #E85585;
  --accent: #FFD93D;
  --secondary: #5EC9F2;
  --success: #6BCB77;
  --danger: #FF6B6B;
  --card: #FFFFFF;
  --text: #2D3142;
  --text-light: #6C7293;
  --border: #F0E6DD;
  --board-bg: #FFE8DD;
  --mound: #FF9F45;
  --mound-dark: #E5882F;
  --shadow: 0 8px 24px rgba(45, 49, 66, 0.12);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game-container {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 64px 16px 16px;
}

#ui-overlay {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
  z-index: 5;
}
.ui-row { display: flex; gap: 6px; align-items: center; }
.ui-pill {
  background: rgba(255,255,255,0.92);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(45,49,66,0.08);
  font-size: 0.88rem;
  white-space: nowrap;
}
.ui-pill--time { color: var(--primary-dark); }
.ui-label { font-weight: 600; color: var(--text-light); margin-right: 4px; font-size: 0.78rem; }

#pause-btn, #mute-btn {
  background: rgba(255,255,255,0.92);
  border: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(45,49,66,0.08);
}

#board {
  width: 100%;
  max-width: 360px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
  aspect-ratio: 1 / 1;
  background: var(--board-bg);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.hole {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #5B3920 0%, #3F2614 65%, transparent 70%);
}
.hole__mound {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 30%;
  background: linear-gradient(180deg, var(--mound), var(--mound-dark));
  border-radius: 0 0 50% 50% / 0 0 20px 20px;
  z-index: 2;
}

/* 角色：默认在洞底，弹出时上移 */
.critter {
  position: absolute;
  left: 12%; right: 12%;
  bottom: -2%;
  height: 78%;
  border-radius: 46% 46% 40% 40% / 56% 56% 38% 38%;
  background: var(--primary);
  z-index: 1;
  transform: translateY(110%);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.08);
}
.critter::before,
.critter::after {
  /* 眼睛 */
  content: '';
  position: absolute;
  top: 28%;
  width: 12%;
  height: 18%;
  background: #2D3142;
  border-radius: 50%;
}
.critter::before { left: 22%; }
.critter::after  { right: 22%; }

.hole.up .critter { transform: translateY(-2%); z-index: 3; }
.hole.hit .critter {
  transform: translateY(80%) scale(0.85);
  opacity: 0.4;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* 普通地鼠（pink），加分；bomb 红色 + 圆 X */
.critter--bomb {
  background: var(--danger);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.12), 0 0 0 3px #C0392B inset;
}
.critter--bomb::before,
.critter--bomb::after {
  background: #FFD93D;
  width: 16%;
  height: 22%;
  border-radius: 50%;
}
.critter--bomb .critter__fuse {
  position: absolute;
  top: -8%;
  left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 16px;
  background: linear-gradient(180deg, #2D3142, #6C7293);
  border-radius: 3px;
}

.critter--bomb .critter__spark {
  position: absolute;
  top: -16%;
  left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFD93D, #FF9F45 70%, transparent);
  animation: spark 0.6s linear infinite;
}
@keyframes spark {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.4); opacity: 0.6; }
}

.score-pop {
  position: absolute;
  top: 14%; left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 4;
  animation: pop-up 0.7s ease-out forwards;
  color: var(--success);
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.score-pop--neg { color: var(--danger); }
@keyframes pop-up {
  0%   { transform: translate(-50%, 0); opacity: 0; }
  20%  { transform: translate(-50%, -8px); opacity: 1; }
  100% { transform: translate(-50%, -36px); opacity: 0; }
}

.modal {
  position: absolute;
  inset: 0;
  background: rgba(45, 49, 66, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal__inner {
  background: var(--card);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px; width: 100%;
  box-shadow: var(--shadow);
}
.modal__inner h2 { margin: 0 0 8px; font-size: 1.6rem; }
.modal__inner p { margin: 0 0 16px; color: var(--text-light); }
.big-score { font-size: 1.4rem !important; color: var(--text) !important; font-weight: 800; margin: 4px 0 !important; }
.sub-score { font-size: 0.95rem; }

.btn {
  background: var(--primary); color: #fff;
  border: 0;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 1rem; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,107,157,0.4);
  font-family: inherit;
}
.btn:hover { background: var(--primary-dark); }

.ad-slot {
  margin-top: 16px;
  min-height: 100px;
}
