/* =========================================================
   墨守山河 · NEON DYNASTY — 界面样式
   夜为底，霓虹为笔，古器为骨；光要亮，字要狠，反馈要满。
   ========================================================= */
:root {
  --void: #05030d;
  --night: #0b0820;
  --dusk: #140d2e;
  --panel: rgba(12, 8, 30, 0.8);
  --panel-2: rgba(20, 13, 46, 0.72);
  --line: rgba(0, 240, 255, 0.2);
  --line-strong: rgba(0, 240, 255, 0.55);
  --cyan: #00f0ff;
  --ice: #5ce1ff;
  --magenta: #ff2bd6;
  --pink: #ff4d9d;
  --red: #ff3b5c;
  --gold: #ffd23f;
  --orange: #ff8a2b;
  --jade: #2bffb1;
  --violet: #b45cff;
  --text: #ece8ff;
  --soft: #9b94c9;
  --faint: #5a5285;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --num: "Avenir Next Condensed", "DIN Condensed", "DIN Alternate", "Bahnschrift", "SF Mono", Menlo, monospace;
  --mono: "SF Mono", Menlo, Consolas, monospace;
  --glow-c: 0 0 6px rgba(0, 240, 255, 0.8), 0 0 18px rgba(0, 240, 255, 0.45);
  --glow-m: 0 0 6px rgba(255, 43, 214, 0.85), 0 0 22px rgba(255, 43, 214, 0.5);
  --glow-g: 0 0 6px rgba(255, 210, 63, 0.85), 0 0 20px rgba(255, 210, 63, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
::selection { background: rgba(255, 43, 214, 0.35); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.35) 100%);
  mix-blend-mode: screen;
}

.screen { position: fixed; inset: 0; display: none; overflow: auto; }
.screen.active { display: block; }
.game-screen.active { display: flex; }
.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------------- 按钮 ---------------- */
.btn {
  appearance: none;
  position: relative;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.1), rgba(0, 240, 255, 0.02));
  color: var(--text);
  border-radius: 2px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s;
  user-select: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn::before, .btn::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  opacity: 0.9;
  pointer-events: none;
}
.btn::before { left: -3px; top: -3px; border-right: 0; border-bottom: 0; }
.btn::after { right: -3px; bottom: -3px; border-left: 0; border-top: 0; }
.btn small { font-family: var(--mono); font-size: 9px; letter-spacing: 0.24em; opacity: 0.7; font-weight: 400; }
.btn:hover { box-shadow: var(--glow-c); border-color: var(--cyan); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(100deg, #ff2bd6 0%, #ff3b5c 55%, #ff8a2b 100%);
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset, 0 0 22px rgba(255, 43, 214, 0.55), 0 8px 30px rgba(255, 59, 92, 0.35);
}
.btn.primary:hover { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4) inset, 0 0 34px rgba(255, 43, 214, 0.8), 0 8px 40px rgba(255, 59, 92, 0.5); filter: brightness(1.1); }
.btn.primary::before, .btn.primary::after { color: var(--gold); }
.btn.primary:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: var(--faint);
  box-shadow: none;
  cursor: not-allowed;
  text-shadow: none;
}
.btn.ghost { color: var(--cyan); }
.btn.ghost span { color: var(--text); }
.btn.small { padding: 6px 12px; font-size: 12px; letter-spacing: 0.06em; }
.btn.big { padding: 15px 30px; font-size: 17px; letter-spacing: 0.22em; }

.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  background: rgba(0, 240, 255, 0.05);
  border-radius: 2px;
  color: var(--cyan);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
  flex: none;
}
.icon-btn:hover { border-color: var(--cyan); box-shadow: var(--glow-c); }
.pill {
  height: 38px;
  min-width: 52px;
  border: 1px solid rgba(255, 210, 63, 0.4);
  border-radius: 2px;
  background: rgba(255, 210, 63, 0.06);
  font-family: var(--num);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  text-shadow: var(--glow-g);
}
.pill:hover { border-color: var(--gold); box-shadow: var(--glow-g); }
.foot-links { display: inline-flex; gap: 8px; align-items: center; }
a.mini-btn { text-decoration: none; display: inline-flex; align-items: center; }
.mini-btn {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--cyan);
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--cyan); box-shadow: var(--glow-c); }
kbd {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-bottom-width: 2px;
  border-radius: 2px;
  background: rgba(0, 240, 255, 0.06);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--cyan);
  text-align: center;
}

.ico {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: center / contain no-repeat;
  flex: none;
}
.ico-heart { background-image: url("../assets/cyber/ui/lamp.svg"); }
.ico-coin { background-image: url("../assets/cyber/ui/coin.svg"); }
.ico-wave { background-image: url("../assets/cyber/ui/wave.svg"); }
.ico-kill { background-image: url("../assets/cyber/ui/kill.svg"); }
.ico-sound { background-image: url("../assets/cyber/ui/sound.svg"); }
.ico-sound.off { background-image: url("../assets/cyber/ui/mute.svg"); }
.ico-pause { background-image: url("../assets/cyber/ui/pause.svg"); }
.ico-back { background-image: url("../assets/cyber/ui/back.svg"); }

/* ---------------- 故障字 ---------------- */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
  white-space: nowrap;
}
.glitch::before { color: var(--cyan); animation: glitchA 3.2s infinite steps(1); }
.glitch::after { color: var(--magenta); animation: glitchB 2.7s infinite steps(1); }
@keyframes glitchA {
  0%, 86%, 100% { transform: none; clip-path: inset(0 0 100% 0); opacity: 0; }
  87% { transform: translate(-6px, 1px); clip-path: inset(12% 0 60% 0); opacity: 0.9; }
  89% { transform: translate(5px, -2px); clip-path: inset(55% 0 20% 0); opacity: 0.9; }
  91% { transform: translate(-3px, 0); clip-path: inset(30% 0 45% 0); opacity: 0.9; }
  93% { opacity: 0; }
}
@keyframes glitchB {
  0%, 80%, 100% { transform: none; clip-path: inset(0 0 100% 0); opacity: 0; }
  81% { transform: translate(6px, 0); clip-path: inset(70% 0 5% 0); opacity: 0.9; }
  83% { transform: translate(-5px, 2px); clip-path: inset(5% 0 75% 0); opacity: 0.9; }
  85% { transform: translate(3px, -1px); clip-path: inset(40% 0 30% 0); opacity: 0.9; }
  87% { opacity: 0; }
}

