/* design/SKILL.md §4.2 / §4.3 / §6.4 — physical offsets and expanded selectors
   keep legacy Android WebViews in the same fitted stage as modern hosts. */
/* design/SKILL.md §2.3 / §4.3 / §6.4: prototype bitmap routes retired; complete card faces and supplied blank panels own presentation. */
/* ============================================================
   大唐军演 · 卡牌对战 — 样式表
   ============================================================ */

/* ── 基础重置 & 变量 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ════════════════════════════════════════════════
     视觉方案 A — 主色系统
     玄铁青灰为主，赤铜战火为冲突，青玉冷光代表我方操作，
     旧金只做军令与胜利强调。靛紫银灰用于战术 / 特殊机制。
     详见 docs/j3card_visual_reference_from_phia_site.md §9–§14
  ════════════════════════════════════════════════ */

  /* 玄铁青灰：全局主基调（背景 / 面板 / HUD / 普通边框 / 分割线） */
  --j3-bg-void:            #080b0d;
  --j3-bg-iron:            #12191d;
  --j3-bg-iron-2:          #172125;
  --j3-panel-iron:         rgba(18, 25, 29, 0.84);
  --j3-panel-iron-soft:    rgba(18, 25, 29, 0.66);
  --j3-border-iron:        rgba(122, 145, 148, 0.28);
  --j3-border-iron-strong: rgba(148, 168, 168, 0.42);

  /* 青玉冷光：我方操作 / 可交互反馈 */
  --j3-player-cyan:        #76d7d2;
  --j3-player-cyan-bright: #9ff3ee;
  --j3-player-cyan-soft:   rgba(118, 215, 210, 0.22);
  --j3-player-cyan-faint:  rgba(118, 215, 210, 0.10);

  /* 赤铜战火：敌方 / 伤害 / 冲突 */
  --j3-enemy-copper:        #b45a3c;
  --j3-enemy-copper-bright: #d87854;
  --j3-enemy-copper-soft:   rgba(180, 90, 60, 0.24);
  --j3-enemy-copper-faint:  rgba(180, 90, 60, 0.12);

  /* 旧金暗金：军令 / 胜利 / 主按钮 / 高阶强调（小面积） */
  --j3-gold-command:        #c7a45a;
  --j3-gold-command-bright: #e0c06f;
  --j3-gold-soft:           rgba(199, 164, 90, 0.26);
  --j3-gold-faint:          rgba(199, 164, 90, 0.10);

  /* 靛紫银灰：战术 / 特殊机制 */
  --j3-tactic-violet:      #8f7bd9;
  --j3-tactic-violet-soft: rgba(143, 123, 217, 0.24);
  --j3-silver-muted:       #aeb8bb;

  /* ── 旧变量：保留兼容，逐组件迁移到 --j3-* ──
     --gold 已对齐旧金军令色（高阶强调），不再作为全局主色使用。 */
  --gold:       #c7a45a;
  --gold-lt:    #e0c06f;
  --gold-dk:    #7a5010;
  --red:        #b45a3c;
  --red-lt:     #d87854;
  --panel-bg:   rgba(18, 25, 29, 0.84);
  --r:          8px;
  --font:       'Noto Serif SC', 'Songti SC', 'FangSong', 'SimSun', serif;

  /* 固定的格子尺寸 —— 全局统一（卡牌 x1.5，战区加宽） */
  --lane-w:     326px;
  --lane-h:     218px;
  --lane-panel-h: 200px;
  --oct-size:   108px;
  --card-w:     90px;
  --card-h:     124px;
  --hand-card-w:122px;
  --hand-card-h:158px;
  --bf-rail-w:  142px;
  --bf-preview-actions-w: 184px;
  --bf-col-gap: 5px;
  --j3-start-title-ornament-w: min(880px, 94vw);
  /* clean HUD 图素 520x140 → 比例 3.714；容器按此比例避免拉伸 */
  --j3-hud-panel-w: 300px;
  --j3-hud-panel-h: 80px;
}

html, body {
  width: 100%; height: 100%;
  overflow: visible;
  position: relative;
  isolation: isolate;
  background: transparent;
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  position: relative;
  isolation: isolate;
  background: #060c14;
}

#btn-close-game { display: none; }

.hidden { display: none !important; }

html.touch-host, html.touch-host body {
  /* H5 owns the two-finger gesture. Excluding native pinch keeps Android
     WebView from cancelling Pointer Events after the first movement. */
  touch-action: pan-x pan-y;
  -webkit-touch-callout: none;
}

#viewport-debug {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 99999;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font: 11px/1.3 Consolas, monospace;
  pointer-events: none;
}

button { cursor: pointer; font-family: var(--font); border: none; outline: none; }

/* ════════════════════════════════════════════════
   开始界面
════════════════════════════════════════════════ */
#start-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  overflow: hidden;
  padding: 8px 6px;
}

.start-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 18px;
  animation: fadeIn .8s ease forwards;
  flex-shrink: 0;
  max-width: 100%;
}

/* ════════════════════════════════════════════════
   §4.3 视觉引导 — 统一动态背景舞台（原型）
   ────────────────────────────────────────────────
   单一背景常驻在所有界面之下（#global-bg-stage），
   页面切换时只改变「镜头焦点」：平移 / 缩放 / 明暗，
   而不是硬切不同背景。性能约束：
     · 始终最底层、pointer-events:none，绝不拦截交互
     · 只用 transform / opacity / 轻量 filter，无重型滤镜链
     · 视频失败或低配模式回退静态图，焦点逻辑保持一致
   焦点配置集中在 app.js 的 BACKGROUND_FOCUS_PRESETS，
   切换统一走 applyBackgroundFocus() / refreshBackgroundMode()。
════════════════════════════════════════════════ */
#global-bg-stage {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0;                 /* 所有界面（z-index:100）之下 */
  overflow: hidden;
  pointer-events: none;       /* §六 性能 — 永不拦截拖拽 / 点击 */
  background-color: #05080f;  /* 视频与静态图都缺失时的兜底底色 */
  --bg-focus-x: 0.5;
  --bg-focus-y: 0.5;
  --bg-zoom: 1.08;
  --bg-offset-x: 0;
  --bg-offset-y: 0;
  --bg-scale: 1.08;
  --bg-translate-x: 0%;
  --bg-translate-y: 0%;
}
/* 媒体层：焦点位移 / 缩放只作用在这一层，便于统一过渡 */
#global-bg-media {
  position: absolute; top: -16%; right: -16%; bottom: -16%; left: -16%;
  transform-origin: 50% 50%;
  transform: translate3d(var(--bg-translate-x), var(--bg-translate-y), 0) scale(var(--bg-scale));
  /* §六 性能 — 切换克制：位移/缩放 0.9s，不做大幅度长动画 */
  transition: transform 0.9s cubic-bezier(.22,.61,.36,1),
              filter 0.9s ease;
  will-change: transform;
}
#global-bg-video,
#global-bg-canvas,
#global-bg-fallback {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
}
/* design/SKILL.md §4.3 / §6.4 — JS centers an intrinsic-ratio cover box.
   Explicit dimensions also cover Android native video surfaces during playback. */
#global-bg-video {
  right: auto; bottom: auto; max-width: none; max-height: none;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
/* design/SKILL.md §4.3 / §6.4 — same-frame cover image stays behind loading or failed media. */
#global-bg-fallback {
  background-image: url("../assets/ui/bg_battlefield.jpg?v=background-4k-revision02-20261013"),
    linear-gradient(175deg, #050e1c 0%, #0e1e0a 35%, #1c0e04 70%, #05080f 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
}
#global-bg-stage.bg-video-playing:not(.bg-use-fallback):not(.bg-canvas-renderer) #global-bg-video { opacity: 1; }
#global-bg-stage.bg-use-fallback #global-bg-video { display: none; }

/* design/SKILL.md §4.3 / §6.4 — Android keeps motion in the page compositor.
   The decoder stays transparent; only a successfully painted canvas is visible. */
#global-bg-canvas {
  display: none; opacity: 0; pointer-events: none;
  right: auto; bottom: auto; max-width: none; max-height: none;
  transition: opacity .25s ease;
}
html.android-host #global-bg-stage.bg-canvas-renderer #global-bg-media { filter: none; }
#global-bg-stage.bg-canvas-renderer #global-bg-video { opacity: 0; transition: none; }
#global-bg-stage.bg-canvas-renderer #global-bg-canvas { display: block; }
#global-bg-stage.bg-canvas-renderer.bg-video-playing:not(.bg-use-fallback) #global-bg-canvas { opacity: 1; }
#global-bg-stage.bg-use-fallback #global-bg-canvas { display: none; }

/* 暗角 + 调光层：营造焦点中心，随焦点切换淡入淡出 */
#global-bg-vignette {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
  background-image:
    radial-gradient(ellipse 78% 70% at 50% 50%, transparent 45%, rgba(3,6,12,0.55) 100%),
    radial-gradient(ellipse 100% 50% at 50% 0%, rgba(20,40,100,0.45) 0%, transparent 60%),
    radial-gradient(ellipse 80% 55% at 50% 100%, rgba(120,55,0,0.4) 0%, transparent 62%);
  transition: opacity .9s ease;
}
#global-bg-dim {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
  background: rgba(4,8,15,0.0);
  transition: background-color .9s ease, opacity .9s ease;
}

/* ── 焦点预设（与 BACKGROUND_FOCUS_PRESETS 对应） ────────────────
   只用 transform 位移/缩放 + 调光，保持轻量。 */

/* 1) 开始界面：聚焦中央偏上，画面开阔，明亮 */
#global-bg-stage.bg-focus-start #global-bg-media {
  filter: brightness(1) saturate(1);
}
#global-bg-stage.bg-focus-start {
  --bg-scale: 1.08;
  --bg-translate-x: 0%;
  --bg-translate-y: 0.84%;
}
#global-bg-stage.bg-focus-start #global-bg-dim { background: rgba(4,8,15,0.18); }
#global-bg-stage.bg-focus-start #global-bg-vignette { opacity: 0.7; }

/* 2) 选敌界面：聚焦战场中景，压暗四周突出敌将 */
#global-bg-stage.bg-focus-enemy-select #global-bg-media {
  filter: brightness(0.66) saturate(0.82);
}
#global-bg-stage.bg-focus-enemy-select {
  --bg-scale: 1.16;
  --bg-translate-x: 0%;
  --bg-translate-y: 0%;
}
#global-bg-stage.bg-focus-enemy-select #global-bg-dim { background: rgba(4,8,15,0.34); }
#global-bg-stage.bg-focus-enemy-select #global-bg-vignette { opacity: 1; }

/* 3) 备战界面：聚焦沙盘局部，整军布阵的近景感 */
#global-bg-stage.bg-focus-deck-prep #global-bg-media {
  filter: brightness(0.6) saturate(0.78);
}
#global-bg-stage.bg-focus-deck-prep {
  --bg-scale: 1.32;
  --bg-translate-x: 6.72%;
  --bg-translate-y: -5.04%;
}
#global-bg-stage.bg-focus-deck-prep #global-bg-dim { background: rgba(4,8,15,0.4); }
#global-bg-stage.bg-focus-deck-prep #global-bg-vignette { opacity: 1; }

/* 4) 战斗界面：聚焦战场中心，克制，不抢卡牌/血条可读性 */
#global-bg-stage.bg-focus-battle #global-bg-media {
  filter: brightness(0.52) saturate(0.72);
}
#global-bg-stage.bg-focus-battle {
  --bg-scale: 1.42;
  --bg-translate-x: 0%;
  --bg-translate-y: 0%;
}
#global-bg-stage.bg-focus-battle #global-bg-dim { background: rgba(4,8,15,0.5); }
#global-bg-stage.bg-focus-battle #global-bg-vignette { opacity: 1; }

/* 5) 结果界面：聚焦中央，周边明显压暗，让结果弹窗成为视觉中心 */
#global-bg-stage.bg-focus-result #global-bg-media {
  filter: brightness(0.45) saturate(0.7);
}
#global-bg-stage.bg-focus-result {
  --bg-scale: 1.42;
  --bg-translate-x: 0%;
  --bg-translate-y: 0%;
}
#global-bg-stage.bg-focus-result #global-bg-dim { background: rgba(3,6,12,0.62); }
#global-bg-stage.bg-focus-result #global-bg-vignette { opacity: 1; }

/* §六 低配模式：关闭背景动画与过渡，仅保留同样的焦点（静态定格） */
#global-bg-stage.bg-low-power #global-bg-media,
#global-bg-stage.bg-low-power #global-bg-dim,
#global-bg-stage.bg-low-power #global-bg-vignette { transition: none; }

@keyframes fadeIn { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform:none; } }


.banner-top, .banner-bot {
  display: flex; align-items: center; gap: 14px;
  color: rgba(174,184,187,0.7); font-size: 13px; letter-spacing: 3px;
}
.banner-line {
  display: none;
}
.banner-bot .banner-line { transform: scaleX(-1); }

.main-title {
  position: relative;
  z-index: 1;
  isolation: isolate;
  font-size: clamp(56px, 9vw, 100px);
  font-weight: 900; letter-spacing: 14px;
  padding: 12px clamp(42px, 8vw, 92px);
  background: none;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: #f8e7aa;
  background-clip: border-box;
  color: #f8e7aa;
  line-height: 1;
  animation: titleGlow 3s ease-in-out infinite alternate;
}
/* §2.3 Synergy & Theme / §4.3 Visual Guidance - image2 title ornament reinforces the command-table identity without replacing HTML text. */
.main-title::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--j3-start-title-ornament-w);
  height: min(188px, 22.5vw);
  transform: translate(-50%, -50%);
  /* §2.3 Synergy & Theme / §4.4 Golden Ratio - HD v2 restores the wider title plate ratio from the sharper pre-batch4 direction. */
  background: none center / contain no-repeat;
  opacity: .74;
  pointer-events: none;
  z-index: -1;
}
@keyframes titleGlow {
  from { filter: drop-shadow(0 0 12px rgba(200,168,75,0.4)); }
  to   { filter: drop-shadow(0 0 28px rgba(200,168,75,0.75)); }
}
.main-sub {
  font-size: 22px; letter-spacing: 10px; color: var(--gold-lt);
  text-shadow: 0 0 12px rgba(200,168,75,0.5); margin-top: 2px;
}

.btn-start-game { padding: 0; background: none; border: none; cursor: pointer; margin-top: 8px; }
.btn-inner {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 260px; min-height: 76px; padding: 0 56px;
  font-family: var(--font); font-size: 20px; font-weight: 700; letter-spacing: 6px;
  color: #fff2c0;
  /* §4.2 Fitts' Law - 9-slice keeps ornate end-caps crisp; only the flat centre stretches, so the
     command never distorts horizontally. fill draws the centre metal → no rectangular bg halo. */
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 12px 30px;
  border-image-source: none;
  border-image-slice: 28 78 fill;
  border-image-width: 12px 30px;
  border-image-repeat: stretch;
  border-radius: 6px;
  filter: drop-shadow(0 0 10px rgba(200,168,75,0.4));
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 10px rgba(0,0,0,0.85);
  transition: transform .22s, filter .22s, opacity .22s;
}
.btn-start-game:hover .btn-inner {
  transform: scale(1.06);
  filter: brightness(1.1) drop-shadow(0 0 14px rgba(200,168,75,0.7));
  letter-spacing: 7px;
}
.btn-start-game:active .btn-inner { transform: scale(0.98); }
.btn-start-game:disabled { cursor: default; opacity: 0.7; filter: grayscale(.25) brightness(.75); }

.start-tip { color: rgba(174,184,187,0.5); font-size: 12px; letter-spacing: 3px; }

.start-secondary-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
/* §五.4 次级按钮：玄铁青灰底 + 青玉 hover，不抢主按钮 */
.btn-secondary {
  min-width: 88px;
  min-height: 40px;
  padding: 7px 20px;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--j3-silver-muted);
  /* §4.3 Visual Guidance - 9-slice 端饰固定，盒子可窄可宽都不拉伸端部纹样。 */
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 9px 18px;
  border-image-source: none;
  border-image-slice: 30 44 fill;
  border-image-width: 9px 18px;
  border-image-repeat: stretch;
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  transition: color .2s, box-shadow .2s, filter .2s, transform .2s;
}
.btn-secondary:hover {
  color: var(--j3-player-cyan-bright);
  filter: brightness(1.1) drop-shadow(0 0 8px var(--j3-player-cyan-soft));
  transform: translateY(-1px);
}

.unit-icons { display: flex; gap: 20px; margin-top: 6px; }
.unit-icon-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: rgba(174,184,187,0.6); font-size: 11px; letter-spacing: 1px;
}
.unit-icon-item > :first-child { font-size: 26px; }

/* ════════════════════════════════════════════════
   敌方选择界面
════════════════════════════════════════════════ */
#enemy-select-screen,
#deck-prep-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; align-items: stretch; justify-content: center;
  z-index: 100; overflow: hidden;
  padding: 6px 6px 8px;
}
.select-shell {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center;
  width: 100%; height: 100%;
  max-height: 100%;
  min-height: 0;
}
.select-bg-overlay { /* 已废弃：背景统一由 #global-bg-stage 提供 */ }

