/* Battle detail sheet (T-008 / R-008) - design/v3/parts/BattleDetail.html.

   Everything here is scoped to `.sheet-battle`, the class web/screens/
   battledetail.js passes to CRApp.openSheet, so none of it can leak into another
   sheet or screen. The sheet chrome itself (panel, backdrop, head, body, foot,
   grab handle, desktop centring) is the kernel's `.sheet-*` primitive in
   web/css/components.css and is not touched here.

   The duel block reuses window.WarTab.buildRoundDetails, whose `.round-*` /
   `.vs-*` markup is styled by web/css/war.css for the War screen. A sheet
   renders outside the screen sections, so the few of those rules this sheet
   needs are restated here in Arena values - scoped to `.sheet-battle`, never
   redefining the shared classes globally. (T-016 removed the leftovers for
   markup that renderer no longer emits: `.round-label` and the whole
   `.card-chip` family, now that CRUI.cardChip is an alias of CRUI.art.) */

/* R-005 TEXT FLOOR - same rule as web/css/battles.css: 11px belongs to the
   uppercase eyebrow/pill/tag family (which set their own size); every mixed-case
   line in this sheet is raised to 12px. Scoped to `.sheet-battle`, so the shared
   `.tiny` keeps its own definition everywhere else. */
.sheet-battle .tiny { font-size: 12px; }

.sheet-battle .sheet-body { gap: 14px; }
.sheet-battle .sheet-foot { flex-direction: row; gap: 10px; }
.sheet-battle .sheet-foot .btn { flex: 1; }
/* "Copy my deck" is the longer label since T4-013: it keeps its natural width on
   ONE line and "All vs <opponent>" (which ellipsizes) takes the rest. */
.sheet-battle .sheet-foot .bd-copy { flex: 0 0 auto; white-space: nowrap; }
.sheet-battle .sheet-foot .bd-vs { flex: 1 1 0; min-width: 0; }
.sheet-battle .bd-vs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A failed load: the reason in the shared error red, then the way out. */
.bd-fail { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.bd-fail .error-text { margin-top: 0; }

.bd-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bd-when { margin-top: -8px; }

/* ---------- the two players ----------
   The Battles list shows only the opponent's deck, so the sheet spells out both
   sides: a labelled "You" block (its left edge carries the result colour, like
   the list row) and a labelled "Opponent" block. Crowns are the big number on
   the right of each block header, so the two read as a scoreboard when stacked.
   The 8 cards fill the block's width in an 8-column grid, capped so a wide
   desktop sheet never stretches them. */

.bd-player { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.bd-you { border-left: 3px solid var(--ink-3); }
.bd-you.bd-win { border-left-color: var(--good); }
.bd-you.bd-loss { border-left-color: var(--bad); }
.bd-player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.bd-player-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bd-player-label { display: flex; align-items: center; gap: 4px; min-height: 16px; }
/* the info tip's 32px hit area must not make the label row taller than its text */
.bd-player-label .info-tip { margin: -8px 0; }
.bd-name { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bd-crowns { font-size: 36px; flex: none; }
.bd-player-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; }
.bd-player .art-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; max-width: 420px; }
.bd-player .art { width: 100%; height: auto; aspect-ratio: 5 / 6; }

/* ---------- sections ---------- */

.bd-sec { display: flex; flex-direction: column; gap: 6px; }
.bd-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bd-sec-head .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-sec .art-row { gap: 4px; }
.bd-elixir { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.bd-drop { color: var(--elixir); display: inline-flex; }

.bd-duel-score { font-weight: 700; }

.bd-troops { display: flex; gap: 18px; flex-wrap: wrap; }
.bd-troop { display: flex; align-items: center; gap: 6px; }

/* ---------- towers ---------- */

.bd-towers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bd-tower-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bd-tower-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-hp-row { display: flex; align-items: center; gap: 8px; }
.bd-hp-label { width: 64px; flex: none; }   /* fits "Princess 1" at the 12px floor */
.bd-hp-meter { flex: 1; height: 6px; }
.bd-hp-meter .fill.good { background: var(--good); }
.bd-hp-meter .fill.bad { background: var(--bad); }
.bd-hp-value { width: 62px; flex: none; text-align: right; }
/* An unreported HP gets NO meter at all (see battledetail.js hpRow) - the words
   take the bar's place so nothing on the row can be read as a zero bar. */
.bd-hp-none { flex: 1; min-width: 0; font-style: italic; }
.bd-standing { padding-top: 2px; }
.bd-standing-text { font-weight: 700; }

/* ---------- facts / lines ---------- */

.bd-facts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bd-fact { display: inline-flex; align-items: center; gap: 5px; }
.bd-fact b { color: var(--ink); }
.bd-line { line-height: 1.5; }

/* ---------- duel rounds (shared WarTab renderer, restyled in-sheet) ---------- */

.sheet-battle .round-details { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.sheet-battle .round-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--s2); border-radius: 12px; padding: 8px 10px;
}
.sheet-battle .round-crowns {
  width: 44px; flex: none; font-family: var(--display); font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sheet-battle .vs-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.sheet-battle .vs-label { flex: none; width: 28px; font-size: 11px; font-weight: 800; color: var(--ink-3); }

/* T-016 removed this file's `.sheet-battle .round-label` and
   `.sheet-battle .card-chip`/`.chip-row` blocks: WarTab.buildRoundDetails emits
   `.round-row-head` (no `.round-label`) and CRUI.artRow, and `.card-chip` no
   longer exists anywhere - CRUI.cardChip is now an alias of CRUI.art, so every
   deck in this sheet is an `.art` chip styled by components.css. */

@media (max-width: 400px) {
  .bd-crowns { font-size: 34px; }
  .bd-troops { gap: 12px; }
}