/* =========================================================
   主菜单
   ========================================================= */
.menu-screen { background: var(--void); }
.menu-vignette {
  position: fixed; inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 3, 13, 0.82) 0%, rgba(5, 3, 13, 0.45) 45%, transparent 70%),
    radial-gradient(ellipse at 50% 40%, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
}
.menu-wrap {
  position: relative;
  z-index: 2;
  max-width: 1360px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 8vh 5vw 14vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 30px;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--cyan);
  text-shadow: var(--glow-c);
}
.kicker-rule { width: 38px; height: 2px; background: var(--magenta); box-shadow: var(--glow-m); }
.hero-title {
  margin: 20px 0 8px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(76px, 10vw, 150px);
  line-height: 1.02;
  letter-spacing: 0.06em;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 0.08em;
  text-shadow: 0 0 2px #fff, 0 0 16px rgba(0, 240, 255, 0.75), 0 0 46px rgba(0, 240, 255, 0.4);
}
.hero-title .title-accent {
  color: #fff;
  text-shadow: 0 0 2px #fff, 0 0 14px var(--magenta), 0 0 40px var(--magenta), 0 0 80px rgba(255, 43, 214, 0.6);
  animation: flicker 5s infinite;
}
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.55; }
}
.hero-en {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--gold);
  text-shadow: var(--glow-g);
  margin-bottom: 22px;
}
.hero-en i { color: var(--magenta); font-style: normal; }
.hero-sub {
  margin: 0 0 30px;
  max-width: 580px;
  font-size: 15px;
  line-height: 2;
  color: #cfc8f5;
  letter-spacing: 0.05em;
}
.hero-actions { display: flex; gap: 18px; flex-wrap: wrap; }
.hero-stats { display: flex; margin-top: 38px; max-width: 560px; }
.hero-stats div { display: flex; flex-direction: column; padding: 0 24px; border-left: 1px solid var(--line); }
.hero-stats div:first-child { padding-left: 0; border-left: 0; }
.hero-stats b { font-family: var(--num); font-weight: 700; font-size: 34px; line-height: 1.1; color: #fff; text-shadow: var(--glow-c); }
.hero-stats span { font-size: 11px; letter-spacing: 0.24em; color: var(--soft); }
.roster { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; }
.roster-item {
  width: 64px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--soft);
  animation: floaty 3.6s ease-in-out infinite;
}
.roster-item img { width: 56px; height: 56px; display: block; margin: 0 auto 2px; filter: drop-shadow(0 0 10px var(--c)); }
.roster-item:nth-child(2) { animation-delay: -0.6s; }
.roster-item:nth-child(3) { animation-delay: -1.2s; }
.roster-item:nth-child(4) { animation-delay: -1.8s; }
.roster-item:nth-child(5) { animation-delay: -2.4s; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.hero-art { position: relative; height: min(66vh, 600px); }
.hero-art img { position: absolute; pointer-events: none; }
.art-bagua {
  width: min(560px, 44vw);
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.85;
  animation: spin 40s linear infinite;
  filter: drop-shadow(0 0 30px rgba(255, 59, 92, 0.5));
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.art-boss {
  width: min(330px, 26vw);
  left: 50%; top: 50%;
  transform: translate(-50%, -54%);
  filter: drop-shadow(0 0 40px rgba(255, 43, 74, 0.8));
  animation: bossFloat 4s ease-in-out infinite;
}
@keyframes bossFloat {
  0%, 100% { transform: translate(-50%, -54%) scale(1); }
  50% { transform: translate(-50%, -58%) scale(1.03); }
}
.art-sword { width: 34px; animation: swordFloat 3s ease-in-out infinite; filter: drop-shadow(0 0 16px var(--gold)); }
.art-sword.s1 { left: 12%; top: 18%; transform: rotate(-24deg); }
.art-sword.s2 { right: 10%; top: 12%; animation-delay: -1s; filter: drop-shadow(0 0 16px var(--cyan)); }
.art-sword.s3 { right: 18%; bottom: 8%; animation-delay: -2s; }
@keyframes swordFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }
.art-tag {
  position: absolute;
  left: 50%; bottom: 4%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--red);
  text-shadow: 0 0 10px var(--red);
  white-space: nowrap;
}
.menu-footer {
  position: fixed;
  z-index: 3;
  left: 0; right: 0; bottom: 0;
  padding: 14px 34px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--soft);
  background: linear-gradient(to top, rgba(5, 3, 13, 0.9), transparent);
}

/* =========================================================
   关卡选择
   ========================================================= */
