/* ═══════════════════════════════════════════════════════
   Battle Arena
═══════════════════════════════════════════════════════ */

.battle-picker-hint {
  color: var(--muted);
  margin-bottom: 16px;
  font-family: var(--font-body);
  font-size: 1.05rem;
}
.battle-picker-hint span { color: var(--gold2); font-weight: 700; }

.battle-pick-item { cursor: pointer; transition: outline .15s, transform .15s, box-shadow .15s; }
.battle-pick-item.picked {
  outline: 2px solid var(--gold2);
  outline-offset: -2px;
  transform: translateY(-4px);
  box-shadow: 0 0 24px var(--glow-gold);
}
.battle-pick-stats {
  display: flex;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
  margin-top: 6px;
}

#battle-start-btn { margin-top: 24px; }
#battle-start-btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
#battle-start-btn:disabled:hover { transform: none; }

/* ── HUD / turn banner ── */
.battle-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}
#battle-turn-info {
  font-family: var(--font-head);
  font-size: 1.1rem;
  letter-spacing: .02em;
}
#battle-turn-info.side-p { color: var(--accent); text-shadow: 0 0 12px var(--glow-blue); }
#battle-turn-info.side-e { color: var(--relic);  text-shadow: 0 0 12px rgba(248,113,113,.5); }

/* ── Unit info panel ── */
#battle-info-panel {
  max-width: 560px;
  margin: 0 auto 18px;
  min-height: 84px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.info-empty { color: var(--muted); font-size: .9rem; padding: 0 18px; }
.info-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 16px; }
.info-card-img {
  width: 60px; height: 60px; flex: none;
  border-radius: 4px; overflow: hidden;
  border: 2px solid var(--border);
}
.info-card.side-p .info-card-img { border-color: var(--accent); box-shadow: 0 0 14px var(--glow-blue); }
.info-card.side-e .info-card-img { border-color: var(--relic);  box-shadow: 0 0 14px rgba(248,113,113,.4); }
.info-card-img img { width: 100%; height: 100%; object-fit: cover; }
.info-card-body { flex: 1; min-width: 0; }
.info-name {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-faction { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.info-hp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.info-hp-label { font-size: .78rem; color: var(--text); white-space: nowrap; }
.info-hp-bar { flex: 1; height: 7px; background: rgba(0,0,0,.5); border-radius: 999px; overflow: hidden; }
.info-hp-fill { height: 100%; background: linear-gradient(90deg, var(--familiar), #86efac); transition: width .3s ease; }
.info-stats-row { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.info-stats-row span { color: var(--gold2); }

/* ── Board ── */
#battle-board {
  display: grid;
  gap: 5px;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px;
  background: radial-gradient(circle at 50% 30%, rgba(120,140,255,.08), transparent 70%), var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.battle-cell {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background .15s, box-shadow .15s;
}
.battle-cell.reachable  { background: color-mix(in srgb, var(--familiar) 12%, var(--surface2)); box-shadow: inset 0 0 0 2px var(--familiar); cursor: pointer; }
.battle-cell.attackable { background: color-mix(in srgb, var(--relic) 14%, var(--surface2));    box-shadow: inset 0 0 0 2px var(--relic);    cursor: pointer; }
.battle-cell.reachable:hover  { background: color-mix(in srgb, var(--familiar) 26%, var(--surface2)); }
.battle-cell.attackable:hover { background: color-mix(in srgb, var(--relic) 26%, var(--surface2)); }

.battle-unit {
  position: absolute;
  inset: 3px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: transform .15s;
}
.battle-unit.side-p { border-color: var(--accent); box-shadow: 0 0 10px var(--glow-blue); }
.battle-unit.side-e { border-color: var(--relic);  box-shadow: 0 0 10px rgba(248,113,113,.45); }
.battle-unit.active { animation: battle-unit-glow 1.4s ease-in-out infinite; z-index: 2; }
.battle-unit.hit    { animation: battle-hit-shake .35s ease; }
.battle-unit img { width: 100%; height: 100%; object-fit: cover; display: block; }

.battle-hp-bar {
  position: absolute;
  left: 3px; right: 3px; bottom: 3px;
  height: 5px;
  background: rgba(0,0,0,.65);
  border-radius: 999px;
  overflow: hidden;
}
.battle-hp-fill { height: 100%; background: linear-gradient(90deg, var(--familiar), #86efac); }
.battle-hp-num {
  position: absolute;
  top: 2px; right: 3px;
  font-size: .62rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
  font-family: var(--font-head);
  line-height: 1;
}

.dmg-float {
  position: absolute;
  top: -4px; left: 50%;
  transform: translateX(-50%);
  color: var(--relic);
  font-family: var(--font-head);
  font-size: .95rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
  animation: battle-dmg-float .7s ease-out forwards;
  pointer-events: none;
  z-index: 3;
}

@keyframes battle-unit-glow {
  0%, 100% { box-shadow: 0 0 8px var(--glow-gold); }
  50%      { box-shadow: 0 0 20px var(--glow-gold); }
}
@keyframes battle-hit-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
@keyframes battle-dmg-float {
  0%   { opacity: 0; transform: translate(-50%, 4px); }
  20%  { opacity: 1; transform: translate(-50%, -6px); }
  100% { opacity: 0; transform: translate(-50%, -28px); }
}

/* ── Log ── */
.battle-log {
  margin: 16px auto 0;
  max-width: 560px;
  max-height: 130px;
  overflow-y: auto;
  font-size: .82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── Result screen ── */
#battle-result { text-align: center; padding: 60px 0; }
#battle-result-title {
  font-family: var(--font-head);
  font-size: 1.7rem;
  color: var(--gold2);
  text-shadow: 0 0 24px var(--glow-gold);
  margin-bottom: 24px;
  letter-spacing: .03em;
}
