/* 桥上打僵尸15 — 夜桥生存 H5 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --orange: #FF8A3D;
  --orange-hot: #FFB063;
  --orange-deep: #E45A12;
  --ink: #080b13;
  --cream: #FFF0DB;
  --glass: rgba(10, 13, 21, 0.62);
  --line: rgba(255, 181, 122, 0.18);
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #060910;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body { position: fixed; inset: 0; }

.game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background: #060910;
}

.scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* 画面氛围层 */
.vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0) 38%, rgba(2, 4, 9, 0.34) 78%, rgba(1, 3, 7, 0.62) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0%, transparent 18%, transparent 78%, rgba(0, 0, 0, 0.34) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.055) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 190, 140, 0.035) 0 1px, rgba(0, 0, 0, 0) 1px 4px);
}

.damage-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(255, 70, 40, 0.1) 20%, rgba(214, 24, 12, 0.66) 100%);
}
.damage-flash.on { animation: dmgFlash 0.46s ease-out both; }
@keyframes dmgFlash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.hud-card {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 8px;
  border-radius: 12px;
  color: #fff;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hud-card .mp-icon { width: 15px; height: 15px; flex: 0 0 auto; }
.hp-card { flex: 1 1 92px; max-width: 144px; }
.hp-icon { color: #ff7668; filter: drop-shadow(0 0 5px rgba(255, 96, 76, 0.5)); }
.hp-track {
  position: relative;
  flex: 1 1 auto;
  height: 7px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}
.hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd06a 0%, #ff9a3d 46%, #ff5b3b 100%);
  box-shadow: 0 0 8px rgba(255, 128, 60, 0.6);
  transition: width 0.18s ease-out;
}
.hp-fill.low { animation: hpLow 0.8s ease-in-out infinite; }
@keyframes hpLow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.55) saturate(1.2); }
}
.hp-num {
  min-width: 22px;
  text-align: right;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffe2c4;
}

