/* ── BattleCard ────────────────────────────────────────────────────────────── */
.battle-card {
  overflow: hidden;
  padding: 1.1rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  box-sizing: border-box;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.battle-card:hover {
  border-color: rgba(12,11,11,.13);
  box-shadow: 0 4px 20px rgba(12,11,11,.05);
}

/* Header — matches ClashCard: space-between, badge left | meta center | title right */
.battle-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .9rem;
}

.battle-card__header-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.battle-card__creator-tag {
  font-size: .7rem;
  font-weight: 600;
  color: var(--clr-muted);
}

.battle-card__network {
  color: var(--clr-muted);
  display: flex;
  align-items: center;
}

/* Title — mirrors clash-card__title */
.battle-card__title {
  font-size: .68rem;
  font-weight: 500;
  color: var(--clr-muted);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.battle-card__draw-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--clr-muted);
  padding: .1rem .35rem;
  border-radius: 4px;
  border: 1px solid var(--clr-border);
}

/* ── Participants grid ───────────────────────────────────────────────────────── */
.battle-card__participants {
  display: grid;
  gap: .65rem;
  margin-bottom: .85rem;
}

.battle-card__participants--3 { grid-template-columns: repeat(3, 1fr); }
.battle-card__participants--4 { grid-template-columns: repeat(2, 1fr); }
.battle-card__participants--5 { grid-template-columns: repeat(3, 1fr); }

/* 5-participant layout: 3 top + 2 centered bottom */
.battle-card__participants--5 .battle-card__slot:nth-child(4) {
  grid-column: 1 / span 1;
  justify-self: end;
  width: calc(100% - .25rem);
}
.battle-card__participants--5 .battle-card__slot:nth-child(5) {
  grid-column: 3 / span 1;
  justify-self: start;
  width: calc(100% - .25rem);
}

/* ── Single slot — <a> tag, mirrors clash-card__fighter column layout ─────── */
.battle-card__slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .5rem .2rem .4rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition), opacity var(--transition);
}

.battle-card__slot:hover { opacity: .88; }

.battle-card__slot--winner {
  background: rgba(197,160,40,.07);
  border: 1px solid rgba(197,160,40,.2);
}
.battle-card__slot--winner:hover { opacity: 1; }

/* Crown absolute — matches clash-card winner-crown */
.battle-card__slot .winner-crown {
  position: absolute;
  top: .2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: .85rem;
  line-height: 1;
}

.battle-card__rank-badge {
  position: absolute;
  top: .2rem;
  right: .2rem;
  font-size: .6rem;
  font-weight: 800;
  color: var(--clr-muted);
  background: var(--clr-surface2);
  border-radius: 4px;
  padding: 0 .25rem;
}
.battle-card__slot--winner .battle-card__rank-badge {
  color: var(--clr-primary);
  background: rgba(197,160,40,.12);
}

/* Avatar wrap — same as clash-card to support official-badge positioning */
.battle-card__avatar-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  border-radius: 50%;
}

.battle-card__slot .avatar--sm {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--clr-border);
  display: block;
  transition: border-color var(--transition);
}
.battle-card__slot--winner .avatar--winner { border-color: var(--clr-primary); }
.battle-card__slot .avatar--official       { border-color: var(--clr-accent); }

.battle-card__name {
  font-size: .72rem;
  font-weight: 700;
  color: var(--clr-text);
  text-align: center;
  line-height: 1.2;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Vote count + gold — mirrors clash-card__votes */
.battle-card__slot-votes {
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
  color: var(--clr-text);
}
.battle-card__slot-votes-gold {
  font-size: .7rem;
  color: var(--clr-primary);
  font-weight: 600;
}

/* Your vote badge — mirrors clash-card__voted-badge */
.battle-card__slot-voted {
  display: block;
  font-size: .62rem;
  font-weight: 700;
  color: var(--clr-accent);
  text-align: center;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.battle-card__slot-voted.is-hidden { display: none !important; }

/* Per-participant vote bar */
.battle-card__slot-bar {
  width: 100%;
  height: 4px;
  background: var(--clr-surface2);
  border-radius: 4px;
  overflow: hidden;
}
.battle-card__slot-bar-fill {
  height: 100%;
  background: var(--clr-primary);
  border-radius: 4px;
  transition: width .4s ease;
  min-width: 3px;
}
.battle-card__slot--winner .battle-card__slot-bar-fill { background: var(--clr-primary); }

/* Percentage label below bar */
.battle-card__slot-pct {
  font-size: .62rem;
  font-weight: 600;
  color: var(--clr-muted);
}

/* Duration row — identical to clash-card__duration */
.battle-card__duration {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  color: var(--clr-muted);
  margin-bottom: .55rem;
}
.battle-card__duration svg { flex-shrink: 0; opacity: .7; }
.battle-card__duration-text { line-height: 1.2; }

/* Actions — right-aligned, no border-top (mirrors clash-card__actions) */
.battle-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: .5rem;
}
.battle-card__action-link {
  font-size: .8rem;
  font-weight: 600;
  color: var(--clr-muted);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color var(--transition);
}
.battle-card__action-link:hover          { color: var(--clr-text); }
.battle-card__action-link--primary       { color: var(--clr-text); }
.battle-card__action-link--primary:hover { color: var(--clr-accent); }

/* Vote flash animation — triggered by WebSocket BattleVoteCast */
@keyframes battle-vote-flash {
  0%   { color: var(--clr-primary); }
  100% { color: var(--clr-text); }
}
.battle-vote-flash { animation: battle-vote-flash .6s ease-out; }

/* Mobile */
@media (max-width: 400px) {
  .battle-card__slot .avatar--sm { width: 44px; height: 44px; }
  .battle-card__name { max-width: 60px; font-size: .64rem; }
}