.levels-screen { background: var(--void); }
.levels-wrap { position: relative; z-index: 2; max-width: 1260px; margin: 0 auto; padding: 40px 44px 70px; min-height: 100vh; }
.levels-head {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  box-shadow: 0 1px 0 rgba(255, 43, 214, 0.2);
}
.levels-title { flex: 1; }
.levels-title h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 0 2px #fff, 0 0 18px var(--magenta), 0 0 40px rgba(255, 43, 214, 0.5);
}
.levels-summary { display: flex; gap: 10px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: var(--gold); }
.levels-summary span { padding: 6px 12px; border: 1px solid rgba(255, 210, 63, 0.35); background: rgba(255, 210, 63, 0.06); text-shadow: var(--glow-g); }
.level-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.level-card {
  grid-column: span 2;
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--c, var(--cyan));
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 2px;
  background: var(--panel);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 18%, transparent);
}
.level-card:nth-child(1), .level-card:nth-child(2) { grid-column: span 3; }
.level-card:hover:not(:disabled) {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--c), 0 0 34px color-mix(in srgb, var(--c) 55%, transparent), 0 20px 50px rgba(0, 0, 0, 0.5);
}
.level-card:disabled { cursor: not-allowed; }
.level-card:disabled .lc-map, .level-card:disabled .lc-body { opacity: 0.35; filter: grayscale(0.7); }
.lc-map {
  position: relative;
  display: block;
  height: 150px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  border-bottom: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.lc-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lc-art {
  position: absolute;
  right: 8px;
  bottom: 0;
  height: 86%;
  filter: drop-shadow(0 0 14px var(--c));
  transition: transform 0.3s ease;
}
.level-card:hover .lc-art { transform: translateY(-4px) scale(1.05); }
.lc-num {
  position: absolute; left: 12px; top: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; color: var(--c);
  text-shadow: 0 0 8px var(--c);
}
.lc-diff { position: absolute; left: 12px; top: 30px; display: flex; gap: 4px; }
.lc-diff i { width: 14px; height: 4px; background: rgba(255, 255, 255, 0.12); transform: skewX(-20deg); }
.lc-diff i.on { background: var(--red); box-shadow: 0 0 8px var(--red); }
.lc-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 15px 14px; flex: 1; }
.lc-title { display: flex; align-items: baseline; gap: 10px; font-family: var(--serif); font-size: 24px; font-weight: 900; letter-spacing: 0.16em; color: #fff; text-shadow: 0 0 12px var(--c); }
.lc-title small { font-family: var(--sans); font-size: 11px; letter-spacing: 0.2em; color: var(--c); font-weight: 600; text-shadow: none; }
.lc-sub { font-size: 11px; color: var(--soft); letter-spacing: 0.05em; }
.lc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.lc-stars { display: flex; gap: 4px; }
.star {
  display: inline-block;
  width: 16px; height: 16px;
  background: url("../assets/cyber/ui/star_off.svg") center / contain no-repeat;
}
.star.on { background-image: url("../assets/cyber/ui/star.svg"); filter: drop-shadow(0 0 6px var(--gold)); }
.lc-go { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--c); text-shadow: 0 0 8px var(--c); }
.lc-lock {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(5, 3, 13, 0.55); color: var(--magenta);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.24em;
  text-shadow: var(--glow-m);
}
.lc-lock::before { content: ""; width: 22px; height: 22px; background: url("../assets/cyber/ui/lock.svg") center / contain no-repeat; }
.levels-hint { margin-top: 28px; text-align: center; font-size: 12px; letter-spacing: 0.14em; color: var(--soft); }

/* =========================================================
   游戏界面
   ========================================================= */
.game-screen {
  flex-direction: column;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  gap: 10px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255, 43, 214, 0.14), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(0, 240, 255, 0.1), transparent 60%),
    linear-gradient(180deg, #0b0820, #05030d);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.hud {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 58px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 43, 214, 0.08), rgba(12, 8, 30, 0.85) 30%, rgba(12, 8, 30, 0.85) 70%, rgba(0, 240, 255, 0.08));
  position: relative;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.08) inset;
}
.hud::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--magenta), var(--cyan), transparent);
  box-shadow: 0 0 12px var(--magenta);
}
.hud-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.level-seal {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--red), var(--magenta));
  color: #fff;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 900;
  flex: none;
  box-shadow: var(--glow-m);
}
.level-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.hud-level { font-family: var(--serif); font-size: 18px; font-weight: 900; letter-spacing: 0.16em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; text-shadow: var(--glow-c); }
.hud-sub { font-family: var(--mono); font-size: 10px; color: var(--cyan); letter-spacing: 0.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; gap: 8px; flex: none; }
.stat {
  display: flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(5, 3, 13, 0.6);
  min-width: 96px;
  position: relative;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--sc); box-shadow: 0 0 10px var(--sc); }
.stat b { font-family: var(--num); font-weight: 700; font-size: 21px; line-height: 1; letter-spacing: 0.02em; color: #fff; text-shadow: 0 0 10px var(--sc); }
.stat-label { font-size: 10px; color: var(--soft); letter-spacing: 0.16em; margin-left: auto; }
.stat.hp { --sc: var(--pink); }
.stat.gold { --sc: var(--gold); }
.stat.wave { --sc: var(--cyan); }
.stat.kills { --sc: var(--red); }
.stat.hp.low b { color: var(--red); animation: blink 0.6s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }
.hud-right { display: flex; align-items: center; gap: 6px; flex: none; }

.game-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}
.stage { flex: 1 1 auto; min-width: 0; max-width: 1100px; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.stage-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 600;
  border: 1px solid var(--line-strong);
  background: var(--void);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 43, 214, 0.25), 0 0 40px rgba(0, 240, 255, 0.18), 0 0 90px rgba(255, 43, 214, 0.12), 0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 1100px;
}
.stage-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(var(--cyan), var(--cyan)) left top / 22px 2px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left top / 2px 22px no-repeat,
    linear-gradient(var(--magenta), var(--magenta)) right top / 22px 2px no-repeat,
    linear-gradient(var(--magenta), var(--magenta)) right top / 2px 22px no-repeat,
    linear-gradient(var(--magenta), var(--magenta)) left bottom / 22px 2px no-repeat,
    linear-gradient(var(--magenta), var(--magenta)) left bottom / 2px 22px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right bottom / 22px 2px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right bottom / 2px 22px no-repeat;
}
.stage-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
}
#game { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.stage-fx { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.stage-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--soft); letter-spacing: 0.05em; padding: 1px 0; }

.sidebar { width: 316px; flex: none; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 88px); overflow-y: auto; padding-right: 2px; }
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 11px 12px;
  position: relative;
  backdrop-filter: blur(6px);
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
}
.panel::before { left: -1px; top: -1px; border-left: 2px solid var(--cyan); border-top: 2px solid var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); }
.panel::after { right: -1px; bottom: -1px; border-right: 2px solid var(--magenta); border-bottom: 2px solid var(--magenta); filter: drop-shadow(0 0 4px var(--magenta)); }
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--serif); font-size: 14px; font-weight: 900;
  letter-spacing: 0.18em; color: #fff;
  margin-bottom: 9px;
}
.panel-head em { font-family: var(--mono); font-style: normal; font-size: 9px; letter-spacing: 0.3em; color: var(--cyan); font-weight: 400; margin-left: 4px; }
.panel-hint { font-family: var(--sans); font-size: 9px; font-weight: 400; letter-spacing: 0.08em; color: var(--soft); }

.shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 5px 9px 5px 5px;
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 10%, transparent), rgba(5, 3, 13, 0.4));
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
  position: relative;
}
.shop-card:hover { border-color: var(--c); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 45%, transparent); transform: translateX(2px); }
.shop-card.active { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 22px color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 18%, transparent); }
.shop-card.unaffordable { opacity: 0.42; filter: saturate(0.4); }
.shop-icon { width: 46px; height: 46px; display: block; filter: drop-shadow(0 0 6px var(--c)); }
.shop-main { min-width: 0; display: block; }
.shop-name { display: flex; gap: 6px; align-items: baseline; font-family: var(--serif); font-size: 14px; font-weight: 900; letter-spacing: 0.08em; color: #fff; }
.shop-name .key { font-family: var(--mono); font-size: 9px; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); padding: 0 4px; }
.shop-tags { display: block; margin-top: 1px; font-size: 10px; color: var(--soft); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-cost { text-align: right; font-family: var(--num); font-size: 18px; color: var(--gold); font-weight: 700; text-shadow: var(--glow-g); }
.shop-cost small { display: block; font-size: 9px; font-weight: 400; color: var(--soft); text-shadow: none; }

.selection-panel { flex: none; }
.selection-body { font-size: 12px; color: var(--text); }
.empty-hint { margin: 2px 0 3px; font-size: 11px; line-height: 1.7; color: var(--soft); }
.sel-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.sel-icon { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 0 8px var(--c)); }
.sel-name { font-family: var(--serif); font-size: 16px; font-weight: 900; color: #fff; letter-spacing: 0.08em; text-shadow: 0 0 10px var(--c); }
.sel-name small { font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--c); margin-left: 6px; font-weight: 400; }
.sel-desc { margin: 2px 0 4px; font-size: 10px; line-height: 1.65; color: var(--soft); }
.sel-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 6px 0 9px; }
.sel-stats div { display: flex; justify-content: space-between; gap: 4px; font-size: 11px; border-bottom: 1px solid rgba(0, 240, 255, 0.12); padding-bottom: 2px; }
.sel-stats span { color: var(--soft); }
.sel-stats b { font-family: var(--num); font-weight: 700; font-size: 13px; color: #fff; }
.sel-actions { display: flex; gap: 6px; }
.sel-actions .btn { flex: 1; padding: 8px 4px; font-size: 12px; letter-spacing: 0.04em; }
.sel-actions .btn.upgrade { border-color: var(--gold); color: var(--gold); background: rgba(255, 210, 63, 0.1); text-shadow: var(--glow-g); }
.sel-actions .btn.upgrade:hover:not(:disabled) { box-shadow: var(--glow-g); }
.sel-actions .btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.sel-target { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--soft); }
.sel-target b { color: var(--magenta); font-weight: 700; text-shadow: var(--glow-m); }
.sel-target button { background: rgba(255, 43, 214, 0.08); border: 1px solid rgba(255, 43, 214, 0.45); color: var(--magenta); padding: 3px 10px; font-size: 11px; cursor: pointer; }
.sel-target button:hover { box-shadow: var(--glow-m); }

.wave-panel { display: flex; flex-direction: column; gap: 8px; }
.wave-preview { display: flex; flex-direction: column; gap: 4px; min-height: 24px; }
.wave-row { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.wave-icon { width: 24px; height: 24px; flex: none; filter: drop-shadow(0 0 4px var(--c)); }
.wave-name { color: #fff; font-family: var(--serif); letter-spacing: 0.04em; font-weight: 700; }
.wave-tag { font-size: 9px; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); color: var(--c); }
.wave-num { margin-left: auto; font-family: var(--num); font-size: 16px; font-weight: 700; color: var(--gold); text-shadow: var(--glow-g); }
.wave-empty { color: var(--soft); font-size: 11px; line-height: 1.6; }
.wave-alert { display: flex; align-items: center; gap: 6px; color: var(--red); font-size: 11px; text-shadow: 0 0 8px var(--red); animation: blink 0.8s infinite; }
.wave-alert b { font-family: var(--mono); }
.wave-tip { margin: 0; font-size: 10px; line-height: 1.6; color: var(--soft); }

.auto-wave {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border: 1px solid rgba(255, 43, 214, 0.35);
  background: rgba(255, 43, 214, 0.06);
  padding: 6px 9px;
  font-size: 10px;
  color: var(--soft);
  letter-spacing: 0.06em;
}
.auto-wave b { font-family: var(--num); font-size: 18px; font-weight: 700; color: var(--magenta); text-shadow: var(--glow-m); }

/* ---------------- 舞台浮层 ---------------- */
.wave-banner {
  position: absolute; top: 20%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(30px, 4.4vw, 60px);
  font-weight: 900;
  letter-spacing: 0.3em;
  color: #fff;
  opacity: 0;
  white-space: nowrap;
  text-shadow: 0 0 4px #fff, 0 0 20px var(--cyan), 0 0 50px var(--cyan);
}
.wave-banner small { display: block; font-family: var(--mono); font-size: 0.26em; letter-spacing: 0.8em; color: var(--cyan); margin-top: 6px; }
.wave-banner::before, .wave-banner::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan));
  box-shadow: 0 0 10px var(--cyan);
}
.wave-banner::before { right: 100%; margin-right: 10px; }
.wave-banner::after { left: 100%; margin-left: 0; transform: scaleX(-1); }
.wave-banner.show { animation: bannerIn 1.9s cubic-bezier(0.2, 1, 0.3, 1); }
.wave-banner.final { text-shadow: 0 0 4px #fff, 0 0 20px var(--red), 0 0 60px var(--red); }
.wave-banner.final small { color: var(--red); }
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); filter: blur(8px); letter-spacing: 0.9em; }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); letter-spacing: 0.3em; }
  18% { transform: translate(calc(-50% + 6px), -50%); }
  20% { transform: translate(calc(-50% - 4px), -50%); }
  22% { transform: translate(-50%, -50%); }
  74% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.04); }
}