.select-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 28px;
  animation: fadeIn .6s ease forwards;
  max-width: 100%;
  flex-shrink: 0;
}
.select-content-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 12px;
  width: 100%;
}
.select-actions-fixed {
  flex-shrink: 0;
  padding: 6px 0 2px;
  margin-top: auto;
}
.select-header { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.select-title {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(180deg, #fffbe0 0%, var(--gold) 45%, #7a4800 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1.2;
}
.select-tip { color: rgba(174,184,187,0.5); font-size: 13px; letter-spacing: 3px; }
.mode-hint {
  min-height: 18px;
  margin: -2px 0 0;
  padding: 5px 12px;
  border: 1px solid var(--j3-border-iron);
  border-radius: 999px;
  background: rgba(6,12,26,0.52);
  color: rgba(245,220,160,0.72);
  font-size: 12px;
  letter-spacing: 1px;
  line-height: 1.35;
}

.enemy-selector-shell {
  --enemy-card-w: clamp(286px, 24vw, 330px);
  --enemy-card-gap: 16px;
  display: grid;
  grid-template-columns: 44px auto 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
}
.enemy-selector-viewport {
  width: min(calc(var(--enemy-card-w) * 3 + var(--enemy-card-gap) * 2), calc(100vw - 128px));
  max-width: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  /* Horizontal enemy paging remains available; page pinch is handled by H5. */
  touch-action: pan-x;
  outline: none;
}
.enemy-selector-viewport::-webkit-scrollbar { display: none; }
.enemy-selector-viewport:focus-visible {
  outline: 2px solid rgba(94, 216, 190, 0.78);
  outline-offset: 4px;
  border-radius: 8px;
}
.enemy-cards-grid {
  display: flex;
  width: max-content;
  gap: var(--enemy-card-gap);
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
}
.enemy-selector-shell.is-single .enemy-selector-viewport { width: var(--enemy-card-w); }
.enemy-selector-shell.is-single { --enemy-card-w: clamp(286px, 32vw, 320px); }
.enemy-selector-shell.is-single .enemy-selector-arrow { visibility: hidden; }
.enemy-selector-arrow {
  width: 44px;
  height: 72px;
  padding: 0;
  border: 1px solid rgba(199, 170, 100, 0.56);
  border-radius: 8px;
  color: #f6e5b0;
  background: rgba(8, 18, 27, 0.82);
  box-shadow: inset 0 0 14px rgba(80, 177, 154, 0.12), 0 5px 18px rgba(0,0,0,0.46);
  font: 700 34px/1 var(--font);
  cursor: pointer;
}
.enemy-selector-arrow:hover:not(:disabled) {
  color: #ffffff;
  border-color: rgba(94, 216, 190, 0.82);
  filter: brightness(1.12);
}
.enemy-selector-arrow:focus-visible {
  outline: 2px solid #8fe6cf;
  outline-offset: 2px;
}
.enemy-selector-arrow:disabled {
  opacity: .28;
  cursor: not-allowed;
  filter: grayscale(.7);
}
.enemy-selector-progress {
  min-height: 18px;
  color: rgba(238, 218, 165, 0.78);
  font-size: 11px;
  letter-spacing: 1px;
}

/* §4.3 Visual Guidance / §6.4 Error Handling — readable progress feedback with existing visual hierarchy. */
.replay-empty-message {
  color: #eedaa5;
  text-align: center;
  line-height: 1.8;
  padding: 32px 20px;
  grid-column: 1 / -1;
}
.replay-empty-message[hidden] { display: none; }

.enemy-select-card {
  /* §4.3 Visual Guidance - HD v2 frame art is the only visual; content lives inside its parchment safe-area.
     安全区（相对图素实测）：L/R≈12% · 顶部冠饰≈16% · 底部纹章≈13%。 */
  --es-safe-x: 14%;
  --es-safe-top: 16.5%;
  --es-safe-bot: 13%;
  width: var(--enemy-card-w);
  flex: 0 0 var(--enemy-card-w);
  aspect-ratio: 23 / 29;
  min-height: 0;
  border-radius: 10px; padding: 0; cursor: pointer;
  position: relative; overflow: hidden;
  border: 0;
  /* 旧深蓝代码底框已移除：图素四角透明，底色会渗成矩形双层框。 */
  background-color: transparent;
  /* §4.1 Hick's Law / §4.3 Visual Guidance - enemy card frame reserves a calmer text field for scanning name, HP, terrain, and description. */
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.6));
  transition: transform .28s cubic-bezier(.25,.46,.45,.94), filter .28s;
  display: flex; flex-direction: column;
  animation: cardSlideIn .5s ease both;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.enemy-select-card:nth-child(1) { animation-delay: 0.05s; }
.enemy-select-card:nth-child(2) { animation-delay: 0.15s; }
.enemy-select-card:nth-child(3) { animation-delay: 0.25s; }
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.enemy-select-card:hover {
  transform: translateY(-8px) scale(1.03);
  filter: drop-shadow(0 14px 34px rgba(0,0,0,0.8)); z-index: 5;
}
.enemy-select-card:active { transform: translateY(-2px) scale(0.98); }
.enemy-select-card.card-selected {
  filter: drop-shadow(0 0 18px var(--j3-player-cyan)) drop-shadow(0 12px 34px rgba(0,0,0,0.8)) brightness(1.08) !important;
}

/* 旧难度色带（细横线）穿过冠饰，移除主视觉；难度仍由头像描边 + meta 文字表达。 */
.enemy-card-ribbon { display: none; }
.enemy-card-body {
  /* 内容内缩到羊皮纸安全区，避开四周浮雕边框与顶部冠饰。 */
  padding: var(--es-safe-top) var(--es-safe-x) 6px;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px; flex: 1; min-height: 0;
}
.enemy-select-card .enemy-card-icon {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  /* §4 选敌头像去掉外侧绿色圆圈：移除 border / outline / box-shadow / glow（旧 diffColor 环）。
     §2.3 / §4.3 自由与战役模式统一头像槽规格和视觉位置。 */
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  /* §4.3 Visual Guidance — 头像与选敌头像框必须共享定位上下文；
     visible 避免把圆框下缘裁成用户截图中的横向黑边。 */
  position: relative;
  overflow: visible;
  isolation: isolate;
  transform: translateY(2px);
}
/* §2.3 Synergy / §4.3 Visual Guidance / §6.4 Error Handling —
   敌将头像图只裁内部不透明方图；外层 .enemy-card-icon 继续 visible，避免裁掉金属头像框。 */
.enemy-select-card .enemy-card-icon-img {
  width: 92%; height: 92%;
  object-fit: contain; object-position: center;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  display: block;
  position: relative;
  z-index: 1;
}
.enemy-card-icon .avatar-emoji-fallback {
  position: relative;
  z-index: 1;
}
.enemy-card-icon::before { content: none !important; }
.enemy-card-icon::after {
  /* §4.3 Visual Guidance - 选敌专用头像框分层叠加，替代旧圆形描边但不遮挡卡牌点击。 */
  content: '';
  position: absolute;
  top: -7px; right: -7px; bottom: -7px; left: -7px;
  background: none center / contain no-repeat;
  pointer-events: none;
  z-index: 2;
}
.enemy-select-card:hover .enemy-card-icon { box-shadow: none; }
.enemy-card-name {
  font-size: 19px; font-weight: 900; letter-spacing: 2px;
  color: #4a2d0c; text-shadow: 0 1px 0 rgba(255,246,210,0.85); text-align: center;
  /* §1.B 下方敌人信息整体上移 10px：name 是头像之后第一个信息元素，
     负 margin 把 name + 其后的 meta/地形/描述一并上移，仍落在浅色内容区内。 */
  margin-top: -10px;
  /* §1 本轮：仅敌人名字再单独下移 5px（transform 不占布局流，不下推副标题/血量/地形/描述）。 */
  transform: translateY(5px);
}
.enemy-card-title { font-size: 10px; letter-spacing: 1px; color: rgba(74,48,22,0.85); margin-top: -2px; }
.enemy-card-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap;
  padding: 4px 12px; border-radius: 5px;
  background: rgba(40,26,10,0.12); border: 0;
  color: #3a2614;
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px; width: 100%;
}
.enemy-meta-item strong { font-weight: 800; }
.enemy-meta-sep { color: rgba(74,48,22,0.4); font-size: 11px; }
.enemy-meta-diff { font-weight: 800; }
.enemy-card-tactic,
.enemy-card-terrain-summary {
  width: 100%;
  padding: 3px 7px;
  border-radius: 5px;
  color: #3a2614;
  background: rgba(78, 55, 24, 0.09);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}
.enemy-card-tactic { margin-top: -2px; }
.enemy-card-info-label {
  color: #71451d;
  font-weight: 900;
  margin-right: 4px;
}
.enemy-card-desc {
  font-size: 11.5px; line-height: 1.5; color: #3a2614; font-weight: 600;
  text-align: center; letter-spacing: 0.1px;
  /* 浅色羊皮纸内的安全区：左右间距保持上一版（约 ≤15 中文字符/行），本轮只修竖向遮挡。
     §1.C 第二行下半被遮挡修复：
       · line-height 1.35→1.5 给descenders 净空；
       · padding-bottom + 明确 max-height（按 line-height×行数），overflow:hidden 不再切在字形中部；
       · position:relative + z-index 抬到按钮之上，避免被 footer/::after 盖住。 */
  width: 100%;
  max-width: min(calc(96% - 10px), 15em);
  margin-inline: auto;
  /* §1（本轮）描述整体再上移 5px，且加大底部净空，确保第二行底部 descenders 不被裁切。
     负 margin-top 只上移描述本身，不影响上方名字/难度/地形。 */
  margin-top: -5px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  text-overflow: clip;
  background: none;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  max-height: calc(1.5em * 4 + 8px);
  padding-bottom: 6px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}
.enemy-card-desc::before, .enemy-card-desc::after { content: none; }
.enemy-card-footer { padding: 4px var(--es-safe-x) var(--es-safe-bot); flex-shrink: 0; }
.enemy-card-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 54px; padding: 0 12px;
  font-family: var(--font); font-size: 14px; font-weight: 700; letter-spacing: 4px;
  color: #fff2c0;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 11px 26px;
  border-image-source: none;
  border-image-slice: 28 70 fill;
  border-image-width: 11px 26px;
  border-image-repeat: stretch;
  border-radius: 6px; cursor: pointer;
  filter: drop-shadow(0 0 8px rgba(200,168,75,0.3)); transition: transform .2s, filter .2s, letter-spacing .2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95);
}
.enemy-card-btn:hover { filter: brightness(1.08) drop-shadow(0 0 14px rgba(200,168,75,0.7)); transform: scale(1.04); letter-spacing: 5px; }
.enemy-card-btn:active { transform: scale(0.97); }

/* §4.3 Visual Guidance / §4.4 Golden Ratio / §7.2 White-box —
   战役单卡增加身份层级后使用独立安全区；保留战术与两种地形表达，不挤出底部边框。 */
.enemy-select-card--war {
  --es-safe-top: 16.5%;
  --es-safe-bot: 9.5%;
}
.enemy-select-card--war .enemy-card-body {
  /* §4.3 Visual Guidance / §6.4 Error Handling — 用布局内边距整体下移，
     避免 transform 造成内容与底部按钮视觉重叠。 */
  gap: 2px;
  padding: calc(var(--es-safe-top) + 10px) var(--es-safe-x) 2px;
}
.enemy-select-card--war .enemy-card-body > * { flex-shrink: 0; }
.enemy-select-card--war .enemy-card-icon {
  /* §4.1 Hick's Law / §4.3 Visual Guidance / §6.4 Error Handling —
     战场名已由页首标题表达；保留头像框与敌将名之间的稳定净空。 */
  margin-bottom: 8px;
}
.enemy-select-card--war .enemy-card-name {
  margin-top: 0;
  transform: none;
  font-size: 18px;
  line-height: 1.15;
}
.enemy-select-card--war .enemy-card-title {
  margin-top: 0;
  font-size: 9.5px;
  line-height: 1.15;
}
.enemy-select-card--war .enemy-card-meta {
  gap: 6px;
  padding: 2px 8px;
  font-size: 10.5px;
  line-height: 1.2;
}
.enemy-select-card--war .enemy-card-tactic,
.enemy-select-card--war .enemy-card-terrain-summary {
  /* §4.3 Visual Guidance / §4.4 Golden Ratio — 再次内缩到美术卡框的文字安全区，
     长文本自然换行，不能压住左右内边线。 */
  width: calc(100% - 28px);
  max-width: calc(100% - 28px);
  min-width: 0;
  margin-inline: auto;
  padding: 2px 5px;
  font-size: 9.5px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
.enemy-select-card--war .enemy-card-tactic { margin-top: 0; }
.enemy-select-card--war .enemy-card-terrain {
  gap: 1px;
  padding: 3px 5px;
}
.enemy-select-card--war .enemy-card-terrain-title { font-size: 9px; line-height: 1.15; }
.enemy-select-card--war .enemy-terrain-lane { gap: 0; }
.enemy-select-card--war .enemy-terrain-lane-label { font-size: 8px; line-height: 1.1; }
.enemy-select-card--war .enemy-terrain-lane-val { font-size: 9px; line-height: 1.15; }
.enemy-select-card--war .enemy-card-footer {
  padding: 2px var(--es-safe-x) var(--es-safe-bot);
}
.enemy-select-card--war .enemy-card-btn {
  min-height: 42px;
  border-width: 8px 22px;
  border-image-width: 8px 22px;
  font-size: 13px;
}

.btn-back { padding: 0; background: none; border: none; cursor: pointer; margin-top: 4px; }
.btn-back-inner {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 112px; min-height: 36px; padding: 6px 22px;
  font-family: var(--font); font-size: 13px; letter-spacing: 2px;
  color: var(--j3-silver-muted);
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 9px 18px;
  border-image-source: none;
  border-image-slice: 30 44 fill;
  border-image-width: 9px 18px;
  border-image-repeat: stretch;
  border-radius: 6px; transition: all .2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
.btn-back:hover .btn-back-inner {
  color: var(--j3-player-cyan-bright);
  filter: brightness(1.1) drop-shadow(0 0 8px var(--j3-player-cyan-soft));
}

/* 敌选 / 备战底部操作栏 */
.select-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap; margin-top: 4px;
}
.btn-prep .btn-prep-inner {
  color: var(--gold-lt);
}
.btn-prep:hover .btn-prep-inner {
  color: #fffbe0;
  filter: brightness(1.1) drop-shadow(0 0 8px rgba(200,168,75,0.4));
}

.terrain-info-panel {
  display: none !important;
}

/* §4.3 视觉引导 — 牌组多于 1 张时提示可一键清空（切换到退出/危险按钮皮肤） */
#btn-prep-clear.prep-clear-available .btn-back-inner {
  color: #ffd8a8;
  border-image-source: none;
  border-image-slice: 30 36 fill;
  filter: drop-shadow(0 0 8px rgba(255, 140, 60, 0.4));
  animation: prepClearPulse 2.2s ease-in-out infinite;
}
#btn-prep-clear.prep-clear-available:hover .btn-back-inner {
  color: #fff4e8;
  border-image-source: none;
  border-image-slice: 30 36 fill;
  filter: brightness(1.08) drop-shadow(0 0 12px rgba(255, 160, 80, 0.6));
  animation: none;
}
@keyframes prepClearPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 140, 60, 0.3)); }
  50% { filter: drop-shadow(0 0 12px rgba(255, 160, 80, 0.6)); }
}

/* 敌卡地形情报 */
.enemy-card-terrain {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 6px;
  background: rgba(40,26,10,0.10); border: 0;
}
.enemy-card-terrain-title {
  font-size: 10px; letter-spacing: 1px; color: rgba(74,48,22,0.85);
}
.enemy-terrain-inline {
  display: flex; width: 100%; justify-content: space-between; gap: 4px;
}
.enemy-terrain-lane {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.enemy-terrain-lane-label {
  font-size: 9px; letter-spacing: 0.5px; color: rgba(74,48,22,0.7);
}
.enemy-terrain-lane-val {
  font-size: 10px; font-weight: 800; color: #3a2614;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.enemy-terrain-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; letter-spacing: 0.5px;
}
.enemy-terrain-value { color: rgba(255,255,255,0.88); font-weight: 700; }

/* 备战界面 */
.deck-prep-content {
  /* §4.3 Visual Guidance / §4.4 Golden Ratio — 标题、摘要、推荐条与牌区拥有明确高度合同，
     推荐出现时只压缩可滚动牌区，不推动外框和底部操作栏。 */
  display: grid;
  grid-template-areas:
    "header"
    "status"
    "preview"
    "body";
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 6px;
  /* §4.4 Golden Ratio / §4.3 Visual Guidance — 加大左右安全区，让备战内容完整落在外层浮雕边框内。 */
  width: min(1260px, 100%);
  margin: 0 auto;
  align-items: stretch;
  justify-content: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  --prep-frame-safe-bottom: 82px;
  padding: 30px 76px var(--prep-frame-safe-bottom);
  border-radius: 10px;
  background-color: transparent;
  /* §2.3 Synergy & Theme / §4.3 Visual Guidance — 备战页使用专用面板图素，移除卡牌库框的左右长竖轨干扰。 */
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
.deck-prep-content > .select-header { grid-area: header; }
.prep-status {
  grid-area: status;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%;
  justify-self: center;
}
.prep-auto-preview { grid-area: preview; }
.prep-body {
  grid-area: body;
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  max-height: none;
}
.prep-pool-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  /* §4.3 Visual Guidance — 外层面板已提供框体，内层不再绘制左右线框，减少边缘重叠干扰。 */
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}
.prep-deck-panel {
  width: 258px;
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* §4.3 Visual Guidance — 同 pool 面板，去掉内层线框，让备战牌库落在外层边框安全区内。 */
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 12px 10px;
  box-shadow: none;
  overflow: hidden;
}
.prep-panel-title {
  font-size: 13px; font-weight: 700; letter-spacing: 3px;
  color: var(--j3-player-cyan); text-align: center;
  padding-bottom: 6px;
  border-bottom: 0;
}
.prep-pool-type-label { color: rgba(245, 225, 170, 0.82); }
.prep-deck-list-count {
  font-size: 15px; font-weight: 700; letter-spacing: 2px;
  color: rgba(255,255,255,0.75); text-align: center;
}
.prep-deck-list-count.prep-count-full { color: var(--j3-player-cyan-bright); }
.prep-deck-list-count.prep-count-warn { color: var(--j3-enemy-copper-bright); }
.prep-deck-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--j3-border-iron-strong) transparent;
  position: relative;
}
.prep-deck-list::-webkit-scrollbar { width: 5px; }
.prep-deck-list::-webkit-scrollbar-thumb { background: var(--j3-border-iron-strong); border-radius: 3px; }
.prep-deck-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px 12px;
  font-size: 12px; line-height: 1.7; letter-spacing: 1px;
  color: rgba(174,184,187,0.4);
}
.prep-deck-group {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  color: rgba(174,184,187,0.55);
  padding: 6px 4px 2px;
}
.prep-deck-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  background: rgba(20,28,45,0.65);
  border: 1px solid var(--j3-border-iron);
  transition: background .15s, border-color .15s;
}
.prep-deck-item:hover {
  background: rgba(30,40,65,0.85);
  border-color: rgba(174,184,187,0.28);
}
.prep-deck-item-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.prep-deck-item-name {
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.92);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prep-deck-item-meta {
  font-size: 10px; letter-spacing: 0.5px;
  color: rgba(174,184,187,0.5);
}
.prep-deck-item-count {
  font-size: 14px; font-weight: 900; color: var(--gold-lt);
  min-width: 28px; text-align: center;
}
.prep-deck-item-remove {
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 5px; border: 1px solid var(--j3-border-iron);
  background: rgba(10,14,24,0.8); color: var(--gold-lt);
  font-family: var(--font); font-size: 16px; font-weight: 700; line-height: 1;
  cursor: pointer; transition: all .15s;
}
.prep-deck-item-remove:hover {
  border-color: var(--gold); background: rgba(40,28,12,0.9);
}
.prep-deck-count {
  font-size: 22px; font-weight: 900; letter-spacing: 3px; color: var(--gold-lt);
}
.prep-deck-count.prep-count-full { color: var(--j3-player-cyan-bright); text-shadow: 0 0 12px var(--j3-player-cyan-soft); }
.prep-deck-count.prep-count-warn { color: var(--j3-enemy-copper-bright); text-shadow: 0 0 12px var(--j3-enemy-copper-soft); }
.prep-deck-tip {
  font-size: 12px; letter-spacing: 1px; color: rgba(174,184,187,0.45); text-align: center;
}
.prep-deck-summary {
  max-width: min(760px, 92vw);
  padding: 4px 10px;
  border: 1px solid var(--j3-border-iron);
  border-radius: 999px;
  background: rgba(5, 10, 24, 0.42);
  color: rgba(245,225,170,0.72);
  font-size: 12px;
  letter-spacing: 1px;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* §4.1 Hick's Law / §4.3 Visual Guidance — 宽屏将同层级牌组摘要并排，给完整卡牌行和内部滚动留出纵向空间。 */
@media (min-width: 1000px) {
  .deck-prep-content .prep-status {
    display: grid;
    grid-template-areas: "tip count summary";
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding-inline: 12px;
  }
  .deck-prep-content .prep-deck-count { grid-area: count; }
  .deck-prep-content .prep-deck-tip {
    grid-area: tip;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
  }
  .deck-prep-content .prep-deck-summary {
    grid-area: summary;
    width: 100%;
    max-width: none;
  }
}
.prep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  justify-items: center;
  justify-content: center;
  width: 100%;
  flex: 0 1 var(--prep-grid-window-height, 246px);
  height: var(--prep-grid-window-height, 246px);
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--j3-border-iron-strong) transparent;
}
/* §4.3 Visual Guidance — 兵种换组由下一组首卡换到第一列，避免空网格行重复叠加行距。 */
.prep-grid .prep-group-start { grid-column-start: 1; }
.prep-grid::-webkit-scrollbar { width: 6px; }
.prep-grid::-webkit-scrollbar-thumb { background: var(--j3-border-iron-strong); border-radius: 3px; }
/* §4.2 Fitts' Law / §4.3 Visual Guidance — 双向控制共享正式图素，并始终以真实滚动范围表达可用性。 */
.prep-pool-scroll-controls {
  width: 126px;
  min-height: 28px;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.prep-pool-scroll-button {
  width: 58px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  /* §4.2 Fitts' Law / §4.3 Visual Guidance — image2 正式图素把方向标与按钮表面合为同一视觉目标。 */
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.prep-pool-prev { background-image: none; }
.prep-pool-next { background-image: none; }
.prep-pool-scroll-button:hover:not(:disabled) { filter: brightness(1.12); }
.prep-pool-scroll-button:active:not(:disabled) { transform: translateY(1px); }
.prep-pool-scroll-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.65);
}
.prep-pool-scroll-button:focus-visible {
  outline: 2px solid #8fe6cf;
  outline-offset: 2px;
}

