* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; overscroll-behavior: none;
  background: #070d13; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}
body { position: relative; }
button { font-family: inherit; border: 0; cursor: pointer; }
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; overflow: hidden; }

/* ---------- 首页 ---------- */
.home { background: #0a1118; }
.home-art {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 111%;
  object-fit: cover; object-position: 6% 0;
  pointer-events: none; user-select: none;
}
.home-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(4,9,14,.42) 0%, rgba(4,9,14,0) 26%),
    linear-gradient(180deg, rgba(4,9,14,0) 42%, rgba(4,9,14,.72) 70%, rgba(4,9,14,.97) 100%);
}
.home-ui {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 22px calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
}
.home-kicker {
  margin: 0 0 8px; color: #ffb37a; font-size: 11px; font-weight: 700;
  letter-spacing: .22em; text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.home-title {
  margin: 0; color: #fff; font-size: clamp(32px, 9vw, 42px); line-height: 1.05;
  font-weight: 900; letter-spacing: -.02em; text-shadow: 0 4px 22px rgba(0,0,0,.8);
}
.home-desc {
  margin: 9px 0 18px; color: #d4dde5; font-size: 13px; letter-spacing: .02em;
  text-shadow: 0 2px 10px rgba(0,0,0,.9);
}
.start-btn {
  display: block; width: 100%; height: 58px; border-radius: 15px;
  background: linear-gradient(180deg, #ffa95e 0%, #ff8a3d 48%, #f36f20 100%);
  border: 2px solid rgba(38, 18, 5, .9);
  color: #231204; font-size: 21px; font-weight: 900; letter-spacing: .06em;
  box-shadow: 0 10px 30px rgba(255, 122, 34, .38), inset 0 1px 0 rgba(255,255,255,.5);
}
.start-btn:active { transform: translateY(1px); filter: brightness(.96); }
.home-best {
  margin: 12px 0 0; text-align: center; color: #95a6b5; font-size: 12px;
}
.home-best b { color: #ffc08a; font-weight: 700; }

/* ---------- 游戏 ---------- */
.game { background: #071018; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.game::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 140px;
  background: linear-gradient(180deg, rgba(4,10,16,.62) 0%, rgba(4,10,16,.22) 55%, rgba(4,10,16,0) 100%);
  pointer-events: none; z-index: 1;
}

.hud {
  position: absolute; z-index: 3;
  top: calc(10px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.hud-pause {
  pointer-events: auto; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(10, 20, 30, .62);
  border: 1px solid rgba(255,255,255,.22);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hud-pause:active { background: rgba(255, 138, 61, .35); }
.hud-pause .mp-icon { width: 24px; height: 24px; }
.hud-score {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  min-width: 108px; padding: 4px 16px 5px; text-align: center;
  background: rgba(8, 16, 24, .66); border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hud-score span { display: block; color: #fff; font-size: 21px; line-height: 1.1; font-weight: 900; }
.hud-score small { display: block; margin-top: 1px; color: #ffb37a; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.hud-hp {
  display: flex; align-items: center; gap: 4px; height: 42px; padding: 0 13px 0 10px;
  border-radius: 13px; background: rgba(8, 16, 24, .66);
  border: 1px solid rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hud-hp .mp-icon { width: 19px; height: 19px; color: #ff5c5c; }
.hud-hp span { color: #fff; font-size: 18px; font-weight: 900; }

.hint {
  position: absolute; z-index: 3; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); white-space: nowrap;
  padding: 8px 15px; border-radius: 999px;
  background: rgba(6, 13, 20, .58); border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.86); font-size: 12px; letter-spacing: .04em;
  transition: opacity .5s ease; pointer-events: none;
}
.hint.off { opacity: 0; }

.toast {
  position: absolute; z-index: 4; left: 50%; top: 27%;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  padding: 9px 18px; border-radius: 999px; white-space: nowrap;
  background: rgba(20, 11, 4, .82); border: 1px solid rgba(255, 138, 61, .62);
  color: #ffc08a; font-size: 13px; font-weight: 700; letter-spacing: .05em;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(4, 8, 12, .72);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
}
.panel {
  width: 100%; max-width: 340px; padding: 26px 20px 20px; text-align: center;
  border-radius: 20px; border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, #1b2733 0%, #101923 100%);
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.panel h2 { margin: 0 0 12px; font-size: 25px; font-weight: 900; letter-spacing: .02em; }
.panel p { margin: 6px 0; color: #9fb0c0; font-size: 13px; }
.panel p b { color: #ffb37a; font-size: 20px; font-weight: 900; margin-left: 4px; }
.panel-btn {
  display: block; width: 100%; height: 48px; margin-top: 10px; border-radius: 12px;
  background: linear-gradient(180deg, #ffa95e, #ff8a3d);
  color: #231204; font-size: 16px; font-weight: 900; letter-spacing: .04em;
  border: 1px solid rgba(50, 25, 8, .5);
}
.panel-btn:active { filter: brightness(.95); }
.panel-btn.ghost {
  background: transparent; color: #dbe4ec;
  border: 1px solid rgba(255,255,255,.18);
}

@media (max-height: 620px) {
  .home-desc { margin-bottom: 12px; }
  .start-btn { height: 52px; }
  .home-kicker { display: none; }
}