.toast-stack { position: absolute; right: 12px; top: 54px; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 74%; }
.toast {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  background: rgba(5, 3, 13, 0.86);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #fff;
  animation: toastIn 0.24s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}
.toast.good { border-left-color: var(--jade); box-shadow: 0 0 16px rgba(43, 255, 177, 0.25); }
.toast.gold { border-left-color: var(--gold); color: var(--gold); box-shadow: 0 0 16px rgba(255, 210, 63, 0.25); }
.toast.warn { border-left-color: var(--orange); }
.toast.danger { border-left-color: var(--red); color: #ffd0d8; box-shadow: 0 0 18px rgba(255, 59, 92, 0.4); }
.toast.out { animation: toastOut 0.3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) skewX(-10deg); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

.boss-hud {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: min(460px, 62%);
  padding: 6px 12px 8px;
  border: 1px solid rgba(255, 43, 74, 0.6);
  background: rgba(30, 2, 10, 0.82);
  box-shadow: 0 0 24px rgba(255, 43, 74, 0.45);
}
.boss-hud.hidden { display: none; }
.boss-label { display: flex; justify-content: space-between; font-family: var(--serif); font-size: 13px; font-weight: 900; letter-spacing: 0.2em; color: var(--gold); margin-bottom: 5px; text-shadow: var(--glow-g); }
.boss-label span:last-child { font-family: var(--num); color: #fff; }
.boss-track { height: 8px; background: rgba(255, 255, 255, 0.08); overflow: hidden; transform: skewX(-20deg); }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); box-shadow: 0 0 14px var(--red); transition: width 0.15s linear; }
.damage-flash { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 30, 70, 0.55)); }
.damage-flash.hit { animation: hurt 0.55s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }
.build-hint {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 0.08em; color: var(--cyan);
  background: rgba(5, 3, 13, 0.85);
  border: 1px solid var(--line-strong);
  padding: 4px 12px;
  white-space: nowrap;
  box-shadow: var(--glow-c);
}
.build-hint.hidden { display: none; }

/* 连斩 */
.combo {
  position: absolute;
  left: 16px;
  top: 14px;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
  --cc: var(--cyan);
  transform-origin: left top;
}
.combo.show { display: flex; }
.combo .cb-row { display: flex; align-items: baseline; gap: 6px; }
.combo b {
  font-family: var(--num);
  font-size: 54px;
  line-height: 0.9;
  font-weight: 900;
  font-style: italic;
  color: #fff;
  text-shadow: 0 0 4px #fff, 0 0 16px var(--cc), 0 0 36px var(--cc);
}
.combo span { font-family: var(--serif); font-size: 16px; font-weight: 900; letter-spacing: 0.2em; color: var(--cc); text-shadow: 0 0 10px var(--cc); }
.combo .cb-bar { width: 140px; height: 3px; background: rgba(255, 255, 255, 0.12); margin-top: 6px; overflow: hidden; }
.combo .cb-bar i { display: block; height: 100%; background: var(--cc); box-shadow: 0 0 8px var(--cc); }
.combo .cb-mult { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--gold); margin-top: 4px; text-shadow: var(--glow-g); }
.combo.bump b { animation: bump 0.18s ease-out; }
@keyframes bump { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }

.tier-pop {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  white-space: nowrap;
  --tc: var(--gold);
}
.tier-pop b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(46px, 7vw, 96px);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #fff;
  text-shadow: 0 0 6px #fff, 0 0 24px var(--tc), 0 0 60px var(--tc), 0 0 120px var(--tc);
}
.tier-pop small { display: block; font-family: var(--mono); font-size: 14px; letter-spacing: 0.6em; color: var(--tc); text-shadow: 0 0 10px var(--tc); }
.tier-pop em { font-style: normal; font-family: var(--num); font-size: 22px; color: var(--gold); letter-spacing: 0.1em; }
.tier-pop.show { animation: tierIn 1.5s cubic-bezier(0.2, 1, 0.3, 1) forwards; }
@keyframes tierIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.6) rotate(-6deg); filter: blur(10px); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(0.92) rotate(-2deg); filter: blur(0); }
  20% { transform: translate(-50%, -50%) scale(1.04) rotate(-2deg); }
  28% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1.06) rotate(-2deg); }
}

