/* Levyhold /live: the rival list over the game's own map and battle stage, read only. Loaded after game.css and uses its tokens,
   frames and stage rules; only the page grid, the list and the caption are new. Breakpoints repeat data/ui.yaml ui.client as game.css
   does (tests/test_client_breakpoints.py reads both sheets): phone at or under bp_phone_w 900, short screens at or under bp_short_h 500.
   /live/embed (body[data-embed]) keeps the map, the stage and the caption. */

/* the page: the view fills the window under the top bar, the caption and the action bar under it; the rival list is a window over
   the view (windows.js: opened from the bar, moved by its title; a bottom sheet on a phone). game.css's grid is overridden here. */
body.live[data-view] #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "top" "mid" "cap" "bar"; }
body.live[data-embed="1"][data-view] #app { grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "mid" "cap"; }
body.live[data-embed="1"] :is(#top, #rivals-panel, #actbar) { display: none; }
#rivals-panel { justify-self: start; width: clamp(220px, 22vw, 320px); }
/* a battle: the list folds to name and status, so the open window covers less of the stage */
body.live[data-view="battle"] #away:empty { display: none; }
body.live[data-view="battle"] .rival { padding: var(--sp-1) var(--sp-2); gap: 0; }
body.live[data-view="battle"] :is(.rv-style, .rv-faces, .rv-nums) { display: none; }

.live-h { margin: 0; font-size: var(--fs-lg); color: var(--ink); white-space: nowrap; }
.live-gap { flex: 1 1 0; min-width: 0; }
#watching { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live .stat.where { min-width: 0; }
.caption { grid-area: cap; margin: 0; padding: var(--sp-1) var(--sp-3); background: var(--band); border-radius: var(--r); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the battle is watched, not played: no Auto, speed, Retreat or Continue */
.live .skillbar .utils, .live #end-ok { display: none; }
.live #map { cursor: default; }

/* ---- the rival strip ------------------------------------------------------------------------------------------------------------ */
.rivals { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); align-content: start; flex: none; }
.rival { width: 100%; min-height: var(--tap); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-1); text-align: left; padding: var(--sp-2) var(--sp-3);
  background: var(--panel2); border: var(--bw) solid var(--line); border-radius: var(--r); box-shadow: inset 0 var(--bw) 0 var(--bevel-hi); cursor: pointer; }
.rival:hover { border-color: var(--gold); }
.rival[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 var(--bw) var(--gold); }
.rival[data-picked="1"] .rv-name::after { content: " \2022"; color: var(--gold); }
.rival[data-status="camp"], .rival[data-status="done"] { background: var(--band); }
.rv-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.rv-name { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-status { flex: none; font-size: var(--fs-xs); font-weight: 700; color: var(--dim); white-space: nowrap; }
.rv-status.playing { color: var(--good); }
.rv-style, .rv-nums { font-size: var(--fs-sm); color: var(--dim); min-width: 0; overflow-wrap: anywhere; }
.rv-faces { display: flex; gap: var(--sp-1); min-width: 0; }
.rv-face { width: 2.2em; height: 2.2em; flex: none; display: grid; place-items: center; overflow: hidden; border: var(--bw) solid var(--bevel-lo);
  border-radius: var(--r); font-size: var(--fs-xs); font-weight: 800; color: var(--chip-ink); }
.rv-face .spr { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
#away:empty { min-height: 0; }

/* phones: the strip is a compact grid over the view (name and status only), two to a row */
@media (max-width: 900px) {
  .live .brand, .live-h, .live .stat.where { display: none; }
  .rivals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-1); flex: none; }
  .rival { padding: var(--sp-1) var(--sp-2); gap: 0; }
  .rv-head { flex-direction: column; align-items: flex-start; gap: 0; }
  .rv-name, .rv-status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .rv-status { font-size: var(--fs-sm); }
  .rv-style, .rv-faces, .rv-nums { display: none; }
  #away { font-size: var(--fs-sm); min-height: 0; }
  /* a watched battle has no skills to press: the empty bar ("Foe's turn") gives its height to the stage, which at 360 px was too
     short for five foes and their plates, so the row showed plates with no figures over them (audit 2026-11-19 #4) */
  body.live[data-view="battle"] .skillbar { display: none; }
}
/* short screens (a phone held sideways): the list is one column of name and status, so the panel stays short */
@media (max-height: 500px) {
  .rivals { grid-template-columns: minmax(0, 1fr); }
  .rv-style, .rv-faces, .rv-nums { display: none; }
  .rv-head { flex-direction: column; align-items: flex-start; gap: 0; }
}

/* the live page names its end title h2 (h1 is the page heading); same look as the game panel title */
.endpanel h2 { margin: 0; font-size: var(--fs-2xl); color: var(--gold); text-align: center; letter-spacing: 0.04em; }
.endpanel.lost h2 { color: var(--bad); }
