:root {
  --orange: #FF8A3D;
  --orange-deep: #F2691B;
  --orange-soft: #FFC08A;
  --ice: #8FDCFF;
  --ink: #050818;
  --line: rgba(126, 184, 255, .26);
  --panel: rgba(10, 21, 48, .72);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #03060f;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(70% 55% at 50% 0%, #172554 0%, #080d20 48%, #03060f 100%);
}

button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid #8FDCFF;
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.game {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #050818;
  isolation: isolate;
  box-shadow: 0 0 90px rgba(30, 68, 150, .28);
}

/* ---------- 深空背景 ---------- */
.space-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 72% at 78% 8%, #1b2c66 0%, rgba(11, 18, 47, 0) 58%),
    radial-gradient(100% 70% at 12% 70%, #2a1758 0%, rgba(7, 11, 30, 0) 62%),
    linear-gradient(180deg, #070b22 0%, #0a1233 52%, #070b1e 100%);
}

.space-art {
  position: absolute;
  inset: -8%;
  background: url("images/gen/gptimg_1795176442_look.png") center / cover no-repeat;
  filter: blur(24px) saturate(1.35) brightness(.50);
  transform: scale(1.12);
  opacity: .62;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(38px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.nebula-a {
  width: 74%;
  height: 42%;
  left: -22%;
  top: 24%;
  background: radial-gradient(circle, rgba(120, 62, 255, .34) 0%, rgba(120, 62, 255, 0) 70%);
  animation: nebulaDrift 16s ease-in-out infinite alternate;
}

.nebula-b {
  width: 68%;
  height: 40%;
  right: -26%;
  top: 44%;
  background: radial-gradient(circle, rgba(255, 122, 52, .20) 0%, rgba(255, 122, 52, 0) 70%);
  animation: nebulaDrift 21s ease-in-out infinite alternate-reverse;
}

.planet {
  position: absolute;
  left: -38%;
  bottom: -35%;
  width: 122%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 26%, #8fbdff 0%, #4a7ed6 15%, #2a4d9b 36%, #152a5f 58%, #08122e 76%);
  box-shadow:
    inset -36px -46px 90px rgba(0, 0, 0, .85),
    inset 18px 22px 46px rgba(150, 205, 255, .18),
    0 -10px 70px rgba(80, 152, 255, .38);
  filter: blur(1.5px);
  opacity: .78;
}

.planet::after {
  content: "";
  position: absolute;
  inset: -3%;
  border-radius: 50%;
  background: radial-gradient(circle at 64% 20%, rgba(160, 216, 255, .5), transparent 18%);
  filter: blur(8px);
}

.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 86% at 50% 46%, transparent 44%, rgba(2, 5, 15, .62) 100%),
    linear-gradient(180deg, rgba(2, 5, 15, .48) 0%, transparent 16%, transparent 72%, rgba(2, 5, 15, .55) 100%);
}

@keyframes nebulaDrift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to { transform: translate3d(4%, 5%, 0) scale(1.12); }
}

/* ---------- 游戏画布 ---------- */
#stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- 顶部 HUD ---------- */
.hud {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px 44px;
  gap: 10px;
  align-items: start;
  padding:
    calc(env(safe-area-inset-top, 0px) + 12px)
    calc(env(safe-area-inset-right, 0px) + 14px)
    0
    calc(env(safe-area-inset-left, 0px) + 14px);
  pointer-events: none;
}

.hud-left {
  min-width: 0;
}

.score-card {
  display: inline-flex;
  flex-direction: column;
  min-width: 104px;
  padding: 7px 12px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(28, 50, 100, .76), rgba(8, 17, 42, .66));
  box-shadow:
    0 8px 22px rgba(0, 0, 0, .38),
    inset 0 1px 0 rgba(255, 255, 255, .13);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hud-label {
  color: #8FB8E6;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .22em;
}

.score-value {
  margin-top: 5px;
  color: #fff;
  font-family: "DIN Alternate", "Bahnschrift", "Avenir Next Condensed", "PingFang SC", sans-serif;
  font-size: 23px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: .05em;
  text-shadow: 0 0 14px rgba(86, 188, 255, .75);
}

.lives {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding: 3px 9px 3px 7px;
  border: 1px solid rgba(255, 166, 98, .22);
  border-radius: 99px;
  background: rgba(38, 20, 12, .44);
  color: #FFD7B6;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lives .mp-icon {
  width: 15px;
  height: 15px;
  color: var(--orange);
  filter: drop-shadow(0 0 5px rgba(255, 138, 61, .9));
}

.lives b {
  color: #fff;
  font-size: 12px;
}

