:root {
  --bg-deep: #060714;
  --bg-panel: #0e1128;
  --bg-card: rgba(18, 23, 52, 0.92);
  --border-neon: rgba(66, 232, 255, 0.28);
  --cyan: #2cf6ff;
  --magenta: #ff2fd0;
  --lime: #7dff5b;
  --amber: #ffbe2e;
  --red: #ff3b6b;
  --text-main: #f3f7ff;
  --text-dim: #95a4cc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 47, 208, 0.16), transparent 42%),
    radial-gradient(circle at 80% 85%, rgba(44, 246, 255, 0.14), transparent 45%),
    #04050d;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 9:16 微信小游戏竖屏外壳 */
.wx-shell {
  width: 100%;
  max-width: 430px;
  height: min(100dvh, 860px);
  background: linear-gradient(180deg, #090b1d 0%, #070917 55%, #0a0c20 100%);
  border: 1px solid rgba(44, 246, 255, 0.22);
  border-radius: 22px;
  box-shadow:
    0 0 40px rgba(44, 246, 255, 0.14),
    0 24px 70px rgba(0, 0, 0, 0.78),
    inset 0 0 24px rgba(255, 47, 208, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

@media (max-width: 440px) {
  .wx-shell {
    max-width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
}

/* 顶部模拟微信栏 */
.wx-topbar {
  height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 14, 34, 0.96);
  border-bottom: 1px solid rgba(44, 246, 255, 0.16);
  flex-shrink: 0;
  z-index: 20;
}

.wx-back {
  color: var(--cyan);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(44, 246, 255, 0.1);
  border: 1px solid rgba(44, 246, 255, 0.3);
  transition: transform 0.12s ease, background 0.15s ease;
  white-space: nowrap;
}

.wx-back:active {
  transform: scale(0.94);
  background: rgba(44, 246, 255, 0.22);
}

.wx-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4px;
  background: linear-gradient(90deg, #fff, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 14px rgba(44, 246, 255, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 8px;
}

.wx-capsule {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  height: 28px;
  padding: 0 4px;
}

.wx-icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  width: 28px;
  height: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.wx-icon-btn:active {
  background: rgba(255, 255, 255, 0.14);
}

.wx-capsule-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
}

/* HUD 区域 */
.hud-bar {
  padding: 8px 10px 6px;
  background: linear-gradient(180deg, rgba(13, 17, 41, 0.96), rgba(9, 12, 28, 0.88));
  border-bottom: 1px solid rgba(44, 246, 255, 0.14);
  flex-shrink: 0;
  z-index: 15;
}

.hud-top-row {
  display: grid;
  grid-template-columns: 1.15fr 0.78fr 0.88fr 1.15fr;
  gap: 6px;
}

.hud-pill {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.hud-timer.boss-time {
  border-color: rgba(255, 59, 107, 0.65);
  background: rgba(255, 59, 107, 0.14);
  animation: pulseWarn 1s infinite alternate;
}

@keyframes pulseWarn {
  from { box-shadow: 0 0 6px rgba(255, 59, 107, 0.25); }
  to { box-shadow: 0 0 14px rgba(255, 59, 107, 0.65); }
}

.hud-label {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.1;
}

.hud-val {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: #fff;
}

.hud-val.cyan { color: var(--cyan); }
.hud-val.lime { color: var(--lime); }
.hud-val.amber { color: var(--amber); }
.hud-val.magenta { color: var(--magenta); }

.hud-energy-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.energy-track {
  flex: 1;
  height: 17px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(44, 246, 255, 0.24);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.energy-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1ad6ff 0%, #b53dff 55%, #ff2fd0 100%);
  box-shadow: 0 0 12px rgba(44, 246, 255, 0.7);
  transition: width 0.16s ease-out;
}

.energy-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.shield-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(44, 246, 255, 0.15);
  border: 1px solid rgba(44, 246, 255, 0.5);
  color: var(--cyan);
  white-space: nowrap;
}

.skills-strip {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  min-height: 20px;
}

.skills-strip::-webkit-scrollbar {
  display: none;
}

.skill-mini {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 47, 208, 0.12);
  border: 1px solid rgba(255, 47, 208, 0.36);
  color: #ffd7f6;
  white-space: nowrap;
  flex-shrink: 0;
}

.skill-mini-empty {
  font-size: 10px;
  color: rgba(149, 164, 204, 0.65);
}

/* 主游戏画布区域 */
.stage-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 100%, rgba(44, 246, 255, 0.08), transparent 45%),
    linear-gradient(180deg, #070917 0%, #090c1f 100%);
  touch-action: none;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* Boss 顶部血条 */
.boss-hud {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  background: rgba(15, 8, 28, 0.88);
  border: 1px solid rgba(255, 47, 208, 0.6);
  border-radius: 10px;
  padding: 5px 9px;
  box-shadow: 0 0 18px rgba(255, 47, 208, 0.35);
  pointer-events: none;
  z-index: 8;
}

.boss-hud-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}

.boss-name {
  color: #ff6be3;
  letter-spacing: 0.5px;
}

.boss-hp-text {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.boss-hp-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff2fd0, #ff4b6e, #ffbe2e);
  box-shadow: 0 0 10px rgba(255, 47, 208, 0.8);
  transition: width 0.1s linear;
}

/* 连击浮标 */
.combo-badge {
  position: absolute;
  top: 54px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 47, 208, 0.28), rgba(44, 246, 255, 0.22));
  border: 1px solid rgba(255, 190, 46, 0.7);
  box-shadow: 0 0 16px rgba(255, 47, 208, 0.45);
  display: flex;
  align-items: baseline;
  gap: 4px;
  pointer-events: none;
  z-index: 9;
  transform-origin: center;
}

