/* =========================================================
   太空射击4 · 竖屏太空射击
   主色 #FF8A3D / 深空蓝 #050b1e / 能量青 #4FD8FF
   ========================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --orange: #FF8A3D;
  --orange-hi: #FFC15E;
  --orange-deep: #E85E08;
  --cyan: #4FD8FF;
  --cyan-deep: #1B8CFF;
  --navy: #050B1E;
  --navy-2: #0A1636;
  --ink: #EEF6FF;
  --muted: #8FA9CC;
  --line: rgba(116, 184, 255, .22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 72% at 50% -12%, #173471 0%, #0B1D46 34%, #060F27 64%, #030713 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.hidden { display: none !important; }

.mp-icon { flex: 0 0 auto; }

/* ---------- 背景画布 / 屏幕 ---------- */
.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  height: 100dvh;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .32s ease, visibility .32s ease;
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ---------- 开始页 ---------- */
.home {
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 14px) 18px calc(var(--safe-bottom) + 12px);
  overflow: hidden;
  background:
    radial-gradient(72% 44% at 50% 16%, rgba(53, 120, 230, .20), transparent 72%),
    radial-gradient(70% 40% at 88% 60%, rgba(255, 138, 61, .13), transparent 72%);
}

.home-top {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.pilot {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 5px 13px 5px 5px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(20, 44, 92, .90), rgba(8, 20, 46, .74));
  border: 1px solid rgba(91, 184, 255, .28);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .30), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.avatar {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  background: #091831;
  border: 1px solid rgba(111, 214, 255, .62);
  box-shadow: 0 0 14px rgba(79, 216, 255, .28), inset 0 0 12px rgba(79, 216, 255, .16);
}
.avatar svg, .avatar .avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar .avatar-img[hidden] { display: none; }

.pilot-info { min-width: 0; }
.pilot-name {
  max-width: 116px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .2px;
  color: #F3FAFF;
}
.pilot-best {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: .4px;
  color: #8EA9CC;
}
.pilot-best b {
  margin-left: 2px;
  font-size: 12px;
  color: var(--orange-hi);
  font-variant-numeric: tabular-nums;
}

.home-actions { display: flex; gap: 9px; flex: 0 0 auto; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #D7ECFF;
  background: linear-gradient(150deg, rgba(21, 46, 92, .88), rgba(8, 20, 46, .70));
  border: 1px solid rgba(103, 190, 255, .26);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.icon-btn .mp-icon { width: 21px; height: 21px; }
.icon-btn:active {
  transform: scale(.90);
  background: rgba(31, 66, 128, .9);
  border-color: rgba(123, 212, 255, .55);
}

.home-main {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 标题 */
.logo-wrap {
  position: relative;
  flex: 0 0 auto;
  margin-top: clamp(6px, 2.2vh, 20px);
  text-align: center;
}
.logo-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: clamp(210px, 62vw, 300px);
  height: clamp(62px, 17vw, 88px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(79, 216, 255, .20);
  box-shadow: 0 0 40px rgba(54, 152, 255, .13), inset 0 0 40px rgba(54, 152, 255, .10);
  pointer-events: none;
}
.logo-kicker {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .40em;
  color: #78BCE8;
  text-transform: uppercase;
}
.logo-kicker span {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 190, 255, .75));
}
.logo-kicker span:last-child { transform: scaleX(-1); }

.logo {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  line-height: .98;
  transform: skewX(-5deg) rotate(-1deg);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45));
}
.logo-cn {
  font-size: clamp(39px, 12.4vw, 58px);
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #FFFFFF 0%, #E4F3FF 34%, #94BEEB 50%, #EAF8FF 67%, #A9C9F5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #0A1B3C) drop-shadow(0 0 18px rgba(66, 178, 255, .50));
}
.logo-num {
  font-size: clamp(50px, 16vw, 74px);
  font-weight: 900;
  font-style: italic;
  background: linear-gradient(180deg, #FFE4A6 0%, #FFC15E 30%, #FF8A3D 62%, #F26A12 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #8B3000) drop-shadow(0 0 22px rgba(255, 138, 61, .68));
}
.logo-sub {
  position: relative;
  z-index: 2;
  margin-top: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .26em;
  color: rgba(158, 200, 238, .82);
}

/* 飞船 */
.hero-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-glow {
  position: absolute;
  width: min(82vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 61, .30) 0%, rgba(54, 160, 255, .18) 40%, rgba(10, 28, 66, 0) 70%);
  filter: blur(8px);
  animation: glowPulse 3.6s ease-in-out infinite;
}
.hero-orbit {
  position: absolute;
  width: min(88vw, 356px);
  height: min(62vw, 250px);
  border-radius: 50%;
  border: 1px solid rgba(79, 216, 255, .14);
  transform: rotate(-17deg);
  box-shadow: inset 0 0 34px rgba(79, 216, 255, .05);
}
.hero-ship {
  position: relative;
  z-index: 2;
  height: min(35vh, 318px);
  aspect-ratio: 320 / 360;
  max-width: 86vw;
  animation: heroHover 4.2s ease-in-out infinite;
  filter: drop-shadow(0 20px 24px rgba(0, 0, 0, .50));
}
.hero-ship svg { display: block; width: 100%; height: 100%; overflow: visible; }