.wave {
  width: 108px;
  margin-top: 4px;
  text-align: center;
}

.wave-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #CDE9FF;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
  text-shadow: 0 0 10px rgba(86, 188, 255, .7);
}

.wave-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 7px var(--orange);
}

.wave-track {
  height: 4px;
  margin-top: 7px;
  border: 1px solid rgba(134, 197, 255, .22);
  border-radius: 99px;
  background: rgba(3, 9, 24, .64);
  overflow: hidden;
}

.wave-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #47B6FF, #9BEEFF);
  box-shadow: 0 0 9px #4FC8FF;
  transition: width .3s ease;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #D7EEFF;
  border: 1px solid rgba(134, 197, 255, .34);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(30, 54, 108, .8), rgba(7, 15, 38, .72));
  box-shadow:
    0 8px 20px rgba(0, 0, 0, .38),
    inset 0 1px 0 rgba(255, 255, 255, .16);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  pointer-events: auto;
  transition: transform .12s ease, background .15s ease;
}

.icon-btn .mp-icon {
  width: 21px;
  height: 21px;
}

.icon-btn:active {
  transform: scale(.92);
  background: rgba(50, 86, 150, .85);
}

/* ---------- 操作提示 / 战斗横幅 ---------- */
.drag-hint {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid rgba(133, 196, 255, .2);
  border-radius: 99px;
  background: rgba(7, 16, 39, .52);
  color: #B7D8F5;
  font-size: 12px;
  letter-spacing: .02em;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 1;
  transition: opacity .5s ease;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.drag-hint .mp-icon {
  width: 15px;
  height: 15px;
  color: var(--orange);
}

.drag-hint.hide {
  opacity: 0;
}

.wave-banner,
.go-banner {
  position: absolute;
  left: 50%;
  z-index: 6;
  color: #FFE7D2;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: .24em;
  text-align: center;
  text-shadow:
    0 0 22px rgba(255, 138, 61, .8),
    0 4px 18px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.wave-banner {
  top: 33%;
}

.go-banner {
  top: 44%;
  color: #FFB15C;
  font-size: 38px;
  letter-spacing: .18em;
}

.wave-banner.show {
  animation: bannerPop 1.7s ease forwards;
}

.go-banner.show {
  animation: bannerPop 1.1s ease forwards;
}

@keyframes bannerPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); filter: blur(4px); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(.96); }
}

/* ---------- 开始页 ---------- */
.start-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #050818;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  animation: artDrift 26s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes artDrift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.10) translate3d(-1.2%, -1.4%, 0); }
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 8, 24, .72) 0%, rgba(4, 8, 24, .10) 17%, rgba(4, 8, 24, 0) 36%),
    linear-gradient(180deg, rgba(4, 8, 24, 0) 40%, rgba(4, 8, 24, .16) 55%, rgba(4, 8, 24, .52) 70%, rgba(4, 8, 24, .82) 84%, rgba(4, 8, 24, .96) 94%, #04081a 100%),
    radial-gradient(92% 44% at 50% 100%, rgba(255, 122, 47, .24), transparent 66%),
    radial-gradient(120% 120% at 50% 50%, transparent 56%, rgba(2, 5, 15, .55) 100%);
}