.combo-badge.pop {
  animation: comboPop 0.18s ease-out;
}

@keyframes comboPop {
  0% { transform: scale(1.26) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.combo-num {
  font-size: 20px;
  font-weight: 900;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 190, 46, 0.8);
  font-variant-numeric: tabular-nums;
}

.combo-lbl {
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.6px;
}

/* Boss / 阶段横幅 */
.phase-banner {
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  text-align: center;
  padding: 12px 16px;
  background: linear-gradient(90deg, transparent, rgba(255, 34, 128, 0.88), rgba(255, 140, 0, 0.85), transparent);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 12;
  animation: bannerPulse 0.4s ease-in-out infinite alternate;
}

@keyframes bannerPulse {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

/* 舞台底部操作条 */
.stage-bottom-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.aim-hint {
  font-size: 11px;
  color: rgba(180, 200, 240, 0.78);
  background: rgba(8, 11, 26, 0.65);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(44, 246, 255, 0.16);
}

.recall-btn {
  pointer-events: auto;
  border: 1px solid rgba(255, 190, 46, 0.8);
  background: linear-gradient(135deg, rgba(255, 150, 20, 0.92), rgba(255, 47, 130, 0.92));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 120, 40, 0.55);
  animation: recallGlow 0.9s infinite alternate;
}

.recall-btn:active {
  transform: scale(0.95);
}

@keyframes recallGlow {
  from { box-shadow: 0 0 10px rgba(255, 160, 30, 0.45); }
  to { box-shadow: 0 0 22px rgba(255, 60, 140, 0.85); }
}

/* 通用弹窗遮罩 */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 18, 0.84);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}

.hidden {
  display: none !important;
}

.panel {
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(19, 24, 56, 0.97), rgba(11, 14, 34, 0.98));
  border: 1px solid rgba(44, 246, 255, 0.35);
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow:
    0 0 32px rgba(44, 246, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* 开始弹窗 */
.start-panel {
  text-align: center;
}

.logo-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: var(--cyan);
  background: rgba(44, 246, 255, 0.1);
  border: 1px solid rgba(44, 246, 255, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.game-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 14px;
}

.logo-main {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #2cf6ff 0%, #ffffff 48%, #ff2fd0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(44, 246, 255, 0.4));
}

.logo-sub {
  font-size: 16px;
  font-weight: 800;
  color: var(--amber);
  letter-spacing: 3px;
  text-shadow: 0 0 12px rgba(255, 190, 46, 0.45);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px 8px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.16s ease;
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(44, 246, 255, 0.18), rgba(255, 47, 208, 0.18));
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 16px rgba(44, 246, 255, 0.25);
}

.mode-title {
  font-size: 13px;
  font-weight: 800;
}

.mode-desc {
  font-size: 11px;
  opacity: 0.8;
}

