/* ==========================================================
   沪上枭姬 · Shanghai Auto Chess
   视觉风格：1930s 上海滩 · Art Deco · 黑金红 + 霓虹夜景
   ========================================================== */

/* ------ 全局变量 ------ */
:root {
  /* 阵营色 */
  --faction-qingbang:    #1f3d7a; /* 青帮 · 深蓝 */
  --faction-hongmen:     #a8202c; /* 洪门 · 朱红 */
  --faction-futou:       #4a4a4a; /* 斧头帮 · 烟灰 */
  --faction-xunpu:       #c8a553; /* 巡捕房 · 流金 */
  --faction-caobang:     #5a3a6c; /* 漕帮 · 暗紫 */

  /* 主题色 */
  --bg-deep:    #0e0a07;        /* 深咖啡 */
  --bg-paper:   #1a140e;        /* 暗纸 */
  --ink:        #f1e6cf;        /* 宣纸白 */
  --ink-dim:    #b8a98a;
  --gold:       #d4af37;        /* 老金 */
  --gold-light: #f1c862;
  --gold-deep:  #8b6f1d;
  --blood:      #7a1e22;
  --jade:       #4a8a6a;
  --neon-pink:  #ff2d6f;
  --neon-cyan:  #00e5ff;
  --neon-amber: #ffb347;

  /* 棋盘 */
  --cell-size: 11.2vmin;
  --cell-gap:  2px;
  --board-bg:  #0a0806;

  /* 字体 */
  --font-zh: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "STHeiti", sans-serif;
  --font-deco: "Cormorant Garamond", "Noto Serif SC", "STKaiti", serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-zh);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;  /* 允许按钮 tap，但不延迟 */
}
.chess, .shop-slot, .bench-slot, .cell, .btn {
  touch-action: none;  /* 棋盘/棋子/商店/板凳禁用触摸默认行为，让拖拽更可靠 */
  -webkit-touch-callout: none;
}

/* ============================================================
   上海滩夜景背景：建筑剪影 + 霓虹灯
   ============================================================ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    /* 顶部月光 */
    radial-gradient(ellipse at 50% -10%, rgba(255, 220, 180, 0.18), transparent 55%),
    /* 底部金红余晖 */
    radial-gradient(ellipse at 50% 110%, rgba(168, 32, 44, 0.22), transparent 55%),
    /* 江面光 */
    linear-gradient(180deg,
      #0a0612 0%,
      #0e0a1a 20%,
      #1a0e1e 40%,
      #2a0c1a 60%,
      #1a0612 80%,
      #0a0408 100%
    );
  pointer-events: none;
  z-index: 0;
}

/* 建筑剪影层（用 linear-gradient 模拟天际线） */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    /* 远处摩天楼 */
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.8) 95%),
    /* 建筑剪影 (硬边 linear-gradient) */
    linear-gradient(90deg,
      transparent 0%, transparent 4%,
      rgba(0,0,0,0.85) 4%, rgba(0,0,0,0.85) 8%,
      transparent 8%, transparent 12%,
      rgba(0,0,0,0.9) 12%, rgba(0,0,0,0.9) 14%,
      transparent 14%, transparent 18%,
      rgba(0,0,0,0.8) 18%, rgba(0,0,0,0.8) 22%,
      transparent 22%, transparent 26%,
      rgba(0,0,0,0.9) 26%, rgba(0,0,0,0.9) 28%,
      transparent 28%, transparent 33%,
      rgba(0,0,0,0.85) 33%, rgba(0,0,0,0.85) 38%,
      transparent 38%, transparent 42%,
      rgba(0,0,0,0.9) 42%, rgba(0,0,0,0.9) 45%,
      transparent 45%, transparent 50%,
      rgba(0,0,0,0.85) 50%, rgba(0,0,0,0.85) 54%,
      transparent 54%, transparent 58%,
      rgba(0,0,0,0.9) 58%, rgba(0,0,0,0.9) 61%,
      transparent 61%, transparent 65%,
      rgba(0,0,0,0.85) 65%, rgba(0,0,0,0.85) 69%,
      transparent 69%, transparent 74%,
      rgba(0,0,0,0.9) 74%, rgba(0,0,0,0.9) 77%,
      transparent 77%, transparent 82%,
      rgba(0,0,0,0.85) 82%, rgba(0,0,0,0.85) 86%,
      transparent 86%, transparent 90%,
      rgba(0,0,0,0.9) 90%, rgba(0,0,0,0.9) 94%,
      transparent 94%, transparent 100%
    );
  background-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

/* 顶层装饰：霓虹叠层 */
.neon-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    /* 粉霓虹 */
    radial-gradient(ellipse at 15% 30%, rgba(255, 45, 111, 0.15) 0%, transparent 30%),
    /* 蓝霓虹 */
    radial-gradient(ellipse at 85% 20%, rgba(0, 229, 255, 0.1) 0%, transparent 25%),
    /* 金霓虹 */
    radial-gradient(ellipse at 50% 60%, rgba(212, 175, 55, 0.08) 0%, transparent 35%);
  mix-blend-mode: screen;
}
.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: repeating-linear-gradient(45deg, transparent 0 1px, rgba(255,255,255,0.015) 1px 2px);
}

/* ============================================================
   顶部 HUD
   ============================================================ */
.hud-top {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(180deg, rgba(26, 20, 14, 0.95) 0%, rgba(14, 10, 7, 0.95) 100%);
  border-bottom: 2px solid var(--gold-deep);
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
.hud-top::after {
  content: "";
  position: absolute;
  bottom: -3px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hud-brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-zh {
  font-family: var(--font-deco);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}
.brand-en {
  font-size: 9px;
  color: var(--ink-dim);
  letter-spacing: 2px;
  margin-top: 1px;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  padding: 2px 6px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--gold-deep);
  border-radius: 2px;
  position: relative;
}
.stat-label {
  font-size: 8px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}
.stat-value {
  font-family: var(--font-deco);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.1;
}
.stat.gold .stat-value { color: var(--gold-light); text-shadow: 0 0 4px var(--gold); }
.stat.phase-tag .stat-value { font-size: 14px; }
.stat.streak.win .stat-value { color: var(--gold-light); }
.stat.streak.lose .stat-value { color: var(--blood); text-shadow: 0 0 4px var(--blood); }
.stat.streak.win { border-color: var(--gold); box-shadow: 0 0 6px rgba(212,175,55,0.4); }
.stat.streak.lose { border-color: var(--blood); box-shadow: 0 0 6px rgba(122,30,34,0.4); }

.stat.xp {
  min-width: 80px;
  padding: 2px 4px;
}
.stat.xp .hud-xp-bar {
  width: 100%;
  height: 3px;
  background: rgba(0,0,0,0.6);
  margin-top: 1px;
  border-radius: 1px;
  overflow: hidden;
}
.stat.xp .hud-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), #5af0ff);
  width: 0%;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 4px var(--neon-cyan);
}

