/* The League Table, then the score predictor, which draws its table on the League Table's rows, so its rules must come
   after the Table's. Linked after auth.css. */

/* The table: each row a button with the position, the player and the form: the last 6 finished bets as W and L tiles,
   the latest on the right, drawn as the Board's team form (board.css .ft, in ink). Behind the tap, one row at a time,
   the result at £10 a bet (read Up or Down) over its bar from the middle, and the finished bets, under the player's
   name (Nic, 15.11.2026, decision 22). The figure and its bar are in ink, never green or red: a ranking measure, not
   money paid (decision 26). No position column while nobody is ahead. The predictor's rows share the grid with columns
   of their own. */
.standings { padding-bottom: 24px; }
.standings .page-head { flex-wrap: wrap; align-items: center; }
.standings-tools { display: flex; align-items: center; gap: 4px; }
.standings-tools .segmented { margin-right: 4px; }
.standings-tip { margin: -4px 0 14px; }
.standings-head, .standing-row, .predict-standing { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.standings.is-level .standings-head, .standings.is-level .standing-row { grid-template-columns: minmax(0, 1fr) auto; }
.standing-form, .sh-form { grid-column: -2 / -1; }
.standings-head { padding: 0 16px 8px; font-size: calc(13px * var(--type)); font-weight: 500; color: var(--faint); }
.standings-head .is-num, .standings-head .sh-form { text-align: right; }
.standings-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.standing { position: relative; }
.standing-row, .standing.predict-standing { padding: 12px 16px; }
.standing + .standing { box-shadow: inset 0 1px var(--line); }
.standing.is-you { background: color-mix(in srgb, var(--highlight) 7%, var(--surface)); }
.standing.is-you::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--highlight); }
.standing-row { width: 100%; min-height: 58px; text-align: left; transition: background-color .15s; }
/* A pointer over a row lights the whole row, its open part too; a tap on a phone leaves no shade behind. */
@media (hover: hover) {
  .standing:has(> .standing-row:hover) { background: var(--surface-2); }
}
.standing-row:focus-visible { outline-offset: -3px; border-radius: 0; }
.standing-rank { font-size: calc(15px * var(--type)); font-weight: 800; color: var(--faint); text-align: center; }
.standings-note { margin-top: 12px; font-size: calc(14px * var(--type)); color: var(--muted); }
.standings-note a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.standing-player { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* The player's racing colours sit before the name and are read after it. */
.standing-player .silks { order: -1; width: 34px; height: 34px; }
.standing-name { min-width: 0; font-size: calc(16px * var(--type)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standing-bets { text-align: right; font-size: calc(15px * var(--type)); color: var(--muted); }
.standing-form { display: flex; justify-content: flex-end; gap: 3px; min-height: 16px; }
/* Behind the tap, under the player's name: the figure and what it is at, the finished bets on the right, the bar under. */
.standing-more { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px 12px; padding: 0 16px 14px 56px; font-size: calc(13px * var(--type)); color: var(--muted); }
.standing-more[hidden] { display: none; }
.standings.is-level .standing-more { padding-left: 16px; }
.standing-level { min-width: 0; }
.standing-level .num { font-size: calc(16px * var(--type)); font-weight: 700; color: var(--text); white-space: nowrap; }
.standing-at { white-space: nowrap; }
.standing-count { text-align: right; white-space: nowrap; }
.standing-bar { grid-column: 1 / -1; position: relative; width: 100%; height: 4px; border-radius: 4px; background: var(--surface-2); }
.standing-bar > span { position: absolute; top: 0; bottom: 0; width: 50%; border-radius: 4px; transform: scaleX(var(--share, 0)); }
.standing-bar > .is-up { left: 50%; transform-origin: 0 50%; background: var(--text); }
.standing-bar > .is-down { right: 50%; transform-origin: 100% 50%; background: var(--text); }
@media (max-width: 379px) {
  .standings-head, .standing-row, .predict-standing { column-gap: 8px; }
  .standings-head, .standing-row, .standing.predict-standing { padding-left: 12px; padding-right: 12px; }
  .standings-head, .standing-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .standings.is-level .standings-head, .standings.is-level .standing-row { grid-template-columns: minmax(0, 1fr) auto; }
  .standing-more { padding: 0 12px 12px 44px; }
  .standings.is-level .standing-more { padding-left: 12px; }
  .standing-level .num { font-size: calc(15px * var(--type)); }
}

/* The score predictor: the round's matches with a score for each (two boxes while entries are open), then its table on
   the League Table's rows: position, player, exact scores and points. */
.predictor { padding-bottom: 24px; }
.predictor .page-head { align-items: center; }
.predict-round, .predict-table { display: grid; gap: 10px; }
.predict-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 0; }
.predict-head .section-title { margin: 0; }
.predict-head .segmented { margin-left: auto; }
.predict-closes { font-size: calc(14px * var(--type)); color: var(--muted); }
.predict-form { display: grid; gap: 12px; }
.predict-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.predict-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "when when when" "home score away" "outcome outcome outcome"; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.predict-row + .predict-row { box-shadow: inset 0 1px var(--line); }
.predict-when { grid-area: when; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(13px * var(--type)); font-weight: 600; color: var(--muted); }
.predict-comp { font-weight: 500; color: var(--faint); }
.predict-side { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: calc(16px * var(--type)); font-weight: 600; }
.predict-side.is-home { grid-area: home; }
.predict-side.is-away { grid-area: away; justify-content: flex-end; text-align: right; }
.predict-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.predict-boxes, .predict-pick { grid-area: score; display: flex; align-items: center; justify-content: center; gap: 6px; }
.predict-pick { min-width: 48px; font-size: calc(18px * var(--type)); font-weight: 700; font-variant-numeric: tabular-nums; }
.predict-goals { width: 48px; height: 48px; padding: 0; border: 1px solid transparent; border-radius: var(--radius-inner); background: var(--surface-2); color: var(--text); font-size: calc(18px * var(--type)); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; outline: 0; -moz-appearance: textfield; appearance: textfield; transition: border-color .15s, background-color .15s; }
.predict-goals::-webkit-outer-spin-button, .predict-goals::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.predict-goals:hover { background: var(--surface-3); }
.predict-goals:focus { border-color: var(--text); background: var(--surface-2); }
.predict-goals[aria-invalid="true"] { border-color: var(--loss); }
.predict-dash { color: var(--muted); font-weight: 700; }
.predict-outcome { grid-area: outcome; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.predict-score { font-size: calc(15px * var(--type)); font-weight: 700; font-variant-numeric: tabular-nums; }
.predict-standing { grid-template-columns: 30px minmax(0, 1fr) 52px 64px; }
.predict-table.is-level .predict-standing { grid-template-columns: minmax(0, 1fr) 52px 64px; }
.predict-standing > * { grid-row: auto; }
.predict-points { text-align: right; font-size: calc(16px * var(--type)); font-weight: 700; }
@media (max-width: 379px) {
  .predict-row { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .predict-goals { width: 44px; height: 44px; }
  .predict-standing { grid-template-columns: 24px minmax(0, 1fr) 44px 52px; }
  .predict-table.is-level .predict-standing { grid-template-columns: minmax(0, 1fr) 44px 52px; }
}

/* Friends' leagues (views/leagues.js): the standings shown and the Leagues button above the list, and the panel under
   them. The pick is the system's own select, 44px tall. */
.league-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.league-pick { flex: 1 1 auto; min-width: 0; }
.league-pick select { width: 100%; max-width: 320px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: calc(15px * var(--type)); }
.league-panel { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.league-panel .auth-form + .auth-form { margin-top: 8px; }
.league-code { font-variant-numeric: tabular-nums; letter-spacing: .08em; font-weight: 600; }
