* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a2332;
  --panel: #26334a;
  --panel2: #1f2a3d;
  --border: #3d4f6b;
  --accent: #4aa3ff;
  --hp: #4ade80;
  --text: #e8eef7;
  --muted: #93a4bb;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

#app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

header h1 { font-size: 18px; color: var(--accent); }

#status {
  font-size: 13px;
  color: var(--muted);
}

#banner {
  text-align: center;
  font-size: 15px;
  font-weight: bold;
  padding: 8px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 22px;
}
#banner.my-turn { border-color: var(--accent); color: var(--accent); }
#banner.over { border-color: #f59e0b; color: #f59e0b; }

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

.player-zone {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.player-zone.human { background: var(--panel2); }

.zone-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.zone {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 6px;
  min-height: 120px;
  flex: 1;
  position: relative;
}
.zone .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.zone .count { font-size: 10px; color: var(--accent); }

.pile {
  width: 84px;
  height: 120px;
  background: repeating-linear-gradient(45deg, #34425c, #34425c 6px, #2b3850 6px, #2b3850 12px);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.pile .num { font-size: 18px; font-weight: bold; color: var(--text); }
.pile.clickable { cursor: pointer; }
.pile.clickable:hover { border-color: var(--accent); }
.discard-row {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.discard-row:last-child { border-bottom: none; }

/* 卡牌 */
.card {
  width: 84px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #222;
  font-size: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform .12s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.card.selected { outline: 3px solid var(--accent); }
.card.disabled { opacity: .5; cursor: not-allowed; }

.card .top {
  padding: 4px 5px;
  background: #dbe6f5;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
}
.card .body {
  padding: 4px 5px;
  height: 74px;
  overflow: hidden;
}
.card .hp { color: #b91c1c; font-weight: bold; }
.card .type { font-size: 9px; color: #555; }
.card .attacks { margin-top: 3px; }
.card .atk { font-size: 9px; margin: 1px 0; }
.card .cost { color: #b45309; }
.card .dmg { color: #b91c1c; font-weight: bold; }

.card.pokemon .top { background: #b8e0b8; }
.card.energy .top { background: #ffe7b8; }
.card.trainer .top { background: #f3c8d3; }

/* HP 条 */
.hpbar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  margin: 2px 0;
  overflow: hidden;
}
.hpbar .fill {
  height: 100%;
  background: var(--hp);
}
.hpbar .fill.low { background: #f87171; }

/* 战斗场中的宝可梦卡片放大 */
.pokemon-card {
  width: 108px;
  height: 150px;
  font-size: 11px;
}
.pokemon-card .body { height: 96px; }

.bench-slot { width: 92px; min-height: 120px; }

.hand-area .card { width: 92px; height: 130px; }

.energy-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 2px;
}
.pip {
  width: 12px; height: 12px; border-radius: 50%;
  font-size: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e7c97a; color: #333;
  border: 1px solid #b8953f;
}

.conditions { margin-top: 2px; }
.cond {
  display: inline-block; font-size: 9px;
  background: #fee2e2; color: #b91c1c;
  border-radius: 3px; padding: 0 3px; margin: 0 1px;
}
.cond.asleep, .cond.paralyzed { background: #e0e7ff; color: #3730a3; }
.cond.confused { background: #f3e8ff; color: #7e22ce; }

/* 手牌 */
.hand-area {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  min-height: 140px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* 操作按钮 */
#controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  flex-wrap: wrap;
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { background: #4a5568; cursor: not-allowed; }
button.alt { background: #5b6b84; }
button.danger { background: #e11d48; }

#message {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* 日志 */
#log {
  margin-top: 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 12px;
}
#log .entry { padding: 2px 0; color: var(--muted); border-bottom: 1px solid #2b3850; }

/* 工具栏 */
#toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}
#toolbar select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
}

/* 历史弹层 */
#history-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
#history-modal.open { display: flex; }
#history-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 620px;
  max-width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
  padding: 16px;
}
#history-box h3 { margin-bottom: 10px; color: var(--accent); }
.history-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid #2b3850;
  font-size: 13px;
}
.history-row .win { color: #4ade80; font-weight: bold; }
.history-row .lose { color: #f87171; font-weight: bold; }
#history-close {
  margin-top: 12px;
  width: 100%;
}

/* 招式选择弹层 */
#atk-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
#atk-modal.open { display: flex; }
#atk-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 360px;
  padding: 16px;
}
#atk-box h3 { color: var(--accent); margin-bottom: 10px; }
.atk-option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 6px 0;
  color: var(--text);
  font-size: 13px;
}
.atk-option:hover { border-color: var(--accent); }
.atk-option .dmg { color: #f87171; font-weight: bold; }
.atk-option .cost { color: #fbbf24; }

/* ==================================================================
   v2 展示升级：分区布局 / 名牌 / 徽章 / 能量着色 / 战报 / 演出
   ================================================================== */

/* ---- 主布局：左战场 + 右战报 ---- */
#main-layout {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
#battle-col { flex: 1; min-width: 0; }
#report-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: 720px;
  overflow: hidden;
}
.report-head {
  padding: 8px 12px;
  font-weight: bold;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
#report {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  font-size: 12px;
}
.rep-turn {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  margin: 8px 0 4px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 2px;
}
.rep-row { padding: 2px 0; color: var(--text); line-height: 1.5; }
.rep-row.hl { background: rgba(74,163,255,.12); border-radius: 4px; padding: 3px 6px; margin: 2px 0; }
.rep-row.over { color: #f59e0b; font-weight: bold; }
.rep-row b { color: #fbbf24; }

/* ---- Header 动作区 ---- */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.header-actions select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
}
#btn-cards {
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.fast-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* ---- 名牌 ---- */
.nameplate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--muted);
}
.nameplate.active {
  border-color: var(--accent);
  color: var(--accent);
  animation: glow 1.6s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 2px rgba(74,163,255,.3); }
  50% { box-shadow: 0 0 12px rgba(74,163,255,.65); }
}
.np-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 11px; font-weight: bold; color: #fff;
}
.np-ai { background: #e11d48; }
.np-me { background: var(--accent); }
.np-first {
  font-size: 10px;
  background: #fbbf24; color: #422006;
  border-radius: 3px; padding: 0 4px;
}

/* ---- 卡面：伤害气泡 / 状态徽章 ---- */
.card .top { gap: 3px; }
.card .top .pname { overflow: hidden; text-overflow: ellipsis; }

.hpbar { position: relative; }
.hpbar .fill.mid { background: #fbbf24; }

.badges { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  font-size: 9px;
  background: color-mix(in srgb, var(--badge-color, #999) 28%, #fff);
  border: 1px solid var(--badge-color, #999);
  cursor: help;
}
.badge.pulse { animation: badge-pulse 1.4s ease-in-out infinite; }
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* ---- 能量 pips 按属性着色（覆盖旧灰底） ---- */
.pip {
  width: 13px; height: 13px; border-radius: 50%;
  font-size: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #1a2332;
  border: 1px solid rgba(0,0,0,.35);
  text-shadow: 0 0 1px rgba(255,255,255,.6);
}

/* ---- 招式可用性 ---- */
.atk { display: flex; align-items: center; gap: 2px; }
.atk.unusable { opacity: .55; }
.usable { margin-left: auto; font-size: 9px; font-weight: bold; }
.usable.ok { color: #16a34a; }
.usable.no { color: #dc2626; }

/* ---- 奖赏卡计数 ---- */
.pile.prizes {
  width: auto;
  min-width: 44px;
  height: auto;
  min-height: 40px;
  flex-direction: row;
  gap: 3px;
  padding: 6px;
  background: var(--panel);
}
.pile.prizes .num { font-size: 16px; font-weight: bold; margin-left: 0; }

/* ---- 演出动画 ---- */
.pokemon-card { transition: transform .18s ease, opacity .3s ease, filter .3s ease; }

.pokemon-card.lunge-up { animation: lunge-up calc(.55s * var(--anim-speed, 1)) ease; z-index: 5; }
@keyframes lunge-up {
  0% { transform: translateY(0); }
  40% { transform: translateY(-34px) scale(1.05); }
  100% { transform: translateY(0); }
}
.pokemon-card.lunge-down { animation: lunge-down calc(.55s * var(--anim-speed, 1)) ease; z-index: 5; }
@keyframes lunge-down {
  0% { transform: translateY(0); }
  40% { transform: translateY(34px) scale(1.05); }
  100% { transform: translateY(0); }
}
.pokemon-card.shake { animation: shake calc(.45s * var(--anim-speed, 1)) ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
.pokemon-card.ko { animation: ko-out calc(1s * var(--anim-speed, 1)) ease forwards; }
@keyframes ko-out {
  0% { filter: grayscale(0); opacity: 1; }
  60% { filter: grayscale(1); opacity: .7; transform: rotate(14deg); }
  100% { filter: grayscale(1); opacity: 0; transform: rotate(90deg) translateY(30px); }
}
.pokemon-card.evolve-flash { animation: evolve-flash calc(.9s * var(--anim-speed, 1)) ease; }
@keyframes evolve-flash {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: 0 0 22px 6px rgba(74,163,255,.9); transform: scale(1.06); }
}
.pokemon-card.guts-flash { animation: guts-flash calc(.9s * var(--anim-speed, 1)) ease; }
@keyframes guts-flash {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: 0 0 22px 6px rgba(251,191,36,.95); transform: scale(1.05); }
}
.pokemon-card.swap-in { animation: swap-in calc(.7s * var(--anim-speed, 1)) ease; }
@keyframes swap-in {
  0% { opacity: .2; transform: translateX(18px); }
  100% { opacity: 1; transform: translateX(0); }
}
.pokemon-card.badge-burst { animation: badge-burst calc(.65s * var(--anim-speed, 1)) ease; }
@keyframes badge-burst {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.09); box-shadow: 0 0 14px rgba(168,85,247,.8); }
}

/* 伤害飘字 */
.fx {
  position: absolute;
  left: 50%;
  pointer-events: none;
  font-weight: bold;
  z-index: 20;
}
.fx-damage {
  top: 8px;
  transform: translateX(-50%);
  color: #ff4d4f;
  font-size: 22px;
  text-shadow: 0 2px 4px rgba(0,0,0,.8), 0 0 2px #000;
  animation: float-up calc(1.25s * var(--anim-speed, 1)) ease-out forwards;
}
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(1); }
}

/* 中央横幅文字（昏厥等） */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fx-banner {
  font-size: 34px;
  font-weight: bold;
  color: #f87171;
  text-shadow: 0 3px 8px rgba(0,0,0,.9);
  animation: banner-pop calc(1.3s * var(--anim-speed, 1)) ease forwards;
}
.fx-banner.ko-text { color: #cbd5e1; }
/* 回合切换横幅（19-战斗过场时间轴）：随回合节拍出现，颜色区分双方 */
.fx-banner.turn-banner {
  font-size: 24px;
  letter-spacing: 5px;
  padding: 8px 0;
  color: #cbd5e1;
  animation-name: banner-slide;
}
.fx-banner.turn-banner.me { color: #7ff0b3; }
.fx-banner.turn-banner.opp { color: #ff9d9d; }
@keyframes banner-slide {
  0% { opacity: 0; transform: translateX(60px) scale(.95); }
  20% { opacity: 1; transform: translateX(0) scale(1); }
  75% { opacity: 1; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(-40px); }
}
/* 补位过渡横幅 */
.fx-banner.promote-text {
  font-size: 26px;
  letter-spacing: 3px;
  color: #fde68a;
}
@keyframes banner-pop {
  0% { opacity: 0; transform: scale(.6); }
  25% { opacity: 1; transform: scale(1.15); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1) translateY(-16px); }
}

/* 硬币演出 */
#coin-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 30;
}
#coin-layer[hidden] { display: none; }
#board { position: relative; }
.coin {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef08a, #eab308 70%);
  border: 3px solid #facc15;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: bold; color: #713f12;
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
}
.coin.flip { animation: coin-flip calc(.72s * var(--anim-speed, 1)) ease; }
@keyframes coin-flip {
  0% { transform: rotateX(0) scale(.6); opacity: 0; }
  50% { transform: rotateX(720deg) scale(1.2); opacity: 1; }
  100% { transform: rotateX(1080deg) scale(1); opacity: 1; }
}

/* ---- 撤退弹层 ---- */
#retreat-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
#retreat-modal.open { display: flex; }
#retreat-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 400px;
  max-width: 92vw;
  padding: 16px;
}
#retreat-box h3 { color: var(--accent); margin-bottom: 10px; }
.retreat-info { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.warn-text { color: #f87171; }
.retreat-option {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 5px 0;
  color: var(--text);
  font-size: 13px;
}
.retreat-option:hover { border-color: var(--accent); }

/* ---- 招式弹层 v2 ---- */
#atk-box { width: 460px; max-width: 94vw; }
.atk-warn {
  background: rgba(244,114,182,.15);
  border: 1px solid #f472b6;
  color: #f9a8d4;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  margin-bottom: 8px;
}
.atk-line { display: flex; align-items: center; gap: 6px; }
.atk-line .atk-name { font-weight: bold; font-size: 14px; }
.atk-line .dmg { margin-left: auto; font-size: 15px; }
.cost-dots { display: inline-flex; gap: 2px; }
.cost-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  font-size: 9px;
  color: #1a2332;
  border: 1px solid rgba(0,0,0,.4);
}
.cost-dot.ab {
  width: auto; border-radius: 3px;
  background: #a3e635; padding: 0 5px;
}
.atk-effect {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}
.atk-missing { font-size: 11px; color: #f87171; margin-top: 3px; }
.atk-option.disabled { opacity: .65; }

/* ---- 对局结束遮罩 ---- */
#over-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
#over-modal[hidden] { display: none; }
#over-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 34px 50px;
  text-align: center;
}
#over-title { font-size: 30px; font-weight: bold; color: var(--accent); margin-bottom: 8px; }
#over-reason { color: var(--muted); margin-bottom: 18px; }

/* ---- 空战斗场占位 ---- */
.pile.empty-zone {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}

/* ---- 窄屏适配 ---- */
@media (max-width: 900px) {
  #main-layout { flex-direction: column; }
  #report-panel {
    width: 100%;
    max-height: 200px;
    order: 2;
  }
  header { flex-wrap: wrap; gap: 8px; }
}

/* ---- 减少动态效果 ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- 编辑模式（调试） ---- */
#debug-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 90;
  background: var(--panel);
  border: 1px solid #f59e0b;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  width: 560px;
  max-width: calc(100vw - 24px);
}
#debug-panel .dbg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: #f59e0b;
  font-weight: 600;
}
#debug-panel .dbg-sub { color: var(--muted); font-weight: 400; font-size: 12px; flex: 1; }
#debug-panel .dbg-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
#debug-panel .dbg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
#debug-panel select, #debug-panel input {
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
}
#debug-panel .dbg-num { width: 52px; }
#debug-panel .dbg-msg { color: #ef4444; min-height: 14px; font-size: 12px; }

/* 宝可梦/手牌卡上的编辑按钮 */
.dbg-tools {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  gap: 3px;
  z-index: 5;
}
.dbg-btn {
  background: #f59e0b;
  color: #1a1a1a;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  padding: 1px 6px;
  cursor: pointer;
  line-height: 1.4;
}
.dbg-btn:hover { filter: brightness(1.15); }
.dbg-btn.dbg-del { background: #ef4444; color: #fff; }
.pokemon-card { position: relative; }
.card { position: relative; }
.card > .dbg-del { position: absolute; top: 2px; right: 2px; z-index: 5; }
.atk-section {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 2px 2px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 4px;
}

/* ---- 阶段标签（名字左侧：基 / 进1 / 进2） ---- */
.stage-tag {
  flex: none;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  color: #fff;
  cursor: help;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.stage-tag.basic { background: #16a34a; }            /* 基础：绿 */
.stage-tag.evo1 { background: #d97706; }             /* 一阶进化：琥珀 */
.stage-tag.evo2 { background: #dc2626; }             /* 二阶进化：红 */

/* ---- 卡牌详情「详」按钮 + 弹层 ---- */
.detail-btn {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 6;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 5px;
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: .85;
}
.detail-btn:hover { opacity: 1; filter: brightness(1.1); }

#card-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 110;
  align-items: center;
  justify-content: center;
}
#card-detail-modal.open { display: flex; }
#card-detail-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  overflow-y: auto;
  padding: 14px 16px;
}
#card-detail-body .cd-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
}
#card-detail-body .cd-name { font-size: 16px; color: var(--text); }
#card-detail-body .cd-hp { margin-left: auto; color: #b91c1c; font-weight: 700; }
#card-detail-body .cd-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
/* 卡图两栏布局（15-卡牌图片缓存设计）：图 | 文本 */
#card-detail-body .cd-cols {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 10px;
  align-items: start;
}
#card-detail-body .cd-img img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}
@media (max-width: 640px) {
  #card-detail-body .cd-cols { grid-template-columns: 1fr; }
  #card-detail-body .cd-img { max-width: 220px; margin: 0 auto; }
}
#card-detail-body .cd-sec {
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  margin: 8px 0 2px;
}
#card-detail-body .cd-text {
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  padding: 5px 8px;
}
#card-detail-body .cd-dmg { color: #ef4444; }
#card-detail-body .cd-foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

/* 弃牌列表行内的「详」按钮 */
.discard-row { display: flex; align-items: center; justify-content: space-between; }
.discard-row .detail-btn { position: static; flex: none; }

/* 战报：属性攻防修正标注 */
.dmg-mod { font-size: 11px; font-weight: 600; }
.dmg-mod.weak { color: #f59e0b; }
.dmg-mod.resist { color: #60a5fa; }

/* 战报：伤害计算类型 + 计算链明细（基础/替代/叠加/弱点/抗性） */
.dmg-kind { font-size: 11px; font-weight: 600; color: #a78bfa; }
.dmg-kind .nw { color: #94a3b8; font-weight: 400; }
.calc-chain { font-size: 11px; color: #9ca3af; }
.calc-chain .dmg-stack { color: #34d399; font-weight: 600; }

/* 昏厥补位待选：备战区可点选高亮 + 战斗场空位提示 */
.pokemon-card.pickable-promote {
  cursor: pointer;
  box-shadow: 0 0 0 2px #facc15, 0 0 14px rgba(250, 204, 21, .45);
  animation: promote-glow 1.2s ease-in-out infinite;
}
.pokemon-card.pickable-promote:hover { transform: translateY(-3px); }
@keyframes promote-glow {
  0%, 100% { box-shadow: 0 0 0 2px #facc15, 0 0 8px rgba(250, 204, 21, .35); }
  50% { box-shadow: 0 0 0 3px #fde047, 0 0 18px rgba(250, 204, 21, .65); }
}
.empty-zone.promote-hint {
  border: 2px dashed #facc15;
  color: #facc15;
  font-weight: 700;
  animation: promote-glow 1.2s ease-in-out infinite;
}
#banner.promote { outline: 2px solid rgba(250, 204, 21, .6); }

/* ---- 攻击分镜演出 ---- */
/* ① 蓄力：攻击前发光微缩 */
.pokemon-card.charge { animation: charge calc(.3s * var(--anim-speed, 1)) ease-in forwards; }
@keyframes charge {
  0% { filter: brightness(1); transform: scale(1); }
  100% { filter: brightness(1.5) drop-shadow(0 0 10px rgba(255,255,255,.7)); transform: scale(.96); }
}

/* ② 招式横幅：大字 + 攻守配色 */
.fx-banner.attack-banner {
  font-size: 42px;
  letter-spacing: 2px;
  animation: banner-pop calc(1.15s * var(--anim-speed, 1)) ease forwards;
}
.fx-banner.attack-banner.me { color: #7cc4ff; }
.fx-banner.attack-banner.opp { color: #ff8f8f; }

/* ③ 命中冲击环 */
.impact-ring {
  position: absolute;
  left: 50%; top: 42%;
  width: 12px; height: 12px;
  border: 3px solid rgba(255,255,255,.95);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 19;
  animation: impact-ring calc(.55s * var(--anim-speed, 1)) ease-out forwards;
}
@keyframes impact-ring {
  0% { opacity: .95; width: 12px; height: 12px; }
  100% { opacity: 0; width: 150px; height: 150px; }
}

/* ④ 弱点/抗性命中闪烁 */
.pokemon-card.hit-weak { animation: hit-weak calc(.9s * var(--anim-speed, 1)) ease; }
@keyframes hit-weak {
  0%, 100% { box-shadow: none; }
  25%, 65% { box-shadow: 0 0 0 3px rgba(245,158,11,.95), 0 0 24px 6px rgba(245,158,11,.5); }
}
.pokemon-card.hit-resist { animation: hit-resist calc(.9s * var(--anim-speed, 1)) ease; }
@keyframes hit-resist {
  0%, 100% { box-shadow: none; }
  25%, 65% { box-shadow: 0 0 0 3px rgba(96,165,250,.95), 0 0 20px 4px rgba(96,165,250,.45); }
}

/* ⑤ 副飘字（弱点/抗性标注） */
.fx-sub {
  top: 40px;
  transform: translateX(-50%);
  font-size: 15px;
  animation: float-up calc(1.25s * var(--anim-speed, 1)) ease-out forwards;
}
.fx-sub.weak { color: #fbbf24; text-shadow: 0 2px 4px rgba(0,0,0,.85); }
.fx-sub.resist { color: #93c5fd; text-shadow: 0 2px 4px rgba(0,0,0,.85); }

/* 大伤害字 */
.fx-damage.big { font-size: 30px; }

/* ⑥ 全屏震动（大伤害） */
body.screen-shake { animation: screen-shake calc(.4s * var(--anim-speed, 1)) ease; }
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 3px); }
  40% { transform: translate(6px, -4px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 2px); }
}

/* ⑦ 血条平滑滑落 */
.hpbar .fill.animating { transition: width calc(.65s * var(--anim-speed, 1)) cubic-bezier(.22,1,.36,1); }

/* ---- 对局设置弹层 ---- */
.setup-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .65); align-items: center; justify-content: center;
}
.setup-overlay.open { display: flex; }
.setup-box {
  background: var(--panel, #16202e); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px; width: min(680px, 94vw);
  max-height: 90vh; overflow: auto;
}
.setup-box h3 { margin: 0 0 14px; color: var(--accent, #4a90d9); }
.setup-grid {
  display: grid; grid-template-columns: 1fr 44px 1fr; gap: 12px; align-items: start;
}
.setup-side-title { font-size: 13px; color: var(--muted, #8fa3b8); margin-bottom: 6px; }
.setup-side select {
  width: 100%; background: var(--bg, #0f1722); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px;
}
.setup-side button { font-size: 16px; padding: 8px 10px; align-self: center; }
#setup-swap { margin-top: 22px; }
.setup-preview {
  margin-top: 8px; font-size: 12px; color: var(--muted, #8fa3b8); line-height: 1.6;
  min-height: 40px; background: var(--bg, #0f1722);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
}
.setup-preview .ok { color: #22c55e; }
.setup-preview .bad { color: #ef4444; }
.setup-row { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.setup-row select {
  background: var(--bg, #0f1722); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.setup-error { color: #ef4444; font-size: 12px; margin-top: 10px; min-height: 16px; }
.setup-actions { display: flex; gap: 10px; margin-top: 12px; justify-content: flex-end; }
.setup-actions button { font-size: 14px; padding: 9px 20px; }
.setup-actions button:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 对局设置弹层：快捷菜单行 ---- */
.setup-menu {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: -4px 0 14px; padding: 8px 10px;
  background: var(--bg, #0f1722); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
}
.setup-menu a {
  color: var(--text); text-decoration: none;
  background: var(--panel); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 6px; font-size: 12px;
}
.setup-menu a:hover { filter: brightness(1.2); }
.setup-menu button { font-size: 12px; padding: 5px 10px; }
.setup-menu-sep { flex: 1; }
.setup-menu .fast-toggle { color: var(--muted, #8fa3b8); font-size: 12px; display: flex; align-items: center; gap: 4px; }

/* ---- 多人对战室（room.html，16-房间功能） ---- */
#room-app { max-width: 720px; margin: 16px auto; display: flex; flex-direction: column; gap: 12px; }
.room-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}
.room-card h2 { font-size: 16px; margin-bottom: 12px; color: var(--accent); }
.room-label { color: var(--muted); font-size: 13px; margin-right: 8px; }
.room-msg { color: #fbbf24; font-size: 13px; margin-left: 8px; }
#identity-box { display: flex; align-items: center; gap: 8px; }
#identity-box input {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; width: 200px;
}
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-btn {
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 22px 12px; cursor: pointer; transition: .15s;
}
.mode-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-icon { font-size: 30px; }
.mode-name { font-size: 17px; font-weight: 700; }
.mode-desc { font-size: 12px; color: var(--muted); }
.room-form { display: flex; gap: 16px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.room-form label { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.room-form select {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; min-width: 180px;
}
.room-actions { display: flex; gap: 10px; margin-top: 14px; }
.wait-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.wait-row { display: flex; align-items: center; gap: 8px; }
#room-link {
  flex: 1; background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.player-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin: 6px 0; font-size: 14px;
}
.player-seat { color: var(--muted); width: 42px; }
.player-name { font-weight: 700; min-width: 90px; }
.player-name.dim { color: var(--muted); font-weight: 400; }
.player-deck { color: var(--muted); font-size: 12px; flex: 1; }
.player-flag { font-size: 12px; }
.player-flag.ok { color: var(--hp); }
.player-flag.off { color: var(--muted); }
.countdown { color: #fbbf24; font-weight: 700; margin-top: 12px; text-align: center; }
.result-body { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.result-line.win { color: var(--hp); font-size: 22px; font-weight: 700; }
.result-line.lose { color: #f87171; font-size: 22px; font-weight: 700; }
.result-line.dim { color: var(--muted); font-size: 13px; }
.join-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 8px; }
.join-box { justify-content: center; }
.join-input {
  flex: 1; max-width: 240px; background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 8px 12px; font-size: 15px;
  letter-spacing: 3px; text-transform: uppercase; text-align: center;
}
.join-input:focus { outline: none; border-color: var(--accent); }
.join-hint { color: var(--muted); font-size: 12px; margin-top: 8px; text-align: center; }

/* ---- 行动弹层：状态面板（血量 + 附加状态，规则 07） ---- */
#atk-status { display: flex; gap: 10px; margin: 4px 0 10px; }
.atk-side {
  flex: 1; min-width: 0;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.atk-side.opp { border-color: #7f1d1d66; }
.atk-side-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.atk-side-label {
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px;
}
.atk-side.opp .atk-side-label { color: #f87171; border-color: #7f1d1d; }
.atk-side.mine .atk-side-label { color: var(--accent); border-color: var(--accent); }
.atk-side-name { font-weight: 700; font-size: 14px; }
.atk-side-hp { font-size: 12px; font-weight: 700; margin-left: auto; }
.atk-side-hp.low { color: #f87171; }
.atk-side-hp.mid { color: #fbbf24; }
.atk-side .hpbar { margin: 6px 0; }
.st-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 20px; }
.st-tag {
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1px 8px; color: var(--muted); cursor: default;
}
.st-tag.none { border-style: dashed; opacity: .7; }

/* ---- 卡牌血条行：血条 + 失血标 + 剩余/最大数值 ---- */
.hp-row { display: flex; align-items: center; gap: 3px; margin: 2px 0; }
.hp-row .hpbar { flex: 1; min-width: 30px; }
.hp-num { font-size: 9px; font-weight: 700; white-space: nowrap; }
.hp-num.low { color: #f87171; }
.hp-num.mid { color: #fbbf24; }
.dmg-num {
  font-size: 9px; font-weight: 700; color: #fff; background: #dc2626;
  border-radius: 5px; padding: 0 3px; white-space: nowrap;
}

/* ---- 状态说明浮层（点击状态徽章，规则 07） ---- */
#status-pop {
  position: fixed;
  z-index: 3000;
  width: 260px;
  background: rgba(15, 23, 42, .97);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  pointer-events: auto;
}
#status-pop .sp-title { font-weight: 700; font-size: 14px; color: var(--accent); margin-bottom: 4px; }
#status-pop .sp-desc { font-size: 12px; line-height: 1.6; color: var(--text); }
.badge.clickable, .st-tag.clickable { cursor: pointer; }

/* ---- 战斗过场时间轴（19）：昏厥鬼影 ---- */
/* 目标卡已被换下时在原位临时回放昏厥动画的鬼影卡（不可交互、不接管事件） */
.pokemon-card.ghost {
  pointer-events: none;
  user-select: none;
}
