/* ════════════════════════════════════════════════════════════════════════
   STANDINGS SCREEN — the redesign (21.10.2026).
   Built from the approved prototype's table and the spec's rules: the head is
   the same as Live and Leaders (a big title, a line under it, the switch at
   the end), the table sits on a card under a 2px rule, numbers are Barlow
   Condensed, the club's colour is only its crest (and, for a club the reader
   follows, a 4px edge on its row), and the zones are lines with words.
   Everything is scoped to #screen-standings and loaded after home.css and
   leaders.css, whose older rules it replaces.
   ════════════════════════════════════════════════════════════════════════ */

#screen-standings .standings-wrap {
  --st-bg: var(--ds-card);
  container-type: inline-size;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px clamp(10px, 3vw, 24px) 60px;
  color: var(--ds-ink);
  font-family: var(--ds-font);
}

/* ── Head: title, the line under it, the Table / Leaders switch ── */
.st-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px 20px; margin-bottom: 20px;
}
.st-head-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-head h1 { margin: 0; font: 900 var(--ds-fd-80)/.92 var(--ds-font); letter-spacing: -.035em; color: var(--ds-ink); }
.st-sub { margin: 0; font: 800 var(--ds-fs-17)/1.25 var(--ds-font); letter-spacing: .04em; color: var(--ds-ink2); }
#screen-standings .st-view-bar { display: block; padding: 0; }
#screen-standings .st-view-bar:empty { display: none; }
#screen-standings .st-view-bar .ld-seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: 0;
  background: transparent; border: 1.5px solid var(--ds-ink); border-radius: 0;
}
#screen-standings .st-view-bar .ld-seg button {
  min-height: var(--ds-h-btn); padding: 0 18px; border: 0; border-radius: 0;
  background: transparent; color: var(--ds-ink);
  font: 800 var(--ds-fs-14) var(--ds-font); white-space: nowrap; cursor: pointer;
  transition: background var(--ds-t-ctrl) ease, color var(--ds-t-ctrl) ease;
}
#screen-standings .st-view-bar .ld-seg button:hover { background: var(--ds-soft); }
#screen-standings .st-view-bar .ld-seg button[aria-selected="true"] { background: var(--ds-ink); color: var(--ds-bg); font-weight: 800; }
@container (max-width: 999px) { .st-head h1 { font-size: var(--ds-fd-64); } }
@container (max-width: 559px) {
  .st-head { margin-bottom: 14px; }
  .st-head h1 { font-size: 40px; line-height: 1; }
  .st-sub { font-size: var(--ds-fs-14); letter-spacing: .02em; }
  #screen-standings .st-view-bar { flex: 1 1 100%; }
}

/* ── Conference / competition tabs ── */
#screen-standings .st-filter-bar,
#screen-standings .st-wl-comp-bar { display: flex; gap: 6px; padding: 0 0 14px; }
#screen-standings .st-filter,
#screen-standings .st-wl-comp-btn {
  flex: 1; min-height: var(--ds-h-btn); padding: 0 16px;
  border: 1.5px solid var(--ds-line); border-radius: 0; background: transparent; color: var(--ds-ink);
  font: 800 var(--ds-fs-14) var(--ds-font); letter-spacing: 0; cursor: pointer;
  transition: background var(--ds-t-ctrl) ease, border-color var(--ds-t-ctrl) ease;
}
#screen-standings .st-filter:hover,
#screen-standings .st-wl-comp-btn:hover { border-color: var(--ds-ink); }
#screen-standings .st-filter.active,
#screen-standings .st-wl-comp-btn.active { border-color: var(--ds-ink); background: var(--ds-ink); color: var(--ds-bg); }
#screen-standings .st-filter-bar[style*="none"] { display: none !important; }

