* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #faf6ec;
  color: #33302a;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#stage { position: fixed; inset: 0; }

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ── HUD ── */
#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
#hud[hidden] { display: none; }
.hud-left, .hud-right { display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.hud-btn {
  min-width: 40px;
  height: 40px;
  border: 2px solid #33302a;
  border-radius: 12px;
  background: #fffdf8;
  color: #33302a;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(38, 34, 28, .18);
}
.hud-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.hud-btn.muted { color: #b3a88f; text-decoration: line-through; }

/* ── 炸弹按钮（触屏；能量满才显示）── */
.bomb-btn {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 84px;
  height: 84px;
  border: 3px solid #c0492b;
  border-radius: 50%;
  background: rgba(255, 253, 248, .9);
  font-size: 34px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(38, 34, 28, .2);
  animation: bomb-pulse 1s infinite;
  touch-action: none;
}
.bomb-btn[hidden] { display: none; }
@keyframes bomb-pulse {
  50% { transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .bomb-btn { animation: none; } }

/* ── 选关列表（同兔子快跑）── */
.level-list { display: grid; gap: 10px; }
.level-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid #33302a;
  border-radius: 14px;
  background: #faf6ec;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #33302a;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(38, 34, 28, .16);
}
.level-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(38, 34, 28, .16); }
.level-btn .lv-tag { font-size: 12px; color: #8a8172; font-weight: 400; }
.level-btn .lv-done { color: #c0492b; }
.level-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.level-btn.boss { border-color: #c0492b; color: #c0492b; }

/* ── 菜单 / 结算 ── */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }
.paper-card {
  width: min(440px, 100%);
  padding: 26px 24px 18px;
  background: #fffdf8;
  border: 2.5px solid #33302a;
  border-radius: 18px;
  box-shadow: 6px 6px 0 rgba(38, 34, 28, .16);
  text-align: center;
}
.menu-kicker {
  display: inline-block;
  margin: 0;
  padding: 3px 14px;
  border: 2px solid #33302a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  box-shadow: 2px 2px 0 rgba(38, 34, 28, .16);
}
.paper-card h1 {
  margin: 12px 0 0;
  font-size: 36px;
  letter-spacing: .04em;
}
.menu-sub {
  margin: 10px 0 16px;
  font-size: 14px;
  line-height: 1.8;
  color: #6f6759;
}
.best-line {
  margin: 0 0 12px;
  font-size: 13px;
  color: #c9962b;
  font-weight: 700;
}
.result-stars {
  margin: 8px 0 0;
  font-size: 34px;
  letter-spacing: .18em;
  color: #c9962b;
}
.big-btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 2.5px solid #c0492b;
  border-radius: 14px;
  background: #faf6ec;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  color: #c0492b;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(38, 34, 28, .16);
}
.big-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(38, 34, 28, .16); }
.menu-hint {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: #8a8172;
}
.menu-foot {
  margin: 14px 0 0;
  font-size: 12px;
  color: #8a8172;
}
.menu-foot a { color: #8a8172; }
.menu-foot a:hover { color: #c0492b; }
.linklike {
  border: 0;
  background: none;
  font: inherit;
  color: #8a8172;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .hud-btn:active, .big-btn:active, .pad-btn:active { transform: none; }
}