/* §4.3 Visual Guidance — 推荐条只收紧纵向留白，为一整行卡牌和跳组按钮让出空间。 */
.deck-prep-content.prep-auto-visible {
  gap: 2px;
  padding: 6px 76px var(--prep-frame-safe-bottom);
}
.deck-prep-content.prep-auto-visible .select-header { gap: 2px; }
.deck-prep-content.prep-auto-visible .prep-status { gap: 2px; }
.deck-prep-content.prep-auto-visible .prep-deck-summary { padding-block: 2px; }
.deck-prep-content.prep-auto-visible .prep-pool-panel,
.deck-prep-content.prep-auto-visible .prep-deck-panel { padding-block: 4px; }
.deck-prep-content.prep-auto-visible .prep-pool-panel { gap: 2px; }
.deck-prep-content.prep-auto-visible .prep-panel-title { padding-bottom: 0; }
.prep-card-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.prep-card-controls {
  display: flex; align-items: center; gap: 8px;
}
/* §10.2 备战卡池 +/- 为我方操作：青玉冷光 */
.prep-btn {
  width: 28px; height: 28px; border-radius: 6px;
  font-family: var(--font); font-size: 18px; font-weight: 700; line-height: 1;
  color: var(--j3-player-cyan-bright); background: var(--j3-panel-iron);
  border: 1px solid var(--j3-border-iron-strong); cursor: pointer;
  transition: all .18s;
}
.prep-btn:hover:not(:disabled) {
  border-color: var(--j3-player-cyan); background: var(--j3-bg-iron-2);
  box-shadow: 0 0 10px var(--j3-player-cyan-soft);
}
.prep-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.prep-btn.prep-btn-unavailable {
  opacity: 0.62;
  border-color: var(--j3-enemy-copper-soft);
  color: var(--j3-enemy-copper-bright);
}
.prep-btn.prep-btn-unavailable:hover:not(:disabled) {
  background: rgba(48,28,18,0.92);
  box-shadow: 0 0 10px var(--j3-enemy-copper-soft);
}
.prep-count {
  min-width: 36px; text-align: center;
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.9);
}
.prep-count.prep-count-maxed { color: #ffb347; }
.prep-actions { margin-top: 0; flex-shrink: 0; }

/* §4.1 Hick's Law / §4.3 Visual Guidance / §6.4 Error Handling — 目标选择与牌组预览分层，保存前始终可撤销。 */
#deck-prep-screen [hidden] { display: none !important; }
.prep-auto-preview {
  width: min(1020px, 100%);
  justify-self: center;
  max-height: 100px;
  padding: 4px 22px;
  /* §2.3 Synergy & Theme / §4.3 Visual Guidance — 推荐条沿用正式横向军令框九宫格，
     固定端饰与四角，仅拉伸中段；文字仍由 DOM 渲染。 */
  border-style: solid;
  border-color: transparent;
  border-width: 12px 28px;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
  border-image-slice: 46 96 fill;
  border-image-width: 12px 28px;
  border-image-repeat: stretch;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.44));
  color: rgba(245, 225, 170, 0.88);
  display: grid;
  grid-template-columns: minmax(180px, .75fr) minmax(280px, 1.4fr) minmax(330px, auto);
  grid-template-areas:
    "heading deltas actions"
    "explain explain actions";
  align-items: center;
  gap: 5px 14px;
}
.prep-auto-preview-heading {
  grid-area: heading;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.prep-auto-preview-heading strong { color: #fff2c0; font-size: 14px; letter-spacing: 1px; }
#prep-auto-preview-status { color: var(--j3-player-cyan-bright); font-size: 11px; }
.prep-auto-deltas {
  grid-area: deltas;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
  font-size: 10px;
  color: rgba(238, 222, 180, 0.76);
}
.prep-auto-deltas span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prep-auto-explanation {
  grid-area: explain;
  margin: 0;
  color: rgba(174, 225, 211, 0.82);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.prep-auto-preview-actions,
.prep-auto-target-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.prep-auto-preview-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, 1fr));
  gap: 6px;
}
.prep-auto-preview-actions .prep-auto-apply { grid-column: auto; }
.prep-auto-inline-btn {
  min-width: 104px;
  min-height: 32px;
  padding: 5px 12px;
  /* §4.2 Fitts' Law / §4.3 Visual Guidance — 配置流程按钮复用正式九宫格皮肤，
     禁用与焦点只改变真实图素的亮度和轮廓。 */
  border-style: solid;
  border-color: transparent;
  border-width: 8px 16px;
  border-image-source: none;
  border-image-slice: 30 44 fill;
  border-image-width: 8px 16px;
  border-image-repeat: stretch;
  border-radius: 6px;
  background: transparent;
  color: rgba(238, 222, 180, 0.88);
  font: 700 11px/1.2 var(--font);
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.45));
}
.prep-auto-inline-btn:hover:not(:disabled),
.prep-auto-inline-btn:focus-visible {
  color: #ffffff;
  filter: brightness(1.14) drop-shadow(0 0 9px var(--j3-player-cyan-soft));
}
.prep-auto-inline-btn:focus-visible { outline: 2px solid #8fe6cf; outline-offset: 2px; }
.prep-auto-inline-btn:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.65) brightness(.72); }
.prep-auto-inline-btn.prep-auto-apply {
  border-image-source: none;
  border-image-slice: 28 78 fill;
  border-image-width: 8px 18px;
  color: #fff2c0;
  background: transparent;
  filter: drop-shadow(0 0 7px var(--j3-gold-soft));
}
.prep-auto-target-layer {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 7, 13, 0.78);
  backdrop-filter: blur(5px);
}
.prep-auto-target-panel {
  width: min(1040px, 94vw);
  max-height: min(700px, 92vh);
  overflow: auto;
  padding: 20px 28px;
  /* §2.3 Synergy & Theme / §4.3 Visual Guidance — 弹层使用已验证的正式横向框九宫格，
     不用渐变矩形假扮 GUI 底板。 */
  border-style: solid;
  border-color: transparent;
  border-width: 26px 44px;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
  border-image-slice: 46 96 fill;
  border-image-width: 26px 44px;
  border-image-repeat: stretch;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 24px 44px rgba(0,0,0,.76));
}
.prep-auto-target-heading { text-align: center; }
.prep-auto-target-heading h3 {
  margin: 0;
  color: var(--gold-lt);
  font-size: 24px;
  letter-spacing: 5px;
}
.prep-auto-target-heading p {
  margin: 7px 0 16px;
  color: rgba(214, 216, 207, 0.64);
  font-size: 12px;
}
.prep-auto-target-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.prep-auto-target-option {
  min-height: 138px;
  padding: 8px 12px;
  border-style: solid;
  border-color: transparent;
  border-width: 12px 20px;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
  border-image-slice: 46 96 fill;
  border-image-width: 12px 20px;
  border-image-repeat: stretch;
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 225, 194, 0.86);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.45));
  transition: filter .18s, transform .18s;
}
.prep-auto-target-option:hover,
.prep-auto-target-option:focus-visible {
  filter: brightness(1.14) drop-shadow(0 0 10px var(--j3-player-cyan-soft));
  transform: translateY(-1px);
}
.prep-auto-target-option:focus-visible { outline: 2px solid #8fe6cf; outline-offset: 2px; }
.prep-auto-target-option.is-selected {
  box-shadow: none;
  background: transparent;
  filter: brightness(1.22) saturate(1.14) drop-shadow(0 0 14px rgba(94,216,190,.7));
}
.prep-auto-target-name { color: #fff2c0; font-size: 16px; font-weight: 900; letter-spacing: 2px; }
.prep-auto-target-difficulty { font-size: 11px; font-weight: 800; }
.prep-auto-target-tactic,
.prep-auto-target-terrain {
  color: rgba(215, 218, 208, 0.72);
  font-size: 11px;
  line-height: 1.4;
}
.prep-auto-target-terrain { color: rgba(174, 225, 211, 0.76); }
.prep-auto-target-actions { margin-top: 16px; }
#btn-prep-save:disabled { opacity: .38; cursor: not-allowed; filter: grayscale(.65); }

@media (max-width: 900px) {
  .prep-auto-target-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prep-auto-preview {
    grid-template-columns: 1fr auto;
    grid-template-areas: "heading actions" "deltas actions" "explain explain";
  }
}
@media (max-width: 600px) {
  .prep-auto-target-options { grid-template-columns: 1fr; }
  .prep-auto-preview {
    grid-template-columns: 1fr;
    grid-template-areas: "heading" "deltas" "explain" "actions";
  }
  .prep-auto-preview-actions { flex-direction: row; flex-wrap: wrap; }
}

/* §4.3 视觉引导 — 备战选牌：禁用发牌闪烁，改用飞入动画 */
#prep-grid .deck-preview-card {
  animation: none !important;
}
.prep-fly-ghost {
  position: fixed !important;
  z-index: 100000 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.65), 0 0 28px var(--j3-player-cyan-soft);
  will-change: transform, opacity;
  transform-origin: center center;
}
.prep-fly-ghost > .card {
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
  margin: 0 !important;
  animation: none !important;
  transition: none !important;
  cursor: default !important;
}
.select-actions { flex-shrink: 0; }

/* H5Host 小视口（1010×520）紧凑布局 */
@media (max-height: 560px) {
  .select-content { gap: 10px; }
  .select-content-main { gap: 8px; }
  .select-header { gap: 4px; }
  .select-title {
    font-size: clamp(18px, 4vw, 26px);
    letter-spacing: 3px;
  }
  .select-tip { font-size: 10px; letter-spacing: 1px; }
  .banner-top, .banner-bot { font-size: 11px; }
  .banner-line { width: 50px; }
  .enemy-selector-shell { --enemy-card-w: 236px; --enemy-card-gap: 8px; }
  .enemy-select-card {
    --es-safe-x: 13%;
    --es-safe-top: 13%;
    --es-safe-bot: 9%;
    aspect-ratio: 23 / 29;
  }
  /* §4.3 Visual Guidance / §7.2 White-box — 短屏仍须让整组战役信息落在顶部美术横边以下。 */
  .enemy-select-card--war { --es-safe-top: 18%; }
  .enemy-card-body { padding: var(--es-safe-top) var(--es-safe-x) 2px; gap: 2px; }
  .enemy-card-icon { width: 38px; height: 38px; font-size: 23px; transform: translateY(2px); }
  .enemy-card-name { margin-top: 0; transform: none; font-size: 14px; letter-spacing: 2px; }
  .enemy-card-title { font-size: 8px; }
  .enemy-card-meta { font-size: 9px; padding: 2px 5px; }
  .enemy-card-tactic,
  .enemy-card-terrain-summary {
    padding: 2px 5px;
    font-size: 8.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .enemy-card-terrain { gap: 1px; padding: 2px 4px; }
  .enemy-card-terrain-title { font-size: 8px; }
  .enemy-terrain-lane-label { font-size: 7px; }
  .enemy-terrain-lane-val { font-size: 8px; }
  .enemy-card-desc { font-size: 10px; -webkit-line-clamp: 2; }
  .enemy-card-footer { padding: 2px var(--es-safe-x) var(--es-safe-bot); }
  .enemy-card-btn { min-height: 38px; padding: 0; font-size: 11px; letter-spacing: 2px; border-width: 8px 18px; }
  .deck-prep-content { gap: 8px; }
  .prep-body { min-height: 0; max-height: none; gap: 10px; }
  .prep-deck-panel { width: 210px; }
  .prep-grid { max-height: none; }
  .main-title { letter-spacing: 8px; }
  .unit-icons { gap: 12px; margin-top: 0; }
  .unit-icon-item > :first-child { font-size: 22px; }
  .start-content { gap: 12px; }
  .tb-left, .tb-right { min-width: 0; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
  :root {
    --lane-w: 230px;
    --lane-h: 116px;
    --lane-panel-h: 148px;
    --oct-size: 92px;
    --card-w: 74px;
    --card-h: 102px;
    --hand-card-w: 94px;
    --hand-card-h: 122px;
    --j3-hud-panel-w: 234px;
    --j3-hud-panel-h: 62px;
  }
  .battle-lanes { gap: 8px; }
  .battle-column { gap: 4px; }
  :root { --bf-col-gap: 4px; }
  .terrain-octagon .t-icon { font-size: 18px; }
  .terrain-octagon .t-name { font-size: 11px; letter-spacing: 1px; }
  .terrain-octagon .t-hint { font-size: 8px; max-width: 76px; }
  .terrain-oct-total { width: 22px; height: 22px; font-size: 10px; }
  .terrain-octagon { padding: 4px 3px; }
  .battle-action-col { min-width: 72px; gap: 6px; }
  .btn-deploy-done { padding: 8px 8px; font-size: 12px; letter-spacing: 2px; }
  :root { --bf-rail-w: 116px; --bf-preview-actions-w: 276px; }
  #top-bar { min-height: 34px; padding: 2px 10px; }
  .hero-panel--inline { --hud-av: 40px; --hud-av-cx: 13%; --hud-content-near: 25%; }
  #top-bar .hero-name { font-size: 11px; letter-spacing: 1px; }
  #top-bar .hp-track { height: 10px; }
  #top-bar .hp-num { font-size: 12px; }
  #hand-panel { padding: 3px 10px 4px; gap: 2px; }
  #hand-cards { gap: 8px; }
  .hand-label, .hand-count { font-size: 10px; }
  .hand-hint { font-size: 9px; }
  .card { padding: 5px; }
}

@media (max-width: 900px) {
  .prep-body { flex-direction: column; max-height: none; }
  .prep-deck-panel { width: 100%; max-height: 220px; }
  .prep-pool-panel .prep-grid { max-height: min(48vh, 420px); flex: none; }
}

@media (max-width: 800px) {
  .enemy-selector-shell { --enemy-card-w: 250px; }
  .enemy-card-icon { width: 58px; height: 58px; font-size: 30px; }
  .enemy-card-name { font-size: 18px; letter-spacing: 3px; }
}
@media (max-width: 540px) {
  .enemy-selector-shell {
    --enemy-card-w: min(300px, calc(100vw - 124px));
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }
}

/* ════════════════════════════════════════════════
   游戏主界面 —— 全屏纵向 flex
════════════════════════════════════════════════ */
#game-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background-color: transparent;   /* §4.3 统一背景从 #global-bg-stage 透出 */
}
#game-screen > * {
  position: relative;
  z-index: 1;
}

