* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(180deg, #ffb6c1 0%, #ff91a4 30%, #ff69b4 100%);
  font-family: 'Zen Maru Gothic', 'Hiragino Kaku Gothic Pro', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8px;
  overflow-x: hidden;
  cursor: none;
}

#game-wrapper {
  width: 100%;
  max-width: 400px;
  text-align: center;
  position: relative;
}

/* タイトル */
.game-title {
  font-family: 'Hachi Maru Pop', cursive;
  font-size: 22px;
  color: #fff;
  text-shadow: 3px 3px 0 #d63384, -1px -1px 0 #d63384, 1px -1px 0 #d63384, -1px 1px 0 #d63384;
  margin-bottom: 2px;
}

.game-subtitle {
  font-size: 11px;
  color: #fff0f5;
  margin-bottom: 6px;
  opacity: 0.9;
}

/* HUD */
#hud {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.hud-item {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 3px 12px;
  min-width: 75px;
}

.hud-label {
  display: block;
  font-size: 9px;
  color: #fff;
  opacity: 0.8;
  letter-spacing: 2px;
}

.hud-value {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
  line-height: 1.3;
}

#timer.urgent {
  color: #ff0;
  animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ゲームボード */
#board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  background: linear-gradient(180deg, #8B4513 0%, #6B3410 50%, #5a2d0c 100%);
  border-radius: 16px;
  border: 3px solid #4a2008;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.1);
  position: relative;
}

/* 穴 */
.hole {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  cursor: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 80%, #3a2010 0%, #5a3518 40%, transparent 70%);
  border-radius: 12px;
}

/* 穴の楕円 */
.hole-bg {
  position: absolute;
  bottom: 0;
  left: 5%;
  width: 90%;
  height: 35%;
  background: radial-gradient(ellipse at center, #1a0a02 0%, #2a1505 50%, #4a2a12 100%);
  border-radius: 50%;
  z-index: 2;
}

/* もぐら（かにかに）コンテナ - 穴の裏に隠れる */
.mole-container {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  height: 80%;
  overflow: hidden;
  z-index: 1;
}

.mole {
  position: absolute;
  bottom: -120%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: auto;
  object-fit: contain;
  transition: bottom 0.15s ease-out;
  pointer-events: none;
}

.hole.active .mole {
  bottom: -10%;
}

.hole.hit .mole {
  bottom: -10%;
  animation: hitSpin 0.4s ease-out forwards;
}

@keyframes hitSpin {
  0% { transform: translateX(-50%) rotate(0deg) scale(1); }
  30% { transform: translateX(-50%) rotate(15deg) scale(1.1); }
  100% { transform: translateX(-50%) rotate(-20deg) scale(0.6) translateY(80%); opacity: 0.3; }
}

/* 叩いた時の穴のエフェクト */
.hole.hit .hole-bg {
  animation: holePulse 0.3s ease-out;
}

@keyframes holePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 20px rgba(255, 200, 0, 0.5); }
  100% { transform: scale(1); }
}

/* ヒットエフェクト（浮き上がるテキスト） */
.hit-text {
  position: fixed;
  font-family: 'Hachi Maru Pop', cursive;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 #d63384;
  pointer-events: none;
  z-index: 100;
  animation: hitTextFloat 0.8s ease-out forwards;
}

.hit-text.combo {
  font-size: 26px;
  color: #ffff00;
  text-shadow: 2px 2px 0 #ff6600;
}

@keyframes hitTextFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-30px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ミスエフェクト */
.miss-text {
  position: fixed;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 100;
  animation: missFloat 0.6s ease-out forwards;
}

@keyframes missFloat {
  0% { opacity: 0.6; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* オーバーレイ */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.overlay.hidden {
  display: none;
}

#overlay-content {
  background: linear-gradient(180deg, #fff5f8 0%, #ffe0eb 100%);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border: 3px solid #ffb6c1;
  max-width: 340px;
  width: 90%;
}

.overlay-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

#overlay-content h2 {
  font-family: 'Hachi Maru Pop', cursive;
  font-size: 24px;
  color: #d63384;
  margin-bottom: 8px;
}

#overlay-content p {
  color: #6a3050;
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 6px;
}

#result-score {
  font-size: 26px !important;
  font-weight: 900;
  color: #d63384 !important;
}

#result-rank {
  font-size: 18px !important;
  font-weight: 700;
}

#result-comment {
  font-size: 12px !important;
  color: #999 !important;
  font-style: italic;
}

button {
  margin-top: 12px;
  padding: 10px 32px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Zen Maru Gothic', sans-serif;
  background: linear-gradient(180deg, #ff69b4 0%, #d63384 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: none;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(214, 51, 132, 0.4);
  letter-spacing: 2px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(214, 51, 132, 0.6);
}

button:active {
  transform: translateY(1px);
}

button.btn-disabled {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}

.hidden {
  display: none !important;
}

/* カスタムカーソル（釘バット） */
#custom-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-20px, -8px);
}

#cursor-bat {
  width: 48px;
  height: 48px;
  position: relative;
  transition: transform 0.06s ease-out;
}

/* 釘バット SVG描画 */
#cursor-bat::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 18px;
  width: 10px;
  height: 32px;
  background: linear-gradient(90deg, #8B6914, #a07828, #8B6914);
  border-radius: 2px;
  transform: rotate(-15deg);
  transform-origin: bottom center;
}