/* 生命值 HUD */
.stat.life {
  min-width: 80px;
  padding: 2px 4px;
  border-color: var(--blood);
}
.stat.life .stat-value { color: #ff6b8a; text-shadow: 0 0 4px var(--blood); font-size: 16px; }
.stat.life .hud-life-bar {
  width: 100%;
  height: 3px;
  background: rgba(0,0,0,0.6);
  margin-top: 1px;
  border-radius: 1px;
  overflow: hidden;
}
.stat.life .hud-life-fill {
  height: 100%;
  width: 100%;
  transition: width 0.3s ease-out, background 0.3s;
  background: linear-gradient(90deg, #6dd49a, var(--jade));
  box-shadow: 0 0 4px var(--jade);
}
.stat.life .hud-life-fill.mid { background: linear-gradient(90deg, var(--neon-amber), #ffd47a); box-shadow: 0 0 4px var(--neon-amber); }
.stat.life .hud-life-fill.low { background: linear-gradient(90deg, var(--blood), #ff6b8a); box-shadow: 0 0 4px var(--blood); animation: lifeCritical 1s ease-in-out infinite; }
@keyframes lifeCritical {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.stat-sub {
  display: inline-block;
  vertical-align: baseline;
}

/* ============================================================
   中部棋盘
   ============================================================ */
.board-wrap {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  overflow: hidden;
}

.round-banner {
  font-family: var(--font-deco);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--gold);
  padding: 4px 16px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--gold-deep);
  border-radius: 2px;
  margin-bottom: 8px;
  text-shadow: 0 0 8px rgba(212,175,55,0.4);
}
.round-banner.boss {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
  text-shadow: 0 0 12px var(--neon-pink);
  animation: bossGlow 1.5s ease-in-out infinite;
}
@keyframes bossGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,45,111,0.3); }
  50% { box-shadow: 0 0 24px rgba(255,45,111,0.6); }
}

.board {
  display: grid;
  grid-template-columns: repeat(6, var(--cell-size));
  grid-template-rows: repeat(8, var(--cell-size));
  gap: var(--cell-gap);
  padding: 4px;
  background: linear-gradient(135deg, #2a1d10 0%, #1a1208 50%, #2a1d10 100%);
  border: 3px double var(--gold);
  box-shadow:
    inset 0 0 24px rgba(0,0,0,0.7),
    0 0 24px rgba(212,175,55,0.15),
    0 0 60px rgba(0,0,0,0.6);
  position: relative;
}
.board::before {
  content: ""; position: absolute;
  left: 4px; right: 4px;
  top: calc(50% - 1px);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blood) 20%, var(--blood) 80%, transparent);
  z-index: 0;
  pointer-events: none;
}

.cell {
  position: relative;
  background: var(--board-bg);
  border: 1px solid #2a2017;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  overflow: visible;
}
.cell.player { background: rgba(212, 175, 55, 0.05); border-color: rgba(212, 175, 55, 0.3); }
.cell.enemy  { background: rgba(168, 32, 44, 0.05);  border-color: rgba(168, 32, 44, 0.3); }
.cell.drop-target {
  background: rgba(74, 138, 106, 0.4);
  border-color: var(--jade);
  box-shadow: inset 0 0 12px rgba(74, 138, 106, 0.6);
}
.cell.invalid-drop {
  background: rgba(122, 30, 34, 0.4);
  border-color: var(--blood);
  cursor: not-allowed;
}
.cell.coord {
  position: absolute;
  font-size: 8px; color: var(--ink-dim);
  font-family: var(--font-deco);
  top: 1px; left: 2px;
  opacity: 0.5;
}

/* ============================================================
   棋子（含头像支持）
   ============================================================ */
.chess {
  position: relative;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: grab;
  border-radius: 1px;
  overflow: hidden;
  text-align: center;
  padding: 2px;
}
.chess:active { cursor: grabbing; }
.chess.dragging { opacity: 0.4; }

.chess .chess-bg {
  position: absolute; inset: 2px;
  background-color: var(--c-faction);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-blend-mode: multiply;
  border-radius: 1px;
  z-index: 0;
  box-shadow: inset 0 -8px 12px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.15);
}
.chess .chess-bg::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.85) 100%);
  z-index: 1;
}
.chess .chess-bg::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(0,0,0,0.06) 4px 5px);
  z-index: 2;
}
.chess .chess-type {
  position: absolute; z-index: 4;
  top: 14px; left: 0; right: 0;
  font-family: var(--font-deco);
  font-size: 9px; font-weight: 700;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(0,0,0,0.8);
  letter-spacing: 1px;
}
.chess .chess-name {
  position: absolute; z-index: 4;
  bottom: 4px; left: 1px; right: 1px;
  font-size: 8px; line-height: 1.1;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 1px #000, 0 0 4px rgba(0,0,0,0.8);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chess .chess-cost {
  position: absolute; z-index: 5;
  top: 1px; right: 1px;
  background: var(--gold);
  color: #000;
  font-family: var(--font-deco);
  font-size: 9px; font-weight: 700;
  width: 12px; height: 12px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gold-deep);
  box-shadow: 0 1px 2px #000;
}
.chess .chess-stars {
  position: absolute; z-index: 5;
  top: 1px; left: 1px;
  font-size: 8px;
  color: var(--gold-light);
  text-shadow: 0 0 4px var(--gold), 0 0 2px #000;
  font-weight: 700;
  letter-spacing: -1px;
}
.chess .chess-stars.s2 { color: var(--gold-light); animation: starTwinkle 2s ease-in-out infinite; }
.chess .chess-stars.s3 {
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink), 0 0 12px var(--neon-amber), 0 0 2px #000;
  animation: starRainbow 2.5s linear infinite;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}
@keyframes starRainbow {
  0%   { color: var(--neon-pink); text-shadow: 0 0 6px var(--neon-pink), 0 0 12px var(--neon-amber); }
  33%  { color: var(--neon-amber); text-shadow: 0 0 6px var(--neon-amber), 0 0 12px var(--neon-cyan); }
  66%  { color: var(--neon-cyan); text-shadow: 0 0 6px var(--neon-cyan), 0 0 12px var(--neon-pink); }
  100% { color: var(--neon-pink); text-shadow: 0 0 6px var(--neon-pink), 0 0 12px var(--neon-amber); }
}
.chess.selected { outline: 2px solid var(--jade); outline-offset: -2px; }
.chess.invalid { outline: 2px solid var(--blood); outline-offset: -2px; }
.chess.dead { filter: grayscale(1) brightness(0.3); opacity: 0.4; }
.chess.hit-flash { animation: hitFlash 0.25s ease-out; }
@keyframes hitFlash {
  0% { filter: brightness(2) saturate(0); }
  50% { filter: brightness(1.4) saturate(1.5) hue-rotate(-20deg); }
  100% { filter: none; }
}
.chess.attacking { animation: attackLunge 0.2s ease-out; }
@keyframes attackLunge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); filter: brightness(1.3); }
  100% { transform: scale(1); }
}
.chess.skill-flash { animation: skillFlash 0.6s ease-out; }
@keyframes skillFlash {
  0%, 100% { filter: none; }
  20% { filter: brightness(1.8) drop-shadow(0 0 6px var(--neon-amber)); }
}

/* 升星动画：闪光 → 变大 → 边框变金 */
.chess.star-upgrading { animation: starUpgrade 0.9s ease-out forwards; }
@keyframes starUpgrade {
  0%   { transform: scale(1);    filter: brightness(1) drop-shadow(0 0 0 transparent); }
  20%  { transform: scale(1.25); filter: brightness(2) drop-shadow(0 0 12px var(--gold-light)); }
  50%  { transform: scale(1.35); filter: brightness(1.5) drop-shadow(0 0 18px var(--gold)); outline: 2px solid var(--gold-light); }
  100% { transform: scale(1);    filter: brightness(1) drop-shadow(0 0 0 transparent); outline: 2px solid var(--gold); }
}
.chess.star-upgrading .chess-bg {
  box-shadow: 0 0 18px var(--gold-light), inset 0 0 12px rgba(255, 215, 0, 0.4);
}