/* ── 顶部栏 ── */
#top-bar {
  flex-shrink: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 7px 16px 6px;
  /* §4.3 战斗顶部 shell 作为背景层（不含文字/按钮逻辑），叠在弱底色上保证可读 */
  background-color: rgba(4, 10, 22, 0.88);
  border-bottom: 0;
  position: relative;
  overflow: visible;
  z-index: 30;
}
#top-bar::before,
#top-bar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: none;
  z-index: 0;
}
#top-bar::before {
  background-image: none;
  background-repeat: repeat-x;
  background-position: center;
  background-size: auto 100%;
}
#top-bar::after {
  background-image: none;
  background-repeat: no-repeat, no-repeat;
  background-position: left center, right center;
  background-size: auto 100%, auto 100%;
}
#top-bar > * {
  position: relative;
  z-index: 1;
}
.tb-left  { justify-self: start; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { justify-self: end; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-center { display: flex; flex-direction: column; align-items: center; gap: 0; justify-self: center; line-height: 1.2; }
.battle-tool-dock {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 31;
}
.battle-tool-dock .btn-sm {
  height: 30px;
  padding: 5px 10px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

/* §5.2 Advance Organizer — 地形情报常驻显示 */
.terrain-info {
  font-size: 11px; letter-spacing: 1.5px;
  color: rgba(174,184,187,0.6);
  white-space: nowrap;
  transition: opacity .4s;
}
.terrain-info:empty { display: none; }

.faction-tag { font-size: 12px; letter-spacing: 1px; padding: 2px 10px; border-radius: 4px; }
.enemy-tag { color: var(--red-lt); border: 1px solid var(--red); background: rgba(160,30,30,0.15); }
/* §4.4 Golden Ratio / §6.4 Error Handling — 阶段文案可静默，但槽位高度固定，结算切换不推动 HUD。 */
.phase-label {
  min-height: 12px;
  font-size: 10px;
  color: rgba(174,184,187,0.55);
  letter-spacing: 2px;
}
.phase-label:empty { visibility: hidden; }
#round-display {
  min-width: 178px;
  padding: 7px 30px;
  color: var(--gold-lt); font-size: 14px; letter-spacing: 2px; text-shadow: 0 0 8px var(--gold);
  background-image: url("../assets/ui/prep/dialog/frame_bottom.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  text-align: center;
}
#round-display strong { font-size: 18px; color: #fff; }
.resolution-info {
  display: none;
  max-width: min(620px, 58vw);
  margin-top: 2px;
  /* §4.3 战报统一使用 toast 框图素（9-slice，端饰固定、中段拉伸；透明角不渗矩形底） */
  padding: 6px 18px;
  border-style: solid;
  border-color: transparent;
  border-width: 14px 26px;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
  border-image-slice: 46 96 fill;
  border-image-width: 14px 26px;
  border-image-repeat: stretch;
  color: rgba(245,225,170,0.95);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 1px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 6px rgba(0,0,0,0.8);
}
.resolution-info.is-active {
  display: flex;
  /* §4.4 Golden Ratio / §6.4 Error Handling — 战报浮在 HUD 下缘，不参与顶部栏高度计算。 */
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  width: max-content;
  margin-top: 0;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.resolution-info-title {
  flex: 0 0 auto;
  color: var(--gold-lt);
  font-weight: 800;
  white-space: nowrap;
}
.resolution-info-detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resolution-info-title[hidden],
.resolution-info-detail[hidden] {
  display: none;
}
/* 战报配色：我方胜青绿/旧金、敌方胜赤铜暗红、平局银灰旧金（仅文字色，不加矩形底） */
.resolution-info.win  { color: #b8ffc8; }
.resolution-info.lose { color: #ffd0d0; }
.resolution-info.draw { color: #ffe6a8; }
.resolution-info.notice { color: #eadcff; }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 5px; letter-spacing: 1px; transition: all .18s; }
/* §五.4 HUD 次级按钮：玄铁青灰 + 青玉 hover（9-slice，端饰不拉伸） */
.btn-gray {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 8px 16px;
  border-image-source: none;
  border-image-slice: 30 44 fill;
  border-image-width: 8px 16px;
  border-image-repeat: stretch;
  color: var(--j3-silver-muted);
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
.btn-gray:hover { color: var(--j3-player-cyan-bright); filter: brightness(1.1) drop-shadow(0 0 7px var(--j3-player-cyan-soft)); }
.btn-red {
  /* §6.4 Error Handling - destructive exit action remains visually distinct while staying in the same ancient-war GUI set. */
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 8px 16px;
  border-image-source: none;
  border-image-slice: 30 36 fill;
  border-image-width: 8px 16px;
  border-image-repeat: stretch;
  color: #fff; font-weight: 700;
  filter: drop-shadow(0 0 7px var(--j3-enemy-copper-soft));
}
.btn-red:hover:not(:disabled) { filter: brightness(1.08) drop-shadow(0 0 12px var(--j3-enemy-copper-soft)); transform: scale(1.05); }
.btn-red:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── 敌方手牌展示条 ── */
#enemy-hand-bar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 4px 18px;
  background: rgba(6, 2, 14, 0.82);
  border-bottom: 1px solid rgba(180, 50, 40, 0.3);
  height: 60px;                 /* 固定高度，不随手牌数量变化 */
}
.ehand-label {
  font-size: 11px; color: rgba(220, 80, 60, 0.75);
  letter-spacing: 2px; white-space: nowrap; flex-shrink: 0;
}
#enemy-hand-cards {
  display: flex; gap: 4px; align-items: center;
  flex: 1; overflow: hidden;
  height: 100%;
}
.ehand-count {
  font-size: 11px; color: rgba(220, 80, 60, 0.6);
  letter-spacing: 1px; white-space: nowrap; flex-shrink: 0;
}
.ehand-count strong { color: #ff9090; }

/* 敌方手牌卡背（迷你） */
.mini-card-back {
  width: 32px; height: 44px; flex-shrink: 0;
  border-radius: 4px;
  background-color: rgba(22,10,8,0.96);
  background-image: url("../assets/card_art/full/official/card_back.png?v=cards-20260928-2");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  animation: dealIn .25s ease both;
}
.mini-card-back-tactic {
  background-image: url("../assets/card_art/full/official/card_back.png?v=cards-20260928-2");
}

/* ════════════════════════════════════════════════
   战场主体 —— flex:1，内容水平垂直居中
════════════════════════════════════════════════ */
#battlefield {
  flex: 1;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
  padding: 0;
}

/* §4.4 Golden Ratio — 左右对称留白 + 右侧操作列 */
.battlefield-shell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  gap: 0;
}
.bf-gutter {
  flex: 1 1 0;
  min-width: 0;
  max-width: calc(max(var(--bf-rail-w), var(--bf-preview-actions-w)) + 24px);
}
.bf-gutter-left { flex-shrink: 1; }
.bf-gutter-right {
  flex-shrink: 1;
}
.bf-main {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 1200px) {
  /* §4.4 Golden Ratio — 为加宽后的正式操作组让出右侧安全区，三路战区整体平移且保持原尺寸。 */
  .bf-main { transform: translateX(calc(var(--bf-rail-w) - var(--bf-preview-actions-w) - 12px)); }
}

/* §4.2 Fitts' Law / §4.4 Golden Ratio — 音效与退出共用战斗辅助操作组，
   组整体跟随部署轨左侧安全边，避免回到敌方头像或侵入第三战区。 */
.battle-utility-actions {
  position: absolute;
  top: 10px;
  right: 16px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.battle-quit-btn {
  position: static;
  transform: none;
  padding: 6px 10px !important;
  font-size: 11px !important;
  letter-spacing: 1px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

/* ════════════════════════════════════════════════
   英雄面板 —— 绝对定位钉死在战场四角
   !important 防止任何 JS inline style 覆盖
════════════════════════════════════════════════ */
.hero-panel {
  position: absolute !important;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  border-radius: var(--r);
  /* 移除 backdrop-filter:blur —— 英雄面板实际内联在不透明顶栏中，模糊近乎无视觉收益，
     却在 DX 端拖拽 / 重绘时持续做背景模糊采样，增加合成压力。详见
     docs/j3card_dx_regression_investigation.md §5.2 */
  z-index: 20;
  pointer-events: none;
}
.hero-panel--inline {
  position: relative !important;        /* 覆盖 .hero-panel 的 absolute!important；内层安全区绝对锚定在此 */
  width: var(--j3-hud-panel-w);
  height: var(--j3-hud-panel-h);
  box-sizing: border-box;
  padding: 0;
  pointer-events: none;
  /* HUD 安全区变量（clean 图素实测：圆槽居一侧，名字条在上、血条槽在下半区）。 */
  --hud-av: 52px;            /* 头像直径（贴合圆槽内径） */
  --hud-av-cx: 13%;          /* 头像圆槽中心（距对应外缘的水平位置） */
  --hud-content-near: 25%;   /* 内容区靠头像侧边界（名字条/血条凹槽起点） */
  --hud-content-far: 9%;     /* 内容区远头像侧边界（凹槽终点 ~91%） */
  /* 本轮微调：头像向中间靠 50px、上移 10px；名字向中间靠 30px（左右镜像各自处理）
     第四轮再微调：名字再向中间 +5px（→35）；头像再向外 10px（→40，我方左/敌方右） */
  --hud-avatar-shift: 40px;
  --hud-avatar-rise: 10px;
  --hud-name-shift: 35px;
  /* 敌方头像在圆槽内的净偏移：上一版 +15px 右 / +5px 下；本轮再左移 10px → 净 +5px 右（下移保持 5px）。 */
  --hud-enemy-avatar-offset-x: 5px;
  --hud-enemy-avatar-offset-y: 5px;
  /* 敌方姓名在上一版基础上再向中间（左）移 10px；仅敌方，我方镜像不引用。 */
  --hud-enemy-name-extra: 10px;
}
/* 头像落进图素圆槽：我方在左、敌方在右（向中间靠拢 + 上移，方向各自镜像） */
.hero-panel--inline .hero-avatar {
  position: absolute;
  top: 50%;
  margin: 0;
}
.player-panel .hero-avatar {
  left: var(--hud-av-cx);
  transform: translate(calc(-50% + var(--hud-avatar-shift)), calc(-50% - var(--hud-avatar-rise)));
}
.enemy-panel  .hero-avatar {
  left: auto; right: var(--hud-av-cx);
  /* 敌方头像在圆槽内再向右 +15px、向下 +5px（本轮微调，我方镜像不受影响） */
  transform: translate(
    calc(50% - var(--hud-avatar-shift) + var(--hud-enemy-avatar-offset-x)),
    calc(-50% - var(--hud-avatar-rise) + var(--hud-enemy-avatar-offset-y))
  );
}
/* 名字 + 血条内容区：占据图素槽位一侧的矩形空白；名字区向中间靠拢 */
.hero-panel--inline .hero-detail {
  position: absolute;
  top: 6px; bottom: 6px;
  display: flex; flex-direction: column;
  justify-content: center; gap: 3px;
}
.player-panel .hero-detail { left: calc(var(--hud-content-near) + var(--hud-name-shift)); right: var(--hud-content-far); align-items: flex-start; text-align: left; }
.enemy-panel  .hero-detail { right: calc(var(--hud-content-near) + var(--hud-name-shift) + var(--hud-enemy-name-extra)); left: var(--hud-content-far); align-items: flex-end; text-align: right; }
#top-bar #player-hero { gap: 0; }
#top-bar #enemy-hero {
  gap: 0;
  flex-direction: row;
  padding: 0;
}
#top-bar #enemy-hero .hero-detail {
  align-items: flex-end;
  text-align: right;
}
#top-bar #enemy-hero .hp-wrap {
  flex-direction: row-reverse;
}
/* 敌方剩余手牌角标：钉在右侧头像圆槽下沿，不覆盖头像主体 */
#top-bar #enemy-hero .enemy-deck-remain {
  position: absolute;
  right: 2px; bottom: 1px;
  border-left: 0; margin-left: 0; padding-left: 0;
  z-index: 2;
}

/* §4.2 Fitts' Law / §4.3 Visual Guidance - HD v2 clean HUD plates (520x140, ratio 3.714).
   player=青绿+左圆槽，enemy=赤红+右圆槽（已用 groove 配色核对，文件名一致）。 */
.player-panel {
  background-color: transparent;
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0;
}
.enemy-panel  {
  background-color: transparent;
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0;
}

.hero-avatar {
  width: var(--hud-av, 40px); height: var(--hud-av, 40px); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  /* 旧代码绘制头像圆圈（border / 背景 / 描边）移除：头像落入 HUD 图素自带圆槽 */
  border: 0;
  background: transparent;
  overflow: hidden;
}
/* 英雄头像图片 */
.hero-art-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  border-radius: 50%;
}
/* Emoji 兜底基类：只管「显示/隐藏 + 居中对齐意图」，不带尺寸/定位，
   避免卡牌与头像共用时互相误伤。具体定位分域写在下面两个子类里。
   onerror 时内联 display 由 none 改 flex。 */
.art-emoji-fallback {
  display: none;
  align-items: center; justify-content: center;
  line-height: 1;
  text-align: center;
  font-size: inherit;
  pointer-events: none;
}
/* 头像域：填满圆形头像并居中（.hero-avatar 有定值宽高 + flex 居中） */
.hero-avatar .avatar-emoji-fallback {
  width: 100%; height: 100%;
}
/* 卡牌域：填满 .card-art 区并居中（.card-art 有 flex:1 定值高度 + flex 居中） */
.card-art .card-emoji-fallback {
  width: 100%; height: 100%;
}

/* —— 个别 emoji 视觉中心微调（局部，只动 emoji 自身，不动容器/头像/图片）——
   🏇（horse-rider）字形略偏下。注意：战场小卡的"下移"主因已由顶部标签布局
   修复解决（见 .is-battle-card 区块），故这里只保留很轻的微调，避免叠加后偏上。
   仅作用于 .card-art 内带 adjust class 的 emoji，其它 emoji / 卡不受影响。
   详见 docs/j3card_card_emoji_audit.md */
.card-art .emoji-adjust-horse-rider {
  transform: translateY(-0.04em);
}
.lane-cards .card .card-art .emoji-adjust-horse-rider {
  transform: translateY(-0.06em);
}
/* 头像不再用代码圆圈背景；保留 emoji/图片本体，落入图素圆槽。颜色身份交给 HUD 图素。 */
.enemy-avatar  { border: 0; background: transparent; }
.player-avatar { border: 0; background: transparent; }

.hero-detail { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-panel--inline .hero-detail { width: auto; }
.hero-name { color: var(--gold-lt); font-size: 12px; font-weight: 700; letter-spacing: 2px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,0.95); }
.hero-title {
  max-width: 100%;
  overflow: hidden;
  color: rgba(238, 215, 164, 0.84);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95);
  white-space: nowrap;
}
.hp-wrap { display: flex; align-items: center; gap: 6px; width: 100%; }
/* HP 数字放在凹槽外侧，避免压住槽内填充；轨道占满内容区（已对齐凹槽） */
.player-panel .hp-wrap { flex-direction: row; }
.enemy-panel .hp-wrap { flex-direction: row-reverse; }
.hp-track {
  width: 100%; max-width: 100%; height: 13px;
  position: relative;
  background-color: rgba(0,0,0,0.45); border-radius: 6px; overflow: hidden;
  border: 0; flex: 1; min-width: 0;
  padding: 2px;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
/* HUD 图素自带血条凹槽，这里只保留 CSS 填充轨道，不再叠旧 hp_frame 描边（避免双层框）。 */
.hp-fill { height: 100%; border-radius: 6px; transition: width .65s cubic-bezier(.4,0,.2,1); position: relative; z-index: 1; }
/* §10.2/§10.3 我方血条青玉冷光，敌方血条赤铜战火 */
.player-fill { background: linear-gradient(90deg, #2c7d78, var(--j3-player-cyan)); }
.enemy-fill  { background: linear-gradient(90deg, #6a2415, var(--j3-enemy-copper-bright)); }
.hp-num { font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 0 6px #000; min-width: 22px; }

/* §4.3 视觉引导 — 敌方剩余手牌（钉在右侧头像槽下沿，见 #enemy-hero 绝对定位规则） */
.enemy-deck-remain {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.enemy-deck-icon {
  font-size: 15px;
  line-height: 1;
  opacity: 0.88;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}
.enemy-deck-num {
  font-size: 13px;
  font-weight: 700;
  color: #ffb39c;
  text-shadow: 0 0 6px rgba(0,0,0,0.9);
  min-width: 14px;
}
.num-tweening {
  animation: numPop .34s ease;
}
@keyframes numPop {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(1.22); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* ════════════════════════════════════════════════
   棋盘 —— 三路垂直列 + 右侧部署按钮
════════════════════════════════════════════════ */
#board.battle-board {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
  transform-origin: center center;
  gap: 10px;
}

/* §4.2 Fitts' Law — 部署按钮列绝对定位贴右，不参与三路战线居中（战线在 #board 内居中）。
   §4.C 本轮：整体再左移 10px（right 偏移 +10px），仍贴右安全区、不压战线。 */
.battle-deploy-rail {
  position: absolute;
  right: calc(-1 * (var(--bf-rail-w) + 12px) + 10px);
  top: calc(var(--lane-panel-h) + var(--bf-col-gap) + var(--oct-size) / 2);
  width: var(--bf-rail-w);
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.battle-deploy-rail .btn-deploy-done {
  width: 100%;
}
.btn-one-click-deploy {
  color: #d9fff3;
  border-image-source: none;
  filter: drop-shadow(0 0 9px rgba(74, 190, 164, 0.34));
  letter-spacing: 1px;
}
.btn-one-click-deploy:hover:not(:disabled) {
  filter: brightness(1.12) drop-shadow(0 0 14px rgba(74, 190, 164, 0.55));
}
.one-click-preview-actions {
  display: grid;
  width: 100%;
  align-self: center;
  justify-content: center;
  /* §4.2 Fitts' Law — 单一取消操作与主操作共用整条控制轨，紧凑视口也不会侵入战区。 */
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}
.one-click-preview-actions[hidden] { display: none; }
.one-click-preview-actions .btn-sm {
  min-width: 0;
  width: 100%;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 4px 9px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: .5px;
  white-space: nowrap;
}

/* §4.3 Visual Guidance / §6.4 Error Handling — 推荐、理由与只读落点始终可辨，且不伪装成已部署卡。 */
#hand-cards .card.one-click-recommended {
  outline: 2px solid rgba(92, 225, 190, 0.92);
  outline-offset: 2px;
  box-shadow: 0 0 20px rgba(54, 198, 164, 0.56), 0 4px 14px rgba(0,0,0,0.7);
}
.one-click-reasons {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.one-click-reason {
  padding: 1px 4px;
  border: 1px solid rgba(143, 239, 213, 0.7);
  border-radius: 8px;
  color: #eafff8;
  background: rgba(8, 42, 37, 0.9);
  font-size: 8px;
  line-height: 1.35;
  white-space: nowrap;
}

/* §4.2 Fitts' Law / §4.3 Visual Guidance — 右上安全区固定 44px 热区，图形状态不依赖颜色。 */
.hud-sfx-toggle {
  flex: 0 0 44px;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(216, 181, 91, 0.62);
  border-radius: 50%;
  background: rgba(5, 12, 22, 0.84);
  color: var(--gold-lt);
  cursor: pointer;
  transition: border-color .16s, background .16s, color .16s, box-shadow .16s;
}
.hud-sfx-toggle:hover {
  border-color: var(--gold-lt);
  background: rgba(35, 28, 16, 0.94);
  color: #fff6cf;
}
.hud-sfx-toggle:focus-visible {
  outline: 3px solid #fff0a8;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(5, 12, 22, 0.92), 0 0 14px rgba(216, 181, 91, 0.72);
}
.hud-sfx-toggle.is-hidden { display: none; }
.hud-sfx-icon {
  width: 25px;
  height: 25px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hud-sfx-speaker { fill: currentColor; stroke: currentColor; }
.hud-sfx-wave,
.hud-sfx-slash { transition: opacity .16s; }
.hud-sfx-toggle.is-muted { color: #aeb8bb; }
.hud-sfx-toggle.is-muted .hud-sfx-wave { opacity: 0; }
.hud-sfx-toggle:not(.is-muted) .hud-sfx-slash { opacity: 0; }
@media (max-height: 560px) {
  .battle-utility-actions { top: 8px; right: 10px; }
  .battle-quit-btn { padding: 5px 8px !important; font-size: 10px !important; }
  .one-click-preview-actions { grid-template-columns: minmax(0, 1fr); }
  .one-click-preview-actions .btn-sm {
    height: 53px;
    min-height: 53px;
    max-height: 53px;
    padding: 7px 14px;
    font-size: 17px;
  }
}
.one-click-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 14;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 184, 154, 0.85);
  border-radius: 50%;
  color: #fff4ea;
  background: rgba(92, 29, 18, 0.92);
  font: 700 15px/22px inherit;
  cursor: pointer;
}
.one-click-remove:focus-visible {
  outline: 2px solid #fff2b0;
  outline-offset: 2px;
}
.one-click-preview-slot {
  position: relative;
  opacity: .72;
  outline: 2px dashed rgba(103, 230, 198, 0.9);
  outline-offset: -3px;
  filter: saturate(.75) brightness(.9);
  pointer-events: none;
}
.one-click-preview-slot::before {
  content: '预览';
  position: absolute;
  top: 4px;
  left: 50%;
  z-index: 13;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 8px;
  color: #eafff8;
  background: rgba(8, 42, 37, 0.9);
  font-size: 8px;
  white-space: nowrap;
}
.one-click-flight {
  position: fixed !important;
  z-index: 10010 !important;
  margin: 0 !important;
  pointer-events: none !important;
  box-shadow: 0 7px 24px rgba(0,0,0,0.64) !important;
  filter: none !important;
  will-change: transform, opacity;
}
.one-click-flight::before,
.one-click-flight::after { display: none !important; }
body[data-one-click-deploy="animating"] { cursor: progress; }

/* §4.3 视觉引导 — 动画裁剪：不超出三路战线上下边界 */
.battle-anim-clip {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.battle-lanes {
  display: grid;
  grid-template-columns: repeat(3, var(--lane-w));
  gap: 14px;
}

.battle-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--bf-col-gap);
  width: var(--lane-w);
}

/* ── 八边形地形（居中一行视觉锚点） ── */
.terrain-octagon {
  position: relative;
  width: var(--oct-size);
  height: var(--oct-size);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px;
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  overflow: hidden;
  background: rgba(18, 25, 29, 0.92);
  border: none;
  box-shadow:
    inset 0 0 0 2px var(--j3-border-iron-strong),
    0 0 16px rgba(0, 0, 0, 0.55);
  transition: background .4s, box-shadow .4s;
}
.terrain-octagon::before {
  content: '';
  position: absolute;
  top: 3px; right: 3px; bottom: 3px; left: 3px;
  clip-path: inherit;
  background: linear-gradient(160deg, rgba(255,255,255,0.08), transparent 55%);
  pointer-events: none;
  z-index: 4;
}
/* §4.3 Visual Guidance — Batch 1 沙盘地形图素分层，旧渐变/emoji 保留为资源失败 fallback。 */
.terrain-base-layer,
.terrain-effect-layer,
.terrain-frame-layer {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  clip-path: inherit;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  pointer-events: none;
}
.terrain-base-layer {
  z-index: 1;
}
.terrain-effect-layer {
  z-index: 2;
  opacity: .5;
  background-size: 145% 145%;
  mix-blend-mode: screen;
}
.terrain-frame-layer {
  z-index: 5;
  background-image: none;
  background-size: contain;
}
.terrain-html-layer {
  position: relative;
  z-index: 8;
}
.terrain-asset-fallback .terrain-base-layer,
.terrain-asset-fallback .terrain-effect-layer,
.terrain-asset-fallback .terrain-frame-layer {
  display: none;
}
.terrain-has-effect .terrain-effect-layer {
  animation: terrainEffectDrift 7s ease-in-out infinite alternate;
}
/* §4.3 / §5.3 — 参考 Batch1 预览页：平原风、水域涟漪、焦土热浪，仅 transform/opacity */
.terrain-has-effect[data-terrain="plains"] .terrain-effect-layer {
  animation: terrainWindDrift 4.8s ease-in-out infinite alternate;
}
.terrain-has-effect[data-terrain="water"] .terrain-effect-layer {
  animation: terrainWaterRipple 4.6s ease-in-out infinite alternate;
}
.terrain-has-effect[data-terrain="scorched"] .terrain-effect-layer {
  animation: terrainHeatFlicker 4.2s ease-in-out infinite alternate;
}
html.low-power .terrain-effect-layer {
  display: none;
  animation: none;
}
@keyframes terrainEffectDrift {
  from { transform: translate3d(-3%, -1%, 0); opacity: .34; }
  50% { opacity: .52; }
  to { transform: translate3d(3%, 1%, 0); opacity: .38; }
}
@keyframes terrainWindDrift {
  from { transform: translate3d(-6%, 0, 0); opacity: .34; }
  50% { opacity: .54; }
  to { transform: translate3d(6%, 0, 0); opacity: .34; }
}
@keyframes terrainWaterRipple {
  from { transform: translate3d(-5%, -3%, 0); opacity: .38; }
  50% { opacity: .60; }
  to { transform: translate3d(5%, 3%, 0); opacity: .38; }
}
@keyframes terrainHeatFlicker {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: .34; }
  45% { transform: translate3d(1%, -1%, 0) scale(1.015); opacity: .58; }
  100% { transform: translate3d(-1%, 1%, 0) scale(1); opacity: .40; }
}
@media (prefers-reduced-motion: reduce) {
  .terrain-effect-layer {
    animation: none !important;
  }
}
.terrain-oct-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 1px 8px;
  text-align: center;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* 旧半透明药丸底已移除：地形识别交给 base 图素 + 文字 */
  background: transparent;
}
/* §4.3 Visual Guidance — 战斗地形八边形不再显示 emoji / 图标，地形由 base 图素承担 */
.terrain-octagon .t-icon {
  display: none !important;
}
.terrain-octagon .t-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #f6f1df;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.88), 0 0 12px rgba(0,0,0,0.72);
}
.terrain-octagon .t-hint {
  font-size: 8px;
  line-height: 1.25;
  letter-spacing: 0.5px;
  color: #e8e0c0;
  max-width: 88px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 7px rgba(0,0,0,0.85);
}
.terrain-oct-total {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: 800;
  /* 旧半透明圆圈底 + 边框已移除：数值仅用 text-shadow 托底 */
  background: transparent;
  border: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.98), 0 0 6px rgba(0,0,0,0.92), 0 0 12px rgba(0,0,0,0.7);
}
.terrain-oct-total.enemy-total { margin-top: 0; }
.terrain-oct-total.player-total { margin-bottom: 0; }
/* 八边形内的数值不再画圆圈：覆盖 .lane-total / *-total 的圆形底 + 边框，仅保留配色 + text-shadow */
.terrain-oct-total.lane-total,
.terrain-oct-total.player-total,
.terrain-oct-total.enemy-total {
  width: 24px; height: 24px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.terrain-oct-total.player-total { color: var(--j3-player-cyan-bright); }
.terrain-oct-total.enemy-total { color: #ffb39c; }

/* 图素正常时，base 层（z-index1, inset0, cover）已覆盖八边形自身底色；
   这里再移除 ::before 高光，避免压住地形纹理。fallback（无图素）时保留旧渐变。 */
.terrain-octagon.terrain-assets-enabled { box-shadow: 0 0 12px rgba(0,0,0,0.5); }
.terrain-octagon.terrain-assets-enabled::before { display: none; }

[data-terrain="plains"]    .terrain-octagon { background: linear-gradient(155deg, rgba(45,95,18,0.95), rgba(22,48,8,0.92)); box-shadow: inset 0 0 0 2px rgba(120,200,50,0.6), 0 0 14px rgba(60,130,20,0.35); }
[data-terrain="mountains"] .terrain-octagon { background: linear-gradient(155deg, rgba(85,55,22,0.95), rgba(42,28,10,0.92)); box-shadow: inset 0 0 0 2px rgba(165,120,58,0.6), 0 0 14px rgba(100,68,28,0.35); }
[data-terrain="city"]      .terrain-octagon { background: linear-gradient(155deg, rgba(75,48,22,0.95), rgba(38,24,10,0.92)); box-shadow: inset 0 0 0 2px rgba(180,130,60,0.6), 0 0 14px rgba(90,60,25,0.35); }
[data-terrain="water"]     .terrain-octagon { background: linear-gradient(155deg, rgba(12,48,130,0.95), rgba(6,24,68,0.92)); box-shadow: inset 0 0 0 2px rgba(48,105,225,0.6), 0 0 14px rgba(14,58,155,0.35); }
[data-terrain="scorched"]  .terrain-octagon { background: linear-gradient(155deg, rgba(110,38,10,0.95), rgba(55,18,5,0.92)); box-shadow: inset 0 0 0 2px rgba(200,80,20,0.6), 0 0 14px rgba(130,45,12,0.35); }
/* 图素正常时覆盖上面的 fallback 渐变阴影（base 层已遮住底色，仅去掉内描边光晕） */
[data-terrain="plains"]    .terrain-octagon.terrain-assets-enabled,
[data-terrain="mountains"] .terrain-octagon.terrain-assets-enabled,
[data-terrain="city"]      .terrain-octagon.terrain-assets-enabled,
[data-terrain="water"]     .terrain-octagon.terrain-assets-enabled,
[data-terrain="scorched"]  .terrain-octagon.terrain-assets-enabled { box-shadow: 0 0 12px rgba(0,0,0,0.5); }

/* §4.2 Fitts' Law — 部署完毕按钮（维持图素 ~3.56:1 比例，不竖向压扁） */
.btn-deploy-done {
  pointer-events: auto;
  width: 100%;
  min-width: 0;
  aspect-ratio: 512 / 144;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border-style: solid;
  border-color: transparent;
  border-width: 11px 22px;
  color: #fff2c0;
  background: transparent;
  border-image-source: none;
  border-image-slice: 28 70 fill;
  border-image-width: 11px 22px;
  border-image-repeat: stretch;
  filter: drop-shadow(0 0 10px rgba(200,168,75,0.38));
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 10px rgba(0,0,0,0.85);
  cursor: pointer;
  transition: transform .18s, opacity .18s, filter .18s;
  font-family: inherit;
}
.btn-deploy-done:hover:not(:disabled) {
  transform: scale(1.04);
  filter: brightness(1.1) drop-shadow(0 0 16px rgba(200,168,75,0.62));
}
.btn-deploy-done:disabled {
  opacity: .38;
  filter: grayscale(.25) brightness(.75);
  cursor: not-allowed;
  transform: none;
}
.btn-deploy-done.is-resolving {
  color: rgba(255,235,180,0.86);
  filter: grayscale(.15) brightness(.92);
  opacity: .62;
}

/* 旧布局兼容（保留 selector 供动画等引用） */
#board:not(.battle-board) {
  width: calc(var(--lane-w) * 3 + 24px);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.board-row {
  display: grid;
  grid-template-columns: repeat(3, var(--lane-w));
  gap: 12px;
}

/* 分隔线 */
#divider {
  height: 26px; flex-shrink: 0;
  display: flex; align-items: center;
}
.divider-inner { display: flex; align-items: center; width: 100%; gap: 12px; }
.divider-line {
  flex: 1; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dk), var(--gold), var(--gold-dk), transparent);
}
.divider-text {
  color: var(--gold); font-size: 12px; letter-spacing: 5px;
  text-shadow: 0 0 10px var(--gold); white-space: nowrap;
}

/* ════════════════════════════════════════════════
   路区格子 —— 固定宽高
════════════════════════════════════════════════ */
.lane {
  width:  var(--lane-w);
  height: var(--lane-h);
  flex-shrink: 0;
  border-radius: var(--r);
  padding: 6px;
  display: flex; flex-direction: column;
  gap: 3px;
  overflow: hidden;
  position: relative;
  transition: box-shadow .18s, border-color .18s, transform .15s, background .4s;
}
.battle-column .lane {
  height: var(--lane-panel-h);
  min-height: 118px;
  border: 0;
  border-style: solid;
  border-width: 0;
  padding: 16px 18px;
  /* §4.3 Visual Guidance / §5.3 Environmental Storytelling - v3 地形战区框为主视觉，
     按列 data-terrain 切换；图素铺满容器，卡牌层在其上。 */
  background-color: transparent;
  background-image: var(--lane-skin, none);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
/* 旧 v2 战区底图 / 半透明地形色块不再作为主视觉；改由 v3 图素表达地形。 */
.enemy-lane,
.player-lane {
  background-color: transparent;
  border-color: transparent;
}

/* ── 五种地形 → v3 战区图素映射（CSS 变量驱动，纯表现层，不改规则） ── */
.battle-column[data-terrain="plains"]    .lane { --lane-skin: none; }
.battle-column[data-terrain="mountains"] .lane { --lane-skin: none; }
.battle-column[data-terrain="water"]     .lane { --lane-skin: none; }
.battle-column[data-terrain="city"]      .lane { --lane-skin: none; }
.battle-column[data-terrain="scorched"]  .lane { --lane-skin: none; }

/* 旧布局 lane 地形映射（兼容 #board:not(.battle-board)） */
.lane[data-terrain="plains"]    { --lane-skin: none; border-color: transparent !important; }
.lane[data-terrain="mountains"] { --lane-skin: none; border-color: transparent !important; }
.lane[data-terrain="city"]      { --lane-skin: none; border-color: transparent !important; }
.lane[data-terrain="water"]     { --lane-skin: none; border-color: transparent !important; }
.lane[data-terrain="scorched"]  { --lane-skin: none; border-color: transparent !important; }

/* 卡牌层在战区图素之上，图素不拦截交互 */
.lane-cards { position: relative; z-index: 2; }

/* 高亮状态 — §10.2 我方可投放：青玉冷光（仅弱 outline + inset glow，不盖 v3 图素、不外渗矩形） */
.player-lane.can-drop {
  outline: 1px solid var(--j3-player-cyan);
  outline-offset: -6px;
  box-shadow: inset 0 0 18px var(--j3-player-cyan-faint);
  cursor: pointer;
}
.player-lane.drag-over {
  outline: 2px solid var(--j3-player-cyan-bright);
  outline-offset: -6px;
  box-shadow: inset 0 0 26px var(--j3-player-cyan-soft);
  transform: scale(1.015);
}

/* ── 地形条 ── */
.terrain-strip {
  flex-shrink: 0;
  height: 22px;
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  border-radius: 4px 4px 0 0;   /* 贴顶时圆角在上 */
  font-size: 11px; letter-spacing: 1px;
  padding: 0 6px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: background .4s, color .4s;
}
/* player-lane 的 terrain-strip 在视觉底部，圆角在下 */
.player-lane .terrain-strip {
  border-radius: 0 0 4px 4px;
  border-bottom: none;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.t-icon { font-size: 13px; line-height: 1; display: flex; align-items: center; }
.t-name { font-weight: 700; letter-spacing: 2px; }
.t-mod  { font-size: 10px; opacity: .75; margin-left: 2px; }

/* 地形条颜色 */
[data-terrain="plains"]    .terrain-strip { background: rgba(60,130,20,0.55); color: #b0f060; border-color: rgba(120,200,50,0.4); }
[data-terrain="mountains"] .terrain-strip { background: rgba(100,68,28,0.60); color: #e0b878; border-color: rgba(170,128,65,0.4); }
[data-terrain="city"]      .terrain-strip { background: rgba(90,60,25,0.60);  color: #e8c878; border-color: rgba(185,135,65,0.4); }
[data-terrain="water"]     .terrain-strip { background: rgba(14,58,155,0.60); color: #78c8ff; border-color: rgba(48,105,225,0.4); }
[data-terrain="scorched"]  .terrain-strip { background: rgba(130,45,12,0.60); color: #ff9050; border-color: rgba(210,85,25,0.4); }

/* 路名 + 点数 header */
.lane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px; flex-shrink: 0;
  height: 36px;
}
.lane-name { font-size: 12px; color: rgba(174,184,187,0.55); letter-spacing: 2px; }
.lane-total {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; border: 2px solid; flex-shrink: 0;
}
.player-total { color: var(--j3-player-cyan-bright); border-color: #2c7d78; background: rgba(20,55,72,0.6); }
.enemy-total  { color: #ffb39c; border-color: var(--j3-enemy-copper); background: rgba(110,40,28,0.6); }
.lane-total-bump { animation: laneTotalBump .36s ease; }
/* §10.2 部署预览为我方操作：青玉冷光 */
.lane-total-preview {
  color: var(--j3-player-cyan-bright) !important;
  border-color: var(--j3-player-cyan) !important;
  box-shadow: 0 0 14px var(--j3-player-cyan-soft);
  opacity: 0.92;
}
.lane-total-clash {
  animation: laneTotalClash .48s ease-in-out infinite alternate;
  box-shadow: 0 0 16px rgba(255,240,180,0.55);
}
@keyframes laneTotalBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes laneTotalClash {
  from { transform: scale(1); filter: brightness(1); }
  to   { transform: scale(1.12); filter: brightness(1.35); }
}

/* 卡牌区 */
.lane-cards {
  flex: 1; min-height: 0;
  display: flex; flex-wrap: nowrap;
  gap: 6px;
  align-content: center; justify-content: center; align-items: center;
  overflow: hidden; padding: 3px;
}

/* ════════════════════════════════════════════════
   手牌区
════════════════════════════════════════════════ */
#hand-panel {
  flex-shrink: 0;
  /* §4.3 底部手牌区 shell 作为背景层（手牌内容在其上），叠在弱底色上 */
  background-color: rgba(4, 8, 18, 0.95);
  border-top: 1px solid var(--j3-border-iron-strong);
  padding: 6px 14px 7px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: visible;
}
#hand-panel::before,
#hand-panel::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: none;
  z-index: 0;
}
#hand-panel::before {
  background-image: none;
  background-repeat: repeat-x;
  background-position: center;
  background-size: auto 100%;
}
#hand-panel::after {
  background-image: none;
  background-repeat: no-repeat, no-repeat;
  background-position: left center, right center;
  background-size: auto 100%, auto 100%;
}
#hand-panel > * {
  position: relative;
  z-index: 1;
}
.hand-bar { display: flex; align-items: center; justify-content: space-between; min-height: 18px; }
.hand-label  { font-size: 11px; color: rgba(174,184,187,0.65); letter-spacing: 1px; }
.hand-hint   { font-size: 10px; color: rgba(174,184,187,0.38); letter-spacing: 1px; }
.hand-count  { font-size: 11px; color: rgba(174,184,187,0.5); }
.hand-count strong { color: var(--gold-lt); }

#hand-cards {
  display: flex; gap: 9px; justify-content: center;
  overflow-x: auto; padding: 4px 0 3px;
  scrollbar-width: none;
  min-height: var(--hand-card-h);
  align-items: center;
}
#hand-cards::-webkit-scrollbar { display: none; }

/* ════════════════════════════════════════════════
   卡牌 —— 战场格内固定尺寸
════════════════════════════════════════════════ */
.card {
  /* 默认：手牌尺寸 */
  width: var(--hand-card-w);
  height: var(--hand-card-h);
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 9px 8px 8px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform .14s, box-shadow .14s, filter .14s;
  box-shadow: 0 3px 14px rgba(0,0,0,0.7);
  --j3-card-frame-image: none;
}

/* 战场上的卡牌：使用 CSS 变量，不依赖父容器动态高度 */
.lane-cards .card {
  width:  var(--card-w);
  height: var(--card-h);
  padding: 7px 6px 6px;
  cursor: default;
}

/* 内光 */
.card::before {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 9px;
  background: linear-gradient(150deg, rgba(255,255,255,0.13) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}

/* 军种配色 */
.card[data-type="infantry"]{ background:linear-gradient(155deg,#1b3d1b,#0c1e0c); border:1px solid #4e8e4e; }
.card[data-type="cavalry"] { background:linear-gradient(155deg,#2c1b3e,#120d1e); border:1px solid #7e4ec0; }
.card[data-type="archer"]  { background:linear-gradient(155deg,#2e2210,#1a140a); border:1px solid #b88430; }
.card[data-type="cannon"]  { background:linear-gradient(155deg,#3c1010,#1c0808); border:1px solid #cc4444; }
.card[data-type="navy"]    { background:linear-gradient(155deg,#0e2234,#080f1c); border:1px solid #2888cc; }
.card[data-type="siege"]   { background:linear-gradient(155deg,#221c10,#100e08); border:1px solid #9a6432; }
.card[data-type="tactic"]  { background:linear-gradient(155deg,#1a1028,#2d1f4e); border:1px solid var(--j3-tactic-violet); }
.card[data-type="tactic"]::after {
  content:''; position:absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius:7px;
  background:radial-gradient(ellipse 60% 40% at 50% 80%, rgba(139,92,246,0.15), transparent);
  pointer-events:none;
}

/* §2.3 Synergy & Theme / §4.3 Visual Guidance - Batch 3 image2 hand card frames replace plain color blocks while keeping HTML content readable. */
.card:not(.card-back) {
  background-color: rgba(10, 14, 18, 0.92);
  background-image: var(--j3-card-frame-image);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0;
}
.card[data-type="tactic"] {
  --j3-card-frame-image: none;
}
.card.dual-type:not([data-type="tactic"]) {
  --j3-card-frame-image: none;
}
.lane-cards .card:not(.card-back) {
  --j3-card-frame-image: none;
}
.enemy-lane .card:not(.card-back) {
  --j3-card-frame-image: none;
}
.lane-cards .card[data-type="tactic"]:not(.card-back) {
  --j3-card-frame-image: none;
}

.card-rarity-2 {
  box-shadow: 0 3px 14px rgba(0,0,0,0.7), inset 0 0 10px rgba(200,168,75,0.12);
}
.card-rarity-3 {
  box-shadow: 0 3px 14px rgba(0,0,0,0.7), 0 0 12px rgba(240,212,138,0.22), inset 0 0 14px rgba(240,212,138,0.18);
}
.card-rarity-3 .card-star {
  color: #ffe8a0;
  text-shadow: 0 0 8px rgba(255,220,120,0.95);
  animation: starShine 1.8s ease-in-out infinite alternate;
}
@keyframes starShine {
  from { filter: brightness(0.95); }
  to   { filter: brightness(1.45); }
}

.card-effect-fire_attack,
.card-effect-scorched_earth {
  border-color: rgba(255,120,40,0.75) !important;
  box-shadow: 0 0 16px rgba(255,90,20,0.25), 0 3px 14px rgba(0,0,0,0.7);
}
.card-effect-shield_wall {
  border-color: rgba(110,180,255,0.78) !important;
  box-shadow: 0 0 16px rgba(80,160,255,0.28), 0 3px 14px rgba(0,0,0,0.7);
}
.card-effect-counter_intel,
.card-effect-intimidate {
  border-color: rgba(190,130,255,0.82) !important;
  box-shadow: 0 0 18px rgba(150,80,255,0.3), 0 3px 14px rgba(0,0,0,0.7);
}
.card-effect-double_win,
.card-effect-swift_strike {
  border-color: rgba(255,220,100,0.82) !important;
  box-shadow: 0 0 18px rgba(255,210,80,0.28), 0 3px 14px rgba(0,0,0,0.7);
}

/* §4.3 视觉引导 — 高星/强战术卡斜切流光（伪元素，不扭曲文字） */
.card-rarity-3:not([data-type="tactic"])::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 7px;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255,230,150,0.34) 50%, transparent 62%);
  animation: cardSkewSheen 2.4s ease-in-out infinite;
}
.card[data-type="tactic"].card-effect-fire_attack::after,
.card[data-type="tactic"].card-effect-scorched_earth::after {
  background:
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(139,92,246,0.15), transparent),
    linear-gradient(115deg, transparent 35%, rgba(255,120,40,0.42) 50%, transparent 65%);
  animation: cardSkewSheen 2s ease-in-out infinite;
}
.card[data-type="tactic"].card-effect-shield_wall::after {
  background:
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(139,92,246,0.15), transparent),
    linear-gradient(115deg, transparent 35%, rgba(110,180,255,0.42) 50%, transparent 65%);
  animation: cardSkewSheen 2.1s ease-in-out infinite;
}
.card[data-type="tactic"].card-effect-counter_intel::after,
.card[data-type="tactic"].card-effect-intimidate::after {
  background:
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(139,92,246,0.15), transparent),
    linear-gradient(115deg, transparent 35%, rgba(190,130,255,0.45) 50%, transparent 65%);
  animation: cardSkewSheen 1.9s ease-in-out infinite;
}
.card[data-type="tactic"].card-effect-double_win::after,
.card[data-type="tactic"].card-effect-swift_strike::after {
  background:
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(139,92,246,0.15), transparent),
    linear-gradient(115deg, transparent 35%, rgba(255,220,100,0.42) 50%, transparent 65%);
  animation: cardSkewSheen 1.8s ease-in-out infinite;
}
@keyframes cardSkewSheen {
  0%, 100% { transform: translateX(-125%) skewX(-18deg); opacity: 0; }
  18% { opacity: 1; }
  50% { transform: translateX(125%) skewX(-18deg); opacity: 1; }
  68% { opacity: 0; }
}

/* 卡背 */
.card.card-back {
  background-color: rgba(22,10,8,0.96);
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0; cursor: default;
  justify-content: center;
}
.card.card-back.card-back-tactic {
  background-image: none;
}
.card.card-back .card-art {
  display: none;
}

.card-row-top {
  width: 100%; display: flex; justify-content: space-between; align-items: flex-start;
  position: relative; z-index: 1;
}
.card-badge {
  min-width: 34px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px; padding: 2px 7px; border-radius: 3px;
  background-color: rgba(0,0,0,0.35);
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  color: rgba(255,255,255,0.86); letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
.badge-tactic {
  color: #d9c8ff;
}
.card-badge.badge-dual {
  background-image: none;
}
.card-effect-icon {
  font-size: 18px; line-height: 1;
  filter: drop-shadow(0 0 4px rgba(139,92,246,0.8));
}
/* §6 战术卡右下角闪电 emoji 去掉：战术卡已用背景图+文字层表达，右下角 ⚡ 冗余。
   仅隐藏视觉（DOM/数据/战术效果逻辑不变）；不影响兵种卡右下角战力数值(.card-atk)。 */
.card[data-type="tactic"] .card-effect-icon {
  display: none !important;
}
.lane-cards .card .card-effect-icon { font-size: 14px; }
.card-row-bot-tactic { align-items: center; }

/* 战术卡主体：emoji + 效果描述 */
.card-tactic-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 0 4px;
  position: relative; z-index: 1;
  overflow: hidden;
}
/* §6.3 战术卡三层：背景图 → 文字遮罩 → 文本层。背景/遮罩不拦截交互。 */
.card-art-bg {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  border-radius: 7px;
  pointer-events: none;
}
.card-tactic-text-overlay {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 1;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  border-radius: 7px;
  pointer-events: none;
}
.card.has-tactic-art .card-text-layer { position: relative; z-index: 2; }
/* 有战术背景图时，不再叠 CSS 渐变底，避免压死背景 */
.card.has-tactic-art[data-type="tactic"]::after { display: none; }
.card.has-tactic-art .card-tactic-desc { color: #fff3d6; }
.card-tactic-emoji {
  font-size: 32px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.85));
}
.card-tactic-desc {
  font-size: 12px; line-height: 1.4;
  color: #d4bfff; text-align: center;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
/* 手牌战术卡：更大空间 */
#hand-cards .card[data-type="tactic"] .card-tactic-emoji { font-size: 38px; }
#hand-cards .card[data-type="tactic"] .card-tactic-desc {
  font-size: 13px;
}
/* 战场战术卡 */
.lane-cards .card[data-type="tactic"] .card-tactic-emoji { font-size: 24px; }
.lane-cards .card[data-type="tactic"] .card-tactic-desc {
  font-size: 11px;
}
/* §4.3 用户要求：卡牌右上角星级不再显示（数据保留，仅视觉隐藏） */
.card-star { display: none !important; }

/* 地形加成指示（替代星级位置，战场卡专用） */
.card-mod {
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
  padding: 2px 5px; border-radius: 3px;
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.65);
}
.card-mod.atk-buff { color: #70ff88; background: rgba(0,140,40,0.45); }
.card-mod.atk-nerf { color: #ff8888; background: rgba(160,0,0,0.45); }
.card-mod.atk-zero { color: #aaaaaa; background: rgba(0,0,0,0.60); }

/* 战场卡攻击力颜色随地形变化 */
.lane-cards .card .card-atk.atk-buff {
  color: #70ff88;
  text-shadow: 0 0 8px #00cc44, 0 2px 4px #000;
}
.lane-cards .card .card-atk.atk-nerf {
  color: #ff8888;
  text-shadow: 0 0 8px #cc2222, 0 2px 4px #000;
}
.lane-cards .card .card-atk.atk-zero {
  color: #888888;
  text-shadow: 0 2px 4px #000;
}

.card-art {
  font-size: 42px; line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.85));
  position: relative; z-index: 1;
  flex: 1; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
/* §2 拖拽手感修复：卡牌所有图素/装饰层不单独接收指针事件，
   点击/拖动卡牌任意位置都作用在 .card 根节点上（整张卡一起拖），
   浏览器也不会把内部 <img> 单独拖走。.card 本身仍可交互（未在此关闭）。
   注意：仅关闭「非交互装饰层」；备战 +/- 按钮、关闭按钮等交互元素不在此列表内。 */
.card img,
.card .card-art,
.card .card-art img,
.card-art-img,
.card-art-bg,
.card-tactic-text-overlay,
.card .card-tactic-body,
.card .card-tactic-emoji,
.card .card-tactic-desc,
.card .card-art .card-emoji-fallback,
.card .art-emoji-fallback {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
/* 卡牌图片（填充 art 区域并等比居中）。未来整张图素卡面也走这套：
   object-fit:contain + object-position:center；如需出血铺满改 cover 即可。 */
.card-art-img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  display: block;
}
/* 迷你卡背图（敌方手牌区） */
.mini-back-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
/* 地形图标图片 */
.terrain-icon-img {
  width: 16px; height: 16px;
  object-fit: contain; display: inline-block;
  vertical-align: middle;
}
.lane-cards .card .card-art { font-size: 28px; }

/* ════════════════════════════════════════════════
   §4.3 Visual Guidance / §7.2 White Box — 战场小卡顶部信息区修复
   兵种短标签(左上) 与 加成角标(右上) 各自绝对定位，互不挤压；
   顶部行不占流式高度，故 card-art 不被下推；标签强制横排不竖排；
   card-art 留出顶部安全区，避免被标签 / 加成遮挡。
   三位数加成(+100%/+120%)压缩后，为双兵种短写优先保留完整宽度。
   仅作用于战场卡 .is-battle-card，手牌大卡 / 备战 / 卡牌库不受影响。
════════════════════════════════════════════════ */
.is-battle-card .card-row-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0;                 /* 不占流式高度，避免下推 card-art */
  z-index: 3;
  pointer-events: none;
}
.is-battle-card .card-badge {
  position: absolute;
  top: 3px; left: 3px;
  max-width: calc(100% - 44px);   /* 优先保证「骑·弓 / 步·骑」完整可读 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  font-size: 10px; padding: 1px 4px;
}
.is-battle-card .card-mod {
  position: absolute;
  top: 3px; right: 3px;
  min-width: auto;
  font-size: 10px;
  line-height: 1.1;
  padding: 1px 3px;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  z-index: 4;
}
/* card-art 顶部安全区：标签区已绝对定位脱离流，这里再留出净空 */
.is-battle-card .card-art {
  margin-top: 16px;
}

.card-row-bot {
  width: 100%; display: flex; justify-content: space-between; align-items: flex-end;
  position: relative; z-index: 1;
}
.card-name {
  font-size: 13px; color: rgba(255,255,255,0.88);
  max-width: 60px; line-height: 1.2; text-shadow: 0 1px 3px #000;
  /* §4.3 用户要求：卡名/兵种名向右 5px、向上 5px（各卡尺寸状态统一） */
  transform: translate(5px, -5px);
}
.lane-cards .card[data-type="tactic"] .card-name {
  max-width: none;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* §7 战区小卡卡名强制单行：4 字及以上（如「攻城先登」）不再换行。
   仅作用于战区已部署小卡 / 敌方战区小卡（.is-battle-card），
   拖拽 clone / ghost preview 也复用 makeCard 生成的 .is-battle-card，故一致。
   手牌大卡 / 卡牌库 / 备战大卡不在此选择器内，标题显示不受影响。 */
.lane-cards .card.is-battle-card .card-name,
.card-preview-ghost.is-battle-card .card-name {
  white-space: nowrap;
  word-break: keep-all;
  overflow: hidden;
  text-overflow: clip;
  max-width: calc(var(--card-w) - 30px);
}
/* 4 字及以上按长度收紧字号 / 字距，保持单行且不压右下角战力数字 */
.lane-cards .card.is-battle-card.name-len-4 .card-name,
.card-preview-ghost.is-battle-card.name-len-4 .card-name {
  font-size: 11px;
  letter-spacing: -0.4px;
}
.lane-cards .card.is-battle-card.name-long .card-name,
.card-preview-ghost.is-battle-card.name-long .card-name {
  font-size: 10px;
  letter-spacing: -0.8px;
}
.card-atk {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font-size: 25px; font-weight: 900; line-height: 1;
  color: var(--gold-lt);
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  text-shadow: 0 0 8px var(--gold), 0 2px 4px #000;
}
.lane-cards .card .card-atk {
  min-width: 28px;
  height: 28px;
  font-size: 18px;
}

/* 手牌悬浮 & 选中 — §10.2 我方操作：青玉冷光（hover 增强见文件末 §方案A Phase1） */
#hand-cards .card:hover {
  transform: translateY(-8px);
  background-image: url("../assets/ui/prep/selection_highlight.png"), var(--j3-card-frame-image);
  background-size: 100% 100%, 100% 100%;
  filter: brightness(1.05);
}
#hand-cards .card.selected {
  transform: translateY(-14px);
  background-image: url("../assets/ui/prep/selection_highlight.png"), var(--j3-card-frame-image);
  background-size: 100% 100%, 100% 100%;
  box-shadow: 0 0 26px var(--j3-player-cyan-soft), 0 0 10px var(--j3-player-cyan), 0 10px 28px rgba(0,0,0,0.8);
}

/* ── 战场卡：可拖拽状态 ── */
.battlefield-card {
  cursor: grab;
  transition: transform .15s, box-shadow .15s;
}
.battlefield-card:hover {
  transform: scale(1.08);
  box-shadow: 0 0 14px var(--j3-player-cyan-soft), 0 4px 14px rgba(0,0,0,0.8);
  z-index: 10;
}
/* 选中的战场卡 — 青玉冷光 */
.battlefield-card.selected {
  border-color: var(--j3-player-cyan) !important;
  box-shadow: 0 0 24px var(--j3-player-cyan-soft), 0 0 8px var(--j3-player-cyan), 0 4px 14px rgba(0,0,0,0.8) !important;
  transform: scale(1.1);
  z-index: 10;
}

/* ── 幽灵预览卡（拖拽悬停时显示在目标路内）— 青玉冷光 ── */
/* 拖拽落点预览幽灵卡：保留虚线青玉边框作为落点提示，但改为静态轻量
   （去掉无限 box-shadow 脉冲动画与内部流光伪元素），避免拖拽中持续重绘。 */
.card-preview-ghost {
  opacity: 0.7;
  border: 2px dashed var(--j3-player-cyan) !important;
  box-shadow: none !important;
  filter: none !important;
  pointer-events: none;
  animation: none !important;
  flex-shrink: 0;
}
.card-preview-ghost::before,
.card-preview-ghost::after {
  display: none !important;
}

/* ── 手牌区：接受战场卡退回时的样式 ── */
#hand-panel.hand-drop-target {
  border-top: 2px dashed var(--j3-player-cyan-soft);
}
#hand-panel.hand-drop-over {
  border-top: 2px solid var(--j3-player-cyan) !important;
  background: linear-gradient(0deg, rgba(20,48,46,0.7) 0%, transparent 100%) !important;
  box-shadow: 0 -6px 24px var(--j3-player-cyan-soft);
}
/* 手牌区退回提示文字 */
#hand-panel.hand-drop-target .hand-hint::after {
  content: ' · 松开可退回手牌';
  color: var(--j3-player-cyan);
  opacity: 0.85;
}

/* ── 地形条修饰文字颜色（保留供将来扩展）── */
.t-mod { transition: color .15s; }

/* 入场动画 */
@keyframes dealIn {
  from { opacity:0; transform: scale(.75) translateY(16px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
.card-deal { animation: dealIn .28s ease forwards; }

/* 卡牌放入战区的回正动画 */
@keyframes cardSettle {
  0%   { transform: perspective(760px) rotateX(-10deg) rotate(3deg) scale(1.06); }
  50%  { transform: perspective(760px) rotateX(4deg) rotate(-1.5deg) scale(1.0); }
  100% { transform: perspective(760px) rotateX(0deg) rotate(0deg) scale(1.0); }
}
.card-settle { animation: cardSettle .32s cubic-bezier(.25,.46,.45,.94) forwards; }

/* ════════════════════════════════════════════════
   自定义拖拽浮动卡牌
════════════════════════════════════════════════ */
.drag-clone {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 9999 !important;
  pointer-events: none !important;
  opacity: 0.9;
  /* JS 用 --drag-x/--drag-y 驱动 transform，避免每帧改 left/top 触发布局 */
  transform: translate3d(var(--drag-x, 0), var(--drag-y, 0), 0) rotate(3deg) scale(1.06);
  /* 移动态轻量：单层阴影，禁用 filter / backdrop-filter / 多层 glow */
  box-shadow: 0 4px 14px rgba(0,0,0,0.45) !important;
  filter: none !important;
  backdrop-filter: none !important;
  text-shadow: none !important;
  transition: none !important;
  animation: none !important;
  will-change: transform;
  backface-visibility: hidden;
}
/* 拖拽浮卡：关闭高星流光 / 内光等伪元素，避免移动中持续重绘 */
.drag-clone::before,
.drag-clone::after {
  display: none !important;
}
body.dragging { cursor: grabbing !important; }
body.dragging * { user-select: none !important; -webkit-user-select: none !important; }
/* 拖拽期间禁用静止卡牌的 hover / selected 强光，避免移动时触发重绘叠加。
   拖拽结束（移除 .dragging）后自动恢复方案 A 青玉 hover / selected。 */
body.dragging #hand-cards .card:hover,
body.dragging .battlefield-card:hover,
body.dragging #hand-cards .card.selected,
body.dragging .battlefield-card.selected {
  box-shadow: 0 3px 14px rgba(0,0,0,0.7) !important;
  transform: none;
}

/* ════════════════════════════════════════════════
   移动态卡牌轻量化（§性能原则）
   拖拽 / 飞入 / 敌方部署等移动中的卡牌只保留 transform + opacity，
   去掉 box-shadow 叠层、filter、backdrop-filter、流光伪元素，
   避免 WebView 每帧重绘。静止的我方卡牌方案 A hover/glow 不受影响。
   注意：只挂在「瞬时 / 非交互」类上，不挂持久存在的 .card-deal，
   以免覆盖静止卡牌的青玉 hover。
════════════════════════════════════════════════ */
.prep-fly-ghost > .card,
.enemy-deploy-lite {
  box-shadow: 0 4px 12px rgba(0,0,0,0.35) !important;
  filter: none !important;
  backdrop-filter: none !important;
  text-shadow: none;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
/* 敌方卡牌：完全移除扫光 / 流光伪元素（避免暗牌剧透 + 停在中间 + 降低重绘）。
   仅作用于 ::after（高星 / 战术斜切扫光层）；::before 是静态内光，保留无妨。
   敌方卡无 hover / spotlight / z-lift 交互，常驻轻量。 */
.enemy-deploy-lite::after {
  content: none !important;
  background: none !important;
  animation: none !important;
  display: none !important;
}

/* ════════════════════════════════════════════════
   战斗结算蒙层
════════════════════════════════════════════════ */
#battle-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 200;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
}
/* design/SKILL.md §2.3 / §7.2: obsolete result art is archived; active outcomes use the formal panels. */
#battle-panel {
  width: 480px; max-width: 92vw;
  background-color: transparent;
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0; border-radius: 10px; padding: 34px 42px 30px;
  box-shadow: 0 0 50px rgba(0,0,0,0.55), inset 0 0 24px rgba(0,0,0,0.3);
}
.battle-title {
  text-align: center; color: var(--gold); font-size: 18px;
  font-weight: 700; letter-spacing: 4px; margin-bottom: 16px;
  text-shadow: 0 0 14px var(--gold);
}
#battle-log { display: flex; flex-direction: column; gap: 10px; }

.battle-row {
  padding: 9px 13px; border-radius: 6px; border: 1px solid;
  font-size: 13px; animation: rowIn .35s ease both;
}
@keyframes rowIn { from{opacity:0;transform:translateX(-18px);} to{opacity:1;transform:none;} }
.battle-row.win  { border-color:#3cb85c; background:rgba(18,70,28,0.45); color:#80ff95; }
.battle-row.lose { border-color:#e04040; background:rgba(70,12,12,0.45); color:#ff8888; }
.battle-row.draw { border-color:#b88030; background:rgba(70,52,8,0.45);  color:#f0c060; }
.battle-row .rw-title  { font-weight:700; font-size:14px; letter-spacing:2px; margin-bottom:3px; }
.battle-row .rw-detail { opacity:.85; line-height:1.6; }
.battle-row .rw-tactics {
  margin-top: 4px; padding-top: 4px;
  border-top: 1px dashed rgba(139,92,246,0.4);
  font-size: 12px; color: #d4bfff; line-height: 1.6; opacity: .9;
}

/* ════════════════════════════════════════════════
   胜负结果
════════════════════════════════════════════════ */
#result-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 300;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
}
#result-box {
  width: min(680px, 88vw);
  min-height: 368px;
  box-sizing: border-box;
  background-color: transparent;
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0; border-radius: 12px;
  padding: 58px 74px 44px; text-align: center;
  filter: drop-shadow(0 0 40px rgba(0,0,0,0.6));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  animation: boxPop .4s cubic-bezier(.18,.89,.32,1.28) both;
}
/* §13 结果框：胜利旧金高光更强，失败赤铜暗红 */
#result-box.result-win  { filter: drop-shadow(0 0 48px var(--j3-gold-soft)) drop-shadow(0 0 40px rgba(0,0,0,0.55)); }
#result-box.result-lose { filter: drop-shadow(0 0 42px var(--j3-enemy-copper-soft)) drop-shadow(0 0 40px rgba(0,0,0,0.55)); }
@keyframes boxPop { from{opacity:0;transform:scale(.7);} to{opacity:1;transform:scale(1);} }

.result-title { font-size: 40px; font-weight: 900; letter-spacing: 5px; animation: titlePulse 1.8s ease-in-out infinite; line-height: 1.05; }
.result-title.win  { color: var(--j3-gold-command-bright); text-shadow: 0 0 24px var(--j3-gold-command); }
.result-title.lose { color: var(--j3-enemy-copper-bright); text-shadow: 0 0 24px var(--j3-enemy-copper); }
.result-title.draw { color: var(--gold-lt); text-shadow: 0 0 18px var(--gold); }
@keyframes titlePulse { 0%,100%{filter:brightness(1);} 50%{filter:brightness(1.12);} }

.result-desc  { color: var(--j3-silver-muted); font-size: 15px; letter-spacing: 2px; line-height: 1.65; max-width: 500px; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.result-stats { color: rgba(225,230,224,0.74); font-size: 13px; letter-spacing: 1px; line-height: 1.5; max-width: 540px; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.result-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 10px; margin-top: 6px; max-width: min(520px, 82vw);
}
.result-actions .btn-start-game { margin-top: 0; }
.result-actions .btn-inner { min-width: 176px; min-height: 58px; padding: 0 30px; font-size: 17px; letter-spacing: 4px; }
.result-actions .btn-sm { min-width: 112px; min-height: 38px; font-size: 13px; }

/* ════════════════════════════════════════════════
   卡牌库弹窗
════════════════════════════════════════════════ */
#deck-modal,
#rules-modal,
#terrain-legend-modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 400;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  position: relative;
  background-color: transparent;
  /* §7.2 Prototyping/Testability - modal panels use explicit HD v2 assets so visual issues can be isolated from DOM layout next round. */
  background-image: url("../assets/ui/prep/dialog/frame_bottom.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 0; border-radius: 10px;
  /* 内容内缩到面板浮雕安全区：左右≈3% 上下≈7%（见安全区实测）。
     卡牌滚动区再单独留出角件净空（见 #deck-grid padding），不依赖 overlay 遮挡。 */
  padding: 52px 44px 46px; width: 920px; max-width: 95vw; max-height: 90vh;
  filter: drop-shadow(0 0 36px rgba(0,0,0,0.55));
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
#terrain-legend-modal .modal-box {
  background-image: url("../assets/ui/prep/dialog/frame_bottom.png");
}
#rules-modal .modal-box {
  /* §4.3 Visual Guidance - rules use a calmer HD v2 text panel instead of inheriting the card-grid panel. */
  background-image: url("../assets/ui/prep/dialog/frame_bottom.png");
}
#btn-close-deck,
#btn-close-rules,
#btn-close-terrain-legend {
  /* §4.2 Fitts' Law - close targets keep a compact dedicated asset (9-slice, no stretched wide frame).
     宽度收紧到接近图素比例，align-stretch 的父容器下也不会被拉成长条。 */
  border-image-source: none;
  border-image-slice: 30 44 fill;
  align-self: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 132px;
  max-width: 180px;
}
.modal-title { color: var(--gold); font-size: 17px; font-weight: 700; letter-spacing: 4px; text-shadow: 0 0 10px var(--gold); flex-shrink: 0; }
#deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; justify-items: center;
  width: 100%;
  overflow-y: auto;
  flex: 1; min-height: 0;
  /* 额外留出面板角件净空：滚动卡牌不会触及左右上角浮雕。 */
  padding: 6px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--j3-border-iron-strong) transparent;
}
#deck-grid::-webkit-scrollbar { width: 6px; }
#deck-grid::-webkit-scrollbar-thumb { background: var(--j3-border-iron-strong); border-radius: 3px; }
#deck-grid::-webkit-scrollbar-track { background: transparent; }

/* 卡牌库预览卡尺寸 */
.deck-preview-card {
  width: 120px !important; height: 166px !important;
  font-size: 12px;
}
.deck-preview-card .card-tactic-desc { font-size: 10px !important; line-height: 1.3 !important; }
.deck-preview-card .card-tactic-emoji { font-size: 22px !important; }

.rules-box {
  width: min(560px, 94vw);
  align-items: stretch;
  /* 规则面板顶部有冠饰，标题需落在冠饰下方的标题区；底部留出纹章安全区。 */
  padding: 64px 52px 52px;
  max-height: 86vh;
}
#rules-modal .modal-title,
#terrain-legend-modal .modal-title {
  text-align: center;
  width: 100%;
  margin-bottom: 4px;
}
.rules-content {
  width: 100%;
  display: grid;
  gap: 10px;
  color: rgba(245,225,170,0.88);
  font-size: 13px;
  line-height: 1.65;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--j3-border-iron-strong) transparent;
}
.rules-content::-webkit-scrollbar { width: 6px; }
.rules-content::-webkit-scrollbar-thumb { background: var(--j3-border-iron-strong); border-radius: 3px; }
.rules-section {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: rgba(0,0,0,0.16);
}
.rules-section-title {
  color: var(--gold-lt);
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.rules-content ul {
  margin: 0;
  padding-left: 18px;
}
.rules-content li {
  margin: 2px 0;
}

/* §6.4 二次确认弹窗 */
#confirm-modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 450;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.confirm-box {
  width: min(420px, 92vw);
  max-height: none;
  text-align: center;
}
.confirm-msg {
  color: rgba(255,255,255,0.88);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0.5px;
  margin: 4px 0 8px;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
}
.confirm-actions .btn-sm {
  min-width: 132px;
  min-height: 44px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* §4.1 分组标题 */
.deck-group-header {
  grid-column: 1 / -1;
  width: 100%;
  padding: 6px 0 2px;
  font-size: 13px; font-weight: 700;
  letter-spacing: 3px;
  color: var(--gold);
  border-bottom: 1px solid var(--j3-border-iron);
  text-align: left;
  margin-top: 4px;
}
.deck-group-header:first-child { margin-top: 0; }

/* ════════════════════════════════════════════════
   Toast 提示
════════════════════════════════════════════════ */
#toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  min-width: 220px;
  padding: 14px 34px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 16px 30px;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
  border-image-slice: 40 60 fill;
  border-image-width: 16px 30px;
  border-image-repeat: stretch;
  border-radius: 6px;
  color: var(--j3-silver-muted); font-size: 13px; letter-spacing: 1px;
  z-index: 500; opacity: 0; pointer-events: none;
  transition: opacity .28s; white-space: nowrap;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
#toast.show { opacity: 1; }
/* §6.4 Error Handling / §4.3 Visual Guidance — 教学退牌说明位于正式军令横幅下方且不被其层级遮挡。 */
#toast.war1-tutorial-feedback {
  top: 310px;
  z-index: 760;
  color: #f2dfb2;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
}

/* ════════════════════════════════════════════════
   伤害数字浮出 —— 追加到 #battlefield（position:relative）
════════════════════════════════════════════════ */
.dmg-float {
  position: absolute;
  pointer-events: none; z-index: 50;
  font-size: 36px; font-weight: 900;
  text-shadow: 0 0 14px currentColor, 0 2px 8px #000;
  animation: floatUp 1.5s ease forwards;
  white-space: nowrap;
}
/* §10.3 我方受伤 → 赤铜战火（左下角，对应玩家英雄位置） */
.dmg-float.player { color: var(--j3-enemy-copper-bright); left: 60px; bottom: 22%; top: auto; transform: none; }
/* §10.2 击中敌方 → 青玉冷光（右上角，对应敌方英雄位置；我方战果） */
.dmg-float.enemy  { color: var(--j3-player-cyan-bright); right: 60px; top: 18%; left: auto; transform: none; }
@keyframes floatUp {
  0%   { opacity:1; transform: translateY(0)    scale(1.3); }
  60%  { opacity:1; transform: translateY(-55px) scale(1); }
  100% { opacity:0; transform: translateY(-85px) scale(.8); }
}

.heal-float {
  position: absolute;
  pointer-events: none;
  z-index: 52;
  font-size: 32px;
  font-weight: 900;
  color: #66ff99;
  text-shadow: 0 0 14px rgba(80,255,140,0.85), 0 2px 8px #000;
  animation: healFloat 1.35s ease forwards;
  white-space: nowrap;
}
.heal-float.player { left: 60px; bottom: 22%; top: auto; }
.heal-float.enemy  { right: 60px; top: 18%; left: auto; }
@keyframes healFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1.15); }
  65%  { opacity: 1; transform: translateY(-42px) scale(1); }
  100% { opacity: 0; transform: translateY(-72px) scale(0.85); }
}
.hp-heal-flash {
  box-shadow: 0 0 14px rgba(80,255,140,0.85) !important;
  filter: brightness(1.25);
}

.lane-fx-shield {
  animation: laneShieldRipple .72s ease;
}
.lane-fx-double {
  animation: laneDoubleFlash .72s ease;
}
.lane-fx-ambush {
  animation: laneAmbushDim .64s ease;
}
@keyframes laneShieldRipple {
  0%,100% { box-shadow: inset 0 0 0 0 transparent; border-color: rgba(80,160,255,0.35); }
  40% { box-shadow: inset 0 0 36px 10px rgba(80,160,255,0.55); border-color: rgba(110,190,255,0.95); }
}
@keyframes laneDoubleFlash {
  0%,100% { box-shadow: none; }
  40% { box-shadow: 0 0 28px rgba(255,220,100,0.85), inset 0 0 24px rgba(255,210,80,0.35); }
}
@keyframes laneAmbushDim {
  0%,100% { filter: brightness(1); }
  45% { filter: brightness(0.72) saturate(0.85); }
}

.card-juice,
.card-atk-bump,
.card-atk-bump-inspire,
.card-atk-bump-swift {
  animation: cardJuice .34s cubic-bezier(.2,.8,.2,1);
}
.card-atk-nerf {
  animation: cardAtkNerf .42s ease;
}
@keyframes cardJuice {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); filter: brightness(1.25); }
  100% { transform: scale(1); }
}
@keyframes cardAtkNerf {
  0%,100% { filter: brightness(1); transform: scale(1); }
  45% { filter: brightness(0.65) saturate(0.7); transform: scale(0.94); }
}
.card-atk-bump-inspire { box-shadow: 0 0 16px rgba(255,220,100,0.75) !important; }
.card-atk-bump-swift  { box-shadow: 0 0 16px rgba(180,130,255,0.75) !important; }

.diversion-link {
  position: absolute;
  z-index: 170;
  height: 3px;
  transform-origin: 0 50%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,220,120,0.95), transparent);
  box-shadow: 0 0 12px rgba(255,220,120,0.65);
  animation: diversionPulse .72s ease forwards;
}
.diversion-link.player { background: linear-gradient(90deg, transparent, rgba(120,200,255,0.95), transparent); }
.diversion-link.enemy  { background: linear-gradient(90deg, transparent, rgba(255,140,140,0.95), transparent); }
@keyframes diversionPulse {
  0%   { opacity: 0; filter: brightness(0.6); }
  25%  { opacity: 1; filter: brightness(1.25); }
  100% { opacity: 0; filter: brightness(1); }
}

#result-dmg {
  color: #ffe8a0;
  text-shadow: 0 0 8px rgba(255,220,120,0.65);
}