/* ── The table ── */
#screen-standings .st-table-wrap {
  position: relative; overflow-x: auto; padding: 0;
  background: var(--st-bg); border-top: 2px solid var(--ds-ink);
}
#screen-standings .st-table { width: 100%; border-collapse: collapse; font-family: var(--ds-font-num); font-size: 16px; }
#screen-standings .st-table thead th {
  padding: 12px 6px 8px; text-align: center; white-space: nowrap;
  font: 700 var(--ds-fs-12)/1.2 var(--ds-font); letter-spacing: 0; text-transform: none; color: var(--ds-ink2);
  background: var(--st-bg); border-bottom: 1px solid var(--ds-line);
}
#screen-standings .st-table th.st-team-col { text-align: start; }
#screen-standings .st-table tbody tr { border: 0; background: transparent; transition: none; }
#screen-standings .st-table tbody td { background: var(--st-bg); border-bottom: 1px solid var(--ds-line); height: 44px; }
#screen-standings .st-table tbody tr.st-row-clickable { cursor: pointer; }
#screen-standings .st-table tbody tr:hover { --st-bg: color-mix(in srgb, var(--ds-ink) 5%, var(--ds-card)); }
#screen-standings .st-rank-cell {
  width: 36px; min-width: 36px; padding: 9px 4px; text-align: center;
  font: 700 16px/1 var(--ds-font-num); color: var(--ds-ink2);
}
#screen-standings .st-team-cell { display: table-cell; padding: 9px 6px; text-align: start; vertical-align: middle; white-space: nowrap; }
#screen-standings .st-team-cell .st-logo,
#screen-standings .st-team-cell .team-crest { display: inline-flex; vertical-align: middle; margin-inline-end: 10px; }
#screen-standings .st-team-name { font: 700 var(--ds-fs-17)/1.2 var(--ds-font); color: var(--ds-ink); vertical-align: middle; }
#screen-standings .st-mine .st-team-name { font-weight: 900; }
#screen-standings .st-num {
  padding: 9px 6px; text-align: center; vertical-align: middle;
  font: 700 16px/1 var(--ds-font-num); font-variant-numeric: tabular-nums; color: var(--ds-ink);
  direction: ltr; unicode-bidi: isolate;
}
#screen-standings .st-muted { color: var(--ds-ink2) !important; font-weight: 600 !important; }

/* The first two columns stay in view while the rest scroll. */
#screen-standings .st-table th:nth-child(1), #screen-standings .st-table td:nth-child(1),
#screen-standings .st-table th:nth-child(2), #screen-standings .st-table td:nth-child(2) { position: sticky; z-index: 1; }
#screen-standings .st-table th:nth-child(1), #screen-standings .st-table td:nth-child(1) { inset-inline-start: 0; }
#screen-standings .st-table th:nth-child(2), #screen-standings .st-table td:nth-child(2) { inset-inline-start: 36px; }
/* A club the reader follows: the 4px edge in its colour, as on the games list. */
#screen-standings .st-mine td:first-child::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
  background: var(--gr-edge-l, var(--ds-ink));
}
html[data-theme="dark"] #screen-standings .st-mine td:first-child::before { background: var(--gr-edge-d, var(--ds-ink)); }

/* ── The streak: a triangle and a count ── */
.st-streak { display: inline-flex; align-items: center; gap: 4px; padding: 0; border-radius: 0; background: none; font: 700 16px/1 var(--ds-font-num); color: var(--ds-ink); }
.st-streak i { font-style: normal; font-size: 10px; line-height: 1; }

/* ── Zones: a labelled line across the table ── */
#screen-standings .st-table tr.st-zone td {
  height: auto; padding: 10px 12px; text-align: center;
  background: var(--ds-bg); border-bottom: 1px solid var(--ds-line); border-top: 1px solid var(--ds-line);
  font: 800 var(--ds-fs-14)/1.2 var(--ds-font); color: var(--ds-ink);
}
#screen-standings .st-table tr.st-zone td:first-child { position: static; }
#screen-standings .st-table tr.st-zone span { display: inline-block; }
@container (max-width: 899px) {
  /* A table that scrolls: the label stays at the start, beside the pinned columns. */
  #screen-standings .st-table tr.st-zone td { text-align: start; }
  #screen-standings .st-table tr.st-zone span { position: sticky; inset-inline-start: 12px; }
}

