/* ── 게임 레이아웃 ── */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.game-ad-top,
.game-ad-bottom {
  max-width: 760px;
  margin: 12px auto;
  width: 100%;
  padding: 0 20px;
}

.ad-label {
  background: var(--ad-bg, #f8f8fc);
  border: 1px dashed var(--border, #e0e0ee);
  border-radius: 8px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #aaaacc);
  font-size: 0.8rem;
  transition: background 0.3s, border-color 0.3s;
}

.game-layout {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 20px 20px 0;
  flex: 1;
}

.game-main { flex-shrink: 0; }

.game-aside {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

.ad-side-box {
  background: var(--ad-bg, #f8f8fc);
  border: 1px dashed var(--border, #e0e0ee);
  border-radius: 12px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #aaaacc);
  font-size: 0.8rem;
  transition: background 0.3s;
}

.guide-box {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0ee);
  border-radius: 12px;
  padding: 20px;
  transition: background 0.3s, border-color 0.3s;
}

.guide-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  margin-bottom: 12px;
}

.guide-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-box li {
  font-size: 0.82rem;
  color: var(--text-secondary, #555577);
  line-height: 1.5;
}

.game-info-section {
  max-width: 760px;
  margin: 32px auto 0;
  padding: 0 20px;
}

.game-info-inner {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0ee);
  border-radius: 14px;
  padding: 24px 28px;
  transition: background 0.3s, border-color 0.3s;
}

.game-info-inner h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  margin-bottom: 10px;
}

.game-info-inner p {
  font-size: 0.88rem;
  color: var(--text-secondary, #555577);
  line-height: 1.8;
}

@media (max-width: 760px) {
  .game-layout { flex-direction: column; align-items: center; }
  .game-aside { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .ad-side-box { flex: 1; min-width: 200px; height: 120px; }
  .guide-box { flex: 1; min-width: 200px; }
}

/* ── 테마 변수 ── */
:root {
  --bg-from: #6fa84a;
  --bg-to: #3d6127;
  --overlay-bg: rgba(0, 0, 0, 0.65);
  --box-bg: #ffffff;
  --box-h1: #333333;
  --box-p: #666666;
  --btn-bg: #e8a020;
  --btn-hover: #cf8a10;
  --stat-bg: rgba(0, 0, 0, 0.25);
  --stat-label: #c8f0a0;
  --stat-value: #ffffff;
  --title-color: #ffffff;
  --title-shadow: rgba(0, 0, 0, 0.3);
  --ground-color: #4a3020;
  --ground-shadow: #3a2010;
  --toggle-bg: rgba(0, 0, 0, 0.2);
  --toggle-color: #ffffff;
  --toggle-hover: rgba(0, 0, 0, 0.35);
}

body.dark {
  --bg-from: #1a1a2e;
  --bg-to: #0d0d1a;
  --overlay-bg: rgba(0, 0, 0, 0.8);
  --box-bg: #1e1e30;
  --box-h1: #e8e8f0;
  --box-p: #9999bb;
  --btn-bg: #5566ff;
  --btn-hover: #3344dd;
  --stat-bg: rgba(255, 255, 255, 0.08);
  --stat-label: #8899ff;
  --stat-value: #ffffff;
  --title-color: #ccccff;
  --title-shadow: rgba(100, 100, 255, 0.4);
  --ground-color: #2a1a0e;
  --ground-shadow: #1a0e06;
  --toggle-bg: rgba(255, 255, 255, 0.1);
  --toggle-color: #ccccff;
  --toggle-hover: rgba(255, 255, 255, 0.18);
}

body {
  background: var(--bg-from);
  background-image: radial-gradient(ellipse at top, var(--bg-from), var(--bg-to));
  min-height: 100vh;
  font-family: 'Segoe UI', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s, background-image 0.4s;
}

/* ── 오버레이 ── */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: background 0.4s;
}

.overlay.hidden {
  display: none;
}

.overlay-box {
  background: var(--box-bg);
  border-radius: 24px;
  padding: 48px 56px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: background 0.4s;
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.title-mole {
  font-size: 72px;
  margin-bottom: 12px;
}

.overlay-box h1 {
  font-size: 2rem;
  color: var(--box-h1);
  margin-bottom: 12px;
  transition: color 0.4s;
}

.overlay-box p {
  color: var(--box-p);
  margin-bottom: 32px;
  font-size: 1rem;
  transition: color 0.4s;
}

.overlay-box button {
  background: var(--btn-bg);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 48px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.overlay-box button:hover {
  background: var(--btn-hover);
  transform: scale(1.05);
}

/* ── 게임 컨테이너 ── */
.game-container {
  width: 560px;
  user-select: none;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.game-title {
  color: var(--title-color);
  font-size: 1.6rem;
  text-shadow: 0 2px 6px var(--title-shadow);
  transition: color 0.4s;
}

.stat {
  background: var(--stat-bg);
  border-radius: 16px;
  padding: 10px 20px;
  text-align: center;
  min-width: 90px;
  transition: background 0.4s;
}

.stat .label {
  display: block;
  color: var(--stat-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.4s;
}

.stat .value {
  display: block;
  color: var(--stat-value);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.2;
}

/* ── 테마 토글 버튼 ── */
.theme-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  border: none;
  border-radius: 50px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.4s;
}

.theme-toggle:hover {
  background: var(--toggle-hover);
}

.theme-icon {
  font-size: 1rem;
}

/* ── 그리드 ── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── 구멍 ── */
.hole {
  position: relative;
  height: 150px;
  overflow: hidden;
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'><text y='34' font-size='34'>🔨</text></svg>") 8 8, pointer;
}

.hole-ground {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 50px;
  background: var(--ground-color);
  border-radius: 50%;
  box-shadow: 0 8px 0 var(--ground-shadow), inset 0 -6px 12px rgba(0, 0, 0, 0.5);
  z-index: 1;
  transition: background 0.4s;
}

/* ── 두더지 ── */
.mole {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 90px;
  height: 100px;
  transition: transform 0.18s cubic-bezier(0.34, 1.3, 0.64, 1);
  pointer-events: none;
  text-align: center;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  z-index: 2;
}

.mole img {
  width: 90px;
  height: 100px;
  object-fit: cover;
  object-position: center top;
  border-radius: 50% 50% 40% 40%;
  border: 3px solid #fff;
  display: block;
}

.hole.up .mole {
  transform: translateX(-50%) translateY(0%);
}

/* 맞았을 때 */
.hole.whacked .mole {
  filter: drop-shadow(0 0 12px #ffdd00) brightness(1.4);
  transition: none;
}

/* ── 히트 메시지 ── */
.hit-message {
  position: fixed;
  font-size: 2.5rem;
  font-weight: 900;
  color: #ffdd00;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: none;
}

.hit-message.show {
  animation: floatUp 0.7s ease-out forwards;
}

@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1.3); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.8); }
}

/* ── 피 물방울 ── */
.blood-drop {
  position: fixed;
  width: 10px;
  height: 14px;
  background: radial-gradient(circle at 40% 35%, #ff4444, #990000);
  border-radius: 50% 50% 60% 60%;
  pointer-events: none;
  z-index: 999;
  animation: bloodSplat 0.6s ease-out forwards;
}

@keyframes bloodSplat {
  0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.2); opacity: 0; }
}

/* ── 타이머 경고 ── */
.stat .value.danger {
  color: #ff6b6b;
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.15); }
}
