/* BackgammonX v0.2.23 — 17-x23-play-tools.css
   Owns: the look of the v0.2.23 play tools built by js/32-x23-play-tools.js —
   the Players panel, the Undo Last Step / Combined Moves controls and the
   dice-left readout, the combined-route chips, the dotted landing rings and
   their dice badges on the board, the Off-tray cue for a combined bear-off,
   and the winner card.

   PRESENTATION ONLY, and override-only: this file sits after css/16 and
   never edits css/01-16. Every rule's SUBJECT (the right-most compound
   selector) is one of this file's own classes (.bgx-player*, .bgx-turn-btn,
   .bgx-undo-btn, .bgx-combo-*, .bgx-route-*, .bgx-dice-left, .x23-combo-*,
   .bgx-winner-*) — nothing here sets a size, position, transform or z-index
   on the board frame, checkers, rails, hit targets, dice layers or the
   rotation stage. The landing rings and badges are NEW elements placed inside
   the existing interaction layer at the existing point anchors (percent
   left/top set inline by js/32, exactly as js/21 places .hti-point-ring);
   the only rule that touches an existing element is .x23-combo-dest, a CLASS
   js/32 adds to the mover's Off-tray cell for a combined bear-off, which
   makes that one cell hit-testable (the same single declaration css/08 uses
   for js/21's own legal Off cell).

   Colour is never the only cue: every player dot carries the seat number,
   every card names its seat, every ring has a dice badge, and a combined
   landing differs from an ordinary one by ring STYLE (dotted + larger) as
   well as by label. Light and Dark both use the --x-* tokens of css/16. */

:root { --bgx-css-17: 1; }

/* A rule that sets `display` must not defeat the hidden attribute. */
.bgx-players-body[hidden],
.bgx-player-stat[hidden],
.bgx-dice-left[hidden],
.bgx-route-chips[hidden] { display: none; }

/* ── Players panel ─────────────────────────────────────────────────── */
.bgx-players-panel {
  box-sizing: border-box;
  padding: 8px 12px 12px;
  border: 1px solid var(--x-line-soft);
  border-radius: var(--x-radius);
  background-color: var(--x-panel);
  color: var(--text);
  box-shadow: var(--x-raised);
}
html[data-appearance="dark"] .bgx-players-panel {
  background-image: linear-gradient(180deg, var(--x-panel-glow), rgba(0, 0, 0, 0) 64px);
  border-color: rgba(255, 255, 255, 0.08);
}
.bgx-players-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.bgx-players-title {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--x-font-serif);
  font-size: calc(1.05rem * var(--text-scale, 1));
  font-weight: 700;
  color: var(--x-gold-bright);
}
html[data-appearance="light"] .bgx-players-title { color: #6b4a00; }
.bgx-players-head .bgx-btn { padding: 0 10px; font-size: 12.5px; }
.bgx-players-body { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.bgx-player-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--x-line-soft);
  border-radius: var(--x-radius-sm);
  background-color: var(--x-panel-2);
}
.bgx-player-card[data-active="true"] { border-color: var(--x-gold); box-shadow: 0 0 0 1px var(--x-gold-dim); }
.bgx-player-card[data-winner="true"] { border-color: var(--x-gold); box-shadow: 0 0 0 2px var(--x-gold-dim); }