/* ── Tags beside a name: clinched, play-in, eliminated ── */
.st-clinch {
  display: inline-block; margin: 0 0 0 0; margin-inline-start: 8px; padding: 1px 5px; vertical-align: middle;
  border: 1px solid currentColor; border-radius: 0; opacity: 1;
  font: 700 var(--ds-fs-12)/1.2 var(--ds-font-num); letter-spacing: .02em;
}
.st-clinch--good, html[data-theme] .st-clinch--good { color: var(--ds-ok); }
.st-clinch--warn, html[data-theme] .st-clinch--warn { color: var(--ds-warn); }
.st-clinch--out,  html[data-theme] .st-clinch--out  { color: var(--ds-ink2); }
.st-clinch--east, html[data-theme] .st-clinch--east,
.st-clinch--west, html[data-theme] .st-clinch--west { color: var(--ds-ink); }

/* ── Edge fade and the swipe hint ── */
/* The fade sits on the end side, where the hidden columns are (the first two stay pinned at the start). */
#screen-standings .st-edge-fade {
  inset-inline-start: auto; inset-inline-end: 0; width: 22px; z-index: 2;
  background: linear-gradient(to left, var(--st-bg), transparent);
}
html[dir="rtl"] #screen-standings .st-edge-fade { background: linear-gradient(to right, var(--st-bg), transparent); }
#screen-standings .st-swipe-hint { margin: 10px 0 0; font: 600 var(--ds-fs-12)/1.3 var(--ds-font); color: var(--ds-ink2); }

/* ── Legend ── */
#screen-standings .st-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 14px 0 0;
  font: 600 var(--ds-fs-12)/1.3 var(--ds-font); color: var(--ds-ink2);
}
#screen-standings .st-leg-item { display: inline-flex; align-items: center; gap: 6px; }
#screen-standings .st-leg-item .st-clinch { margin-inline-start: 0; }

/* ── A tapped column header ── */
.st-header-tip {
  border-radius: 0; background: var(--ds-ink); color: var(--ds-card);
  font: 600 var(--ds-fs-13)/1.4 var(--ds-font); box-shadow: 0 8px 24px rgba(12, 22, 48, .25);
}

/* ── Loading and empty ── */
#screen-standings .st-skeleton td {
  height: 44px; background: linear-gradient(90deg, var(--ds-line) 0%, var(--ds-card) 50%, var(--ds-line) 100%);
  background-size: 200% 100%; animation: lv-shim 1.2s linear infinite;
}
#screen-standings .st-empty { padding: 32px 16px; text-align: center; font: 600 var(--ds-fs-15) var(--ds-font); color: var(--ds-ink2); }

/* ── Groups (Champions League, EuroCup, national teams, Winner Cup) ── */
#screen-standings #st-groups { display: flex; flex-direction: column; gap: 24px; padding: 0; }
#screen-standings .st-group-block { overflow-x: auto; background: var(--st-bg); border-top: 2px solid var(--ds-ink); }
#screen-standings .st-group-title { margin: 0; padding: 12px 12px 4px; font: 900 var(--ds-fs-20)/1.2 var(--ds-font); color: var(--ds-ink); }
#screen-standings .st-group-table { min-width: 280px; table-layout: fixed; }
#screen-standings .st-group-table th:nth-child(1), #screen-standings .st-group-table td:nth-child(1) { width: 40px; }
#screen-standings .st-group-table th:nth-child(n+3), #screen-standings .st-group-table td:nth-child(n+3) { width: 64px; }
#screen-standings .st-group-table .st-team-cell { overflow: hidden; white-space: normal; }
#screen-standings .st-group-table .st-team-name { line-height: 1.2; }
#screen-standings .st-group-table th:nth-child(2), #screen-standings .st-group-table td:nth-child(2) { position: static; }