/* ════════════════════════════════════════════════
   路区结算闪光
════════════════════════════════════════════════ */
.lane.flash-win  { animation: flashWin  .7s ease; }
.lane.flash-lose { animation: flashLose .7s ease; }
@keyframes flashWin  { 0%,100%{box-shadow:none;} 50%{box-shadow:0 0 32px rgba(60,220,90,.85);} }
@keyframes flashLose { 0%,100%{box-shadow:none;} 50%{box-shadow:0 0 32px rgba(220,50,50,.85);} }

/* 平局闪光 */
.lane.flash-draw { animation: flashDraw .7s ease; }
@keyframes flashDraw { 0%,100%{box-shadow:none;} 50%{box-shadow:0 0 28px rgba(200,168,75,.7);} }

/* ════════════════════════════════════════════════
   §3.3 战线结算动画
════════════════════════════════════════════════ */

/* ── 卡牌收拢 ── */
.lane-cards.battle-animating {
  position: relative;
  overflow: hidden;
}
.lane:has(.battle-animating) {
  overflow: hidden;
}
.lane-cards.battle-animating .card {
  position: absolute !important;
  transition: left 0.4s cubic-bezier(.25,.46,.45,.94),
              top 0.4s cubic-bezier(.25,.46,.45,.94),
              opacity 0.3s ease;
}
.lane-cards.dissolve-pinning .card {
  transition: none !important;
}
.card.stack-top {
  z-index: 15 !important;
  box-shadow: 0 0 20px rgba(255,220,100,0.8) !important;
}