/* The dot is a neutral disc carrying the seat NUMBER, ringed in the player's colour. */
.bgx-player-dot {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 5px solid var(--bgx-p1-mid, #62b5ff);
  border-radius: 50%;
  background: #0b0d10;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 0 2px #0b0d10;
}
.bgx-player-card[data-side="P2"] .bgx-player-dot { border-color: var(--bgx-p2-mid, #ff6675); }

.bgx-player-main { min-width: 0; }
.bgx-player-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.bgx-player-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: calc(0.95rem * var(--text-scale, 1));
  font-weight: 700;
  color: var(--x-text);
}
.bgx-player-role {
  padding: 0 7px;
  border: 1px solid var(--x-line);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bgx-player-badge {
  margin-left: auto;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--x-gold);
  color: #1a1208;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.bgx-player-badge:empty { display: none; }
html[data-appearance="light"] .bgx-player-badge { background: #7a5200; color: #ffffff; }

.bgx-player-seat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bgx-player-seat { font-size: 12.5px; color: var(--text-muted); }
.bgx-player-rename { padding: 0 6px; font-size: 12.5px; }

.bgx-player-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 4px 10px;
  margin: 2px 0 0;
}
.bgx-player-stat { margin: 0; min-width: 0; }
.bgx-player-stat dt { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.bgx-player-stat dd { margin: 0; font-size: 14px; font-weight: 700; color: var(--x-text); font-variant-numeric: tabular-nums; }

@media (max-width: 479px) {
  .bgx-player-card { column-gap: 10px; padding: 8px; }
  .bgx-player-badge { margin-left: 0; }
}

/* ── Turn controls (Undo Last Step, Combined Moves, dice left, route chips) ── */
.bgx-turn-btn { min-width: 0; }
.dtf-hud .bgx-undo-btn { padding: 0 14px; }
html[data-appearance="dark"] .dtf-hud .bgx-undo-btn { color: var(--x-amber); border-color: var(--x-amber); }
html[data-appearance="light"] .dtf-hud .bgx-undo-btn { color: var(--x-amber); border-color: var(--x-amber); background-color: #ffffff; }
.dtf-hud .bgx-undo-btn:disabled { color: var(--text-muted); border-color: var(--x-line); }

/* Combined Moves is a pill toggle: gold wash + gold edge when ON, quiet when OFF. */
.dtf-hud .bgx-combo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text-muted);
  border-color: var(--x-line);
}
.bgx-combo-state { font-weight: 800; letter-spacing: 0.04em; }
html[data-appearance="dark"] .dtf-hud .bgx-combo-toggle[aria-pressed="true"] {
  color: var(--x-gold-bright);
  background-color: rgba(216, 180, 106, 0.1);
  background-image: none;
  border-color: rgba(216, 180, 106, 0.55);
}
html[data-appearance="light"] .dtf-hud .bgx-combo-toggle[aria-pressed="true"] {
  color: #5c3f00;
  background-color: rgba(138, 95, 0, 0.12);
  border-color: rgba(138, 95, 0, 0.6);
}

.bgx-dice-left {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px dashed var(--x-gold-dim);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.bgx-route-chips { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bgx-route-caption { flex: 1 0 100%; font-size: 12.5px; color: var(--text-muted); }
.bgx-route-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 3px 14px;
  border: 1px dashed var(--x-gold);
  border-radius: 999px;
  background: transparent;
  color: var(--x-gold-bright);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
}
.bgx-route-chip:hover { background-color: rgba(216, 180, 106, 0.12); }
.bgx-route-chip:focus-visible { outline: 2px solid var(--x-focus); outline-offset: 2px; }
.bgx-route-dice { font-size: 11px; font-weight: 600; color: var(--text-muted); }
html[data-appearance="light"] .bgx-route-chip { color: #5c3f00; border-color: #8a6a2f; }
html[data-appearance="light"] .bgx-route-chip:hover { background-color: rgba(138, 95, 0, 0.12); }

@media (max-width: 639px) {
  .dtf-hud .bgx-undo-btn, .dtf-hud .bgx-combo-toggle { flex: 1 1 40%; padding: 0 10px; font-size: 12.5px; }
}

/* ── Landing rings and dice badges on the board ──────────────────────────
   Placed inside the interaction layer at the point's own anchor (left/top in
   percent are set inline by js/32); click-through like .hti-point-ring. A
   combined landing is DOTTED and a little larger than an ordinary
   one-die destination (dashed), and always carries its dice as text. */
.x23-combo-ring {
  --x23-accent: var(--bgx-p1-rgb, 98, 181, 255);
  position: absolute;
  box-sizing: border-box;
  width: max(6.4%, 28px);
  height: max(6.4%, 28px);
  transform: translate(-50%, -50%);
  border: 3px dotted #ffffff;
  border-radius: 50%;
  background: rgba(var(--x23-accent), 0.2);
  box-shadow: 0 0 0 2px #0b0d10, inset 0 0 0 2px rgba(var(--x23-accent), 0.95);
  pointer-events: none;
}
.x23-combo-ring[data-side="P2"] { --x23-accent: var(--bgx-p2-rgb, 255, 102, 117); }
.x23-combo-ring[data-active="true"] {
  border-style: solid;
  border-width: 4px;
  background: rgba(var(--x23-accent), 0.34);
  box-shadow: 0 0 0 3px #0b0d10, inset 0 0 0 3px rgba(var(--x23-accent), 1);
}

.x23-combo-badge {
  --x23-badge-dy: 0px;
  position: absolute;
  top: var(--x23-anchor-top, 50%);
  padding: 0 7px;
  border: 1px solid rgba(255, 209, 102, 0.75);
  border-radius: 999px;
  background: #0b0d10;
  color: #ffd166;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
  transform: translate(-50%, var(--x23-badge-dy));
  pointer-events: none;
}
/* The label sits on the OUTER side of its ring (past the base of the stack), so it never covers the
   checkers on the point: below the ring for a bottom-row point, above it for a top-row point. The ring is
   max(6.4%, 28px) tall, so half of it is max(3.2%, 14px): the label starts a fixed 5px past the ring's own
   edge at every board size (a fixed pixel offset from the anchor overlapped the ring on tablets). */
.x23-combo-badge[data-row="bottom"] { --x23-badge-dy: 0px; top: calc(var(--x23-anchor-top, 50%) + max(3.2%, 14px) + 5px); }
.x23-combo-badge[data-row="top"] { --x23-badge-dy: -100%; top: calc(var(--x23-anchor-top, 50%) - max(3.2%, 14px) - 5px); }
/* The interaction layer turns with the board; the label's own text must stay upright. */
.bgx-board-rotated .x23-combo-badge { transform: translate(-50%, var(--x23-badge-dy)) rotate(180deg); }

/* A combined bear-off: the mover's Off tray becomes tappable and says so. */
.x23-combo-dest {
  cursor: pointer;
  pointer-events: auto;
  box-shadow: inset 0 0 0 2px #ffffff, inset 0 0 0 3px #0b0d10;
  outline: 2px dotted #ffd166;
  outline-offset: -5px;
}

/* ── Winner card ────────────────────────────────────────────────────── */
.bgx-winner-card { border-color: var(--x-gold); border-radius: 16px; }
.bgx-winner-card[data-winner="P1"] { border-top: 5px solid var(--bgx-p1-mid, #62b5ff); }
.bgx-winner-card[data-winner="P2"] { border-top: 5px solid var(--bgx-p2-mid, #ff6675); }
.bgx-winner-kind {
  margin: 0 0 4px;
  font-family: var(--x-font-serif);
  font-size: calc(1.5rem * var(--text-scale, 1));
  font-weight: 700;
  color: var(--x-gold-bright);
}
html[data-appearance="light"] .bgx-winner-kind { color: #6b4a00; }
.bgx-winner-explain { color: var(--text-muted); font-size: 13.5px; }
.bgx-winner-stats { margin-top: 12px; }