.wave-card {
  padding: 0 9px;
  color: #ffd5a8;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.wave-card .mp-icon { color: var(--orange); width: 14px; height: 14px; }

.score-card {
  margin-left: auto;
  padding: 0 10px;
  color: #ffcf92;
}
.score-card .mp-icon { color: #ffb44f; }
.score-card b {
  min-width: 26px;
  text-align: right;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

/* ---------- 波次提示 ---------- */
.wave-banner {
  position: absolute;
  top: 21%;
  left: 50%;
  z-index: 7;
  width: 100%;
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px) scale(0.96);
  transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.wave-banner.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.wave-banner strong {
  display: block;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff8ee;
  text-shadow:
    0 0 22px rgba(255, 122, 44, 0.85),
    0 3px 0 rgba(126, 42, 8, 0.8),
    0 8px 22px rgba(0, 0, 0, 0.6);
}
.wave-banner span {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #ffd2a2;
  border-radius: 99px;
  background: rgba(12, 10, 14, 0.52);
  border: 1px solid rgba(255, 160, 90, 0.22);
}

/* 底部操作提示 */
.tip {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  color: rgba(255, 236, 218, 0.84);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
  background: rgba(8, 11, 18, 0.55);
  border: 1px solid rgba(255, 190, 135, 0.16);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.tip .mp-icon { width: 15px; height: 15px; color: var(--orange); }
.tip.dim { opacity: 0; transform: translate(-50%, 8px); }
.hud.is-hidden,
.tip.is-hidden {
  opacity: 0;
  visibility: hidden;
}
.new-best.is-hidden { display: none; }

/* ---------- 通用屏幕层 ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(env(safe-area-inset-top, 0px) + 5.5vh)
    22px
    calc(env(safe-area-inset-bottom, 0px) + 24px);
  pointer-events: none;
  transition: opacity 0.34s ease, visibility 0.34s ease;
}
.screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.screen button { pointer-events: auto; }

.start-screen {
  background:
    linear-gradient(180deg,
      rgba(4, 7, 14, 0.86) 0%,
      rgba(5, 8, 16, 0.5) 24%,
      rgba(5, 8, 16, 0) 45%,
      rgba(5, 7, 12, 0.32) 62%,
      rgba(4, 6, 11, 0.83) 86%,
      rgba(3, 5, 9, 0.96) 100%);
}

/* ---------- 首页标题 ---------- */
.menu-top { max-width: 430px; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 99px;
  color: #ffd6b0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  background: rgba(12, 9, 12, 0.5);
  border: 1px solid rgba(255, 160, 95, 0.26);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
.kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 10px 2px rgba(255, 122, 45, 0.8);
  animation: dotPulse 1.6s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 0.65; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.25); }
}

.game-title {
  margin: 16px 0 0;
  line-height: 0.84;
  letter-spacing: -0.045em;
  color: #fff;
}
.title-top {
  display: block;
  font-size: clamp(34px, 10.2vw, 46px);
  font-weight: 900;
  color: #ffe9d0;
  text-shadow: 0 2px 0 rgba(87, 38, 15, 0.9), 0 8px 22px rgba(0, 0, 0, 0.55);
}
.title-main {
  display: block;
  margin-left: -3px;
  font-size: clamp(62px, 18.5vw, 86px);
  font-weight: 900;
  letter-spacing: -0.075em;
  background: linear-gradient(178deg, #fff3d9 0%, #ffc06a 34%, #ff8a3d 68%, #f05e16 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 242, 222, 0.24);
  filter:
    drop-shadow(0 3px 0 #7d2d0a)
    drop-shadow(0 6px 0 rgba(48, 16, 4, 0.4))
    drop-shadow(0 14px 30px rgba(255, 103, 33, 0.32));
}
.tagline {
  margin: 18px 0 0;
  color: rgba(255, 226, 201, 0.72);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* ---------- 首页底部 ---------- */
.menu-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.best-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  color: rgba(255, 230, 204, 0.8);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: rgba(8, 11, 18, 0.55);
  border: 1px solid rgba(255, 181, 122, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.best-pill .mp-icon { width: 15px; height: 15px; color: #ffc15e; }
.best-pill b {
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.btn-primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: min(100%, 312px);
  height: 60px;
  padding: 0 20px;
  border: 0;
  border-radius: 18px;
  outline: none;
  cursor: pointer;
  color: #2a1304;
  font-family: inherit;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, #ffbb77 0%, #ff9847 30%, #ff7a25 62%, #ef5e13 100%);
  box-shadow:
    0 7px 0 #9d390c,
    0 14px 34px rgba(255, 103, 28, 0.42),
    0 2px 0 rgba(255, 255, 255, 0.5) inset,
    0 -8px 16px rgba(150, 46, 3, 0.28) inset;
  text-shadow: 0 1px 0 rgba(255, 230, 195, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.2s ease;
}
.btn-primary::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 12%;
  right: 12%;
  height: 38%;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.btn-primary .mp-icon {
  position: relative;
  width: 24px;
  height: 24px;
  color: #3b1a05;
}
.btn-primary span { position: relative; }
.btn-primary:active {
  transform: translateY(5px) scale(0.994);
  filter: brightness(1.05);
  box-shadow:
    0 2px 0 #9d390c,
    0 5px 14px rgba(255, 96, 22, 0.26),
    0 1px 0 rgba(255, 255, 255, 0.35) inset;
}
.btn-primary:focus-visible { outline: 2px solid #ffe6c6; outline-offset: 4px; }

.control-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  color: rgba(255, 221, 192, 0.54);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
}
.control-hint .mp-icon { width: 14px; height: 14px; color: rgba(255, 149, 76, 0.8); }

/* ---------- 结束面板 ---------- */
.over-screen {
  z-index: 15;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding-left: 20px;
  padding-right: 20px;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(60, 20, 10, 0.3) 0%, rgba(3, 5, 10, 0.78) 64%, rgba(2, 4, 8, 0.92) 100%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.over-screen.is-hidden { display: flex; }
.over-screen:not(.is-hidden) .end-card { animation: cardUp 0.42s cubic-bezier(0.18, 1.18, 0.36, 1) both; }

@keyframes cardUp {
  0% { opacity: 0; transform: translateY(26px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.end-card {
  width: min(100%, 342px);
  padding: 26px 22px 22px;
  border-radius: 26px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 126, 54, 0.16), rgba(255, 126, 54, 0) 56%),
    linear-gradient(180deg, rgba(31, 23, 21, 0.97) 0%, rgba(15, 14, 18, 0.98) 58%, rgba(10, 11, 15, 0.99) 100%);
  border: 1px solid rgba(255, 143, 72, 0.28);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 214, 173, 0.12) inset;
}
.end-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #341404;
  background: linear-gradient(180deg, #ffc077, #ff7a26);
  box-shadow: 0 8px 22px rgba(255, 102, 28, 0.36), 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}
.end-badge .mp-icon { width: 28px; height: 28px; }
.end-card h2 {
  margin: 0;
  color: #fff4e7;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.end-sub {
  margin: 8px 0 0;
  color: rgba(255, 214, 180, 0.56);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 14px;
  padding: 13px 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 190, 140, 0.1);
}
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 26px;
  transform: translateY(-50%);
  background: rgba(255, 190, 140, 0.13);
}
.stat b {
  color: #ffb266;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat span {
  color: rgba(255, 228, 205, 0.5);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.new-best {
  display: inline-block;
  margin: 2px 0 10px;
  padding: 4px 12px;
  border-radius: 99px;
  color: #351804;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, #ffd27f, #ff9d45);
  box-shadow: 0 0 18px rgba(255, 161, 74, 0.4);
}
.best-line {
  margin-bottom: 17px;
  color: rgba(255, 223, 195, 0.5);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.best-line b {
  color: #ffe5c6;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.btn-retry {
  width: 100%;
  height: 54px;
  font-size: 17px;
  border-radius: 16px;
}
.btn-retry .mp-icon { width: 21px; height: 21px; }

@media (max-width: 350px) {
  .hud { padding-left: 10px; padding-right: 10px; gap: 5px; }
  .hud-card { padding: 0 7px; }
  .hp-card { max-width: 124px; }
  .score-card b { font-size: 13px; }
  .screen { padding-left: 18px; padding-right: 18px; }
  .tagline { font-size: 12px; }
}

@media (min-width: 560px) {
  .hud {
    max-width: 500px;
    margin: 0 auto;
  }
  .menu-top, .menu-bottom {
    width: 100%;
    max-width: 430px;
    margin-left: auto;
    margin-right: auto;
  }
  .title-top { font-size: 46px; }
  .title-main { font-size: 86px; }
}