/* ── 叠牌容器 ── */
.battle-stack {
  position: absolute;
  z-index: 100;
  pointer-events: none;
}
@keyframes stackRise {
  0%   { transform: perspective(900px) rotateX(0deg) translateY(0) scale(1); filter: brightness(1); }
  100% { transform: perspective(900px) rotateX(-8deg) translateY(-30px) scale(1.3); filter: brightness(1.2); }
}
/* §4.3 视觉引导 — 受击方卡牌向战线中心下压倾倒 */
@keyframes laneCollapseEnemy {
  0%   { transform: perspective(900px) rotateX(0deg) rotateY(var(--collapse-ry, 0deg)) translateY(0) scale(1); }
  32%  { transform: perspective(900px) rotateX(24deg) rotateY(var(--collapse-ry, 0deg)) translateY(12px) scale(0.96, 0.90); }
  58%  { transform: perspective(900px) rotateX(14deg) rotateY(var(--collapse-ry, 0deg)) translateY(7px) scale(0.98, 0.94); }
  100% { transform: perspective(900px) rotateX(0deg) rotateY(0deg) translateY(0) scale(1); }
}
@keyframes laneCollapsePlayer {
  0%   { transform: perspective(900px) rotateX(0deg) rotateY(var(--collapse-ry, 0deg)) translateY(0) scale(1); }
  32%  { transform: perspective(900px) rotateX(-22deg) rotateY(var(--collapse-ry, 0deg)) translateY(-10px) scale(0.96, 0.90); }
  58%  { transform: perspective(900px) rotateX(-13deg) rotateY(var(--collapse-ry, 0deg)) translateY(-6px) scale(0.98, 0.94); }
  100% { transform: perspective(900px) rotateX(0deg) rotateY(0deg) translateY(0) scale(1); }
}
.lane-cards.lane-collapse-enemy {
  transform-origin: 50% 0%;
  animation: laneCollapseEnemy 0.44s cubic-bezier(.2,.8,.2,1);
}
.lane-cards.lane-collapse-player {
  transform-origin: 50% 100%;
  animation: laneCollapsePlayer 0.44s cubic-bezier(.2,.8,.2,1);
}
.battle-stack.rising {
  animation: stackRise 0.5s cubic-bezier(.25,.46,.45,.94) forwards;
}