/* 大招切入 */
.cutin { position: absolute; inset: 0; opacity: 0; pointer-events: none; --kc: var(--magenta); }
.cutin.show { animation: cutFade 1.15s ease forwards; }
.cutin .ci-band {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 34%;
  height: 32%;
  transform: skewY(-7deg);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 14px),
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--kc) 70%, transparent) 20%, color-mix(in srgb, var(--kc) 85%, #000) 50%, color-mix(in srgb, var(--kc) 70%, transparent) 80%, transparent);
  box-shadow: 0 0 60px var(--kc);
  border-top: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.cutin.show .ci-band { animation: bandIn 1.15s cubic-bezier(0.2, 1, 0.3, 1) forwards; }
.cutin .ci-icon {
  position: absolute;
  left: 14%;
  top: 50%;
  width: 22%;
  max-width: 200px;
  transform: translate(0, -50%);
  filter: drop-shadow(0 0 24px var(--kc));
}
.cutin.show .ci-icon { animation: iconIn 1.15s cubic-bezier(0.2, 1, 0.3, 1) forwards; }
.cutin .ci-text { position: absolute; left: 40%; top: 50%; transform: translateY(-50%); white-space: nowrap; }
.cutin .ci-text b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(40px, 6.4vw, 92px);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 6px #fff, 0 0 24px var(--kc), 0 4px 0 rgba(0, 0, 0, 0.5);
}
.cutin .ci-text small { display: block; font-family: var(--mono); font-size: clamp(10px, 1.1vw, 15px); letter-spacing: 0.6em; color: #fff; opacity: 0.85; margin-top: 4px; }
.cutin.show .ci-text { animation: textIn 1.15s cubic-bezier(0.2, 1, 0.3, 1) forwards; }
@keyframes cutFade { 0% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bandIn { 0% { transform: skewY(-7deg) scaleY(0); } 12% { transform: skewY(-7deg) scaleY(1.15); } 20% { transform: skewY(-7deg) scaleY(1); } 100% { transform: skewY(-7deg) scaleY(0.9); } }
@keyframes iconIn { 0% { transform: translate(-200%, -50%) rotate(-30deg); } 18% { transform: translate(0, -50%) rotate(0); } 100% { transform: translate(14%, -50%) rotate(4deg); } }
@keyframes textIn { 0% { transform: translate(60%, -50%); opacity: 0; } 16% { transform: translate(0, -50%); opacity: 1; } 100% { transform: translate(-6%, -50%); opacity: 1; } }

.boss-warn { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.boss-warn.show { animation: warnFade 2.6s ease forwards; }
.boss-warn .bw-stripe {
  position: absolute; left: 0; right: 0; height: 36px;
  background: repeating-linear-gradient(-45deg, rgba(255, 43, 74, 0.85) 0 18px, rgba(5, 3, 13, 0.85) 18px 36px);
  box-shadow: 0 0 30px rgba(255, 43, 74, 0.8);
  animation: stripeMove 0.6s linear infinite;
}
.boss-warn .bw-stripe.top { top: 28%; }
.boss-warn .bw-stripe.bot { top: calc(28% + 150px); }
.boss-warn .bw-text {
  position: absolute; left: 50%; top: calc(28% + 93px); transform: translate(-50%, -50%);
  text-align: center; white-space: nowrap;
}
.boss-warn .bw-text b {
  display: block;
  font-family: var(--mono);
  font-size: clamp(30px, 5vw, 64px);
  letter-spacing: 0.4em;
  color: var(--red);
  text-shadow: 0 0 10px var(--red), 0 0 40px var(--red);
  animation: blink 0.35s steps(1) infinite;
}
.boss-warn .bw-text small { font-family: var(--serif); font-size: 18px; letter-spacing: 0.5em; color: var(--gold); text-shadow: var(--glow-g); }
@keyframes stripeMove { to { background-position: 51px 0; } }
@keyframes warnFade { 0% { opacity: 0; } 8% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

.stamp-flash { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9), rgba(255, 59, 92, 0.4) 40%, transparent 70%); }
.stamp-flash.show { animation: stamp 0.7s ease-out; }
@keyframes stamp { 0% { opacity: 1; } 100% { opacity: 0; } }
.stage-frame.quake { animation: quake 0.5s linear; }
@keyframes quake {
  0%, 100% { transform: none; }
  10% { transform: translate(-8px, 5px); }
  20% { transform: translate(7px, -6px); }
  30% { transform: translate(-6px, -4px); }
  40% { transform: translate(5px, 6px); }
  55% { transform: translate(-3px, 2px); }
  70% { transform: translate(2px, -2px); }
}

.mobile-dock { display: none; }

/* 主动技法 + 超载 */
.skill-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  z-index: 6;
  pointer-events: none;
}
.skill {
  pointer-events: auto;
  position: relative;
  width: 64px;
  height: 64px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, filter 0.15s;
  --p: 0;
}
.skill img { width: 100%; height: 100%; display: block; }
.skill:hover { transform: translateY(-3px) scale(1.06); }
.skill:active { transform: scale(0.94); }
.skill.ready { filter: drop-shadow(0 0 10px var(--c)); animation: readyPulse 1.6s ease-in-out infinite; }
@keyframes readyPulse { 50% { filter: drop-shadow(0 0 18px var(--c)) brightness(1.15); } }
.skill.cooling img { filter: grayscale(0.85) brightness(0.55); }
.skill-mask {
  position: absolute; inset: 6px;
  border-radius: 50%;
  background: conic-gradient(rgba(5, 3, 13, 0.78) calc(var(--p) * 360deg), transparent 0);
  display: none;
}
.skill.cooling .skill-mask { display: block; }
.skill-key {
  position: absolute; left: -2px; top: -4px;
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: #fff;
  background: var(--c); padding: 0 4px; box-shadow: 0 0 8px var(--c);
}
.skill-name {
  position: absolute; left: 50%; top: -19px; transform: translateX(-50%);
  white-space: nowrap; font-family: var(--serif); font-size: 11px; font-weight: 900;
  letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 8px var(--c);
}
.skill-cd {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  font-family: var(--num); font-size: 20px; font-weight: 700; color: #fff;
  text-shadow: 0 0 6px #000, 0 0 10px var(--c);
}
.skill.cooling .skill-cd { display: flex; }
.skill.cooling .skill-name { opacity: 0.45; }
.skill.flash { animation: castFlash 0.4s ease-out; }
@keyframes castFlash { 0% { transform: scale(1.35); filter: brightness(2.5) drop-shadow(0 0 30px var(--c)); } 100% { transform: none; } }

.od-btn {
  pointer-events: auto;
  position: relative;
  width: 132px;
  height: 64px;
  margin-left: 8px;
  border: 1px solid rgba(255, 43, 214, 0.5);
  background: rgba(10, 4, 22, 0.85);
  cursor: pointer;
  padding: 0 10px 0 54px;
  text-align: left;
  color: #fff;
  overflow: hidden;
  --v: 0;
}
.od-btn img { position: absolute; left: 4px; top: 6px; width: 50px; height: 50px; filter: grayscale(0.7) brightness(0.7); transition: filter 0.2s; }
.od-btn .od-fill {
  position: absolute; left: 0; bottom: 0; top: 0;
  width: calc(var(--v) * 100%);
  background: linear-gradient(90deg, rgba(255, 43, 214, 0.15), rgba(255, 43, 214, 0.45));
  box-shadow: 0 0 20px rgba(255, 43, 214, 0.5) inset;
  transition: width 0.15s linear;
}
.od-btn b { position: relative; display: block; font-family: var(--serif); font-size: 15px; letter-spacing: 0.12em; text-shadow: var(--glow-m); }
.od-btn small { position: relative; display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--magenta); }
.od-btn.ready { border-color: var(--gold); animation: odReady 0.8s ease-in-out infinite; }
.od-btn.ready img { filter: drop-shadow(0 0 10px var(--magenta)); }
.od-btn.ready .od-fill { background: linear-gradient(90deg, rgba(255, 43, 214, 0.5), rgba(255, 210, 63, 0.55)); }
.od-btn.ready small { color: var(--gold); }
.od-btn.active { border-color: var(--magenta); box-shadow: 0 0 30px var(--magenta); }
.od-btn.active img { filter: drop-shadow(0 0 14px var(--gold)) brightness(1.3); animation: spinSlow 1.2s linear infinite; }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes odReady { 50% { box-shadow: 0 0 28px var(--magenta), 0 0 50px rgba(255, 210, 63, 0.5); transform: translateY(-2px); } }