.rules-card {
  background: rgba(5, 8, 22, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  text-align: left;
}

.rules-card p {
  font-size: 12.5px;
  line-height: 1.55;
  color: #d6e2ff;
  margin-bottom: 9px;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feature-tags span {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(44, 246, 255, 0.09);
  border: 1px solid rgba(44, 246, 255, 0.24);
  padding: 3px 8px;
  border-radius: 999px;
}

.best-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(255, 190, 46, 0.08);
  border: 1px solid rgba(255, 190, 46, 0.25);
  font-size: 12px;
  color: #ffe2a3;
}

.best-score-row strong {
  font-size: 16px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #060916;
  background: linear-gradient(90deg, #2cf6ff 0%, #7dff5b 50%, #ffbe2e 100%);
  box-shadow: 0 6px 24px rgba(44, 246, 255, 0.4);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.primary-btn:active {
  transform: scale(0.97);
  filter: brightness(1.08);
}

.secondary-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 800;
  color: var(--cyan);
  background: rgba(44, 246, 255, 0.1);
  border: 1px solid rgba(44, 246, 255, 0.35);
}

.secondary-btn:active {
  transform: scale(0.97);
}

/* 肉鸽三选一技能弹窗 */
.skill-panel {
  border-color: rgba(255, 47, 208, 0.5);
  box-shadow: 0 0 36px rgba(255, 47, 208, 0.22);
}

.skill-header {
  text-align: center;
  margin-bottom: 12px;
}

.skill-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--amber);
  background: rgba(255, 190, 46, 0.14);
  border: 1px solid rgba(255, 190, 46, 0.45);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.skill-header h3 {
  font-size: 19px;
  font-weight: 900;
  color: #fff;
}

.skill-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

.skill-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-card {
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, rgba(25, 32, 72, 0.96), rgba(16, 20, 48, 0.98));
  border: 1.5px solid rgba(44, 246, 255, 0.34);
  border-radius: 14px;
  padding: 12px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.skill-card:hover {
  border-color: var(--magenta);
  box-shadow: 0 0 18px rgba(255, 47, 208, 0.35);
}

.skill-card:active {
  transform: scale(0.97);
}

.skill-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(44, 246, 255, 0.12);
  border: 1px solid rgba(44, 246, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.skill-info {
  flex: 1;
  min-width: 0;
}

.skill-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.skill-name {
  font-size: 15px;
  font-weight: 900;
  color: #fff;
}

.skill-lv {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(125, 255, 91, 0.16);
  border: 1px solid rgba(125, 255, 91, 0.45);
  color: var(--lime);
  white-space: nowrap;
}

.skill-desc {
  font-size: 12px;
  line-height: 1.4;
  color: #c5d4f7;
}

/* 结算弹窗 */
.end-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.rank-stamp {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 900;
  color: #080b18;
  background: linear-gradient(135deg, #ffea59, #ff9922);
  box-shadow: 0 0 24px rgba(255, 190, 46, 0.65);
  flex-shrink: 0;
}

.rank-stamp.rank-A {
  background: linear-gradient(135deg, #2cf6ff, #6b8cff);
  box-shadow: 0 0 24px rgba(44, 246, 255, 0.55);
}

.rank-stamp.rank-B {
  background: linear-gradient(135deg, #7dff5b, #20d494);
  box-shadow: 0 0 20px rgba(125, 255, 91, 0.45);
}

.rank-stamp.rank-C {
  background: linear-gradient(135deg, #ff6b8b, #b64bff);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 75, 130, 0.45);
}

.end-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--cyan);
}

.end-titles h2 {
  font-size: 22px;
  font-weight: 900;
  margin: 2px 0;
}

.end-titles p {
  font-size: 12px;
  color: var(--text-dim);
}

.new-record-banner {
  text-align: center;
  padding: 6px 10px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255, 190, 46, 0.2), rgba(255, 47, 208, 0.22));
  border: 1px solid rgba(255, 190, 46, 0.6);
  color: #ffe891;
  font-size: 12px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  background: rgba(5, 8, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-k {
  font-size: 11px;
  color: var(--text-dim);
}

.stat-v {
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.stat-v.amber { color: var(--amber); }
.stat-v.magenta { color: var(--magenta); }
.stat-v.cyan { color: var(--cyan); }
.stat-v.lime { color: var(--lime); }

.build-summary {
  background: rgba(5, 8, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 14px;
}

.build-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.build-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.build-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(44, 246, 255, 0.12);
  border: 1px solid rgba(44, 246, 255, 0.34);
  color: #e6f9ff;
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