/* 死亡动画：缩小 + 变灰 */
.chess.dying {
  animation: unitDying 0.4s ease-out forwards;
}
@keyframes unitDying {
  0%   { transform: scale(1) rotate(0); filter: none; opacity: 1; }
  50%  { transform: scale(0.8) rotate(15deg); filter: grayscale(0.5) brightness(0.7); }
  100% { transform: scale(0.3) rotate(45deg); filter: grayscale(1) brightness(0.3); opacity: 0.5; }
}
.chess.dead { filter: grayscale(1) brightness(0.3); opacity: 0.4; }

/* 胜利舞蹈：弹跳 + 缩放循环 */
.chess.victory-dance {
  animation: victoryDance 0.6s ease-in-out infinite alternate;
}
@keyframes victoryDance {
  0%   { transform: translateY(0) scale(1); filter: brightness(1); }
  100% { transform: translateY(-8px) scale(1.1); filter: brightness(1.5) drop-shadow(0 0 8px var(--gold-light)); }
}

/* 弹道（小亮点从 attacker 飞向 target） */
.projectile {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--neon-amber);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--neon-amber), 0 0 12px var(--neon-amber);
  z-index: 50;
  pointer-events: none;
  transition: left 0.25s ease-out, top 0.25s ease-out, transform 0.25s linear;
}
.projectile.skill {
  width: 14px; height: 14px;
  background: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink), 0 0 20px var(--neon-amber);
  border: 2px solid #fff;
}
/* 弹道尾部拖痕 */
.projectile::after {
  content: '';
  position: absolute;
  top: 50%; left: 100%;
  width: 12px; height: 2px;
  background: linear-gradient(90deg, currentColor, transparent);
  transform: translateY(-50%);
  opacity: 0.6;
}