.stat.gold.pulse b { animation: goldPulse 0.35s ease; }
@keyframes goldPulse { 0% { transform: scale(1.25); color: var(--gold); } 100% { transform: none; } }
.stat.kills.pulse b { animation: goldPulse 0.25s ease; }
.sheet-close { display: none; }

/* =========================================================
   弹层
   ========================================================= */
#overlay-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(5, 3, 13, 0.62);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: min(580px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 30px 32px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(160deg, rgba(255, 43, 214, 0.1), transparent 40%),
    linear-gradient(340deg, rgba(0, 240, 255, 0.1), transparent 40%),
    rgba(10, 6, 26, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 43, 214, 0.3), 0 0 60px rgba(0, 240, 255, 0.2), 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.32s cubic-bezier(0.16, 1.3, 0.3, 1);
}
.modal::before {
  content: "";
  position: absolute; top: -1px; left: 30px;
  width: 80px; height: 3px;
  background: var(--magenta);
  box-shadow: var(--glow-m);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal h2 { margin: 4px 0 6px; font-family: var(--serif); font-size: 34px; font-weight: 900; letter-spacing: 0.14em; color: #fff; text-shadow: var(--glow-c); }
.modal-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.4em; color: var(--magenta); text-shadow: var(--glow-m); }
.modal-sub { margin: 4px 0 18px; font-size: 13px; line-height: 1.8; color: var(--soft); }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.modal-actions .btn { flex: 1; min-width: 120px; }
.modal-close {
  position: absolute; right: 14px; top: 13px;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  font-size: 13px;
}
.modal-close:hover { box-shadow: var(--glow-c); }
.pause-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.pause-list .btn { justify-content: flex-start; text-align: left; }
.pause-meta { display: flex; gap: 18px; margin-top: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--soft); }