/* ── 震动 ── */
@keyframes boardShake {
  0%,100% { transform: translate(0,0); }
  10% { transform: translate(-5px,3px); }
  20% { transform: translate(6px,-4px); }
  30% { transform: translate(-4px,5px); }
  40% { transform: translate(5px,-3px); }
  50% { transform: translate(-3px,4px); }
  60% { transform: translate(4px,-2px); }
  70% { transform: translate(-2px,3px); }
  80% { transform: translate(3px,-2px); }
  90% { transform: translate(-2px,1px); }
}
#battlefield.screen-shake { animation: boardShake 0.5s ease-out; }

/* ── 兵种撞击特效 ── */
@keyframes impactType {
  0%   { box-shadow: inset 0 0 0 0 var(--impact-color); }
  30%  { box-shadow: inset 0 0 45px 12px var(--impact-color); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
.lane.impact-infantry { animation: impactType .6s ease; --impact-color: rgba(78,142,78,0.75); }
.lane.impact-cavalry  { animation: impactType .6s ease; --impact-color: rgba(126,78,192,0.75); }
.lane.impact-archer   { animation: impactType .6s ease; --impact-color: rgba(184,132,48,0.75); }
.lane.impact-cannon   { animation: impactType .6s ease; --impact-color: rgba(204,68,68,0.75); }
.lane.impact-navy     { animation: impactType .6s ease; --impact-color: rgba(40,136,204,0.75); }
.lane.impact-siege    { animation: impactType .6s ease; --impact-color: rgba(154,100,50,0.75); }

/* ── 战术卡升起 ── */
@keyframes tacticRiseEnemy {
  0%   { transform: perspective(820px) scale(1) translateY(0) rotateX(0deg); opacity: 1; }
  40%  { transform: perspective(820px) scale(1.35) translateY(-14px) rotateX(14deg); opacity: 1; }
  70%  { transform: perspective(820px) scale(1.35) translateY(-18px) rotateX(10deg); opacity: 1; }
  100% { transform: perspective(820px) scale(1.35) translateY(-22px) rotateX(14deg); opacity: 0; }
}
@keyframes tacticRisePlayer {
  0%   { transform: perspective(820px) scale(1) translateY(0) rotateX(0deg); opacity: 1; }
  40%  { transform: perspective(820px) scale(1.35) translateY(-12px) rotateX(-12deg); opacity: 1; }
  70%  { transform: perspective(820px) scale(1.35) translateY(-16px) rotateX(-8deg); opacity: 1; }
  100% { transform: perspective(820px) scale(1.35) translateY(-20px) rotateX(-12deg); opacity: 0; }
}
.card.tactic-activate {
  position: absolute !important;
  z-index: 200;
  box-shadow: 0 0 28px rgba(190,130,255,0.9), 0 0 50px rgba(120,80,220,0.45) !important;
}
.card.tactic-activate.tactic-from-enemy {
  transform-origin: 50% 0%;
  animation: tacticRiseEnemy 0.9s cubic-bezier(.25,.46,.45,.94) forwards;
}
.card.tactic-activate.tactic-from-player {
  transform-origin: 50% 100%;
  animation: tacticRisePlayer 0.9s cubic-bezier(.25,.46,.45,.94) forwards;
}
.card.tactic-activate::before {
  background: linear-gradient(115deg, transparent 25%, rgba(210,170,255,0.65) 46%, rgba(255,240,180,0.55) 54%, transparent 75%);
  animation: tacticSkewScan 0.88s ease forwards;
  z-index: 2;
}
@keyframes tacticSkewScan {
  0%   { transform: translateX(-130%) skewX(-20deg); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateX(130%) skewX(-20deg); opacity: 0; }
}

/* ── 战术卡被反制销毁：闪红 → 噪声消融 ── */
@keyframes tacticDestroyFlash {
  0%   { transform: scale(1) translateY(0); opacity: 1; filter: brightness(1); }
  40%  { transform: scale(1.08) translateY(-6px); opacity: 1; filter: brightness(1.3); }
  100% { transform: scale(1) translateY(0); opacity: 1; filter: brightness(0.85) saturate(0.7); }
}
.card.tactic-destroyed {
  position: absolute !important;
  z-index: 200;
  animation: tacticDestroyFlash 0.3s cubic-bezier(.4,.0,.7,.3) forwards;
  box-shadow: 0 0 18px rgba(255,60,60,0.7) !important;
  border-color: #ff3333 !important;
}
.card.card-dissolve-prep {
  overflow: visible !important;
}
/* 消融前关闭斜切扫光，避免与 Canvas 溶解层冲突 */
.card.card-dissolve-prep::after,
.card.card-dissolve-capture::after {
  animation: none !important;
  opacity: 0 !important;
}
.card.card-dissolve-hidden {
  visibility: hidden !important;
}
.card-dissolve-canvas {
  border-radius: 9px;
  image-rendering: auto;
  /* §4.3 Visual Guidance - a tiny canvas blur softens the live burn edge while keeping the card silhouette readable. */
  filter: blur(0.22px);
}
.card-dissolve-fallback {
  border-radius: 9px;
  overflow: visible !important;
  transform-origin: 50% 58%;
  backface-visibility: hidden;
  filter: brightness(1.04) saturate(0.96) drop-shadow(0 0 8px rgba(150, 32, 18, 0.52));
}
.card-dissolve-ember {
  position: absolute;
  z-index: 260;
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 210, 118, 0.88) 0 12%, rgba(212, 74, 28, 0.74) 38%, rgba(111, 26, 18, 0.38) 68%, rgba(42, 18, 12, 0) 84%);
  box-shadow:
    0 0 6px rgba(234, 108, 42, 0.46),
    0 0 14px rgba(139, 30, 16, 0.34),
    0 0 24px rgba(48, 16, 10, 0.18);
  mix-blend-mode: screen;
  animation: cardDissolveEmber var(--ember-ms, 680ms) cubic-bezier(.12,.68,.28,1) forwards;
}
.card-dissolve-flame,
.card-dissolve-burn-glow {
  position: absolute;
  pointer-events: none;
  mix-blend-mode: screen;
}
.card-dissolve-flame {
  z-index: 250;
  border-radius: 58% 46% 62% 42% / 72% 62% 36% 38%;
  transform-origin: 50% 92%;
  opacity: 0;
  filter: blur(0.55px) saturate(0.95);
  -webkit-mask-image: radial-gradient(ellipse at 50% 72%, #000 0 42%, rgba(0, 0, 0, 0.78) 58%, rgba(0, 0, 0, 0.3) 74%, transparent 92%);
  mask-image: radial-gradient(ellipse at 50% 72%, #000 0 42%, rgba(0, 0, 0, 0.78) 58%, rgba(0, 0, 0, 0.3) 74%, transparent 92%);
  animation: cardDissolveFlame var(--flame-ms, 620ms) cubic-bezier(.18,.7,.24,1) forwards;
}
/* §4.3 Visual Guidance - two softened flame scales make the burn read as layered combustion instead of one bright pasted sprite. */
.card-dissolve-flame-large {
  background:
    radial-gradient(ellipse at 50% 82%, rgba(248, 132, 62, 0.26) 0 12%, transparent 36%),
    radial-gradient(ellipse at 48% 64%, rgba(172, 36, 24, 0.5) 0 34%, transparent 78%),
    linear-gradient(to top, rgba(58, 18, 14, 0.72), rgba(142, 34, 22, 0.58) 48%, rgba(224, 76, 36, 0.28) 76%, transparent);
  box-shadow:
    0 0 10px rgba(168, 42, 22, 0.3),
    0 0 22px rgba(76, 18, 10, 0.22);
}
.card-dissolve-flame-small {
  background:
    radial-gradient(ellipse at 50% 78%, rgba(242, 132, 68, 0.38) 0 10%, transparent 36%),
    linear-gradient(to top, rgba(84, 24, 14, 0.66), rgba(188, 50, 24, 0.5) 54%, rgba(238, 96, 42, 0.26) 78%, transparent);
  filter: blur(0.4px) saturate(0.98);
  box-shadow:
    0 0 8px rgba(178, 52, 26, 0.28),
    0 0 15px rgba(86, 22, 12, 0.18);
}
.card-dissolve-burn-glow {
  z-index: 245;
  border-radius: 13px;
  background:
    radial-gradient(ellipse at 50% 70%, rgba(236, 76, 32, 0.16) 0 22%, rgba(124, 26, 16, 0.18) 42%, transparent 74%),
    radial-gradient(ellipse at 50% 42%, rgba(255, 118, 42, 0.1) 0 20%, transparent 64%);
  filter: blur(4px) saturate(0.96);
  animation: cardDissolveBurnGlow var(--burn-glow-ms, 680ms) ease-out forwards;
}
@keyframes cardDissolveEmber {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.45);
    filter: brightness(1.1);
  }
  18% {
    opacity: 0.82;
    transform: translate(calc(var(--ember-dx) * 0.16), calc(var(--ember-dy) * 0.12)) scale(var(--ember-scale, 1));
  }
  48% {
    opacity: 0.68;
    filter: brightness(0.96) saturate(1.04);
  }
  100% {
    opacity: 0;
    transform: translate(var(--ember-dx), var(--ember-dy)) scale(0.06);
    filter: brightness(0.62);
  }
}
@keyframes cardDissolveFlame {
  0% {
    opacity: 0;
    transform: translate(0, 8px) rotate(calc(var(--flame-rot) * -0.35)) scale(0.55, 0.38);
  }
  20% {
    opacity: 0.78;
    transform: translate(calc(var(--flame-dx) * 0.1), calc(var(--flame-dy) * 0.08)) rotate(var(--flame-rot)) scale(1.02, 1.14);
  }
  58% {
    opacity: 0.48;
    transform: translate(calc(var(--flame-dx) * 0.42), calc(var(--flame-dy) * 0.48)) rotate(calc(var(--flame-rot) * -0.55)) scale(0.76, 1.2);
  }
  100% {
    opacity: 0;
    transform: translate(var(--flame-dx), var(--flame-dy)) rotate(calc(var(--flame-rot) * 0.5)) scale(0.26, 0.64);
  }
}
@keyframes cardDissolveBurnGlow {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  18% {
    opacity: 0.48;
    transform: scale(1.02);
  }
  62% {
    opacity: 0.28;
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.tactic-status-float {
  position: absolute;
  z-index: 180;
  pointer-events: none;
  transform: translate(-50%, -100%);
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff3c0;
  background: rgba(42,20,72,0.92);
  border: 1px solid rgba(210,170,255,0.65);
  box-shadow: 0 0 16px rgba(160,90,255,0.45);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.85);
  animation: tacticStatusFloat 0.92s ease forwards;
}
.tactic-status-float.countered {
  color: #ffd0d0;
  background: rgba(80,12,20,0.94);
  border-color: rgba(255,90,90,0.75);
  box-shadow: 0 0 16px rgba(255,60,60,0.45);
}
@keyframes tacticStatusFloat {
  0%   { opacity: 0; transform: translate(-50%, -85%) scale(0.75); }
  18%  { opacity: 1; transform: translate(-50%, -120%) scale(1.08); }
  72%  { opacity: 1; transform: translate(-50%, -145%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.9); }
}

/* ── 浮动战线信息（列顶显示，避免被卡牌遮挡）— 统一 toast 框 9-slice ── */
.lane-battle-info {
  position: absolute;
  z-index: 200;
  padding: 8px 20px;
  border-style: solid;
  border-color: transparent;
  border-width: 16px 28px;
  border-image-source: url("../assets/ui/prep/dialog/frame_bottom.png");
  border-image-slice: 46 96 fill;
  border-image-width: 16px 28px;
  border-image-repeat: stretch;
  font-size: 14px; font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.85);
  animation: infoPopIn 0.4s cubic-bezier(.18,.89,.32,1.28) forwards;
}
.lane-battle-info-top {
  font-size: 18px;
  padding: 10px 26px;
  letter-spacing: 3px;
  transform: translate(-50%, 0);
  animation: infoPopInTop 0.45s cubic-bezier(.18,.89,.32,1.28) forwards;
}
/* 战报配色仅用文字色：我方胜青绿、敌方胜暗红、平局旧金（不再用矩形色块底） */
.lane-battle-info.win  { color: #8effa3; }
.lane-battle-info.lose { color: #ff9a9a; }
.lane-battle-info.draw { color: #f4cf78; }
@keyframes infoPopIn {
  from { opacity: 0; transform: translate(-50%,-50%) scale(0.6); }
  to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
@keyframes infoPopInTop {
  from { opacity: 0; transform: translate(-50%, -10px) scale(0.82); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes infoFadeOut {
  from { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  to   { opacity: 0; transform: translate(-50%,-60%) scale(0.9); }
}
@keyframes infoFadeOutTop {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to   { opacity: 0; transform: translate(-50%, -14px) scale(0.92); }
}

.lane-tactic-note {
  position: absolute;
  z-index: 199;
  font-size: 12px; font-weight: 600;
  color: #d4bfff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  pointer-events: none;
  white-space: nowrap;
  animation: noteFade 2.2s ease forwards;
}
.lane-tactic-note-top {
  font-size: 15px;
  font-weight: 700;
  color: #e8d4ff;
  transform: translateX(-50%);
  text-shadow: 0 2px 8px rgba(0,0,0,0.95), 0 0 12px rgba(160,100,255,0.35);
  animation: noteFadeTop 2.4s ease forwards;
}
@keyframes noteFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0); }
  12%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-18px); }
}
@keyframes noteFadeTop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(6px); }
  14%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ── 火攻全场特效 ── */
.fire-attack-overlay {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 150; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,80,0,0.35), transparent 70%);
  animation: fireFlash 1.1s ease forwards;
}
@keyframes fireFlash {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ════════════════════════════════════════════════
   §4.3 视觉引导 — 最佳路线高亮
════════════════════════════════════════════════ */
/* §4.3 玩家操作引导：青玉冷光 —— 增益最高战区强化（方案 C：弱高亮框 + 明显文字）。
   高亮/文字层 pointer-events:none，不影响拖拽 / 部署 / ghost preview；不遮挡卡牌数值。 */
.player-lane.best-lane {
  outline: 2px solid var(--j3-player-cyan-bright);
  outline-offset: -5px;
  box-shadow: 0 0 26px var(--j3-player-cyan-soft),
              inset 0 0 20px var(--j3-player-cyan-faint);
  animation: bestLaneBreath 1.8s ease-in-out infinite alternate;
}
/* §4.3 Visual Guidance — 只提亮地形徽章；不在祖先列使用 filter，避免连带增亮部署卡牌。 */
.battle-column.best-terrain-column > .terrain-octagon {
  filter: brightness(1.1) drop-shadow(0 0 18px rgba(68, 226, 205, 0.56));
}
/* §4.3 Visual Guidance — 青玉覆盖层位于 v3 地形图素之上、卡牌之下；
   screen 混合提亮地形纹理而不遮挡卡牌数值，且不拦截部署交互。 */
.player-lane.best-lane::before {
  content: '';
  position: absolute;
  top: 4px; right: 4px; bottom: 4px; left: 4px;
  border-radius: var(--r);
  border: 1px solid rgba(107, 255, 238, 0.88);
  background:
    radial-gradient(ellipse at 50% 48%, rgba(103, 255, 239, 0.22) 0%, rgba(35, 183, 176, 0.16) 48%, rgba(8, 79, 84, 0.10) 100%),
    linear-gradient(180deg, rgba(84, 238, 222, 0.15), rgba(24, 127, 132, 0.20));
  mix-blend-mode: screen;
  box-shadow:
    inset 0 0 0 1px rgba(156, 255, 242, 0.38),
    inset 0 0 30px rgba(63, 235, 218, 0.34),
    0 0 14px rgba(58, 223, 207, 0.24);
  pointer-events: none;
  z-index: 1;
}
.player-lane.best-lane::after {
  content: '▲ 增益最高';
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 800; letter-spacing: 2px;
  color: #061a19;
  background: linear-gradient(180deg, var(--j3-player-cyan-bright), var(--j3-player-cyan));
  text-shadow: 0 1px 1px rgba(255,255,255,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.55), 0 0 14px var(--j3-player-cyan-soft);
  pointer-events: none;
  z-index: 16;
  white-space: nowrap;
  animation: bestPulse 1.2s ease-in-out infinite alternate;
}
@keyframes bestPulse {
  from { opacity: 0.82; }
  to   { opacity: 1; }
}
@keyframes bestLaneBreath {
  from { box-shadow: 0 0 18px var(--j3-player-cyan-faint), inset 0 0 14px var(--j3-player-cyan-faint); }
  to   { box-shadow: 0 0 30px var(--j3-player-cyan-soft), inset 0 0 22px var(--j3-player-cyan-faint); }
}
/* §六 low-power / reduced-motion：关闭增益最高的动态（保留静态高亮 + 文字） */
html.low-power .player-lane.best-lane,
html.low-power .player-lane.best-lane::after {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .player-lane.best-lane,
  .player-lane.best-lane::after {
    animation: none;
  }
}

/* ════════════════════════════════════════════════
   §3.4 双兵种卡 — 视觉差异化
   §4.3 视觉引导 — 斜切渐变 + 角标标识双兵种
════════════════════════════════════════════════ */
.card-badge.badge-dual {
  background-color: rgba(0,0,0,0.35);
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffe8a0;
  border: 0;
  font-size: 10px; letter-spacing: 0px;
}
.card.dual-type::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 7px;
  pointer-events: none; z-index: 0;
}
.card.dual-type[data-type="cavalry"][data-subtype="archer"]::after {
  background: linear-gradient(135deg, rgba(126,78,192,0.15) 0%, rgba(184,132,48,0.15) 100%);
}
.card.dual-type[data-type="infantry"][data-subtype="archer"]::after {
  background: linear-gradient(135deg, rgba(78,142,78,0.15) 0%, rgba(184,132,48,0.15) 100%);
}
.card.dual-type[data-type="infantry"][data-subtype="cavalry"]::after {
  background: linear-gradient(135deg, rgba(78,142,78,0.15) 0%, rgba(126,78,192,0.15) 100%);
}
.card.dual-type[data-type="navy"][data-subtype="infantry"]::after {
  background: linear-gradient(135deg, rgba(40,136,204,0.15) 0%, rgba(78,142,78,0.15) 100%);
}
.card.dual-type[data-type="cannon"][data-subtype="cavalry"]::after {
  background: linear-gradient(135deg, rgba(204,68,68,0.15) 0%, rgba(126,78,192,0.15) 100%);
}
.card.dual-type[data-type="siege"][data-subtype="infantry"]::after {
  background: linear-gradient(135deg, rgba(154,100,50,0.15) 0%, rgba(78,142,78,0.15) 100%);
}
/* §4.3 用户要求：不再显示左上角黄色「双」圆形图案；双兵种改由文本标签（骑·弓）表达，规则不变。 */
.card.dual-type::before {
  content: none !important;
  display: none !important;
}
.lane-cards .card.dual-type::before {
  content: none !important;
  display: none !important;
}
/* §4.3 Visual Guidance / §7.2 White Box — 战场小卡已用「骑·弓」短写表达双兵种，隐藏重复的「双」角标。 */
.lane-cards .card.is-battle-card.dual-type::before {
  content: none;
  display: none;
}