.start-content {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding:
    0
    calc(env(safe-area-inset-right, 0px) + 22px)
    calc(env(safe-area-inset-bottom, 0px) + 22px)
    calc(env(safe-area-inset-left, 0px) + 22px);
  text-align: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 10px;
  color: var(--orange-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .30em;
  text-shadow: 0 0 16px rgba(255, 138, 61, .65);
}

.eyebrow .mp-icon {
  width: 13px;
  height: 13px;
  color: var(--orange);
}

.eyebrow .flip {
  transform: scaleX(-1);
}

.start-content h1 {
  margin: 0;
  font-size: clamp(38px, 11.4vw, 54px);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF1E3 44%, #FFB878 72%, #FF8A3D 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 26px rgba(255, 122, 47, .38));
}

.tagline {
  margin: 12px 0 0;
  color: #C6DCF5;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: .04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}

.best-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 7px 15px 7px 11px;
  border: 1px solid rgba(255, 184, 120, .30);
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(44, 29, 20, .62), rgba(20, 14, 12, .54));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
  color: #E9C6A6;
  font-size: 11px;
  letter-spacing: .06em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.best-chip .mp-icon {
  width: 16px;
  height: 16px;
  color: #FFC857;
  filter: drop-shadow(0 0 6px rgba(255, 200, 87, .7));
}

.best-chip b {
  margin-left: 1px;
  color: #FFF3E4;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  padding: 0 20px;
  border: 1px solid rgba(255, 214, 170, .75);
  border-radius: 18px;
  background: linear-gradient(180deg, #FFC078 0%, #FF9147 42%, #F97324 100%);
  box-shadow:
    0 14px 30px rgba(240, 94, 18, .38),
    0 2px 0 rgba(255, 255, 255, .30) inset,
    0 -8px 16px rgba(191, 62, 8, .22) inset;
  color: #35190A;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .10em;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.primary-btn .mp-icon {
  width: 23px;
  height: 23px;
}

.primary-btn:active {
  transform: translateY(1px) scale(.985);
  filter: brightness(.95);
  box-shadow:
    0 6px 16px rgba(240, 94, 18, .34),
    0 2px 0 rgba(255, 255, 255, .22) inset;
}

.start-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 12px 0 0;
  color: #8099B8;
  font-size: 11px;
  letter-spacing: .04em;
}

.start-foot .mp-icon {
  width: 13px;
  height: 13px;
  color: #9BB8D8;
}

/* ---------- 弹窗 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 22px)
    22px
    calc(env(safe-area-inset-bottom, 0px) + 22px);
  background: rgba(3, 7, 20, .70);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fadeIn .22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 344px;
  padding: 26px 22px 22px;
  border: 1px solid rgba(130, 190, 255, .26);
  border-radius: 26px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 138, 61, .16), transparent 62%),
    linear-gradient(180deg, rgba(23, 39, 80, .97) 0%, rgba(9, 17, 40, .98) 100%);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, .62),
    inset 0 1px 0 rgba(255, 255, 255, .13);
  text-align: center;
  overflow: hidden;
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 120px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  transform: translateX(-50%);
  box-shadow: 0 0 18px rgba(255, 138, 61, .9);
}

.modal-kicker {
  margin: 0 0 8px;
  color: var(--orange-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .32em;
}

.modal-card h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .06em;
  color: #F5FAFF;
}

.modal-sub {
  margin: 8px 0 0;
  color: #8EA9C9;
  font-size: 12.5px;
  letter-spacing: .03em;
}

.final-score {
  margin: 12px 0 2px;
  font-family: "DIN Alternate", "Bahnschrift", "Avenir Next Condensed", sans-serif;
  font-size: 58px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #FFFFFF, #FFD2A6 54%, #FF8A3D);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 20px rgba(255, 138, 61, .28));
}

.new-record {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 0;
  padding: 4px 10px;
  border: 1px solid rgba(255, 200, 87, .32);
  border-radius: 99px;
  background: rgba(255, 184, 64, .10);
  color: #FFD98C;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}

.new-record .mp-icon {
  width: 14px;
  height: 14px;
  color: #FFC857;
}

.best-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 0;
  padding-top: 13px;
  border-top: 1px solid rgba(126, 184, 255, .14);
  color: #9AB4D2;
  font-size: 11.5px;
  letter-spacing: .06em;
}

.best-row .mp-icon {
  width: 15px;
  height: 15px;
  color: #FFC857;
}

.best-row b {
  color: #FFF1E1;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.modal-card .primary-btn {
  margin-top: 18px;
  min-height: 52px;
  font-size: 16px;
}

.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 44px;
  margin-top: 9px;
  border: 1px solid rgba(126, 184, 255, .18);
  border-radius: 14px;
  background: rgba(20, 39, 76, .36);
  color: #A9C4E2;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  transition: transform .12s ease, background .12s ease;
}

.ghost-btn .mp-icon {
  width: 16px;
  height: 16px;
}

.ghost-btn:active {
  transform: scale(.985);
  background: rgba(33, 59, 108, .54);
}

.over-card .modal-sub {
  margin-top: 10px;
}

/* ---------- 小屏适配 ---------- */
@media (max-height: 720px) {
  .start-content h1 {
    font-size: clamp(34px, 10.5vw, 44px);
  }

  .tagline {
    margin-top: 8px;
    font-size: 12.5px;
  }

  .best-chip {
    margin-top: 11px;
  }

  .primary-btn {
    min-height: 52px;
    margin-top: 13px;
  }

  .start-foot {
    margin-top: 8px;
  }

  .modal-card {
    padding: 22px 20px 18px;
  }

  .final-score {
    font-size: 50px;
  }
}

@media (max-height: 620px) {
  .start-content .tagline {
    display: none;
  }

  .start-content .best-chip {
    margin-top: 8px;
  }

  .drag-hint {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  }
}

@media (min-width: 620px) {
  .game {
    border-left: 1px solid rgba(126, 184, 255, .12);
    border-right: 1px solid rgba(126, 184, 255, .12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art,
  .nebula-a,
  .nebula-b {
    animation: none;
  }
}
