/* ============================================================
   坦克大战 · 卡通军团
   移动端优先 / 竖屏铺满 / 无顶部标题栏
   ============================================================ */
:root {
  --orange: #FF8A3D;
  --orange-hot: #FFB13D;
  --orange-light: #FFD76A;
  --orange-deep: #A8430D;
  --orange-dark: #5B2407;
  --blue: #2F7BE0;
  --blue-deep: #123B7A;
  --navy: #0B1624;
  --navy-2: #122338;
  --panel: #12263B;
  --cream: #FFF3D6;
  --muted: #9FB0C4;
  --line: rgba(255, 255, 255, .12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bg-img: url("images/gen/tank-bg.webp");
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #070D15;
}
body {
  font-family: var(--font);
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button {
  font-family: inherit;
  border: 0;
  margin: 0;
  padding: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
[hidden], .hidden { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; display: block; fill: currentColor; flex: 0 0 auto; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.screen { position: fixed; inset: 0; }

/* ============================================================
   首页
   ============================================================ */
.home {
  overflow: hidden;
  background: #0B1725;
  touch-action: manipulation;
}
.home-bg {
  position: absolute;
  inset: -28px;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center 38%;
  filter: blur(24px) saturate(1.18) brightness(.5);
  transform: scale(1.07);
  will-change: transform;
}
.home-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(5, 12, 21, .78) 0%,
      rgba(5, 12, 21, .30) 20%,
      rgba(5, 12, 21, .10) 40%,
      rgba(5, 12, 21, .48) 68%,
      rgba(5, 12, 21, .88) 88%,
      rgba(5, 12, 21, .97) 100%),
    radial-gradient(ellipse 80% 46% at 50% 18%, rgba(255, 138, 61, .17), transparent 72%);
  pointer-events: none;
}
.home-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
  opacity: .5;
  pointer-events: none;
}
.home-glow--one {
  width: 220px; height: 220px;
  right: -70px; top: 18%;
  background: rgba(255, 138, 61, .38);
}
.home-glow--two {
  width: 180px; height: 180px;
  left: -80px; top: 48%;
  background: rgba(47, 123, 224, .28);
}

/* 顶部资源栏 */
.home-hud {
  position: absolute;
  z-index: 12;
  top: calc(10px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: dropIn .5s cubic-bezier(.2, .9, .25, 1.2) both;
}
.coin-pill {
  display: flex;
  align-items: center;
  height: 42px;
  min-width: 118px;
  padding: 0 4px 0 5px;
  border-radius: 13px;
  background: linear-gradient(180deg, #334961 0%, #182B40 52%, #0E1D2E 100%);
  border: 2px solid #07121E;
  box-shadow: 0 3px 0 #050C14, 0 8px 16px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.coin-ico {
  width: 28px; height: 28px;
  flex: none;
  color: #FFC93C;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}
.coin-ico .icon { width: 28px; height: 28px; }
.coin-num {
  flex: 1;
  padding: 0 5px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .02em;
  color: #FFF0C9;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
  font-variant-numeric: tabular-nums;
}
.coin-add {
  width: 29px; height: 29px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #EFFFF4;
  background: linear-gradient(180deg, #66E99A 0%, #26B966 52%, #158846 100%);
  border: 2px solid #074D2A;
  box-shadow: 0 2px 0 #053B20, inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .08s ease, box-shadow .08s ease;
}
.coin-add .icon { width: 17px; height: 17px; }
.coin-add:active { transform: translateY(2px); box-shadow: 0 0 0 #053B20; }
.hud-actions { display: flex; gap: 8px; }
.hud-btn {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  color: #EAF3FF;
  border-radius: 12px;
  background: linear-gradient(180deg, #5C96E9 0%, #2F6CCF 48%, #1B4898 100%);
  border: 2px solid #0A1B36;
  box-shadow: 0 3px 0 #07152A, inset 0 2px 0 rgba(255, 255, 255, .3);
  transition: transform .08s ease, box-shadow .08s ease;
}
.hud-btn .icon { width: 22px; height: 22px; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35)); }
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #07152A, inset 0 2px 0 rgba(255, 255, 255, .3); }

/* 主内容 */
.home-main {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(58px + var(--safe-top)) 18px calc(122px + var(--safe-bottom));
}
.hero {
  position: relative;
  width: 100%;
  flex: 0 0 auto;
  animation: heroDrop .65s cubic-bezier(.18, .9, .24, 1.15) both;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .35));
}
.hero-art {
  width: 100%;
  aspect-ratio: 936 / 440;
  background-image: var(--bg-img);
  background-size: 164.1% auto;
  background-position: 50% 2.4%;
  background-repeat: no-repeat;
  border-radius: 10px;
}
.hero::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -4px;
  height: 22%;
  background: linear-gradient(to bottom, transparent, rgba(8, 17, 29, .42));
  pointer-events: none;
}
.hero-spark {
  position: absolute;
  width: 5px; height: 5px;
  background: #FFD06A;
  box-shadow: 0 0 8px 2px rgba(255, 148, 52, .9);
  border-radius: 1px;
  opacity: 0;
  animation: ember 3.6s ease-in-out infinite;
}
.hero-spark--a { left: 13%; top: 42%; animation-delay: .4s; }
.hero-spark--b { right: 11%; top: 30%; animation-delay: 1.5s; }
.hero-spark--c { left: 26%; top: 18%; animation-delay: 2.4s; }

/* 玩家小卡 */
.player-chip {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  height: 38px;
  margin-top: 2px;
  padding: 4px 9px 4px 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(23, 42, 62, .82), rgba(8, 19, 32, .82));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeUp .5s .18s cubic-bezier(.2, .8, .2, 1) both;
}
.player-chip:active { transform: scale(.98); }
.avatar {
  position: relative;
  width: 30px; height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #FFE5B0;
  background: radial-gradient(circle at 32% 24%, #FFC76A, #E06A18 72%);
  border: 2px solid #FFC15C;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.avatar .icon { width: 18px; height: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 46px; height: 46px; border-width: 2px; }
.avatar--lg .icon { width: 27px; height: 27px; }
.player-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.08; }
.player-meta b {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  color: #FFF7E7;
}
.player-meta small { margin-top: 3px; font-size: 9px; color: #FFB678; letter-spacing: .08em; }
.player-star { width: 21px; height: 21px; color: #FFC44D; opacity: .95; }
.player-star .icon { width: 21px; height: 21px; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35)); }

/* 菜单 */
.menu {
  width: 100%;
  max-width: 356px;
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeUp .55s .26s cubic-bezier(.2, .8, .2, 1) both;
}
.game-btn {
  position: relative;
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .11em;
  line-height: 1;
  user-select: none;
  touch-action: manipulation;
  transition: transform .07s ease, box-shadow .07s ease, filter .15s ease;
}
.game-btn .btn-icon {
  width: 24px; height: 24px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .28));
}
.game-btn--start {
  color: #4B2308;
  background: linear-gradient(180deg, #FFE477 0%, #FFC14A 34%, #FF9A3D 72%, #F7822D 100%);
  border: 3px solid #46230C;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  box-shadow:
    0 7px 0 #A84A12,
    0 13px 22px rgba(0, 0, 0, .4),
    inset 0 3px 0 rgba(255, 255, 255, .62),
    inset 0 -4px 0 rgba(160, 55, 4, .22);
  overflow: hidden;
}
.game-btn--start::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -45%;
  width: 34%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .56), transparent);
  transform: rotate(22deg);
  animation: sheen 4.2s 1.1s ease-in-out infinite;
  pointer-events: none;
}
.game-btn--blue {
  color: #fff;
  background: linear-gradient(180deg, #62A2FF 0%, #3273DA 42%, #2258B4 100%);
  border: 3px solid #0B2245;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .38);
  box-shadow:
    0 7px 0 #0C2C5C,
    0 13px 22px rgba(0, 0, 0, .38),
    inset 0 3px 0 rgba(255, 255, 255, .34),
    inset 0 -3px 0 rgba(0, 15, 45, .24);
}
.game-btn--ghost {
  color: #DCE9F8;
  background: linear-gradient(180deg, #2B3F55 0%, #1B2C3F 100%);
  border: 2px solid #091725;
  box-shadow: 0 5px 0 #07121D, inset 0 2px 0 rgba(255, 255, 255, .15);
  font-size: 14px;
  letter-spacing: .05em;
}
.game-btn--small { min-height: 50px; border-radius: 11px; font-size: 14px; letter-spacing: .04em; }
.game-btn--start:active,
.game-btn--blue:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #0C2C5C, 0 4px 8px rgba(0, 0, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .25);
}
.game-btn--start:active { box-shadow: 0 2px 0 #A84A12, 0 4px 8px rgba(0, 0, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .45); }
.game-btn--ghost:active { transform: translateY(3px); box-shadow: 0 1px 0 #07121D; }
.game-btn:disabled { opacity: .55; pointer-events: none; }
.btn-tag {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #FFE3B8;
  background: rgba(70, 35, 12, .28);
  border: 1px solid rgba(75, 35, 8, .25);
}
.home-tip {
  flex: 0 0 auto;
  margin: 11px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  color: rgba(255, 238, 211, .64);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.home-tip i { width: 18px; height: 1px; background: rgba(255, 196, 77, .5); }

/* 底部战场 */
.ground-strip {
  position: absolute;
  z-index: 2;
  left: 0; right: 0; bottom: 0;
  height: clamp(108px, 15.5vh, 152px);
  background-image: var(--bg-img);
  background-size: 100% auto;
  background-position: center bottom;
  pointer-events: none;
}
.ground-strip::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 46%;
  background: linear-gradient(to bottom, rgba(7, 15, 25, .92), rgba(7, 15, 25, 0));
}
.ground-strip::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  background: linear-gradient(to bottom, rgba(6, 12, 20, 0), rgba(6, 12, 20, .82));
}
.ground-fade {
  position: absolute;
  z-index: 3;
  left: 0; right: 0;
  bottom: 0;
  height: calc(22px + var(--safe-bottom));
  background: linear-gradient(to bottom, transparent, rgba(5, 10, 17, .96));
  pointer-events: none;
}
.home-version {
  position: absolute;
  z-index: 6;
  right: 12px;
  bottom: calc(7px + var(--safe-bottom));
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
  color: rgba(225, 234, 245, .34);
  pointer-events: none;
}

/* Toast */
.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(146px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  max-width: min(86vw, 360px);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  color: #FFF4DB;
  background: rgba(8, 18, 30, .94);
  border: 1px solid rgba(255, 179, 77, .38);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   战斗界面
   ============================================================ */
.game {
  background: #0A1119;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.game-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(4, 10, 17, .62), transparent 16%, transparent 76%, rgba(4, 10, 17, .5)),
    radial-gradient(ellipse 92% 80% at 50% 46%, transparent 56%, rgba(4, 10, 17, .48));
  z-index: 2;
}
.game-hud {
  position: absolute;
  z-index: 10;
  top: calc(8px + var(--safe-top));
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}
.game-hud > * { pointer-events: auto; }
.round-btn {
  width: 38px; height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #EAF3FF;
  background: linear-gradient(180deg, rgba(43, 71, 101, .94), rgba(14, 29, 46, .94));
  border: 1.5px solid rgba(7, 18, 30, .9);
  box-shadow: 0 2px 0 rgba(4, 10, 17, .85), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.round-btn .icon { width: 18px; height: 18px; }
.round-btn:active { transform: translateY(1px); }
.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 5px;
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(20, 38, 57, .9), rgba(9, 20, 32, .9));
  border: 1.5px solid rgba(6, 15, 25, .9);
  box-shadow: 0 2px 0 rgba(4, 10, 17, .8), inset 0 1px 0 rgba(255, 255, 255, .12);
  white-space: nowrap;
}
.stat-pill span { font-size: 8px; font-weight: 800; letter-spacing: .12em; color: #FFB05E; }
.stat-pill b { font-size: 15px; font-weight: 900; color: #FFF7E8; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 #000; }
.stat-pill i { font-style: normal; font-size: 9px; color: #8197AF; font-weight: 700; }
.stat-pill--wave { margin-left: auto; }
.lives-pill {
  height: 34px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 6px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(20, 38, 57, .9), rgba(9, 20, 32, .9));
  border: 1.5px solid rgba(6, 15, 25, .9);
  box-shadow: 0 2px 0 rgba(4, 10, 17, .8), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.lives-pill .icon { width: 15px; height: 15px; color: #FF6357; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .5)); transition: opacity .2s, transform .2s; }
.lives-pill .icon.is-lost { opacity: .2; transform: scale(.82); filter: grayscale(1); }
.game-subhud {
  position: absolute;
  z-index: 9;
  top: calc(50px + var(--safe-top));
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.mini-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 23px;
  padding: 0 7px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  color: #B9CBDC;
  background: rgba(7, 18, 30, .66);
  border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mini-pill .icon { width: 12px; height: 12px; color: #73D7FF; }
.mini-pill b { color: #FFF4DE; font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mini-pill--enemy .icon { color: #FF8E7A; }

.wave-banner {
  position: absolute;
  z-index: 14;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 28px;
  border-radius: 12px;
  background: rgba(7, 16, 27, .78);
  border: 1px solid rgba(255, 177, 61, .42);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  animation: bannerPop 1.7s cubic-bezier(.2, .9, .2, 1) both;
}
.wave-banner b { font-size: 22px; font-weight: 900; letter-spacing: .12em; color: #FFD06A; text-shadow: 0 2px 0 #5A2605; }
.wave-banner span { font-size: 9px; font-weight: 700; letter-spacing: .24em; color: #E1EEFF; }

/* 触控摇杆 */
.joystick {
  position: absolute;
  z-index: 12;
  left: 18px;
  bottom: calc(24px + var(--safe-bottom));
  width: 114px;
  height: 114px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(40, 67, 94, .42), rgba(5, 14, 24, .42));
  border: 2px solid rgba(210, 230, 250, .22);
  box-shadow: inset 0 4px 16px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .22);
  touch-action: none;
}
.joystick-ring {
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  border: 1px dashed rgba(199, 222, 245, .22);
}
.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(255, 246, 227, .9);
  background: linear-gradient(180deg, #4C7FAE 0%, #274C72 55%, #16324F 100%);
  border: 2px solid rgba(8, 22, 36, .82);
  box-shadow: 0 4px 0 rgba(5, 13, 23, .8), inset 0 2px 0 rgba(255, 255, 255, .24);
  transition: transform .06s linear;
}
.joystick-knob .icon { width: 20px; height: 20px; opacity: .8; }
.joystick.is-active { border-color: rgba(255, 177, 61, .55); }
.joystick.is-active .joystick-knob {
  background: linear-gradient(180deg, #FFB85B 0%, #F07A22 55%, #B94B0D 100%);
  border-color: #4B2107;
}
.fire-btn {
  position: absolute;
  z-index: 12;
  right: 22px;
  bottom: calc(26px + var(--safe-bottom));
  width: 88px;
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  color: #FFF1D2;
  background: linear-gradient(180deg, #FF8E4A 0%, #F2641D 48%, #BE3C07 100%);
  border: 3px solid #4A1C05;
  box-shadow: 0 6px 0 #6D2708, 0 10px 20px rgba(0, 0, 0, .35), inset 0 3px 0 rgba(255, 255, 255, .35);
  touch-action: none;
}
.fire-btn .icon { width: 34px; height: 34px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3)); }
.fire-label { font-size: 9px; font-weight: 900; letter-spacing: .22em; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.fire-btn .fire-halo {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 157, 74, .35);
  animation: firePulse 2.1s ease-out infinite;
  pointer-events: none;
}
.fire-btn.is-active { transform: translateY(4px) scale(.96); box-shadow: 0 2px 0 #6D2708, 0 4px 10px rgba(0, 0, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .3); }
.game-hint {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: calc(7px + var(--safe-bottom));
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .1em;
  white-space: nowrap;
  color: rgba(226, 236, 247, .58);
  background: rgba(4, 12, 21, .4);
  pointer-events: none;
  transition: opacity .6s ease;
}
.game-hint.is-fade { opacity: 0; }

/* ============================================================
   暂停 / 结算面板
   ============================================================ */
.overlay {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 9, 16, .72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn .18s ease both;
}
.panel {
  position: relative;
  width: 100%;
  max-width: 342px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 24px 20px 18px;
  border-radius: 18px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(27, 48, 70, .98), rgba(9, 20, 33, .99)),
    var(--bg-img);
  border: 2px solid rgba(255, 177, 61, .42);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 4px rgba(7, 16, 27, .6);
  animation: panelIn .28s cubic-bezier(.2, .9, .25, 1.12) both;
}
.panel-badge {
  width: 54px; height: 54px;
  margin: -44px auto 12px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #FFE3A8;
  background: linear-gradient(180deg, #FFB64E, #D96916);
  border: 3px solid #4A2107;
  box-shadow: 0 5px 0 #6A2A07, 0 8px 18px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .4);
}
.panel-badge .icon { width: 27px; height: 27px; }
.panel-badge--result { color: #FFF0BD; }
.panel h2 { margin: 0; font-size: 25px; font-weight: 900; letter-spacing: .1em; color: #FFF6E3; text-shadow: 0 2px 0 #000; }
.panel-sub { margin: 6px 0 14px; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: #9EB2C7; }
.panel-stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 0 0 14px;
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(4, 12, 21, .4);
  border: 1px solid rgba(255, 255, 255, .07);
}
.panel-stats div { display: flex; flex-direction: column; gap: 2px; }
.panel-stats span { font-size: 8px; letter-spacing: .12em; color: #8FA5BB; font-weight: 700; }
.panel-stats b { font-size: 16px; font-weight: 900; color: #FFDE9C; font-variant-numeric: tabular-nums; }
.setting-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(4, 12, 21, .3);
  border: 1px solid rgba(255, 255, 255, .06);
}
.setting-inline > span { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; color: #D5E3F2; }
.setting-inline .icon { width: 16px; height: 16px; color: #FFB05E; }
.panel-btn { width: 100%; margin-top: 2px; }
.panel-btn + .panel-btn { margin-top: 9px; }
.panel-row { display: flex; gap: 8px; margin-top: 9px; }
.panel-row .game-btn { flex: 1; padding: 0 6px; }
.panel-row .game-btn .btn-icon { width: 17px; height: 17px; }

.result-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 0 12px;
  padding: 12px 8px 10px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 70% 100% at 50% 0%, rgba(255, 170, 61, .18), transparent 70%),
    rgba(4, 12, 21, .42);
  border: 1px solid rgba(255, 177, 61, .16);
}
.result-score span { font-size: 8px; font-weight: 700; letter-spacing: .2em; color: #B9A27E; }
.result-score b { font-size: 36px; line-height: 1.1; font-weight: 900; color: #FFD46A; font-variant-numeric: tabular-nums; text-shadow: 0 3px 0 #5C2B04, 0 0 24px rgba(255, 158, 50, .3); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.result-grid div { padding: 7px 4px; border-radius: 8px; background: rgba(4, 12, 21, .34); border: 1px solid rgba(255, 255, 255, .06); }
.result-grid span { display: block; font-size: 8px; color: #8FA5BB; letter-spacing: .08em; }
.result-grid b { display: block; margin-top: 1px; font-size: 15px; font-weight: 900; color: #F3F8FF; font-variant-numeric: tabular-nums; }
.result-best {
  margin-bottom: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #FFB968;
}
.result-best.is-new { color: #FFE17D; animation: blinkGold 1.2s ease-in-out infinite; }

/* ============================================================
   弹窗
   ============================================================ */
.modal {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, var(--safe-top)) 16px max(16px, var(--safe-bottom));
  animation: fadeIn .18s ease both;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 13, .74);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 366px;
  max-height: min(86dvh, 720px);
  overflow-y: auto;
  padding: 20px 18px 16px;
  border-radius: 19px;
  background:
    radial-gradient(ellipse 100% 42% at 50% 0%, rgba(255, 143, 61, .12), transparent 70%),
    linear-gradient(180deg, #1A3048 0%, #0D1C2D 58%, #0A1624 100%);
  border: 2px solid rgba(255, 177, 61, .3);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 4px rgba(4, 10, 17, .55);
  animation: panelIn .3s cubic-bezier(.2, .9, .25, 1.1) both;
  scrollbar-width: none;
}
.modal-card::-webkit-scrollbar { display: none; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.modal-head h2 { margin: 0; font-size: 23px; font-weight: 900; letter-spacing: .08em; color: #FFF5E0; text-shadow: 0 2px 0 #000; }
.modal-sub { margin: 4px 0 0; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: #8EA5BC; }
.modal-close {
  width: 34px; height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #D5E3F2;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
}
.modal-close .icon { width: 16px; height: 16px; }
.modal-close:active { background: rgba(255, 255, 255, .14); }
.modal-cta { width: 100%; margin-top: 13px; }

/* 排行榜 */
.board-me {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(255, 138, 61, .18), rgba(47, 123, 224, .1));
  border: 1px solid rgba(255, 177, 61, .24);
  margin-bottom: 12px;
}
.board-me .avatar { width: 38px; height: 38px; }
.board-me .avatar .icon { width: 22px; height: 22px; }
.board-me-copy { flex: 1; min-width: 0; text-align: left; }
.board-me-copy b { display: block; font-size: 13px; font-weight: 800; color: #FFF6E4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-me-copy span { display: block; margin-top: 2px; font-size: 9px; color: #A9BBCD; letter-spacing: .04em; }
.board-me-score { text-align: right; }
.board-me-score b { display: block; font-size: 19px; font-weight: 900; color: #FFD06A; font-variant-numeric: tabular-nums; }
.board-me-score span { font-size: 8px; letter-spacing: .1em; color: #A9BBCD; }
.board-list { display: flex; flex-direction: column; gap: 5px; }
.board-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(4, 12, 21, .34);
  border: 1px solid rgba(255, 255, 255, .05);
}
.board-row.is-me { border-color: rgba(255, 177, 61, .3); background: rgba(255, 138, 61, .08); }
.board-rank {
  width: 24px; height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 900;
  color: #C7D5E4;
  background: rgba(255, 255, 255, .07);
  font-variant-numeric: tabular-nums;
}
.board-rank.r1 { color: #4A2504; background: linear-gradient(180deg, #FFE27A, #FFB330); box-shadow: 0 2px 0 #8A4A06; }
.board-rank.r2 { color: #29313B; background: linear-gradient(180deg, #E7EFF8, #B8C6D6); box-shadow: 0 2px 0 #6E7E8F; }
.board-rank.r3 { color: #4A250B; background: linear-gradient(180deg, #FFC084, #D57A32); box-shadow: 0 2px 0 #82400F; }
.board-name { flex: 1; min-width: 0; text-align: left; }
.board-name b { display: block; font-size: 12px; font-weight: 800; color: #EFF6FF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-name span { display: block; font-size: 8px; color: #8398AD; margin-top: 1px; }
.board-score { text-align: right; font-size: 15px; font-weight: 900; color: #FFDA8C; font-variant-numeric: tabular-nums; }
.board-empty {
  padding: 22px 10px;
  text-align: center;
  color: #8FA5BB;
  font-size: 11px;
  line-height: 1.7;
}
.board-empty .icon { width: 34px; height: 34px; margin: 0 auto 7px; color: rgba(255, 177, 61, .5); }

/* 设置 */
.profile-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  margin-bottom: 13px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(255, 138, 61, .14), rgba(47, 123, 224, .08));
  border: 1px solid rgba(255, 255, 255, .08);
}
.profile-meta { flex: 1; min-width: 0; text-align: left; }
.profile-meta b { display: block; font-size: 15px; font-weight: 800; color: #FFF6E4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-meta span { display: block; margin-top: 3px; font-size: 9px; letter-spacing: .08em; color: #98AEC4; }
.profile-rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: #FFC44D;
}
.profile-rank .icon { width: 19px; height: 19px; }
.profile-rank small { font-size: 7px; font-weight: 800; letter-spacing: .06em; color: #C6A66E; }
.setting-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(4, 12, 21, .34);
  border: 1px solid rgba(255, 255, 255, .05);
}
.setting-ico {
  width: 31px; height: 31px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #FFB05E;
  background: rgba(255, 138, 61, .11);
  border: 1px solid rgba(255, 138, 61, .14);
}
.setting-ico .icon { width: 17px; height: 17px; }
.setting-copy { flex: 1; min-width: 0; text-align: left; }
.setting-copy b { display: block; font-size: 12px; font-weight: 800; color: #EFF6FF; }
.setting-copy small { display: block; margin-top: 2px; font-size: 8px; color: #8CA2B8; }
.switch {
  position: relative;
  width: 42px; height: 24px;
  flex: none;
  border-radius: 999px;
  background: #2A3B4D;
  border: 1.5px solid #0A1622;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4);
  transition: background .18s ease;
}
.switch i {
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: linear-gradient(180deg, #F4F8FF, #C8D4E1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1.2);
}
.switch.is-on { background: linear-gradient(180deg, #FFAD4D, #E56D14); }
.switch.is-on i { transform: translateX(18px); background: linear-gradient(180deg, #FFFDF6, #FFE3B6); }
.howto {
  padding: 11px 12px;
  margin-bottom: 13px;
  border-radius: 11px;
  background: rgba(4, 12, 21, .3);
  border: 1px solid rgba(255, 255, 255, .06);
}
.howto h3 { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #FFB05E; }
.howto-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.howto-key {
  width: 16px; height: 16px;
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 5px;
  font-size: 8px;
  font-weight: 900;
  color: #FFE0B0;
  background: rgba(255, 138, 61, .17);
  border: 1px solid rgba(255, 138, 61, .2);
}
.howto-row p { margin: 0; text-align: left; font-size: 9px; line-height: 1.55; color: #A5B8CB; }
.settings-foot { margin: 12px 0 0; font-size: 8px; letter-spacing: .12em; color: #5F7489; }

/* ============================================================
   动画
   ============================================================ */
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes heroDrop {
  from { opacity: 0; transform: translateY(-18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sheen {
  0%, 46% { left: -45%; }
  70%, 100% { left: 120%; }
}
@keyframes ember {
  0%, 100% { opacity: 0; transform: translateY(8px) scale(.7); }
  35% { opacity: .9; }
  65% { opacity: .6; transform: translateY(-18px) scale(1.15); }
}
@keyframes firePulse {
  0% { transform: scale(.92); opacity: .7; }
  70%, 100% { transform: scale(1.13); opacity: 0; }
}
@keyframes bannerPop {
  0% { opacity: 0; transform: translateX(-50%) scale(.82); }
  18% { opacity: 1; transform: translateX(-50%) scale(1.03); }
  28%, 78% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(.98); }
}
@keyframes blinkGold {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* ============================================================
   适配
   ============================================================ */
@media (max-height: 700px) {
  .home-main { padding-top: calc(52px + var(--safe-top)); padding-bottom: calc(102px + var(--safe-bottom)); }
  .menu { gap: 9px; padding-top: 10px; }
  .game-btn { min-height: 55px; font-size: 18px; }
  .game-btn--small { min-height: 46px; font-size: 13px; }
  .home-tip { margin-top: 8px; }
  .ground-strip { height: 98px; }
  .player-chip { height: 35px; }
  .joystick { width: 102px; height: 102px; }
  .joystick-knob { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .fire-btn { width: 80px; height: 80px; }
}
@media (max-width: 360px) {
  .home-hud { left: 10px; right: 10px; }
  .home-main { padding-left: 14px; padding-right: 14px; }
  .coin-pill { min-width: 100px; height: 38px; }
  .coin-num { font-size: 15px; }
  .hud-btn { width: 38px; height: 38px; }
  .game-btn { font-size: 18px; min-height: 56px; }
  .stat-pill span { display: none; }
  .stat-pill { gap: 3px; }
  .game-subhud .mini-pill span { display: none; }
}
@media (min-width: 700px) {
  .home-main { padding-top: calc(64px + var(--safe-top)); }
  .hero { max-width: 540px; }
  .menu { max-width: 380px; }
  .game-hud { left: 50%; right: auto; width: min(92vw, 560px); transform: translateX(-50%); }
  .game-subhud { left: 50%; right: auto; width: min(92vw, 560px); transform: translateX(-50%); }
  .joystick { left: max(18px, calc(50vw - 280px)); }
  .fire-btn { right: max(22px, calc(50vw - 280px)); }
}

/* 横屏时仍是一屏游戏：左标题、右菜单，不要求玩家旋转 */
@media (orientation: landscape) and (max-height: 600px) {
  .home-main {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 3vw, 40px);
    max-width: 100%;
    padding: calc(48px + var(--safe-top)) 4vw calc(30px + var(--safe-bottom));
  }
  .hero { width: min(54vw, 540px); flex: 0 1 auto; }
  .player-chip { display: none; }
  .menu {
    width: min(38vw, 330px);
    margin: 0;
    padding: 0;
    gap: 9px;
  }
  .game-btn { min-height: 54px; font-size: 17px; }
  .home-tip { display: none; }
  .ground-strip { height: 32vh; }
  .home-glow--one { top: 8%; }
  .home-glow--two { top: 30%; }
  .game-hud { width: min(94vw, 760px); }
  .game-subhud { width: min(94vw, 760px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* 焦点可见性 */
button:focus-visible {
  outline: 2px solid #FFD27A;
  outline-offset: 2px;
}