/* 战斗模式下的 HP 条 */
.chess .hp-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(0,0,0,0.7);
  z-index: 5;
  overflow: hidden;
}
.chess .hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--jade), #6dd49a);
  transition: width 0.2s ease-out, background 0.2s;
  width: 100%;
}
.chess .hp-bar-fill.low { background: linear-gradient(90deg, var(--blood), #d45c5c); }
.chess .hp-bar-fill.mid { background: linear-gradient(90deg, var(--neon-amber), #ffd47a); }

/* MP 条 */
.chess .mp-bar {
  position: absolute;
  bottom: 3px; left: 0; right: 0;
  height: 2px;
  background: rgba(0,0,0,0.6);
  z-index: 5;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}
.chess.in-battle .mp-bar { opacity: 1; }
.chess .mp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5a8fcf, #a3d9ff);
  width: 0%;
  transition: width 0.15s;
}

/* 装备图标（小角标） */
.chess .equip-icons {
  position: absolute; z-index: 5;
  bottom: 6px; right: 2px;
  display: flex; flex-direction: column; gap: 1px;
}
.chess .equip-icons .equip-icon {
  width: 8px; height: 8px;
  background: var(--gold);
  border: 1px solid var(--gold-deep);
  border-radius: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 6px;
  color: #000;
  font-weight: 700;
}
.chess .equip-icons .equip-icon.q-blue { background: #5a9bff; border-color: #2c5fa0; color: #fff; }
.chess .equip-icons .equip-icon.q-purple { background: #b56cff; border-color: #6e3a9e; color: #fff; }
.chess .equip-icons .equip-icon.q-white { background: #C9C0B0; border-color: #6a5a40; color: #1a1208; }
.chess .equip-icons .equip-icon.q-orange { background: #C66B3D; border-color: #8b4513; color: #f1e6cf; }
.chess .equip-icons .equip-icon.q-gold { background: #D9B570; border-color: #8b6f1d; color: #1a1208; }
.chess .equip-icons .equip-icon {
  font-size: 7px;
  font-weight: 700;
  font-family: var(--font-zh);
  width: 10px; height: 10px;
}

/* 卖英雄 X 按钮（棋盘/板凳） */
.chess .board-sell-btn,
.bench-slot .bench-sell-btn {
  position: absolute;
  z-index: 10;
  top: -2px; right: -2px;
  width: 14px; height: 14px;
  background: var(--blood);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  border: 1px solid #000;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.chess:hover .board-sell-btn { display: flex; }
.bench-slot:hover .bench-sell-btn { display: flex; }
.bench-slot .bench-sell-btn {
  top: 0; right: 0;
  width: 12px; height: 12px;
  font-size: 9px;
}

/* 伤害飘字 */
.dmg-num {
  position: absolute;
  z-index: 100;
  font-family: var(--font-deco);
  font-size: 14px;
  font-weight: 700;
  color: var(--blood);
  text-shadow: 0 1px 0 #000, 0 0 4px rgba(0,0,0,0.8);
  pointer-events: none;
  animation: dmgFloat 1.0s ease-out forwards;
  transform: translateX(-50%);
}
.dmg-num.crit {
  font-size: 18px;
  color: var(--neon-amber);
  text-shadow: 0 0 6px var(--neon-amber), 0 1px 0 #000;
}
.dmg-num.skill {
  font-size: 16px;
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink), 0 1px 0 #000;
}
@keyframes dmgFloat {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); }
  20% { opacity: 1; transform: translateX(-50%) translateY(-8px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.7); }
}

/* 治疗飘字（绿） */
.heal-num {
  position: absolute; z-index: 100;
  left: 50%; top: 30%;
  font-family: var(--font-deco);
  font-size: 14px; font-weight: 700;
  color: var(--jade);
  text-shadow: 0 1px 0 #000, 0 0 4px var(--jade);
  pointer-events: none;
  animation: dmgFloat 1.0s ease-out forwards;
  transform: translateX(-50%);
}

/* ============================================================
   底部 招贤馆 / 待部署
   ============================================================ */
.hud-bottom {
  position: relative; z-index: 10;
  background: linear-gradient(0deg, rgba(26, 20, 14, 0.95) 0%, rgba(14, 10, 7, 0.95) 100%);
  border-top: 2px solid var(--gold-deep);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.6);
  padding: 8px 10px 10px;
}
.hud-bottom::before {
  content: "";
  position: absolute;
  top: -3px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.shop-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
  padding: 0 4px;
}
.shop-title { display: flex; flex-direction: column; line-height: 1.1; }
.shop-zh { font-size: 14px; color: var(--gold); font-weight: 700; letter-spacing: 2px; }
.shop-en { font-size: 8px; color: var(--ink-dim); letter-spacing: 2px; }

.shop-actions { display: flex; gap: 4px; align-items: center; }

.btn {
  border: 1px solid var(--gold-deep);
  background: rgba(0,0,0,0.4);
  color: var(--ink);
  font-family: var(--font-zh);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:hover:not(:disabled) { background: rgba(212, 175, 55, 0.15); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #1a1208;
  font-weight: 700;
  border-color: var(--gold);
  letter-spacing: 2px;
  padding: 8px 20px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%); }
.btn-refresh .cost,
.btn-buy-xp .cost { color: var(--gold-light); font-weight: 700; margin-left: 2px; }
.btn-buy-xp {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
}
.btn-buy-xp:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.15);
  color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.shop-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.shop-slot {
  position: relative;
  aspect-ratio: 5 / 6;
  background: rgba(0,0,0,0.4);
  border: 1px dashed var(--gold-deep);
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  padding: 2px;
}
.shop-slot:hover { background: rgba(212, 175, 55, 0.1); border-style: solid; }
.shop-slot.empty { color: var(--ink-dim); font-size: 11px; }
.shop-slot .chess { cursor: pointer; }

.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.bench {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--gold-deep);
  border-radius: 2px;
  min-height: 56px;
}
.bench-label { font-size: 11px; color: var(--ink-dim); letter-spacing: 1px; flex-shrink: 0; }
.bench-slots { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.bench-slot {
  flex-shrink: 0;
  width: 44px; height: 50px;
  background: var(--board-bg);
  border: 1px solid #2a2017;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: visible;
}
.bench-slot:hover { border-color: var(--gold); }
.bench-slot .chess { padding: 1px; }
.bench-slot .chess .chess-type { font-size: 8px; top: 10px; }
.bench-slot .chess .chess-name { display: none; }
.bench-slot .chess .chess-bg { inset: 1px; }
.bench-slot .chess .chess-cost { width: 10px; height: 10px; font-size: 8px; top: 1px; right: 1px; }

/* 板凳空槽（虚线框） */
.bench-slot.empty {
  border: 1.5px dashed rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.04);
  color: var(--ink-dim);
  font-size: 18px;
  cursor: default;
}
.bench-slot.empty:hover { border-color: rgba(212, 175, 55, 0.5); }
.bench-slot.empty.filled { display: none; }   /* 不显示已占用的空槽 */
/* 板凳满：所有 empty 红色高亮 */
.bench-slots.bench-full .bench-slot.empty {
  border-color: rgba(122, 30, 34, 0.6);
  color: var(--blood);
  background: rgba(122, 30, 34, 0.08);
}
/* 板凳满时闪烁 */
.bench-slots.flash-bench-full {
  animation: benchFullFlash 0.6s ease-out;
}
@keyframes benchFullFlash {
  0%   { box-shadow: 0 0 0 0 rgba(255, 45, 111, 0); }
  20%  { box-shadow: 0 0 20px 4px rgba(255, 45, 111, 0.7); transform: translateX(-3px); }
  40%  { transform: translateX(3px); }
  60%  { transform: translateX(-2px); }
  80%  { transform: translateX(2px); }
  100% { box-shadow: 0 0 0 0 rgba(255, 45, 111, 0); transform: translateX(0); }
}

/* 商店槽位（6 个） */
.shop-slot {
  flex-shrink: 0;
  width: calc((100vw - 80px) / 6);
  max-width: 70px;
  min-width: 50px;
  height: 88px;
  background: var(--board-bg);
  border: 1px solid #2a2017;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
}
.shop-slot.empty {
  color: var(--ink-dim);
  font-size: 11px;
  border-style: dashed;
  border-color: rgba(212, 175, 55, 0.3);
}
/* 锁定按钮（商店槽位右上角） */
.slot-lock-btn {
  position: absolute;
  top: 1px; right: 1px;
  width: 16px; height: 16px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--gold-deep);
  border-radius: 50%;
  color: var(--ink-dim);
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.slot-lock-btn:hover { color: var(--gold-light); border-color: var(--gold); }
.slot-lock-btn.is-locked {
  background: var(--gold);
  color: #000;
  border-color: var(--gold-light);
  box-shadow: 0 0 6px var(--gold);
}
.chess.locked {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  filter: drop-shadow(0 0 4px var(--gold));
}

/* 棋盘棋格 - 不可用（popCap 满） */
.cell.player.pop-cap-disabled {
  background: rgba(0, 0, 0, 0.3);
  background-image:
    repeating-linear-gradient(45deg, transparent 0, transparent 4px, rgba(122, 30, 34, 0.15) 4px, rgba(122, 30, 34, 0.15) 6px);
  cursor: not-allowed;
  opacity: 0.6;
}
.cell.pop-cap-flash {
  animation: popCapFlash 0.7s ease-out;
}
@keyframes popCapFlash {
  0%, 100% { background-color: rgba(122, 30, 34, 0.3); }
  50% { background-color: rgba(255, 45, 111, 0.5); }
}

/* 调整布阵按钮 */
.btn-deploy {
  background: rgba(74, 138, 106, 0.2);
  border-color: var(--jade);
  color: var(--ink);
}
.btn-deploy:hover:not(:disabled) {
  background: rgba(74, 138, 106, 0.4);
  border-color: var(--jade);
}
.btn-deploy:disabled { opacity: 0.4; }

/* ============================================================
   详情面板
   ============================================================ */
.detail-panel {
  position: fixed;
  top: 60px; right: 8px;
  width: 180px;
  max-height: 60vh;
  background: rgba(26, 20, 14, 0.95);
  border: 1px solid var(--gold-deep);
  border-radius: 2px;
  padding: 10px;
  z-index: 20;
  overflow-y: auto;
  font-size: 11px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  display: none;
}
.detail-panel.show { display: block; }
.detail-empty { color: var(--ink-dim); text-align: center; padding: 20px 0; font-size: 11px; }
.detail-name { font-size: 14px; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.detail-meta { color: var(--ink-dim); font-size: 10px; margin-bottom: 6px; }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; margin: 6px 0; }
.detail-stats .s { display: flex; justify-content: space-between; }
.detail-stats .s-label { color: var(--ink-dim); }
.detail-stats .s-value { color: var(--gold-light); font-family: var(--font-deco); font-weight: 700; }
.detail-skill {
  background: rgba(0,0,0,0.4);
  padding: 6px;
  border-left: 2px solid var(--gold);
  margin-top: 6px;
}
.detail-skill-name { color: var(--gold); font-size: 11px; font-weight: 700; }
.detail-skill-desc { color: var(--ink-dim); font-size: 10px; margin-top: 3px; line-height: 1.4; }
.detail-desc { color: var(--ink-dim); font-size: 10px; line-height: 1.5; margin-bottom: 4px; font-style: italic; }
.detail-equip {
  margin-top: 6px; padding: 4px 6px;
  background: rgba(212,175,55,0.05);
  border-left: 2px solid var(--gold);
  font-size: 10px;
}
.detail-equip .eq-row { display: flex; justify-content: space-between; margin: 1px 0; gap: 4px; }
.detail-equip .eq-name { color: var(--ink); }
.detail-equip .eq-name.q-white { color: #C9C0B0; }
.detail-equip .eq-name.q-blue { color: #5a9bff; }
.detail-equip .eq-name.q-purple { color: #b56cff; }
.detail-equip .eq-name.q-orange { color: #C66B3D; }
.detail-equip .eq-name.q-gold { color: #D9B570; }
.detail-equip .eq-stats { color: var(--ink-dim); font-size: 9px; }
.detail-syn {
  margin-top: 6px; padding: 4px 6px;
  background: rgba(74,138,106,0.06);
  border-left: 2px solid var(--jade);
  font-size: 10px;
}
.detail-syn .syn-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; margin: 2px 0; }
.detail-syn .syn-tag {
  display: inline-block; padding: 1px 4px; border-radius: 2px;
  background: var(--syn-color, var(--ink-dim)); color: #000;
  font-size: 9px; font-weight: 700;
}
.detail-syn .syn-tag.syn-fac { color: #fff; }
.detail-syn .syn-tag.syn-type { color: #fff; }
.detail-syn .syn-cnt {
  color: var(--gold-light); font-family: var(--font-deco); font-weight: 700; font-size: 12px;
}
.detail-syn .syn-next { color: var(--ink-dim); font-size: 9px; flex-basis: 100%; margin-top: 1px; }
.detail-stars-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 4px var(--gold);
  letter-spacing: -1px;
  vertical-align: middle;
}
.detail-stars-badge.s3 {
  color: var(--neon-pink);
  text-shadow: 0 0 4px var(--neon-pink), 0 0 8px var(--neon-amber);
  animation: starRainbow 2.5s linear infinite;
}
.detail-section-title {
  color: var(--gold);
  font-size: 11px;
  margin-bottom: 3px;
  font-weight: 700;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--gold-deep);
  padding-bottom: 2px;
  margin-top: 8px;
}
.detail-cost {
  display: inline-block;
  background: var(--gold);
  color: #000;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-deco);
  text-align: center;
  line-height: 18px;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 1px 2px #000;
}
.btn-sell-detail {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 4px 0;
  font-size: 10px;
  background: rgba(122, 30, 34, 0.85);
  color: #fff;
  border: 1px solid var(--blood);
  cursor: pointer;
  letter-spacing: 1px;
  font-family: var(--font-zh);
}
.btn-sell-detail:hover { background: var(--blood); }
.btn-sell-detail:active { transform: scale(0.97); }

/* ============================================================
   战斗日志
   ============================================================ */
.battle-log {
  position: absolute;
  top: 50%; left: 8px;
  transform: translateY(-50%);
  width: 180px;
  max-height: 70%;
  background: rgba(0,0,0,0.75);
  border-left: 2px solid var(--gold);
  padding: 8px 10px;
  font-size: 10px;
  color: var(--ink-dim);
  overflow-y: auto;
  z-index: 5;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
.battle-log .log-line { margin: 2px 0; line-height: 1.3; }
.battle-log .log-dmg { color: var(--blood); }
.battle-log .log-crit { color: var(--neon-amber); font-weight: 700; }
.battle-log .log-skill { color: var(--neon-pink); font-weight: 700; }
.battle-log .log-heal { color: var(--jade); }
.battle-log .log-kill { color: var(--gold-light); font-weight: 700; }
.battle-log .log-header { color: var(--gold); font-weight: 700; letter-spacing: 2px; border-bottom: 1px solid var(--gold-deep); padding-bottom: 3px; margin-bottom: 4px; }

/* ============================================================
   战斗速度控制
   ============================================================ */
.battle-controls {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
  z-index: 5;
}
.battle-controls .btn-speed {
  background: rgba(0,0,0,0.75);
  border: 1px solid var(--gold-deep);
  color: var(--ink-dim);
  font-family: var(--font-deco);
  font-size: 12px; font-weight: 700;
  padding: 6px 10px;
  border-radius: 2px;
  cursor: pointer;
  min-width: 44px;
  text-align: center;
}
.battle-controls .btn-speed.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212,175,55,0.15);
  box-shadow: 0 0 8px rgba(212,175,55,0.4);
}

/* ============================================================
   羁绊面板
   ============================================================ */
.synergy-panel {
  position: absolute;
  top: 50%; left: 8px;
  transform: translateY(-50%);
  width: 180px;
  max-height: 70%;
  background: rgba(0,0,0,0.75);
  border-left: 2px solid var(--gold);
  padding: 8px 10px;
  font-size: 10px;
  color: var(--ink-dim);
  z-index: 5;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  overflow-y: auto;
}
.synergy-title {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 11px;
  border-bottom: 1px solid var(--gold-deep);
  padding-bottom: 3px;
  margin-bottom: 6px;
}
.synergy-list { display: flex; flex-direction: column; gap: 4px; }
.synergy-item {
  background: rgba(0,0,0,0.4);
  border-left: 3px solid var(--c-faction, var(--gold));
  padding: 4px 6px;
  font-size: 10px;
  line-height: 1.3;
}
.synergy-item.inactive { opacity: 0.4; border-left-color: var(--ink-dim); }
.synergy-item .sy-name { color: var(--gold-light); font-weight: 700; font-size: 11px; }
.synergy-item .sy-count { color: var(--ink-dim); font-size: 9px; }
.synergy-item .sy-desc { color: var(--ink); font-size: 9px; margin-top: 2px; line-height: 1.3; }
.synergy-item.inactive .sy-name { color: var(--ink-dim); }

/* ============================================================
   弹窗
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: modalFadeIn 0.3s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal[hidden] { display: none; }
.modal-card {
  background: linear-gradient(180deg, #1a140e 0%, #0e0a07 100%);
  border: 3px double var(--gold);
  padding: 30px 40px;
  min-width: 280px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.4);
  position: relative;
}
.modal-card::before, .modal-card::after {
  content: "❖"; position: absolute;
  color: var(--gold);
  font-size: 16px;
}
.modal-card::before { top: 6px; left: 8px; }
.modal-card::after  { bottom: 6px; right: 8px; }
.modal-card h2 {
  font-family: var(--font-deco);
  color: var(--gold);
  font-size: 28px;
  letter-spacing: 8px;
  margin-bottom: 10px;
}
.modal-card p { color: var(--ink-dim); margin-bottom: 12px; font-size: 12px; letter-spacing: 1px; }
.modal-loot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 8px 0 4px;
  padding: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px dashed var(--gold-deep);
  border-radius: 2px;
  min-height: 36px;
}
.modal-loot .loot-label { color: var(--ink-dim); font-size: 11px; }
.modal-loot .loot-name { color: var(--gold-light); font-size: 13px; font-weight: 700; }
.modal-loot .loot-name.q-blue { color: #5a9bff; }
.modal-loot .loot-name.q-purple { color: #b56cff; }
.modal-loot .loot-icon {
  width: 16px; height: 16px;
  background: var(--gold);
  border: 1px solid var(--gold-deep);
  display: inline-flex; align-items: center; justify-content: center;
  color: #000;
  font-weight: 700;
  font-size: 10px;
  border-radius: 1px;
}
.modal-loot .loot-icon.q-blue { background: #5a9bff; border-color: #2c5fa0; color: #fff; }
.modal-loot .loot-icon.q-purple { background: #b56cff; border-color: #6e3a9e; color: #fff; }
.modal-stats {
  display: flex; justify-content: space-around;
  margin: 12px 0 20px;
  font-size: 11px;
}
.modal-stats .ms-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; width: 100%; }
.modal-stats .ms { display: flex; flex-direction: column; align-items: center; }
.modal-stats .ms-label { color: var(--ink-dim); }
.modal-stats .ms-value { color: var(--gold-light); font-size: 18px; font-weight: 700; }

/* ============================================================
   Toast 提示
   ============================================================ */
.toast {
  font-family: var(--font-zh);
  white-space: pre;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
  transition: opacity 0.3s;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 480px) {
  :root { --cell-size: 13.6vmin; }
  .brand-zh { font-size: 18px; letter-spacing: 3px; }
  .stat { min-width: 42px; padding: 3px 5px; }
  .stat-value { font-size: 15px; }
  .stat.xp { min-width: 60px; }
  .detail-panel { width: 150px; }
  /* 移动端：侧边栏改为顶部 dock，避免遮挡棋盘 */
  .battle-log { top: 60px; left: 8px; right: 8px; width: auto; max-height: 28%; transform: none; }
  .synergy-panel { display: none; }  /* 移动端隐藏，在详情面板/战斗中显示 */
  .battle-controls { top: auto; bottom: 8px; right: 8px; transform: none; flex-direction: row; }
  .modal-card { padding: 24px 30px; min-width: 240px; }
  .modal-card h2 { font-size: 24px; }
  .shop-actions .btn-text { display: none; }
  .shop-actions .btn { padding: 6px 8px; }
}
@media (min-width: 768px) and (orientation: landscape) {
  :root { --cell-size: 9vmin; }
  body { max-width: 1000px; margin: 0 auto; border-left: 1px solid var(--gold-deep); border-right: 1px solid var(--gold-deep); }
  .battle-log, .synergy-panel { width: 200px; }
}

/* 战斗模式全局 */
body.battle-mode .board { border-color: var(--blood); box-shadow: 0 0 24px rgba(168,32,44,0.4), inset 0 0 24px rgba(0,0,0,0.7); }
body.battle-mode .chess { cursor: default; }
body.battle-mode .chess:active { cursor: default; }
body.battle-mode .chess .board-sell-btn { display: none; }

/* ============================================================
   R3 Artisan 新增视觉系统
   - 卡片星级边框 (1星/2星/3星)
   - 战斗 VFX (HP 条渐变、抖动、阵亡、升星、Boss 入场)
   - 阵营徽章 (5 阵营圆形 emblem)
   - 装备品质色彩统一
   - 文字系统 (衬线大标题 + 数字等宽)
   ============================================================ */

/* ----- 1. 卡片星级边框 ----- */
.card-frame {
  position: relative;
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
  overflow: visible;
  transition: transform 0.2s;
}
.card-frame::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 4px;
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, currentColor 50%, transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* 1星：白铁·素框 */
.card-frame.star1 {
  color: #b0a890;
  box-shadow: inset 0 0 0 1px #6a5a40, 0 0 4px rgba(176, 168, 144, 0.3);
}
.card-frame.star1::after {
  content: "★"; position: absolute; top: -6px; right: -6px;
  font-size: 12px; color: #b0a890;
  text-shadow: 0 0 4px rgba(176, 168, 144, 0.5);
}

/* 2星：银蓝·发光 */
.card-frame.star2 {
  color: #6a9bd0;
  box-shadow:
    inset 0 0 0 1px #4a7ba0,
    0 0 8px rgba(106, 155, 208, 0.5),
    0 0 16px rgba(106, 155, 208, 0.2);
  animation: star2Glow 2.5s ease-in-out infinite;
}
@keyframes star2Glow {
  0%, 100% { box-shadow: inset 0 0 0 1px #4a7ba0, 0 0 8px rgba(106, 155, 208, 0.5), 0 0 16px rgba(106, 155, 208, 0.2); }
  50% { box-shadow: inset 0 0 0 1px #8ab8e0, 0 0 12px rgba(106, 155, 208, 0.8), 0 0 24px rgba(106, 155, 208, 0.4); }
}
.card-frame.star2::after {
  content: "★★"; position: absolute; top: -8px; right: -10px;
  font-size: 10px; color: #6a9bd0;
  text-shadow: 0 0 6px rgba(106, 155, 208, 0.8);
  letter-spacing: 1px;
}

/* 3星：流金·旋转光带 */
.card-frame.star3 {
  color: #d4af37;
  box-shadow:
    inset 0 0 0 2px #d4af37,
    0 0 12px rgba(212, 175, 55, 0.6),
    0 0 24px rgba(212, 175, 55, 0.3);
  background: linear-gradient(135deg,
    rgba(212, 175, 55, 0.1) 0%,
    rgba(0, 0, 0, 0.5) 30%,
    rgba(212, 175, 55, 0.15) 50%,
    rgba(0, 0, 0, 0.5) 70%,
    rgba(212, 175, 55, 0.1) 100%);
  background-size: 200% 200%;
  animation: star3Shine 3s linear infinite;
}
@keyframes star3Shine {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 200%; }
}
.card-frame.star3::after {
  content: "★★★"; position: absolute; top: -8px; right: -14px;
  font-size: 10px; color: #d4af37;
  text-shadow: 0 0 8px rgba(212, 175, 55, 1), 0 0 16px rgba(212, 175, 55, 0.6);
  letter-spacing: 1px;
  animation: star3Twinkle 1.5s ease-in-out infinite;
}
@keyframes star3Twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ----- 2. 战斗 VFX 增强 ----- */

/* HP 条纹路 + 渐变 */
.chess .hp-bar-fill {
  background: repeating-linear-gradient(
    90deg,
    var(--jade) 0,
    #6dd49a 4px,
    var(--jade) 8px,
    #6dd49a 12px,
    var(--jade) 16px
  );
  background-size: 16px 100%;
  animation: hpStripe 1s linear infinite;
}
@keyframes hpStripe {
  0% { background-position: 0 0; }
  100% { background-position: 16px 0; }
}
.chess .hp-bar-fill.mid {
  background: repeating-linear-gradient(
    90deg,
    var(--neon-amber) 0,
    #ffd47a 4px,
    var(--neon-amber) 8px,
    #ffd47a 12px,
    var(--neon-amber) 16px
  );
  background-size: 16px 100%;
  animation: hpStripe 1s linear infinite;
}
.chess .hp-bar-fill.low {
  background: repeating-linear-gradient(
    90deg,
    var(--blood) 0,
    #e06060 4px,
    var(--blood) 8px,
    #e06060 12px,
    var(--blood) 16px
  );
  background-size: 16px 100%;
  animation: hpStripe 0.6s linear infinite;
  box-shadow: 0 0 4px rgba(168, 32, 44, 0.8);
}

/* 升级金光 + scale up */
.chess.star-up {
  animation: starUp 0.6s ease-out;
  z-index: 50;
}
@keyframes starUp {
  0% { transform: scale(1); filter: brightness(1); }
  30% { transform: scale(1.4); filter: brightness(2) drop-shadow(0 0 12px var(--gold)); }
  60% { transform: scale(1.1); filter: brightness(1.5) drop-shadow(0 0 8px var(--gold)); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* Boss 入场震动 + 红色 flash */
.chess.boss-enter {
  animation: bossEnter 1s ease-out;
}
@keyframes bossEnter {
  0% { transform: scale(0); opacity: 0; }
  20% { transform: scale(1.3); opacity: 1; filter: brightness(2) drop-shadow(0 0 16px var(--blood)); }
  40% { transform: scale(0.95); filter: brightness(1.5) drop-shadow(0 0 12px var(--blood)); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); filter: none; }
}

/* 死亡淡出增强 */
.chess.dead {
  filter: grayscale(1) brightness(0.3);
  opacity: 0.4;
  transition: all 0.5s ease-out;
  transform: scale(0.85);
}

/* 抖动更明显 */
.chess.shake-strong {
  animation: shakeStrong 0.4s ease-out;
}
@keyframes shakeStrong {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-3px) rotate(-1deg); }
  20% { transform: translateX(3px) rotate(1deg); }
  30% { transform: translateX(-3px) rotate(-1deg); }
  40% { transform: translateX(3px) rotate(1deg); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
}

/* ----- 3. 阵营徽章样式 ----- */
.faction-emblem {
  width: 48px; height: 48px;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
  transition: transform 0.2s;
}
.faction-emblem:hover { transform: scale(1.1) rotate(3deg); }
.faction-emblem.qingbang   { border-color: #1f3d7a; }
.faction-emblem.hongmen    { border-color: #a8202c; }
.faction-emblem.futoubang  { border-color: #4a4a4a; }
.faction-emblem.xunpufang  { border-color: #c8a553; }
.faction-emblem.caobang    { border-color: #5a3a6c; }

/* ----- 4. 装备品质色彩 (4 装备位角标) ----- */
.equip-icon.q-白 { background: #C9C0B0; border-color: #6a5a40; color: #1a1208; }
.equip-icon.q-蓝 { background: #4A8AB5; border-color: #2c5c7a; color: #f1e6cf; }
.equip-icon.q-紫 { background: #B56CFF; border-color: #5a3a7a; color: #f1e6cf; }
.equip-icon.q-橙 { background: #C66B3D; border-color: #8b4513; color: #f1e6cf; }
.equip-icon.q-金 { background: #D9B570; border-color: #8b6f1d; color: #1a1208; }

/* ----- 5. 文字系统 (衬线大标题 + 数字等宽) ----- */
.title-deco {
  font-family: var(--font-deco);
  letter-spacing: 0.15em;
  color: var(--gold);
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(212, 175, 55, 0.3);
}
.title-deco .en {
  font-size: 0.6em;
  color: var(--ink-dim);
  letter-spacing: 0.3em;
  margin-left: 0.5em;
  text-shadow: none;
}
.num-mono {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.hero-name-zh {
  font-family: var(--font-deco);
  color: var(--gold);
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(212, 175, 55, 0.4);
  letter-spacing: 0.05em;
}
.hero-desc {
  font-size: 10px;
  color: var(--ink-dim);
  opacity: 0.85;
  font-style: italic;
  line-height: 1.4;
}

/* ----- 6. 招募面板 Art Deco 装饰 ----- */
.shop-deco-frame {
  position: relative;
  border: 1px solid var(--gold-deep);
  background: linear-gradient(180deg, rgba(26, 20, 14, 0.95) 0%, rgba(14, 10, 7, 0.95) 100%);
  padding: 8px 10px;
}
.shop-deco-frame::before, .shop-deco-frame::after {
  content: "❖"; position: absolute;
  color: var(--gold);
  font-size: 10px;
}
.shop-deco-frame::before { top: 2px; left: 4px; }
.shop-deco-frame::after { top: 2px; right: 4px; }

/* ----- 7. 详情面板（英雄卡片）美化 ----- */
.detail-panel {
  border: 1px solid var(--gold-deep);
  background: linear-gradient(180deg,
    rgba(26, 20, 14, 0.98) 0%,
    rgba(14, 10, 7, 0.98) 100%);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(212, 175, 55, 0.1);
  font-family: var(--font-zh);
}
.detail-panel::before {
  content: "英雄档案";
  display: block;
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 4px;
  text-align: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--gold-deep);
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.1), transparent);
}
.detail-name {
  font-family: var(--font-deco);
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 #000;
  margin-bottom: 6px;
}
.detail-name::after {
  content: "";
  display: block;
  width: 60%;
  height: 1px;
  margin-top: 4px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.detail-stats .s-label { font-size: 10px; }
.detail-stats .s-value {
  font-family: "JetBrains Mono", monospace;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
}
.detail-skill {
  border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.08), transparent);
  padding: 6px 8px;
}
.detail-skill-name {
  font-family: var(--font-deco);
  color: var(--gold);
  letter-spacing: 0.05em;
}
.detail-skill-desc {
  color: var(--ink);
  font-size: 10px;
  font-style: normal;
  line-height: 1.5;
}

/* ----- 8. 战斗结果弹窗 美化 ----- */
.modal-card {
  border: 3px double var(--gold);
  background:
    linear-gradient(180deg, #1a140e 0%, #0e0a07 100%),
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.15), transparent 60%);
  box-shadow:
    0 0 40px rgba(212, 175, 55, 0.4),
    inset 0 0 24px rgba(0, 0, 0, 0.6);
  position: relative;
}
.modal-card::before, .modal-card::after {
  content: "❖"; position: absolute;
  color: var(--gold);
  font-size: 16px;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}
.modal-card::before { top: 6px; left: 8px; }
.modal-card::after  { bottom: 6px; right: 8px; }
.modal-card h2 {
  font-family: var(--font-deco);
  color: var(--gold);
  font-size: 28px;
  letter-spacing: 0.4em;
  text-shadow: 0 1px 0 #000, 0 0 12px rgba(212, 175, 55, 0.5);
  margin-bottom: 12px;
}
.modal-card p {
  color: var(--ink-dim);
  font-family: var(--font-deco);
  letter-spacing: 0.1em;
  font-style: italic;
}

/* ----- 9. 按钮黄铜+斜面+按压 ----- */
.btn {
  border: 1px solid var(--gold-deep);
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(20,16,10,0.6) 100%);
  color: var(--ink);
  font-family: var(--font-zh);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: inset 0 1px 0 rgba(212, 175, 55, 0.15);
}
.btn:active { transform: translateY(1px) scale(0.97); box-shadow: inset 0 2px 4px rgba(0,0,0,0.4); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.2) 0%, rgba(166, 124, 46, 0.1) 100%);
  box-shadow: inset 0 1px 0 rgba(212, 175, 55, 0.3), 0 0 6px rgba(212, 175, 55, 0.2);
}
.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #1a1208;
  font-weight: 700;
  border-color: var(--gold);
  letter-spacing: 0.15em;
  padding: 8px 20px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 0 #5a4015;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 0 #5a4015, 0 0 8px rgba(212, 175, 55, 0.4);
}

/* ----- 10. 棋盘回合切换 banner ----- */
.round-banner {
  font-family: var(--font-deco);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--gold);
  padding: 4px 16px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--gold-deep);
  border-radius: 2px;
  margin-bottom: 8px;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
  position: relative;
  overflow: hidden;
}
.round-banner::before {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
  animation: bannerSlide 3s linear infinite;
}
@keyframes bannerSlide {
  0% { left: -100%; }
  100% { left: 100%; }
}
.round-banner.switching {
  animation: bannerSwitch 0.6s ease-out;
}
@keyframes bannerSwitch {
  0% { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   粒子系统（particles.js）
   - 6 类：灵气 / 升级 / 技能 / 死亡 / 金雨 / 云海
   - 全部以 .pt 为根类，配合 .pt-<type>-<role> 区分
   ============================================================ */

/* host：所有粒子的父容器，position:absolute 锚定屏幕坐标 */
.pt-host {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
}

/* 粒子基本形态：圆形发光 */
.pt {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px currentColor, 0 0 12px currentColor;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: transform, opacity;
  /* 默认动画：自身淡出（每个子类 keyframe 覆盖 transform 部分） */
  animation-fill-mode: forwards;
  animation-timing-function: ease-out;
}

/* ---------- 1. 灵气（spriti）---------- */
.pt-spriti-dot {
  /* 灵气是漂向上方的光点：上升 + 淡出 */
  animation-name: ptSpritiFloat;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}
@keyframes ptSpritiFloat {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  20%  { transform: translate(calc(-50% + var(--tx, 0) * 0.4), calc(-50% + var(--ty, 0) * 0.4)) scale(1); opacity: var(--op, 0.9); }
  100% { transform: translate(calc(-50% + var(--tx, 0)), calc(-50% + var(--ty, 0))) scale(0.4); opacity: 0; }
}

/* ---------- 2. 升级（upgrade）---------- */
.pt-upgrade-ring {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  border: 3px solid var(--gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px var(--gold-light), inset 0 0 12px rgba(241, 200, 98, 0.4);
  animation: ptUpgradeRing 0.8s ease-out forwards;
  pointer-events: none;
}
@keyframes ptUpgradeRing {
  0%   { width: 6px; height: 6px; opacity: 1; border-width: 4px; }
  100% { width: 110px; height: 110px; opacity: 0; border-width: 1px; }
}

.pt-upgrade-spark {
  animation-name: ptBurst;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  animation-fill-mode: forwards;
}
@keyframes ptBurst {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx, 0)), calc(-50% + var(--ty, 0))) scale(0.2); opacity: 0; }
}

/* ---------- 3. 技能（skill）---------- */
.pt-skill-ring {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  border: 2px solid var(--neon-pink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 14px var(--neon-pink), 0 0 24px var(--neon-amber);
  animation: ptSkillRing 0.7s ease-out forwards;
  pointer-events: none;
}
@keyframes ptSkillRing {
  0%   { width: 6px; height: 6px; opacity: 1; }
  100% { width: 100px; height: 100px; opacity: 0; border-width: 1px; }
}

.pt-skill-spark {
  animation-name: ptSkillSpark;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}
@keyframes ptSkillSpark {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  60%  { opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--tx, 0)), calc(-50% + var(--ty, 0))) scale(1.4); opacity: 0; }
}

/* ---------- 4. 死亡（death）---------- */
.pt-death-ash {
  /* 灰暗碎片：向上飘 + 旋转 + 渐隐 */
  background: #5a4a40 !important;
  color: #5a4a40 !important;
  box-shadow: 0 0 4px currentColor;
  animation-name: ptDeathAsh;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes ptDeathAsh {
  0%   { transform: translate(-50%, -50%) scale(0.6) rotate(0deg); opacity: var(--op, 0.7); }
  100% { transform: translate(calc(-50% + var(--tx, 0)), calc(-50% + var(--ty, 0))) scale(0.3) rotate(var(--rt, 0deg)); opacity: 0; }
}

/* ---------- 5. 金雨（goldenRain）---------- */
.pt-rain-drop {
  /* 金色细条从上方斜向下落 */
  width: 2px !important;
  height: 14px !important;
  border-radius: 1px !important;
  animation-name: ptRainFall;
  animation-timing-function: cubic-bezier(0.4, 0.0, 0.8, 0.6);
  animation-fill-mode: forwards;
}
@keyframes ptRainFall {
  0%   { transform: translate(-50%, -50%) scaleY(0.4) rotate(var(--rt, 0deg)); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx, 0)), calc(-50% + var(--ty, 200px))) scaleY(1.2) rotate(var(--rt, 0deg)); opacity: 0; }
}

/* ---------- 6. 云海（cloudSea）---------- */
/* .pt-cloud-puff 在 JS 内联样式中已含 radial-gradient 背景；只负责漂移动画 */
@keyframes ptCloudDrift {
  0%   { transform: translate(0, 0) scale(1);     opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.9; }
  100% { transform: translate(-110vw, -8px) scale(1.05); opacity: 0; }
}

/* ============================================================
   场景过渡（transitions.js）
   - SHOP → BATTLE：棋盘上升 + 暗场蒙层扫过
   - 通用面板 open/close：左/右/上/下/淡入
   ============================================================ */

/* 暗场蒙层基础 */
#phase-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: linear-gradient(180deg, rgba(10,6,18,0) 0%, rgba(10,6,18,0.85) 60%, rgba(0,0,0,0.95) 100%);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-100%);
  will-change: transform, opacity;
}
#phase-overlay.show { opacity: 1; }
#phase-overlay.sweep-down {
  animation: ptPhaseSweepDown 0.6s cubic-bezier(0.65, 0.0, 0.35, 1) forwards;
}
#phase-overlay.sweep-up {
  animation: ptPhaseSweepUp 0.6s cubic-bezier(0.65, 0.0, 0.35, 1) forwards;
}
@keyframes ptPhaseSweepDown {
  0%   { transform: translateY(-100%); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(100%);  opacity: 0.4; }
}
@keyframes ptPhaseSweepUp {
  0%   { transform: translateY(100%);  opacity: 0.4; }
  80%  { opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}

/* 棋盘上升：SHOP → BATTLE */
.board-wrap.rising-up,
.board.rising-up {
  animation: ptBoardRise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  transform-origin: center bottom;
}
@keyframes ptBoardRise {
  0%   { transform: translateY(40px) scale(0.94); filter: brightness(0.6) blur(2px); opacity: 0; }
  30%  { transform: translateY(0)     scale(1.02); filter: brightness(1.4) blur(0);    opacity: 1; }
  100% { transform: translateY(0)     scale(1);    filter: brightness(1)   blur(0);    opacity: 1; }
}

/* 棋盘下沉：RESULT → SHOP（备用，便于调用方反向） */
.board-wrap.falling-down {
  animation: ptBoardFall 0.6s ease-in forwards;
}
@keyframes ptBoardFall {
  0%   { transform: translateY(0)    scale(1);    opacity: 1; }
  100% { transform: translateY(40px) scale(0.96); filter: brightness(0.7); opacity: 0; }
}

/* 通用面板 slide in（从右） */
.pt-slide-in-right { animation: ptSlideInRight 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.pt-slide-in-left  { animation: ptSlideInLeft  0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.pt-slide-in-up    { animation: ptSlideInUp    0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.pt-slide-in-down  { animation: ptSlideInDown  0.32s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes ptSlideInRight { from { transform: translateX(105%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes ptSlideInLeft  { from { transform: translateX(-105%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes ptSlideInUp    { from { transform: translateY(105%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes ptSlideInDown  { from { transform: translateY(-105%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 通用面板 slide out */
.pt-slide-out-right { animation: ptSlideOutRight 0.3s cubic-bezier(0.4, 0.0, 0.7, 0.5) forwards; }
.pt-slide-out-left  { animation: ptSlideOutLeft  0.3s cubic-bezier(0.4, 0.0, 0.7, 0.5) forwards; }
.pt-slide-out-up    { animation: ptSlideOutUp    0.3s cubic-bezier(0.4, 0.0, 0.7, 0.5) forwards; }
.pt-slide-out-down  { animation: ptSlideOutDown  0.3s cubic-bezier(0.4, 0.0, 0.7, 0.5) forwards; }

@keyframes ptSlideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(105%); opacity: 0; } }
@keyframes ptSlideOutLeft  { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-105%); opacity: 0; } }
@keyframes ptSlideOutUp    { from { transform: translateY(0); opacity: 1; } to { transform: translateY(105%); opacity: 0; } }
@keyframes ptSlideOutDown  { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-105%); opacity: 0; } }

/* 结算面板向下滑出（RESULT → SHOP） */
.modal.slide-down-out {
  animation: ptSlideDownOut 0.35s cubic-bezier(0.4, 0.0, 0.7, 0.5) forwards;
}
@keyframes ptSlideDownOut {
  0%   { opacity: 1; transform: translateY(0)    scale(1); }
  100% { opacity: 0; transform: translateY(60px) scale(0.94); }
}

/* dimScreen 全屏淡黑 */
#phase-overlay.dim {
  background: rgba(0, 0, 0, 0.85);
  transform: translateY(0) !important;
}

/* banner 切换复用 bannerSwitch（在 1629 行已定义）—— 若有 .banner-switch 类则再覆盖一次 */
.round-banner.banner-switch {
  animation: bannerSwitch 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
