/* ==== 战场布局 ==== */

.board-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/board/planks.jpg');
  background-size: 512px;
}
.board-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(rgba(20,12,4,0.35), rgba(20,12,4,0.35));
}

/* 中央桌面板 */
.play-table {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1500px);
  height: min(88vh, 860px);
  border-radius: 26px;
  background: url('../assets/board/wood.jpg');
  background-size: 700px;
  box-shadow:
    0 0 0 6px #241708,
    0 0 0 10px #4a3113,
    0 24px 60px rgba(0,0,0,0.75),
    inset 0 0 80px rgba(0,0,0,0.55);
}
.play-table::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,220,150,0.10), rgba(0,0,0,0.35) 90%);
  pointer-events: none;
}

/* 随从战区（中央地毯） */
.battlefield {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 78%;
  height: 38%;
  border-radius: 18px;
  background: url('../assets/board/leather.jpg');
  background-size: 480px;
  box-shadow:
    inset 0 0 40px rgba(0,0,0,0.65),
    0 0 0 4px #3a2410,
    0 0 0 6px #6b4a1c;
}
.battlefield::after {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(214,178,110,0.45), transparent);
}

.board-row {
  position: absolute;
  left: 0;
  width: 100%;
  height: 46%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.board-row.enemy  { top: 2%; }
.board-row.player { bottom: 2%; }

/* ==== 英雄区 ==== */
.hero-zone {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 5;
}
.hero-zone.enemy  { top: 7%; }
.hero-zone.player { bottom: 17%; }

.hero {
  position: relative;
  width: 118px;
  height: 118px;
}
.hero .portrait-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: url('../assets/board/metal.jpg');
  background-size: 220px;
  box-shadow:
    0 6px 16px rgba(0,0,0,0.7),
    inset 0 0 6px rgba(0,0,0,0.8);
  border: 3px solid #201409;
}
.hero .portrait {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero .portrait img {
  width: 68%;
  height: 68%;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
}
.hero .stat {
  position: absolute;
  width: 44px;
  height: 44px;
  bottom: -6px;
  z-index: 3;
}
.hero .stat.hp   { right: -8px; }
.hero .stat.atk  { left: -8px; }
.hero .stat.armor {
  right: -8px;
  top: -4px;
  bottom: auto;
  width: 38px;
  height: 38px;
}
.hero.targetable { cursor: pointer; }
.hero.can-attack .portrait-ring {
  box-shadow: 0 0 18px 5px rgba(76,255,120,0.75), inset 0 0 6px rgba(0,0,0,0.8);
}

.hero-name-plate {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -20px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: bold;
  color: #f3e3b8;
  text-shadow: 0 1px 2px #000, 0 0 6px #000;
  background: rgba(20,12,4,0.72);
  border: 1px solid #6b4a1c;
  border-radius: 10px;
  padding: 1px 10px;
}

/* 英雄技能 */
.hero-power {
  position: relative;
  width: 84px;
  height: 84px;
  cursor: pointer;
  transition: transform 0.15s;
}
.hero-power:hover { transform: scale(1.07); }
.hero-power .ring { position: absolute; inset: 0; }
.hero-power .ring img { width: 100%; height: 100%; }
.hero-power .picon {
  position: absolute;
  inset: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-power .picon img { width: 100%; height: 100%; opacity: 0.92; }
.hero-power .cost {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  z-index: 2;
}
.hero-power.used, .hero-power.unusable { filter: grayscale(0.85) brightness(0.6); cursor: default; }
.hero-power.used:hover, .hero-power.unusable:hover { transform: none; }
.hero-power.usable-glow { animation: powerGlow 1.6s ease-in-out infinite; border-radius: 50%; }

/* ==== 牌库 / 法力 / 结束回合 ==== */
.side-panel {
  position: absolute;
  right: 1.4%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 6;
}
.side-panel.enemy  { top: 4%; }
.side-panel.player { bottom: 4%; }

.deck-pile {
  position: relative;
  width: 58px;
  height: 78px;
  border-radius: 6px;
  background:
    linear-gradient(rgba(30,18,8,0.25), rgba(30,18,8,0.25)),
    url('../assets/board/leather.jpg');
  background-size: 240px;
  border: 2px solid #7a5a22;
  box-shadow: 2px 2px 0 #201203, 4px 4px 0 #55401a, 6px 6px 12px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.deck-pile img { width: 60%; opacity: 0.8; }
.deck-pile .count {
  position: absolute;
  bottom: -8px;
  right: -8px;
  min-width: 26px;
  height: 26px;
  border-radius: 13px;
  background: #1c1204;
  border: 2px solid #c9a24b;
  color: #ffe6a6;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.mana-bar {
  display: flex;
  align-items: center;
  gap: 3px;
}
.mana-bar .crystals { display: flex; gap: 2px; }
.mana-bar .crystal { width: 22px; height: 24px; transition: filter 0.25s, opacity 0.25s; }
.mana-bar .crystal img { width: 100%; height: 100%; }
.mana-bar .crystal.empty { filter: grayscale(1) brightness(0.45); opacity: 0.7; }
.mana-text {
  font-size: 15px;
  font-weight: bold;
  color: #bfe4ff;
  text-shadow: 0 1px 2px #000;
  margin-right: 4px;
}
.mana-bar.enemy-mana .crystal { width: 15px; height: 17px; }

.end-turn-btn {
  position: absolute;
  right: 1.2%;
  top: 50%;
  transform: translateY(-50%);
  width: 130px;
  height: 52px;
  z-index: 20;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #3a2404;
  background:
    linear-gradient(rgba(255,236,170,0.25), rgba(120,70,10,0.25)),
    url('../assets/board/metal.jpg');
  background-size: 260px;
  background-blend-mode: overlay;
  background-color: #d8b054;
  border: 3px solid #6d4c1e;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.5);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.2s;
}
.end-turn-btn:hover { transform: translateY(-50%) scale(1.05); box-shadow: 0 0 18px rgba(255,214,110,0.8); }
.end-turn-btn:disabled {
  filter: grayscale(0.8) brightness(0.6);
  cursor: default;
  transform: translateY(-50%);
  box-shadow: none;
}

/* ==== 顶层横幅 ==== */
.turn-banner {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0.6);
  padding: 16px 70px;
  font-size: 42px;
  font-weight: bold;
  letter-spacing: 10px;
  color: #ffe9b0;
  text-shadow: 0 2px 4px #000, 0 0 22px rgba(255,180,60,0.9);
  background:
    linear-gradient(rgba(40,22,6,0.88), rgba(40,22,6,0.88));
  border-top: 3px solid #c9a24b;
  border-bottom: 3px solid #c9a24b;
  opacity: 0;
  pointer-events: none;
  z-index: 70;
}

.toast-msg {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  padding: 8px 26px;
  border-radius: 20px;
  background: rgba(90,10,10,0.88);
  border: 2px solid #e57373;
  color: #ffd9d9;
  font-size: 17px;
  font-weight: bold;
  text-shadow: 0 1px 2px #000;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
}

/* ==== 结算画面 ==== */
.result-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: rgba(8,4,1,0.82);
  z-index: 100;
}
.result-screen .title {
  font-size: 92px;
  font-weight: bold;
  letter-spacing: 20px;
}
.result-screen .title.win {
  color: #ffd76e;
  text-shadow: 0 0 34px rgba(255,190,60,0.95), 0 4px 8px #000;
}
.result-screen .title.lose {
  color: #90a4ae;
  text-shadow: 0 0 24px rgba(120,144,156,0.8), 0 4px 8px #000;
}
.result-screen button {
  font-family: inherit;
  font-size: 22px;
  font-weight: bold;
  padding: 12px 46px;
  border-radius: 12px;
  border: 3px solid #6d4c1e;
  background: #d8b054;
  color: #3a2404;
  cursor: pointer;
}
.result-screen button:hover { filter: brightness(1.1); }

/* ==== 开场画面 ==== */
.start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(120,70,20,0.45), rgba(0,0,0,0.9) 75%),
    url('../assets/board/planks.jpg');
  background-size: cover, 512px;
  z-index: 100;
}
.start-screen h1 {
  font-size: 64px;
  letter-spacing: 14px;
  color: #ffd76e;
  text-shadow: 0 0 30px rgba(255,190,60,0.8), 0 4px 6px #000;
}
.start-screen .subtitle { color: #cbb98a; font-size: 16px; letter-spacing: 4px; }
.start-screen .hero-pick {
  display: flex;
  gap: 40px;
}
.start-screen .pick-card {
  width: 180px;
  padding: 20px 16px 16px;
  border-radius: 16px;
  background: rgba(28,17,6,0.92);
  border: 3px solid #6d4c1e;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.start-screen .pick-card:hover {
  transform: translateY(-8px) scale(1.04);
  border-color: #f7de9a;
  box-shadow: 0 0 26px rgba(255,204,90,0.55);
}
.start-screen .pick-card img { width: 90px; height: 90px; }
.start-screen .pick-card .pname { color: #ffe9b0; font-size: 19px; font-weight: bold; margin-top: 10px; }
.start-screen .pick-card .pdesc { color: #b09c72; font-size: 13px; margin-top: 6px; line-height: 1.5; }
.start-screen .credits {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  color: #8a7a58;
  font-size: 11px;
  line-height: 1.7;
}
.start-screen .credits a { color: #b09c72; }
