* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #14100D; color: #FFF3E4;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  user-select: none; -webkit-user-select: none;
}
#stage {
  position: fixed; inset: 0; overflow: hidden;
  background: #14100D;
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- HUD ---------- */
.hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; opacity: 0; transition: opacity .25s;
}
.hud.show { opacity: 1; }
.hud-left { display: flex; flex-direction: column; gap: 8px; }
.hp-wrap { display: flex; align-items: center; gap: 6px; }
#hpIcon { font-size: 18px; color: #FF5A5A; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.hp-bar {
  width: 132px; height: 13px; border-radius: 8px;
  background: rgba(20, 12, 8, .62);
  border: 1.5px solid rgba(255, 138, 61, .55);
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,.45);
}
.hp-fill {
  height: 100%; width: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #FF5A5A, #FF8A3D);
  transition: width .18s ease;
}
.hp-fill.low { background: linear-gradient(90deg, #C62828, #FF5A5A); animation: pulse .7s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.hud-row { display: flex; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  background: rgba(20, 12, 8, .6);
  border: 1px solid rgba(255, 138, 61, .35);
  font-size: 12px; font-weight: 700; color: #FFD9B5;
  box-shadow: 0 3px 10px rgba(0,0,0,.4);
}
.chip i { font-size: 14px; color: #FF8A3D; }
.chip b { font-size: 13px; color: #FFF3E4; }

.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ammo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,138,61,.95), rgba(214,96,26,.95));
  color: #2A1608; font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 14px rgba(255,138,61,.4);
}
.ammo i { font-size: 15px; color: #2A1608; }
.ammo.reload { background: linear-gradient(180deg, #6b5a4d, #4a3d33); color: #FFD9B5; }
.ammo.reload i { color: #FFD9B5; }
.player-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 3px; border-radius: 999px;
  background: rgba(20, 12, 8, .6);
  border: 1px solid rgba(255, 138, 61, .3);
  font-size: 11px; color: #FFD9B5; max-width: 130px;
}
.player-tag img {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  background: #3A2A1E; border: 1.5px solid rgba(255,138,61,.6);
}
.player-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 遮罩面板 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(120% 80% at 50% 0%, rgba(60, 26, 8, .55), rgba(10, 7, 5, .88));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.panel {
  width: 100%; max-width: 360px;
  padding: 26px 20px 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, #2A1D14 0%, #1C1310 100%);
  border: 1.5px solid rgba(255, 138, 61, .38);
  box-shadow: 0 22px 50px rgba(0,0,0,.6), inset 0 1px 0 rgba(255, 200, 150, .12);
  text-align: center;
  transform: translateY(10px) scale(.97);
  transition: transform .3s cubic-bezier(.2,.9,.3,1.2);
}
.overlay.show .panel { transform: translateY(0) scale(1); }

.logo { display: flex; flex-direction: column; line-height: 1; margin-bottom: 10px; }
.logo-top {
  font-size: 20px; letter-spacing: .5em; color: #FF8A3D; font-weight: 800;
  text-shadow: 0 0 18px rgba(255,138,61,.55);
}
.logo-bot {
  font-size: 44px; font-weight: 900; letter-spacing: .06em; color: #FFF3E4;
  text-shadow: 0 4px 0 #8C3A0C, 0 8px 22px rgba(0,0,0,.7);
  margin-top: 2px;
}
.tagline { margin: 6px 0 18px; font-size: 13px; color: #B79A82; letter-spacing: .04em; }

.how { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.how-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 14px;
  background: rgba(255, 138, 61, .09);
  border: 1px solid rgba(255, 138, 61, .18);
  font-size: 13px; color: #E8D3C0; text-align: left;
}
.how-item i { font-size: 18px; color: #FF8A3D; }

.btn-main {
  width: 100%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 0; border-radius: 18px;
  font-size: 17px; font-weight: 800; letter-spacing: .06em; color: #2A1608;
  background: linear-gradient(180deg, #FFB067, #FF8A3D 55%, #E06A1E);
  box-shadow: 0 8px 0 #A84A10, 0 14px 26px rgba(255, 138, 61, .35);
  transition: transform .1s, box-shadow .1s;
  font-family: inherit;
}
.btn-main i { font-size: 20px; color: #2A1608; }
.btn-main:active { transform: translateY(5px); box-shadow: 0 3px 0 #A84A10, 0 6px 14px rgba(255,138,61,.3); }

.best-line { margin: 16px 0 0; font-size: 12px; color: #8E7561; }
.best-line b { color: #FF8A3D; font-size: 14px; }

.over-title {
  font-size: 24px; font-weight: 900; color: #FF5A5A; letter-spacing: .08em;
  text-shadow: 0 3px 0 #6E1A1A, 0 8px 20px rgba(0,0,0,.6);
  margin-bottom: 18px;
}
.over-stats { display: flex; gap: 8px; margin-bottom: 18px; }
.stat {
  flex: 1; padding: 12px 4px; border-radius: 16px;
  background: rgba(255, 138, 61, .08);
  border: 1px solid rgba(255, 138, 61, .2);
  display: flex; flex-direction: column; gap: 3px;
}
.stat b { font-size: 20px; color: #FF8A3D; font-weight: 900; }
.stat span { font-size: 11px; color: #A98D77; }

.revive-box { margin-bottom: 14px; }
.btn-ad {
  width: 100%; border: 0; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 0; border-radius: 16px;
  font-size: 14px; font-weight: 700; color: #FFD9B5;
  background: linear-gradient(180deg, #4A3324, #33231A);
  border: 1.5px solid rgba(255, 138, 61, .45);
  transition: transform .1s;
}
.btn-ad i { font-size: 18px; color: #FF8A3D; }
.btn-ad:active { transform: scale(.97); }
.btn-ad[disabled] { opacity: .45; }
.ad-tip { margin: 8px 0 0; font-size: 11px; color: #8E7561; }

.toast {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.9);
  padding: 10px 18px; border-radius: 14px;
  background: rgba(20, 12, 8, .9); border: 1px solid rgba(255,138,61,.5);
  color: #FFD9B5; font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