/* ── FIBA windows (national teams) ── */
#screen-standings .st-wt-block { border-radius: 0; background: var(--ds-card); border: 1px solid var(--ds-line); }
#screen-standings .st-wt-standing { border-bottom-color: var(--ds-line); }
#screen-standings .st-wt-comp, #screen-standings .st-wt-sum-team { font-family: var(--ds-font); }
#screen-standings .st-wt-promo { border-radius: var(--ds-r-pill); font-family: var(--ds-font); }
#screen-standings .st-wt-promo-yes { background: transparent; border: 1px solid var(--ds-ok); color: var(--ds-ok); }
#screen-standings .st-wt-promo-no  { background: transparent; border: 1px solid var(--ds-live); color: var(--ds-live); }
#screen-standings .st-wt-win  { background: color-mix(in srgb, var(--ds-ok) 10%, transparent); }
#screen-standings .st-wt-loss { background: color-mix(in srgb, var(--ds-live) 8%, transparent); }
#screen-standings .st-wt-select, #screen-standings .st-wt-chip { border-radius: 0; min-height: var(--ds-h-btn); font-family: var(--ds-font); }

@media (prefers-reduced-motion: reduce) { #screen-standings .st-skeleton td { animation: none; } }

/* ── East against West (Claude Design, 30.10): a summary, one line to open the per-club lists ── */
#screen-standings .st-vs { margin: 0 0 16px; padding: 18px 16px 4px; background: var(--ds-card); border-block-start: 2px solid var(--ds-ink); color: var(--ds-ink); font-family: var(--ds-font); }
#screen-standings .st-vs.hidden { display: none; }
#screen-standings .st-vs-top { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding-block-end: 14px; }
#screen-standings .st-vs-h { margin: 0; font: 900 20px/1.2 var(--ds-font); letter-spacing: -.01em; }
#screen-standings .st-vs-sub { margin: 4px 0 0; font: 500 14px/1.45 var(--ds-font); color: var(--ds-ink2); text-wrap: pretty; }
#screen-standings .st-vs-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; min-width: 0; }
#screen-standings .st-vs-l1 { justify-self: start; } #screen-standings .st-vs-l3 { justify-self: end; }
#screen-standings .st-vs-l1, #screen-standings .st-vs-l3 { font: 700 13px/1.2 var(--ds-font); color: var(--ds-ink2); }
#screen-standings .st-vs-l2 { justify-self: center; font: 600 13px/1.2 var(--ds-font); color: var(--ds-ink2); }
#screen-standings .st-vs-n { font: 800 40px/1 var(--ds-font-num); font-style: normal; font-variant-numeric: tabular-nums; color: var(--ds-ink); direction: ltr; }
#screen-standings .st-vs-n.dim { font-weight: 700; color: var(--ds-ink2); }
#screen-standings .st-vs-grid .st-vs-n:first-of-type { justify-self: start; }
#screen-standings .st-vs-grid .st-vs-n:last-of-type { justify-self: end; }
#screen-standings .st-vs-bar { display: flex; gap: 8px; min-width: 0; block-size: 12px; }
#screen-standings .st-vs-bar > span { display: flex; gap: 2px; min-width: 0; }
#screen-standings .st-vs-bar i { display: block; flex: 1 1 0; min-width: 0; block-size: 12px; background: var(--ds-ink); }
#screen-standings .st-vs-bar i.dim { background: var(--ds-ink2); }
#screen-standings .st-vs-note { margin: 0; display: flex; align-items: center; gap: 10px; font: 600 13px/1.45 var(--ds-font); color: var(--ds-ink2); text-wrap: pretty; }
#screen-standings .st-vs-note i { flex: none; display: block; inline-size: 10px; block-size: 10px; box-sizing: border-box; border: 2px solid var(--ds-warn); border-radius: 50%; }
#screen-standings .st-vs-tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; inline-size: 100%; min-block-size: 52px; margin: 0; padding: 0 2px; border: 0; border-block-start: 1px solid var(--ds-line); background: transparent; color: var(--ds-ink); font: 800 14px/1.35 var(--ds-font); text-align: start; cursor: pointer; }
#screen-standings .st-vs-tog svg { flex: none; transition: transform .2s; }
#screen-standings .st-vs-tog[aria-expanded="true"] svg { transform: rotate(180deg); }
#screen-standings .st-vs-tog:focus-visible { outline: 2px solid var(--ds-ink); outline-offset: 2px; }
#screen-standings .st-vs-panel { display: flex; flex-direction: column; gap: 26px; padding-block: 6px 18px; }
#screen-standings .st-vs-panel[hidden] { display: none; }
#screen-standings .st-vs-sh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-block-end: 8px; border-block-end: 1.5px solid var(--ds-ink); }
#screen-standings .st-vs-sh h3 { margin: 0; font: 800 14px/1.35 var(--ds-font); }
#screen-standings .st-vs-sh b { flex: none; font: 800 17px/1 var(--ds-font-num); direction: ltr; }
#screen-standings .st-vs-sec ol { list-style: none; margin: 0; padding: 0; }
#screen-standings .st-vs-sec li { display: flex; align-items: center; gap: 10px; min-block-size: 44px; border-block-end: 1px solid var(--ds-line); }
#screen-standings .st-vs-crest { flex: none; display: inline-flex; }
#screen-standings .st-vs-name { flex: 1 1 0; min-width: 0; font: 600 15px/1.3 var(--ds-font); overflow-wrap: anywhere; }
#screen-standings .st-vs-marks { display: flex; align-items: center; gap: 3px; }
#screen-standings .st-vs-marks i { display: block; inline-size: 9px; block-size: 9px; box-sizing: border-box; background: var(--ds-ink); }
#screen-standings .st-vs-marks i.lost { background: transparent; border: 1.5px solid var(--ds-ink2); }
#screen-standings .st-vs-sec li b { flex: none; min-inline-size: 34px; font: 800 17px/1 var(--ds-font-num); direction: ltr; text-align: start; }

/* One scroll, not two: a box that scrolls sideways is also made to scroll up and down by the browser unless it is told not to,
   which put a second scrollbar inside the page's own (Site review, 30.10). */
#screen-standings .st-table-wrap, #screen-standings .st-group-block { overflow-y: hidden; max-height: none; }

/* ── NBA Cup: groups and knockout (Claude Design, 1.11) ── */
.st-cup { margin: 0 0 20px; }
.st-cup.hidden { display: none; }
.st-cup-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.st-cup-h { margin: 0 0 4px; font: 800 var(--ds-fs-20, 20px)/1.2 var(--ds-font); }
.st-cup-sub { margin: 0 0 12px; font-size: 13px; opacity: .75; max-inline-size: 62ch; text-wrap: balance; }
.st-cup-toggle { min-height: 44px; padding: 0 14px; border: 1.5px solid var(--ds-ink); background: transparent; color: var(--ds-ink); font: 800 14px var(--ds-font); cursor: pointer; }
.st-cup-toggle:hover { background: var(--ds-soft); }
.st-cup-sel { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.st-cup-chips { display: flex; gap: 8px; }
.st-cup-chip { flex: 1; min-height: 44px; border: 1.5px solid var(--ds-line); background: var(--ds-card); color: var(--ds-ink); font: 700 14px var(--ds-font); cursor: pointer; }
.st-cup-chip.is-on { background: var(--ds-ink); border-color: var(--ds-ink); color: var(--ds-card); }
.st-cup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.st-cup-g { background: var(--ds-card); border: 1px solid var(--ds-line); border-top: 2px solid var(--accent, var(--ds-ink)); padding: 12px; min-width: 0; }
.st-cup-gh { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.st-cup-gh h3 { margin: 0; font: 800 14px/1.2 var(--ds-font); }
.st-cup-gh span { font-size: 12px; opacity: .65; }
.st-cup-g ol { list-style: none; margin: 0; padding: 0; }
.st-cup-g li { border-top: 1px solid var(--ds-line); }
.st-cup-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 44px 40px; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0; background: none; border: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; font-variant-numeric: tabular-nums; }
.st-cup-row:hover { background: var(--ds-soft); }
.st-cup-row:focus-visible { outline: 2px solid var(--ds-ink); outline-offset: -2px; }
.st-cup-g li.lead { font-weight: 800; }
.st-cup-g li.is-mine { box-shadow: inset -3px 0 0 var(--accent, var(--ds-ink)); }
html[dir="ltr"] .st-cup-g li.is-mine { box-shadow: inset 3px 0 0 var(--accent, var(--ds-ink)); }
.st-cup-pos { display: inline-flex; align-items: center; gap: 6px; }
.st-cup-mk { display: inline-block; width: 10px; height: 10px; box-sizing: border-box; border: 1.5px solid transparent; }
.st-cup-mk.is-1 { background: var(--ds-ink); border-color: var(--ds-ink); }
.st-cup-mk.is-2 { background: transparent; border-color: var(--ds-ink); }
.st-cup-pos .st-cup-mk:not(.is-1):not(.is-2) { visibility: hidden; }
.st-cup-t { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.st-cup-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: inherit; }
.st-cup-r, .st-cup-d { text-align: end; }
.st-cup-d { opacity: .7; font-size: 12px; }
.st-cup-key { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 0; font-size: 13px; opacity: .85; }
.st-cup-key span { display: inline-flex; align-items: center; gap: 6px; }
.st-cup-ko { margin-top: 16px; }
.st-cup-ko h3 { margin: 0 0 6px; font: 800 14px/1.2 var(--ds-font); }
.st-cup-ko ul { list-style: none; margin: 0; padding: 0; }
.st-cup-ko li { padding: 6px 0; border-top: 1px solid var(--ds-line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.st-cup-ko li span { opacity: .65; font-size: 12px; min-width: 40px; }
.st-cup-ko li button { min-height: 44px; padding: 0 4px; background: none; border: 0; color: inherit; font: 800 14px var(--ds-font); cursor: pointer; }
@media (max-width: 759px) {
  .st-cup-grid { grid-template-columns: minmax(0, 1fr); }
  .st-cup-grid .st-cup-g { display: none; }
  #st-cup[data-sel="0"] .st-cup-g[data-gi="0"], #st-cup[data-sel="1"] .st-cup-g[data-gi="1"], #st-cup[data-sel="2"] .st-cup-g[data-gi="2"],
  #st-cup[data-sel="3"] .st-cup-g[data-gi="3"], #st-cup[data-sel="4"] .st-cup-g[data-gi="4"], #st-cup[data-sel="5"] .st-cup-g[data-gi="5"] { display: block; }
}
@media (min-width: 760px) { .st-cup-sel { display: none; } }

/* ── Whole league / divisions ── */
.st-lgview.hidden { display: none; }
.st-div { margin-bottom: 20px; }
.st-div h3 { margin: 0 0 6px; font: 800 15px/1.3 var(--ds-font); }
.st-cup-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* Phone: the two Cup buttons sit in one full-width row under the text, the main one filled, and the groups follow (owner, 1.11) */
@media (max-width: 759px) {
  .st-cup-top { flex-direction: column; align-items: stretch; gap: 0; }
  .st-cup-acts { width: 100%; flex-wrap: nowrap; margin-bottom: 12px; }
  .st-cup-acts .st-cup-toggle { flex: 1; padding: 0 8px; }
  .st-cup-acts .st-cup-toggle:first-child { background: var(--ds-ink); color: var(--ds-card); }
}