.result-stars { display: flex; justify-content: center; gap: 14px; margin: 8px 0 20px; }
.result-stars .star { width: 52px; height: 52px; }
.result-stars .star.on { animation: starPop 0.6s cubic-bezier(0.34, 1.8, 0.64, 1) both; }
.result-stars .star:nth-child(2) { animation-delay: 0.15s; }
.result-stars .star:nth-child(3) { animation-delay: 0.3s; }
@keyframes starPop { from { transform: scale(0.2) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-grid div { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 12px; border: 1px solid var(--line); background: rgba(0, 240, 255, 0.04); font-size: 11px; color: var(--soft); }
.result-grid b { font-family: var(--num); font-size: 20px; font-weight: 700; color: #fff; text-shadow: var(--glow-c); }
.result-grid .hl b { color: var(--gold); text-shadow: var(--glow-g); }
.result-title.win { color: #fff; text-shadow: 0 0 4px #fff, 0 0 20px var(--gold), 0 0 50px var(--gold); }
.result-title.lose { color: #fff; text-shadow: 0 0 4px #fff, 0 0 20px var(--red), 0 0 50px var(--red); }

.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.help-block { border: 1px solid var(--line); padding: 10px 12px; background: rgba(0, 240, 255, 0.04); }
.help-block h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 14px; letter-spacing: 0.14em; color: var(--magenta); text-shadow: var(--glow-m); }
.help-block p, .help-block li { margin: 0; font-size: 11px; line-height: 1.8; color: #cfc8f5; }
.help-block ul { margin: 0; padding-left: 15px; }
.help-block b { color: var(--gold); }
.help-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.help-table td { padding: 4px 0; border-bottom: 1px dashed rgba(0, 240, 255, 0.15); color: #cfc8f5; vertical-align: middle; }
.help-table td:first-child { width: 36%; color: #fff; font-family: var(--serif); font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.help-table img { width: 26px; height: 26px; vertical-align: middle; margin-right: 6px; }
.help-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.help-controls span { font-size: 11px; color: var(--soft); }

/* =========================================================
   响应式
   ========================================================= */
@media (max-height: 780px) and (min-width: 1151px) {
  .stage-frame { width: min(100%, calc((100vh - 120px) * 1.6)); }
  .sidebar { max-height: calc(100vh - 80px); }
  .hero-sub { margin-bottom: 22px; }
  .hero-stats { margin-top: 26px; }
  .roster { margin-top: 20px; }
}
@media (max-width: 1150px) {
  .menu-wrap { grid-template-columns: 1fr; padding-bottom: 110px; }
  .hero-art { display: none; }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .level-card, .level-card:nth-child(1), .level-card:nth-child(2) { grid-column: span 1; }
  .game-body { flex-direction: column; align-items: center; overflow-y: auto; padding-bottom: 7px; }
  .stage { flex: none; width: 100%; }
  .stage-frame { width: min(100%, calc((100vh - 260px) * 1.6)); align-self: center; }
  .sidebar { width: 100%; max-height: none; display: grid; grid-template-columns: 1.25fr 1fr 1fr; align-items: start; overflow: visible; }
  .shop-list { display: grid; grid-template-columns: 1fr 1fr; }
  .game-screen { overflow-y: auto; }
}
@media (max-width: 780px) {
  .game-screen { padding: 6px 6px 0; gap: 6px; overflow: hidden; }
  .hud { height: auto; min-height: 50px; flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .hud-left { order: 1; flex: 1 1 42%; gap: 7px; }
  .hud-stats { order: 3; width: 100%; justify-content: space-between; gap: 4px; }
  .hud-right { order: 2; }
  .level-seal { width: 30px; height: 30px; font-size: 16px; }
  .hud-level { font-size: 15px; letter-spacing: 0.1em; }
  .hud-sub { display: none; }
  .stat { flex: 1; min-width: 0; height: 32px; padding: 0 6px; justify-content: center; gap: 4px; }
  .stat b { font-size: 16px; }
  .stat .ico { width: 15px; height: 15px; }
  .stat-label { display: none; }
  .icon-btn, .pill { width: 34px; min-width: 34px; height: 34px; }
  .game-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow: hidden; padding-bottom: 0; }
  .stage { flex: none; width: 100%; justify-content: flex-start; align-items: center; gap: 0; }
  .stage-frame { width: 100%; max-width: 100%; }
  .stage-footer { display: none; }
  .sidebar { display: contents; }
  .shop-panel { display: none; }
  .wave-panel {
    display: flex;
    width: calc(100% - 12px);
    margin: 8px 6px 170px;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    padding: 8px 4px 0;
    backdrop-filter: none;
  }
  .wave-panel::before, .wave-panel::after { display: none; }
  .wave-panel .panel-head { margin-bottom: 4px; }
  .wave-panel .wave-tip { font-size: 9px; }
  .wave-panel .wave-preview { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; }
  .selection-panel {
    position: fixed;
    left: 8px; right: 8px;
    bottom: calc(180px + env(safe-area-inset-bottom));
    z-index: 40;
    display: none;
    max-height: 46vh;
    overflow-y: auto;
    background: rgba(10, 6, 26, 0.97);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.25);
    padding: 12px 13px;
  }
  .selection-panel.open { display: block; }
  .sheet-close {
    display: block;
    position: absolute; right: 8px; top: 8px;
    background: none; border: 1px solid var(--line);
    color: var(--cyan); font-size: 10px;
    padding: 2px 8px; cursor: pointer;
  }
  .mobile-dock {
    display: block;
    flex: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 35;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(8, 5, 20, 0.96);
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -10px 30px rgba(0, 240, 255, 0.15);
  }
  .dock-wave {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--cyan);
    padding: 0 2px 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .dock-row { display: flex; gap: 6px; align-items: stretch; }
  .dock-towers { display: flex; gap: 6px; overflow-x: auto; flex: 1; padding-bottom: 1px; justify-content: space-between; }
  .skill-bar {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(96px + env(safe-area-inset-bottom));
    transform: none;
    justify-content: center;
    gap: 8px;
    z-index: 34;
  }
  .skill { width: 52px; height: 52px; }
  .skill-name { display: none; }
  .skill-cd { font-size: 15px; }
  .od-btn { width: 52px; height: 52px; padding: 0; margin-left: 2px; }
  .od-btn img { left: 2px; top: 2px; width: 46px; height: 46px; }
  .od-btn b, .od-btn small { display: none; }
  .dock-tower {
    flex: 1;
    min-width: 54px;
    padding: 3px 2px 3px;
    border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
    background: color-mix(in srgb, var(--c) 8%, transparent);
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    cursor: pointer;
    color: #fff;
  }
  .dock-tower img { width: 36px; height: 36px; filter: drop-shadow(0 0 5px var(--c)); }
  .dock-tower.active { border-color: var(--c); box-shadow: 0 0 14px var(--c); }
  .dock-tower.unaffordable { opacity: 0.42; }
  .dock-cost { font-family: var(--num); font-size: 12px; font-weight: 700; color: var(--gold); }
  .toast-stack { top: 8px; right: 8px; }
  .boss-hud { top: 8px; width: 66%; }
  .combo b { font-size: 34px; }
  .combo span { font-size: 12px; }
  .combo .cb-bar { width: 90px; }
  .wave-banner { font-size: 26px; letter-spacing: 0.18em; }
  .wave-banner::before, .wave-banner::after { width: 40px; }
  .build-hint { bottom: 8px; font-size: 10px; }
  .cutin .ci-icon { left: 4%; width: 28%; }
  .cutin .ci-text { left: 34%; }
  .boss-warn .bw-stripe { height: 22px; }
  .boss-warn .bw-stripe.bot { top: calc(28% + 96px); }
  .boss-warn .bw-text { top: calc(28% + 60px); }
  .boss-warn .bw-text small { font-size: 12px; }
  .levels-wrap { padding: 22px 16px 60px; }
  .levels-head { flex-wrap: wrap; gap: 10px; }
  .levels-title h2 { font-size: 34px; }
  .levels-summary { width: 100%; }
  .level-grid { grid-template-columns: 1fr; gap: 14px; }
  .lc-map { height: 120px; }
  .menu-wrap { padding: 10vh 22px 110px; }
  .hero-title { font-size: clamp(60px, 18vw, 96px); }
  .hero-en { font-size: 10px; letter-spacing: 0.24em; }
  .hero-sub { font-size: 13px; line-height: 1.95; margin-bottom: 26px; }
  .hero-actions .btn { flex: 1; padding: 13px 10px; }
  .hero-stats { margin-top: 26px; }
  .hero-stats div { padding: 0 13px; }
  .hero-stats b { font-size: 25px; }
  .roster-item { width: 54px; }
  .roster-item img { width: 46px; height: 46px; }
  .menu-footer { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .foot-note { display: none; }
  .modal { padding: 24px 18px; }
  .modal h2 { font-size: 26px; }
  .help-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .stat { padding: 0 4px; }
  .stat b { font-size: 14px; }
  .hud-right { gap: 3px; }
  .icon-btn, .pill { width: 30px; min-width: 30px; height: 30px; }
  .hero-stats div { padding: 0 10px; }
  .hero-title { font-size: 58px; }
  .skill { width: 46px; height: 46px; }
  .od-btn { width: 46px; height: 46px; }
  .od-btn img { width: 42px; height: 42px; }
}
