* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  background: #7a1218;
  color: #ffe5a5;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button { font: inherit; touch-action: manipulation; cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }

.game {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  max-width: 520px;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  background: #b82c24;
}
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: -3;
  pointer-events: none;
  user-select: none;
}
.wash {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, rgba(92, 12, 16, .22) 0%, rgba(140, 28, 24, .08) 38%, rgba(92, 12, 18, .42) 100%);
  pointer-events: none;
}

.scores { display: flex; gap: 12px; position: relative; z-index: 2; }
.panel {
  flex: 1;
  min-height: 78px;
  padding: 10px 8px 8px;
  text-align: center;
  border: 2px solid #edbb66;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(183, 42, 35, .92), rgba(110, 18, 22, .92));
  box-shadow: 0 4px 0 #5c1016, inset 0 1px 0 #ffdf90;
}
.panel span {
  display: block;
  color: #f4cb87;
  font-size: 13px;
  letter-spacing: 1px;
}
.panel strong {
  display: block;
  margin-top: 2px;
  font-size: 34px;
  line-height: 1.15;
  color: #ffe7a0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px #8f371a;
}
.panel b { font-weight: 800; }
.panel small { font-size: 14px; margin-left: 4px; }

#status {
  position: relative;
  z-index: 2;
  margin: 10px 0 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff1c4;
  text-shadow: 0 1px 3px #68151a;
}
.start {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  min-height: 52px;
  border-radius: 14px;
  font-weight: 800;
  border: 2px solid #f5c370;
  box-shadow: 0 4px 0 #68151a;
  background: linear-gradient(#ffb15f, #ff8a3d);
  color: #70251b;
  font-size: 20px;
  letter-spacing: 2px;
}

.board {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-content: center;
  min-height: 280px;
  margin: 8px 0 4px;
}
.hole {
  position: relative;
  width: 100%;
  height: clamp(88px, 16vh, 120px);
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  border-radius: 0 0 46% 46%;
  user-select: none;
}
.hole:before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 0;
  height: 36px;
  border: 4px solid #e9a248;
  border-bottom: 7px solid #ffbd66;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #2a1410, #6a301c);
  box-shadow: 0 4px 0 #7a2218;
}
.hole.up:before { border-color: #ffdb82; }
.mole {
  position: absolute;
  left: 14%;
  bottom: 14px;
  width: 72%;
  height: 86px;
  transform: translateY(120px);
  transition: transform .12s ease-out, filter .12s ease;
  background: radial-gradient(ellipse at 38% 22%, #d8a56c, #ad703c 64%, #7d4a2a);
  border: 2px solid #663c28;
  border-radius: 48% 48% 36% 36%;
  box-shadow: inset 3px 3px 0 #e8b37a;
  pointer-events: none;
}
.up .mole { transform: translateY(0); }
.ear {
  position: absolute;
  width: 22px;
  height: 24px;
  top: -8px;
  background: #c48753;
  border: 3px solid #75452e;
  border-radius: 50%;
  z-index: -1;
}
.ear.left { left: -8px; }
.ear.right { right: -8px; }
.eye {
  position: absolute;
  top: 24px;
  width: 8px;
  height: 12px;
  background: #291d1a;
  border-radius: 50%;
  box-shadow: inset 2px 2px 0 #fff;
}
.eye.left { left: 22%; }
.eye.right { right: 22%; }
.muzzle {
  position: absolute;
  left: 16%;
  bottom: 8px;
  width: 68%;
  height: 28px;
  border-radius: 50%;
  background: #ffe0ae;
}
.nose {
  position: absolute;
  left: calc(50% - 6px);
  top: 38px;
  width: 12px;
  height: 9px;
  background: #6b382a;
  border-radius: 50%;
}
.tooth {
  position: absolute;
  left: calc(50% - 7px);
  bottom: 9px;
  width: 14px;
  height: 10px;
  background: #fff4df;
  border-radius: 2px 2px 4px 4px;
  border: 1px solid #98633a;
}
.tooth:after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  height: 8px;
  border-left: 1px solid #ba9167;
}
.cheek {
  position: absolute;
  top: 42px;
  width: 14px;
  height: 8px;
  border-radius: 50%;
  background: #ef977b;
}
.cheek.left { left: 6%; }
.cheek.right { right: 6%; }
.hole.hit .mole {
  filter: brightness(1.35);
  transform: translateY(18px) rotate(-10deg) scale(0.9);
}
.smash {
  position: absolute;
  left: 50%;
  top: 18px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: #ffe08a;
  box-shadow: 0 0 0 4px rgba(255, 214, 110, .35);
  opacity: 0;
  pointer-events: none;
}
.smash:before, .smash:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 3px;
  margin: -1px 0 0 -14px;
  background: #fff6c8;
  border-radius: 2px;
}
.smash:after { transform: rotate(90deg); }
.hit .smash {
  opacity: 1;
  animation: smash .28s ease-out;
}
.points {
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  color: #fff0ab;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 2px #85200e;
  pointer-events: none;
  opacity: 0;
}
.hit .points {
  opacity: 1;
  animation: pop .28s ease-out;
}
@keyframes smash {
  from { transform: scale(.4); opacity: 1; }
  to { transform: scale(1.6); opacity: 0; }
}
@keyframes pop {
  from { transform: translateY(8px); }
  to { transform: translateY(-6px); }
}

.actions { position: relative; z-index: 2; text-align: center; padding: 4px 0 6px; }
.actions p { margin: 6px 0 10px; font-size: 14px; min-height: 20px; color: #fff1c8; }
.reward {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-weight: 800;
  border: 2px solid #f5c370;
  box-shadow: 0 4px 0 #68151a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffda85;
  background: linear-gradient(#9d2426, #72151b);
  font-size: 18px;
}
.reward small { font-size: 12px; font-weight: 500; color: #e5b579; }
.play {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid #ffda85;
}
.hint { color: #f0c896; font-size: 12px; margin: 12px 0 0; }
.urgent { color: #ffb07a !important; }
.hole:focus-visible, .start:focus-visible, .reward:focus-visible {
  outline: 3px solid #fff7c4;
  outline-offset: 2px;
}

@media (max-height: 680px) {
  .panel { min-height: 64px; }
  .panel strong { font-size: 28px; }
  #status { margin-top: 8px; font-size: 14px; }
  .board { min-height: 240px; }
  .mole { height: 72px; bottom: 10px; }
  .start, .reward { min-height: 48px; }
}