/* バットの頭（太い部分） */
#cursor-bat::after {
  content: '';
  position: absolute;
  top: -2px;
  left: 10px;
  width: 26px;
  height: 16px;
  background: linear-gradient(180deg, #666, #444);
  border-radius: 3px;
  transform: rotate(-15deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* 釘 */
.nail {
  position: absolute;
  width: 3px;
  height: 8px;
  background: linear-gradient(180deg, #ccc, #888);
  border-radius: 0 0 1px 1px;
}

#custom-cursor.swing #cursor-bat {
  transform: rotate(-40deg);
}

/* 叩かれた時のセリフ */
.pain-text {
  position: fixed;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 100;
  animation: painFloat 1s ease-out forwards;
  white-space: nowrap;
}

@keyframes painFloat {
  0% { opacity: 1; transform: translateY(0) translateX(-50%) scale(1); }
  30% { opacity: 1; transform: translateY(-15px) translateX(-50%) scale(1.15); }
  100% { opacity: 0; transform: translateY(-50px) translateX(-50%) scale(0.8); }
}

/* 画面揺れ */
.screen-shake {
  animation: shake 0.15s ease-out;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-0.5deg); }
  50% { transform: translateX(4px) rotate(0.5deg); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* ===== 左右デコレーション ===== */
.side-deco {
  position: fixed;
  top: 0;
  width: 240px;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.side-deco--left {
  left: 0;
}

.side-deco--right {
  right: 0;
}

/* キャラ画像 */
.deco-chara {
  position: absolute;
  width: 200px;
  height: auto;
  opacity: 0.35;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.deco-chara--1 {
  bottom: 40px;
  left: 10px;
  transform: rotate(-10deg);
  animation: decoFloat1 4s ease-in-out infinite;
}

.deco-chara--2 {
  bottom: 40px;
  right: 10px;
  transform: scaleX(-1) rotate(-10deg);
  animation: decoFloat2 4s ease-in-out infinite;
}

@keyframes decoFloat1 {
  0%, 100% { transform: rotate(-10deg) translateY(0); }
  50% { transform: rotate(-8deg) translateY(-12px); }
}

@keyframes decoFloat2 {
  0%, 100% { transform: scaleX(-1) rotate(-10deg) translateY(0); }
  50% { transform: scaleX(-1) rotate(-8deg) translateY(-12px); }
}

/* 吹き出し */
.deco-bubble {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #d63384;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.deco-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(255, 255, 255, 0.7);
}

.deco-bubble--1 {
  bottom: 260px;
  left: 40px;
  animation: bubblePop 3s ease-in-out infinite;
}

.deco-bubble--1::after {
  left: 20px;
}

.deco-bubble--2 {
  bottom: 260px;
  right: 40px;
  animation: bubblePop 3s ease-in-out 1.5s infinite;
}

.deco-bubble--2::after {
  right: 20px;
}

@keyframes bubblePop {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* 散らばる星・花 */
.deco-star {
  position: absolute;
  font-size: 28px;
  opacity: 0.5;
  animation: starTwinkle 2s ease-in-out infinite;
}

.deco-star--2 { top: 25%; left: 50px; font-size: 34px; animation-delay: 0.7s; color: #ff69b4; }
.deco-star--3 { top: 50%; left: 20px; font-size: 24px; animation-delay: 1.4s; color: #ffb6c1; }
.side-deco--left > .deco-star { top: 12%; left: 30px; color: #fff; }

.deco-star--4 { top: 18%; right: 40px; font-size: 32px; animation-delay: 0.3s; color: #fff; }
.deco-star--5 { top: 40%; right: 60px; font-size: 26px; animation-delay: 1s; color: #ffb6c1; }
.deco-star--6 { top: 58%; right: 25px; font-size: 36px; animation-delay: 1.8s; color: #ff69b4; }

@keyframes starTwinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 0.6; transform: scale(1.2) rotate(15deg); }
}

/* ===== 背景のハートパーティクル ===== */
body::before,
body::after {
  content: '🦀 ❤ 🦀 ❤ 🦀 ❤ ✦ ❀ ♪ ✧';
  position: fixed;
  font-size: 14px;
  opacity: 0.08;
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
  letter-spacing: 20px;
}

body::before {
  top: 10%;
  left: -20px;
  transform: rotate(-15deg);
}

body::after {
  bottom: 10%;
  right: -20px;
  transform: rotate(10deg);
}

/* レスポンシブ */
@media (max-width: 900px) {
  .side-deco { width: 160px; }
  .deco-chara { width: 130px; }
  .deco-bubble { font-size: 10px; padding: 8px 10px; }
}

@media (max-width: 650px) {
  .side-deco { display: none; }
}

@media (max-width: 420px) {
  #game-wrapper { padding-top: 24px; }
  .game-title { font-size: 18px; }
  #board { padding: 8px; gap: 4px; }
  .hud-item { padding: 3px 10px; min-width: 65px; }
  .hud-value { font-size: 16px; }
  #hud { gap: 8px; }
  #overlay-content { padding: 20px 16px; }
}

/* ===== トップに戻るリンク ===== */
.back-to-top-link {
  position: fixed;
  top: 12px;
  left: 12px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  cursor: none;
  z-index: 300;
  transition: color 0.2s;
}
.back-to-top-link:hover {
  color: #fff;
}
