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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #8fd3f4 0%, #bde8c8 70%, #a9d97c 100%);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  user-select: none;
}

#wrap {
  width: min(96vw, 984px);
  padding: 12px 0 20px;
}

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff8e8;
  border: 4px solid #c9a36b;
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 8px 16px;
}

.hud-left { display: flex; gap: 14px; align-items: center; }

.stat {
  background: #fff;
  border: 2.5px solid #e8c98f;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 17px;
  color: #6b4f2a;
  white-space: nowrap;
}
.stat b { color: #d97b12; font-size: 19px; }

.hud-right { display: flex; gap: 6px; }

.hud-btn {
  border: 2.5px solid #e8c98f;
  background: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  color: #6b4f2a;
  transition: transform .1s, background .15s;
  white-space: nowrap;
}
.hud-btn:hover { background: #fff3d6; transform: translateY(-1px); }
.hud-btn:active { transform: translateY(1px); }

.hud-btn.primary {
  background: linear-gradient(180deg, #ffb23e, #ff8a3d);
  border-color: #d96a1e;
  color: #fff;
  font-weight: bold;
  font-size: 16px;
  padding: 7px 16px;
  box-shadow: 0 3px 0 #c9581a;
  animation: bounce 1.2s infinite;
}
.hud-btn.primary:hover { filter: brightness(1.08); }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

#stage {
  position: relative;
  border: 4px solid #c9a36b;
  border-radius: 0 0 20px 20px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(80, 50, 10, .25);
  line-height: 0;
}

#game {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(60, 40, 15, .55);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  line-height: 1.6;
  text-align: center;
  padding: 20px;
}
.overlay[hidden] { display: none; }

.overlay h1 {
  font-size: 44px;
  color: #fff;
  text-shadow: 0 4px 0 rgba(120, 60, 10, .6), 0 8px 20px rgba(0,0,0,.4);
}

.overlay .sub { font-size: 19px; color: #ffe8b0; }

.overlay .help {
  background: rgba(255, 248, 232, .95);
  border: 3px solid #e8c98f;
  border-radius: 18px;
  padding: 14px 26px;
  font-size: 15px;
  color: #6b4f2a;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

#endStars { font-size: 46px; letter-spacing: 8px; }
#endStats { font-size: 17px; color: #ffe8b0; }

.big-btn {
  border: none;
  background: linear-gradient(180deg, #8ee060, #5da344);
  color: #fff;
  font-family: inherit;
  font-size: 24px;
  font-weight: bold;
  padding: 14px 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 5px 0 #3f7d2c, 0 10px 20px rgba(0,0,0,.3);
  transition: transform .1s, filter .15s;
}
.big-btn:hover { filter: brightness(1.08); transform: translateY(-2px); }
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #3f7d2c; }

#foot {
  text-align: center;
  margin-top: 12px;
  color: #5b7a3a;
  font-size: 14px;
}

/* ===== 手机端（viewport=620 时生效）：游戏贴顶，不再上下悬空 ===== */
@media (max-width: 660px) {
  body { align-items: flex-start; }
  #wrap { padding-top: 6px; }
}
