/* ==========================================================================================
   screens/board.css — 排行榜 (leaderboard, DESIGN §29): the 称号 boards of every finished
   match — 卫戍之星 / 坚若磐石 / 挥金如土 / 精英云集 and our own 卫戍之区 (most leaked) — one
   set per scope (单人局 / 多人局), aggregated server-side from the same results the 大厅
   shows (server/leaderboard.js, screens/board.js).
   The look is the 大厅's 最近战绩 (screens/hall.css): numbered section labels, bracketed
   panels, one row per holder. All sizes are rem (1rem = 100 design px at 1920×1080, css/theme.css).

   Source: original to this repository (the upstream project has no leaderboard).
   ========================================================================================== */

/* 排行榜 over the room (the 大厅's own overlay rule, screens/hall.css `.hall-screen--over`): the room's 更多 menu opens
   the boards while the room keeps the route, so this layer must be opaque — the room stays mounted and live beneath it,
   and 返回 (closeBoard) drops it again. One step above the screens, so it always wins. */
.board-screen--over {
  z-index: calc(var(--z-screen) + 1);
  background:
    radial-gradient(120% 80% at 50% 110%, rgba(23, 249, 183, .08), transparent 55%),
    linear-gradient(180deg, #0b0e0d 0%, #0e1311 55%, #0a0d0c 100%);
}

/* A single page-wide grid: the five boards of the scope on show, three columns at desktop width. */
.board-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .24rem;
  width: 100%;
  max-width: 19.2rem;
  margin: 0 auto;
  padding: .34rem .6rem .4rem;
  align-content: start;
  align-items: start;
}
.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .3rem;
  align-items: start;
}
.board-col { display: flex; flex-direction: column; min-width: 0; }
.board-panel { min-width: 0; }
.board-loading { display: flex; justify-content: center; padding: .8rem 0; }

/* ---- the rule line (what is counted, by whom) ----------------------------------------------- */
.board-lead {
  margin: 0;
  max-width: 13rem;
  font-size: calc(.15 * var(--t));
  line-height: 1.8;
}
.board-lead b { color: var(--text-hi); font-weight: 700; }
.board-lead__note { display: block; margin-top: .04rem; color: var(--text-dim); font-size: calc(.14 * var(--t)); }

/* A guest sees the boards but is on none of them — say so where it is read, not in a footnote. */
.board-guest {
  display: flex;
  align-items: center;
  gap: .1rem;
  margin: 0;
  padding: .1rem .16rem;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--gold);
  background: rgba(255, 198, 0, .045);
  color: var(--text-md);
  font-size: calc(.15 * var(--t));
}
.board-guest b { color: var(--gold); font-weight: 700; }
.board-guest__icon { flex: none; width: .18rem; height: .18rem; color: var(--gold); }

/* ---- one board ------------------------------------------------------------------------------ */
.board-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.board-list > li + li { border-top: 1px solid var(--line); }

.board-row { display: flex; align-items: center; gap: .12rem; padding: .1rem .16rem; }
/* 1st place carries the board's tone as a left bar — mint on the 称号 boards, red on 卫戍之区
   (the same language the 大厅's win/lose rows use). */
.board-row.is-first { box-shadow: inset 2px 0 0 var(--mint-600); }
.board-panel--worst .board-row.is-first { box-shadow: inset 2px 0 0 var(--red); }

.board-row__rank {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .04rem;
  flex: none;
  width: .46rem;
  color: var(--text-lo);
  font-size: calc(.18 * var(--t));
  font-weight: 700;
}
.board-row.is-first .board-row__rank { color: var(--mint-400); }
.board-panel--worst .board-row.is-first .board-row__rank { color: var(--red-premium); }
.board-row__crown { width: .17rem; height: .17rem; color: var(--gold-2); }

.board-row__who { display: flex; flex-direction: column; gap: .02rem; flex: 1 1 auto; min-width: 0; }
.board-row__name { color: var(--text-hi); font-size: calc(.17 * var(--t)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row__meta { font-size: calc(.13 * var(--t)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.board-row__score { flex: none; color: var(--text-hi); font-size: calc(.19 * var(--t)); font-weight: 700; }
.board-row__score i { margin-left: .04rem; color: var(--text-dim); font-size: calc(.12 * var(--t)); font-style: normal; font-weight: 400; letter-spacing: .04em; }
.board-row__at { flex: none; width: .72rem; text-align: right; font-size: calc(.13 * var(--t)); }

.board-empty {
  margin: 0;
  padding: .3rem .22rem;
  font-size: calc(.16 * var(--t));
  line-height: 1.7;
  text-align: center;
}

/* What the board is made of (its 称号 rule) + how much data is behind it. */
.board-foot {
  display: flex;
  flex-wrap: wrap;
  gap: .06rem;
  margin: 0;
  padding: .1rem .16rem .12rem;
  border-top: 1px solid var(--line);
  font-size: calc(.13 * var(--t));
  line-height: 1.6;
}
.board-foot b { color: var(--text-hi); font-weight: 700; }
.board-foot__sep { color: var(--text-dim); }

/* ---- the 单人 / 多人 toggle (topbar) ---------------------------------------------------------- */
.board-scope { display: flex; align-items: center; gap: .06rem; }

/* Two columns under 1200 CSS px (the third board would be squeezed), one on phones. */
@media (max-width: 1199px) {
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .board-body { padding-left: .3rem; padding-right: .3rem; }
  .board-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Short landscape phones (≤ 460 CSS px tall): the rows lose their second line so five boards stay reachable. */
@media (max-height: 460px) {
  .board-body { padding-top: .2rem; padding-bottom: .2rem; gap: .18rem; }
  .board-row { padding-top: .06rem; padding-bottom: .06rem; }
  .board-row__meta { display: none; }
  .board-lead__note { display: none; }
}