.hero-dust { position: absolute; inset: 0; pointer-events: none; }
.hero-dust i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #FFD08A;
  box-shadow: 0 0 10px rgba(255, 170, 70, .9);
  animation: dustFloat 3.2s ease-in-out infinite;
}
.hero-dust i:nth-child(1) { left: 20%; top: 36%; animation-delay: -.4s; }
.hero-dust i:nth-child(2) { right: 18%; top: 30%; animation-delay: -1.6s; width: 3px; height: 3px; }
.hero-dust i:nth-child(3) { left: 13%; top: 62%; animation-delay: -2.2s; width: 3px; height: 3px; }
.hero-dust i:nth-child(4) { right: 14%; top: 64%; animation-delay: -.9s; }
.hero-dust i:nth-child(5) { left: 48%; top: 16%; animation-delay: -2.8s; width: 2px; height: 2px; }

/* 启动按钮 */
.launch-zone {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  padding: 4px 6px 0;
}
.launch-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 66px;
  overflow: hidden;
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 50%, calc(100% - 22px) 100%, 22px 100%, 0 50%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .52) 0%, rgba(255, 255, 255, 0) 26%),
    linear-gradient(180deg, #FFD98E 0%, #FFAE4A 22%, #FF8A2B 52%, #F46A0C 82%, #D64F00 100%);
  box-shadow:
    inset 0 0 0 3px rgba(113, 40, 0, .34),
    inset 0 0 0 5px rgba(255, 226, 168, .40),
    inset 0 -5px 0 rgba(137, 42, 0, .42),
    inset 0 4px 0 rgba(255, 255, 255, .34);
  filter: drop-shadow(0 12px 24px rgba(255, 112, 24, .40));
  transition: transform .12s ease, filter .12s ease;
}
.launch-btn:active {
  transform: translateY(1px) scale(.972);
  filter: drop-shadow(0 7px 14px rgba(255, 112, 24, .30)) brightness(1.05);
}
.launch-text {
  position: relative;
  z-index: 3;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #FFFFFF;
  text-shadow: 0 2px 0 #A53E00, 0 0 18px rgba(255, 210, 140, .72);
}
.launch-icon {
  position: relative;
  z-index: 3;
  width: 31px;
  height: 31px;
  color: #FFFFFF;
  filter: drop-shadow(0 2px 0 #A53E00);
}
.launch-shine {
  position: absolute;
  top: -40%;
  left: -30%;
  width: 34%;
  height: 180%;
  transform: rotate(24deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .62), transparent);
  animation: shineSweep 3.8s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}
.launch-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: .4px;
  color: rgba(157, 190, 224, .82);
}
.launch-hint .mp-icon { width: 16px; height: 16px; color: var(--orange); }

.home-foot {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 10px;
}
.foot-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .3px;
  color: rgba(143, 169, 204, .85);
  background: rgba(9, 22, 49, .48);
  border: 1px solid rgba(96, 168, 255, .13);
}
.foot-chip .mp-icon { width: 12px; height: 12px; color: rgba(255, 170, 90, .85); }