/* ════════════════════════════════════════════════
   响应式 —— 小屏缩放 CSS 变量即可
════════════════════════════════════════════════ */
@media (max-height: 680px) {
  :root { --lane-h: 198px; --card-h: 124px; --card-w: 90px; --hand-card-w: 116px; --hand-card-h: 150px; }
  .hero-avatar { width: 36px; height: 36px; font-size: 18px; }
  #hand-panel { padding: 5px 12px 7px; }
  #enemy-hand-bar { height: 52px; }
}

@media (max-width: 760px) {
  :root { --lane-w: 292px; --lane-h: 204px; --card-w: 88px; --card-h: 122px; --hand-card-w: 110px; --hand-card-h: 144px; }
  .main-title { letter-spacing: 8px; }
}

/* ════════════════════════════════════════════════
   视觉方案 A · Phase 1 — 我方可操作卡牌青玉冷光 hover（静态版）
   参考 docs/j3card_visual_reference_from_phia_site.md §3 / §10.2
   本版只做静态青玉边缘光 + 轻 z-lift，不做鼠标跟随 spotlight / tilt /
   能量纹理。仅 fine-pointer + 非 reduced-motion 启用；触摸端保留 selected
   高亮（在前文 .selected 规则中，已为青玉）。
   适用对象：手牌、备战卡池可操作卡、卡牌库卡（弱）。
   不适用：敌方卡、备战右侧已选列表、结算阶段强 hover。
════════════════════════════════════════════════ */
@media (hover: hover) and (pointer: fine) {
  /* 手牌：我方主操作面 — 中强 */
  #hand-cards .card:hover {
    transform: translateY(-8px);
    border-color: var(--j3-player-cyan) !important;
    box-shadow: 0 0 18px var(--j3-player-cyan-soft),
                inset 0 0 14px var(--j3-player-cyan-faint),
                0 8px 22px rgba(0,0,0,0.7);
  }
  /* 备战卡池可操作卡 — 中 */
  #prep-grid .card:hover {
    border-color: var(--j3-player-cyan) !important;
    box-shadow: 0 0 16px var(--j3-player-cyan-soft),
                inset 0 0 12px var(--j3-player-cyan-faint);
  }
  /* 卡牌库卡 — 弱 */
  #deck-grid .card:hover {
    border-color: var(--j3-border-iron-strong) !important;
    box-shadow: 0 0 12px var(--j3-player-cyan-faint);
  }
  /* 备战右侧已选列表：仅轻微行 hover（沿用 .prep-deck-item:hover，不发光） */

  /* 敌方卡牌：不使用青玉 hover（保持赤铜静态身份，无交互高亮） */
  .enemy-lane .card:hover {
    transform: none;
    box-shadow: 0 3px 14px rgba(0,0,0,0.7);
  }

  /* 结算阶段：禁用我方卡强 hover，避免抢结算表现 / 冲突点击 */
  .lane-cards.battle-animating .card:hover {
    transform: none;
    box-shadow: 0 3px 14px rgba(0,0,0,0.7);
  }
}

/* 尊重 prefers-reduced-motion：去掉位移，仅保留静态描边反馈 */
@media (prefers-reduced-motion: reduce) {
  #hand-cards .card:hover { transform: none; }
}

/* ════════════════════════════════════════════════
   war1 新兵演练 · 正式图素 GUI
   §3.1 Flow State / §4.3 Visual Guidance / §6.4 Error Handling
════════════════════════════════════════════════ */
#war1-tutorial-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 720;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 7, 12, 0.76);
}
#war1-tutorial-overlay.is-visible { display: flex; }
.war1-tutorial-actions .is-hidden,
.war1-tutorial-terrain-preview.is-hidden { display: none !important; }
#war1-tutorial-overlay.is-command {
  align-items: flex-start;
  padding-top: 76px;
  background: transparent;
  pointer-events: none;
}
#war1-tutorial-panel {
  position: relative;
  width: min(760px, calc(100vw - 48px));
  min-height: 0;
  aspect-ratio: 5 / 4;
  padding: 96px 118px 72px;
  color: #f2dfb2;
  background: transparent url("../assets/ui/prep/dialog/frame_bottom.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 24px 34px rgba(0, 0, 0, 0.72));
}
#war1-tutorial-overlay.is-command #war1-tutorial-panel {
  width: min(620px, calc(100vw - 120px));
  min-height: 154px;
  aspect-ratio: auto;
  padding: 18px 66px 32px;
  background: transparent;
  filter: none;
  pointer-events: none;
}
.war1-tutorial-step-title {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 78px 10px;
  color: #f6dfa2;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 7px;
  text-shadow: 0 2px 3px #000, 0 0 12px rgba(226, 183, 83, 0.38);
  background: transparent url("../assets/ui/prep/dialog/frame_bottom.png") center / contain no-repeat;
}
.war1-tutorial-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.war1-tutorial-command {
  width: min(520px, 100%);
  min-height: 78px;
  margin: 0;
  padding: 23px 58px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8d6aa;
  font-size: 18px;
  line-height: 1.65;
  text-align: center;
  white-space: pre-line;
  background: transparent url("../assets/ui/prep/dialog/frame_bottom.png") center / 100% 100% no-repeat;
  text-shadow: 0 1px 2px #000;
}
#war1-tutorial-overlay.is-command .war1-tutorial-step-title {
  min-height: 56px;
  padding-bottom: 8px;
  font-size: 22px;
}
#war1-tutorial-overlay.is-command .war1-tutorial-command {
  min-height: 60px;
  padding: 16px 54px 14px;
  font-size: 15px;
}
.war1-tutorial-terrain-preview {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.war1-tutorial-terrain {
  aspect-ratio: 1.8 / 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 10px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.56));
}
.war1-tutorial-terrain span {
  color: #f3e3bc;
  font-size: 14px;
  text-shadow: 0 1px 3px #000, 0 0 8px #000;
}
.war1-tutorial-terrain.terrain-plain {
  background-image: url("../assets/ui/battle/terrain_plain_large.png");
}
.war1-tutorial-terrain.terrain-water {
  background-image: url("../assets/ui/battle/terrain_water_large.png");
}
.war1-tutorial-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 22px;
}
.war1-tutorial-actions .btn-start-game { width: auto; }
.war1-tutorial-actions .btn-inner {
  min-width: 300px;
  white-space: nowrap;
}
#btn-war1-tutorial-skip { min-width: 148px; }
#war1-tutorial-overlay.is-command .war1-tutorial-actions {
  margin-top: 6px;
  pointer-events: auto;
}
#war1-tutorial-overlay.is-command #btn-war1-tutorial-primary { display: none; }
#war1-tutorial-overlay.is-command #btn-war1-tutorial-skip {
  transform: scale(0.86);
  transform-origin: center top;
}
.war1-tutorial-card-glow {
  position: absolute;
  top: -8px; right: -8px; bottom: -8px; left: -8px;
  z-index: 8;
  pointer-events: none;
  background: transparent url("../assets/ui/prep/selection_highlight.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 12px rgba(68, 226, 205, 0.72));
  animation: war1TutorialGlow 1.2s ease-in-out infinite;
}
.card.war1-tutorial-target {
  z-index: 20;
  filter: brightness(1.1) drop-shadow(0 0 13px rgba(68, 226, 205, 0.72));
}
.battle-column.war1-tutorial-lane-target {
  filter: brightness(1.12) drop-shadow(0 0 18px rgba(68, 226, 205, 0.6));
}
#btn-end-turn.war1-tutorial-action-target {
  filter: brightness(1.18) drop-shadow(0 0 15px rgba(226, 183, 83, 0.82));
  animation: war1TutorialGlow 1.2s ease-in-out infinite;
}
@keyframes war1TutorialGlow {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}
@media (max-height: 720px) {
  #toast.war1-tutorial-feedback { top: 286px; }
  #war1-tutorial-panel {
    width: min(660px, calc(100vw - 48px));
    min-height: 0;
    padding: 78px 100px 60px;
  }
  .war1-tutorial-step-title { min-height: 60px; font-size: 24px; }
  .war1-tutorial-command { min-height: 66px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .war1-tutorial-card-glow,
  #btn-end-turn.war1-tutorial-action-target { animation: none; opacity: 1; }
}

/* §4.3 Visual Guidance — 超长称号在正式 HUD 安全区内缩放并保留单行。 */
.hero-name.hero-name-long {
  font-size: 13px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-name.hero-name-very-long { font-size: 11px; }