/* 星球 / 陨石装饰 */
.planet {
  position: absolute;
  z-index: 0;
  left: -27%;
  bottom: -23%;
  width: min(102vw, 430px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 66% 28%, #9FDFFF 0%, #4D9BF5 13%, #2466D8 29%, #123B9B 47%, #0A2260 65%, #061235 82%, #040A1E 100%);
  box-shadow:
    inset 18px 16px 40px rgba(109, 198, 255, .30),
    inset -34px -38px 86px rgba(0, 0, 0, .82),
    0 0 80px rgba(43, 128, 255, .22);
  opacity: .9;
  pointer-events: none;
  animation: planetBreathe 12s ease-in-out infinite;
}
.planet::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  box-shadow: inset 4px 6px 10px rgba(133, 212, 255, .32);
}
.planet-glow {
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(48, 139, 255, .22), transparent 62%);
  filter: blur(14px);
}
.planet-crater {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(7, 24, 60, .42), rgba(2, 9, 26, .70));
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .5), 0 1px 2px rgba(120, 193, 255, .18);
  opacity: .7;
}
.planet-crater.c1 { width: 18%; height: 16%; left: 30%; top: 28%; }
.planet-crater.c2 { width: 11%; height: 10%; left: 56%; top: 46%; }
.planet-crater.c3 { width: 23%; height: 18%; left: 18%; top: 56%; }
.planet-crater.c4 { width: 8%; height: 7%; left: 47%; top: 20%; }

.rock {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 33% 28%, #77839E 0%, #3D4860 38%, #222A3D 66%, #111726 100%);
  box-shadow:
    inset -8px -10px 16px rgba(0, 0, 0, .62),
    inset 5px 5px 9px rgba(170, 200, 240, .14),
    0 0 26px rgba(71, 148, 255, .12);
  opacity: .78;
}
.rock-a {
  width: 76px;
  height: 58px;
  right: -18px;
  top: 24%;
  border-radius: 46% 54% 58% 42% / 48% 42% 58% 52%;
  transform: rotate(-18deg);
  animation: rockFloat 13s ease-in-out infinite;
}
.rock-b {
  width: 44px;
  height: 36px;
  left: -14px;
  bottom: 23%;
  border-radius: 58% 42% 46% 54% / 44% 56% 44% 56%;
  transform: rotate(22deg);
  animation: rockFloat 10s ease-in-out infinite reverse;
}
.rock-c {
  width: 25px;
  height: 21px;
  right: 12%;
  top: 55%;
  border-radius: 52% 48% 40% 60% / 58% 46% 54% 42%;
  transform: rotate(40deg);
  opacity: .55;
  animation: rockFloat 15s ease-in-out infinite;
}

/* ---------- 游戏中 ---------- */
.game {
  background: #030713;
  touch-action: none;
}
#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.hud::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 132px;
  background: linear-gradient(180deg, rgba(2, 6, 16, .82) 0%, rgba(2, 6, 16, .38) 58%, transparent 100%);
}

.hud-top {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 14px;
  background: rgba(9, 23, 50, .78);
  border: 1px solid rgba(95, 175, 255, .24);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.hud-avatar { width: 35px; height: 35px; }
.hud-stats { min-width: 66px; }
.hud-lv {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .7px;
  color: var(--orange-hi);
  line-height: 1;
}
.hud-hpbar {
  width: 72px;
  height: 6px;
  margin-top: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
}
.hud-hpfill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2EE4FF, #66FFC2);
  box-shadow: 0 0 8px rgba(79, 216, 255, .9);
  transition: width .18s ease, background .25s ease;
}
.hud-hpfill.low { background: linear-gradient(90deg, #FF5B3D, #FFB13D); box-shadow: 0 0 8px rgba(255, 90, 60, .9); }

.hud-score {
  position: relative;
  flex: 0 1 auto;
  padding-top: 1px;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
}
.hud-score-label {
  display: block;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .34em;
  color: #87A6CE;
  line-height: 1;
}
.hud-score b {
  display: block;
  margin-top: 2px;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .5px;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(79, 216, 255, .30), 0 2px 0 rgba(4, 12, 30, .7);
}
.hud-wave {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #FFD08A;
  background: rgba(255, 138, 61, .13);
  border: 1px solid rgba(255, 138, 61, .38);
  white-space: nowrap;
}
.hud-actions { display: flex; gap: 6px; }
.hud-actions .icon-btn {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(9, 23, 50, .78);
  backdrop-filter: none;
}
.hud-actions .icon-btn .mp-icon { width: 19px; height: 19px; }

.boss-bar {
  position: absolute;
  top: calc(var(--safe-top) + 66px);
  left: 26px;
  right: 26px;
  z-index: 7;
  text-align: center;
}
.boss-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .22em;
  color: #FFB3A0;
  text-shadow: 0 0 10px rgba(255, 70, 40, .55);
}
.boss-name .mp-icon { width: 13px; height: 13px; color: #FF7A5A; }
.boss-track {
  height: 8px;
  border-radius: 999px;
  padding: 1px;
  background: rgba(41, 9, 14, .78);
  border: 1px solid rgba(255, 102, 76, .48);
  box-shadow: 0 0 16px rgba(255, 60, 30, .24), inset 0 1px 3px rgba(0, 0, 0, .6);
}
.boss-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF3D3D, #FF7A3D 55%, #FFC24B);
  box-shadow: 0 0 12px rgba(255, 80, 40, .9);
  transition: width .12s linear;
}

.wave-banner {
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
  z-index: 8;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
.wave-banner.show { animation: waveBanner 1.9s cubic-bezier(.18, .8, .25, 1) forwards; }
.wave-banner span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .55em;
  color: #7FD6FF;
  text-shadow: 0 0 14px rgba(79, 216, 255, .7);
}
.wave-banner strong {
  display: block;
  margin-top: 4px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #FFFFFF, #FFD08A 52%, #FF8A3D);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(63, 21, 0, .85)) drop-shadow(0 0 20px rgba(255, 138, 61, .55));
}
.wave-banner.is-boss span { color: #FF9B80; text-shadow: 0 0 14px rgba(255, 70, 40, .8); }
.wave-banner.is-boss strong {
  background: linear-gradient(180deg, #FFFFFF, #FFB3A0 45%, #FF4D3D);
  -webkit-background-clip: text;
  background-clip: text;
}

.toast {
  position: absolute;
  top: calc(var(--safe-top) + 78px);
  left: 50%;
  z-index: 9;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #FFF4D8;
  background: rgba(14, 33, 68, .90);
  border: 1px solid rgba(255, 178, 90, .48);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 0 18px rgba(255, 138, 61, .16);
  transform: translate(-50%, -8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.drag-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 26px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 6;
  font-size: 11px;
  letter-spacing: .5px;
  color: rgba(204, 228, 255, .72);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  transition: opacity .5s ease;
  pointer-events: none;
}
.drag-hint .mp-icon { width: 17px; height: 17px; color: var(--cyan); animation: touchNudge 1.6s ease-in-out infinite; }
.drag-hint.hide { opacity: 0; }

/* ---------- 遮罩 / 通用卡片 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px);
  background: rgba(2, 7, 18, .74);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}
.pause-overlay { z-index: 60; }

.overlay-card {
  width: 100%;
  max-width: 342px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 20px 20px;
  text-align: center;
  border-radius: 24px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(59, 131, 238, .18), transparent 70%),
    linear-gradient(180deg, #102449 0%, #08152F 100%);
  border: 1px solid rgba(96, 178, 255, .28);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .62), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: cardIn .28s cubic-bezier(.2, .9, .3, 1.2) both;
  scrollbar-width: none;
}
.overlay-card::-webkit-scrollbar { display: none; }
.overlay-card h2 {
  margin: 10px 0 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
}
.overlay-sub {
  margin: 7px 0 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.overlay-emblem {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 150, 70, .22), rgba(255, 120, 50, .04) 66%);
  border: 1px solid rgba(255, 160, 92, .42);
  box-shadow: 0 0 30px rgba(255, 138, 61, .18), inset 0 0 20px rgba(255, 138, 61, .12);
}
.overlay-emblem .mp-icon { width: 28px; height: 28px; color: #FFC16B; }
.overlay-emblem.cyan {
  background: radial-gradient(circle, rgba(79, 216, 255, .20), rgba(79, 216, 255, .03) 66%);
  border-color: rgba(79, 216, 255, .42);
  box-shadow: 0 0 30px rgba(79, 216, 255, .16), inset 0 0 20px rgba(79, 216, 255, .12);
}
.overlay-emblem.cyan .mp-icon { color: var(--cyan); }

.btn-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 52px;
  margin-top: 4px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #FFC15E 0%, #FF9A3F 38%, #FF7A1A 100%);
  box-shadow: 0 9px 20px rgba(255, 120, 26, .30), inset 0 2px 0 rgba(255, 255, 255, .38), inset 0 -3px 0 rgba(142, 46, 0, .36);
  transition: transform .12s ease, filter .12s ease;
}
.btn-main .mp-icon { width: 21px; height: 21px; }
.btn-main:active { transform: scale(.975); filter: brightness(1.05); }
.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: #CFE4FF;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(116, 184, 255, .24);
  transition: transform .12s ease, background .2s ease;
}
.btn-ghost .mp-icon { width: 19px; height: 19px; }
.btn-ghost:active { transform: scale(.98); background: rgba(255, 255, 255, .10); }
.btn-text {
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  font-size: 12px;
  color: #8FA9CC;
  letter-spacing: .5px;
}
.btn-text:active { color: #D8ECFF; }

.help-card { max-width: 352px; text-align: left; }
.help-card h2, .help-card .overlay-sub { text-align: center; }
.help-list {
  display: grid;
  gap: 12px;
  margin: 2px 0 18px;
  padding: 0;
  list-style: none;
}
.help-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(116, 184, 255, .13);
}
.help-list .mp-icon {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  color: var(--orange);
}
.help-list b {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #EAF4FF;
  letter-spacing: .3px;
}
.help-list span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.55;
  color: #8FA9CC;
}

/* ---------- 结束页 ---------- */
.over {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  background:
    radial-gradient(74% 46% at 50% 22%, rgba(255, 68, 38, .16), transparent 72%),
    radial-gradient(120% 72% at 50% -12%, rgba(29, 60, 124, .40), transparent 64%);
}
.over-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 4, 8, .26) 0%, rgba(4, 8, 20, .62) 48%, rgba(2, 5, 14, .90) 100%);
  pointer-events: none;
}
.over-ground {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: -20%;
  height: 44%;
  border-radius: 50% 50% 0 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 92, 48, .18), rgba(5, 11, 26, 0) 64%);
  pointer-events: none;
}
.over-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 390px;
  margin: auto;
  padding: calc(var(--safe-top) + 26px) 20px calc(var(--safe-bottom) + 22px);
}
.over-emblem {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 85, 54, .22), rgba(255, 60, 30, .02) 68%);
  border: 1.5px solid rgba(255, 108, 74, .48);
  box-shadow: 0 0 36px rgba(255, 68, 38, .26), inset 0 0 26px rgba(255, 68, 38, .14);
  animation: emblemPulse 2.6s ease-in-out infinite;
}
.over-emblem .mp-icon { width: 36px; height: 36px; color: #FF7A5A; }
.over-tag {
  margin-top: 14px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .34em;
  color: #FF9B80;
  background: rgba(255, 74, 44, .10);
  border: 1px solid rgba(255, 92, 60, .34);
}
.over-title {
  margin: 10px 0 0;
  font-size: 33px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #F5FAFF;
  text-shadow: 0 3px 0 rgba(93, 16, 8, .55), 0 0 26px rgba(255, 80, 44, .20);
}
.over-sub {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #9AAFD0;
}
.result-card {
  width: 100%;
  margin: 18px 0;
  padding: 17px 16px 15px;
  border-radius: 20px;
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(58, 129, 235, .16), transparent 70%),
    linear-gradient(180deg, rgba(16, 36, 74, .94), rgba(7, 17, 39, .96));
  border: 1px solid rgba(100, 180, 255, .22);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.result-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .32em;
  color: #8AA6C8;
}
.result-score {
  margin-top: 3px;
  font-size: 56px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFD166 54%, #FF9A3D 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 170, 70, .30));
}
.new-best {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #3B2602;
  background: linear-gradient(180deg, #FFE39A, #FFB13D);
  box-shadow: 0 0 16px rgba(255, 180, 70, .45);
  animation: bestPop .5s cubic-bezier(.2, .9, .3, 1.4) both;
}
.new-best .mp-icon { width: 13px; height: 13px; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid rgba(120, 180, 255, .13);
}
.result-grid div { text-align: center; }
.result-grid span {
  display: block;
  font-size: 9px;
  letter-spacing: .1em;
  color: #7F9ABC;
}
.result-grid b {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  font-weight: 800;
  color: #EAF4FF;
  font-variant-numeric: tabular-nums;
}
.retry-btn { width: 100%; }
.home-btn { width: 100%; }

/* ---------- 动画 ---------- */
@keyframes heroHover {
  0%, 100% { transform: translateY(6px) rotate(-.6deg); }
  50% { transform: translateY(-8px) rotate(.8deg); }
}
@keyframes glowPulse {
  0%, 100% { opacity: .78; transform: scale(.96); }
  50% { opacity: 1; transform: scale(1.04); }
}
@keyframes shineSweep {
  0%, 20% { left: -36%; opacity: 0; }
  46% { opacity: .9; }
  68%, 100% { left: 108%; opacity: 0; }
}
@keyframes dustFloat {
  0%, 100% { transform: translate3d(0, 4px, 0) scale(.8); opacity: .25; }
  50% { transform: translate3d(3px, -8px, 0) scale(1.25); opacity: 1; }
}
@keyframes rockFloat {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: -5px 9px; rotate: -5deg; }
}
@keyframes planetBreathe {
  0%, 100% { opacity: .82; transform: scale(1); }
  50% { opacity: .95; transform: scale(1.015); }
}
@keyframes flamePulse {
  from { transform: scaleY(.78) scaleX(.92); opacity: .78; }
  to { transform: scaleY(1.16) scaleX(1.05); opacity: 1; }
}
@keyframes waveBanner {
  0% { opacity: 0; transform: translateY(16px) scale(.86); }
  16% { opacity: 1; transform: translateY(0) scale(1); }
  76% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(1.04); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes emblemPulse {
  0%, 100% { box-shadow: 0 0 32px rgba(255, 68, 38, .20), inset 0 0 22px rgba(255, 68, 38, .12); }
  50% { box-shadow: 0 0 46px rgba(255, 68, 38, .38), inset 0 0 28px rgba(255, 68, 38, .20); }
}
@keyframes bestPop {
  from { opacity: 0; transform: scale(.7); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes touchNudge {
  0%, 100% { transform: translateY(0); opacity: .75; }
  50% { transform: translateY(-3px); opacity: 1; }
}

/* 飞船 SVG 内部火焰动画 */
.ship-flame {
  transform-box: fill-box;
  transform-origin: 50% 0%;
  animation: flamePulse .17s ease-in-out infinite alternate;
}
.ship-flame:nth-of-type(2) { animation-delay: -.06s; }
.ship-flame:nth-of-type(3) { animation-delay: -.11s; }
.wreck-ship .ship-flame { animation: none; opacity: .18; }
.wreck-ship { filter: grayscale(.45) brightness(.62) drop-shadow(0 0 26px rgba(255, 70, 40, .35)); }

/* ---------- 适配 ---------- */
@media (min-width: 620px) {
  .home-top, .home-main, .home-foot { width: 100%; max-width: 480px; margin-left: auto; margin-right: auto; }
  .home-foot { margin-top: 0; }
}
@media (max-height: 700px) {
  .home { padding-top: calc(var(--safe-top) + 10px); }
  .hero-wrap { min-height: 148px; }
  .hero-ship { height: min(31vh, 236px); }
  .logo-wrap { margin-top: 2px; }
  .logo-sub { margin-top: 2px; }
  .launch-btn { height: 60px; }
  .launch-text { font-size: 21px; }
  .launch-hint { margin-top: 7px; }
  .home-foot { padding-top: 6px; }
  .over-wrap { padding-top: calc(var(--safe-top) + 14px); padding-bottom: calc(var(--safe-bottom) + 14px); }
  .over-emblem { width: 60px; height: 60px; }
  .over-emblem .mp-icon { width: 28px; height: 28px; }
  .over-title { font-size: 28px; }
  .result-score { font-size: 46px; }
  .result-card { margin: 13px 0; padding: 14px; }
  .retry-btn { height: 58px; }
}
@media (max-width: 350px) {
  .home { padding-left: 14px; padding-right: 14px; }
  .pilot-name { max-width: 88px; }
  .hud-hpbar { width: 60px; }
  .hud-left { padding-right: 8px; }
  .hud-avatar { width: 32px; height: 32px; }
  .hud-score b { font-size: 22px; }
  .hud-actions .icon-btn { width: 35px; height: 35px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-ship, .hero-glow, .hero-dust i, .rock, .launch-shine,
  .over-emblem, .new-best, .drag-hint .mp-icon { animation: none !important; }
  .ship-flame { animation-duration: .5s; }
}
