/* Keep table figures consistent and give names their own responsive sizing. */
:root{--table-number-size:1rem;--table-change-size:.9375rem;--table-selector-size:16px;--table-heading-size:13px}
/* A small increase, with normal wrapping inside each existing column. */
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) th,
body[data-palette] :is(.history-table,.chart-values,.collection-values) th{
 font-size:var(--table-heading-size);line-height:1.3;letter-spacing:0;white-space:normal;
}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) th button{
 font-size:inherit;line-height:inherit;white-space:normal;overflow-wrap:normal;
}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) th small{font-size:.85em;line-height:1.3}
body[data-palette] .radar-table thead :is(th,button){font-size:var(--table-heading-size)!important;line-height:1.3}
body[data-palette] table td{font-variant-numeric:tabular-nums lining-nums}
body[data-palette] table tbody{-webkit-tap-highlight-color:transparent}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) td:not(:nth-child(2)),
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) td :is(.score,.goal-value),
body[data-palette] :is(.history-table,.chart-values,.radar-table) td{
 font-size:var(--table-number-size);font-variant-numeric:tabular-nums lining-nums;
}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) td:not(:nth-child(2)){white-space:nowrap}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(td.change-detail,td.numeric-change,td .change){font-size:var(--table-change-size)}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(td.change-detail,td.numeric-change)>span{font-size:inherit}

body[data-palette] .radar-table td{font-size:var(--table-number-size)!important;white-space:nowrap!important}
body[data-palette] .radar-table td.numeric-change{font-size:var(--table-change-size)!important}
body[data-palette] .chart-values td{white-space:nowrap!important;overflow-wrap:normal}
.radar-table-wrap{max-width:100%;overflow-x:auto}

/* Both selectors fill their equal grid cells, including the heading wrapper. */

/* Two independent tab surfaces: no enclosing frame or nested heading box. */

/* Centre the badge/name pair as one unit, with a readable gap between them. */

body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td){vertical-align:middle}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):not(:nth-child(2)){text-align:center}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) th button{width:100%;text-align:inherit}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(2),
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) th:nth-child(2) button{text-align:left}
body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club{justify-content:flex-start;text-align:left}
/* Separate the snapshot/chart row from the following controls and table. */

/* Wide projection tables retain usable cells instead of squeezing the figures. */
@media(min-width:761px){

 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table:not(.combined-projections)) :is(th,td):nth-child(2){width:24%}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(td.change-detail,td.numeric-change,td .change),
 body[data-palette] .radar-table td.numeric-change{font-weight:400}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(td.change-detail,td.numeric-change)>span{font-weight:inherit}
 body[data-palette] #main #snapshot-view .combined-projections{min-width:calc(426px + var(--outcome-count,4) * 72px)}
 body[data-palette] #main #snapshot-view .combined-projections :is(th,td):first-child{width:40px;padding-inline:4px}
 body[data-palette] #main #snapshot-view .combined-projections :is(th,td):nth-child(2){width:24%}
 body[data-palette] #main #snapshot-view .combined-projections :is(th,td):nth-child(3){width:auto}
 body[data-palette] #main #snapshot-view .combined-projections :is(th,td):nth-child(4){width:auto}
 body[data-palette] #main #snapshot-view .combined-projections :is(th,td):nth-child(5){width:auto}
 body[data-palette] #main #snapshot-view .combined-projections :is(th,td).probability-column{width:auto;padding-inline:4px}
}
@media(max-width:760px){
 :root{--table-number-size:.9375rem;--table-change-size:.875rem;--table-selector-size:14px;--table-heading-size:12.5px;--table-team-size:14px}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club{font-size:var(--table-team-size);line-height:1.3}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club-name{overflow-wrap:anywhere}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(2){padding-right:8px}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(n+3){padding-inline:3px}

 /* Snapshot and Charts share a flexible row, including on 320px phones. */

 body[data-palette] #main #ratings :is(#strength-table,.snapshot-table.performance:not([data-columns=points])) :is(th,td):nth-child(2){width:37%}
 body[data-palette] #main #global-table :is(th,td):nth-child(2){width:39%}
 body[data-palette] #main #ratings .snapshot-table.performance[data-columns=points]{min-width:0}
 body[data-palette] #main #ratings .snapshot-table.performance[data-columns=points] :is(th,td):nth-child(2){width:32%;padding-right:8px}
 body[data-palette] #main #ratings .snapshot-table.performance[data-columns=points] :is(th,td):nth-child(8){width:20%}
 body[data-palette] #main #ratings .outcome-table:not(.many-outcomes) :is(th,td):nth-child(2){width:37%}

 body[data-palette] #predict .matchup-team-button{align-items:center}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) td:not(:nth-child(2)),
 body[data-palette] :is(.history-table,.chart-values,.radar-table) td{font-weight:400}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) td.main-metric:not(:nth-child(2)),
 body[data-palette] .radar-table td.main-metric{font-weight:700}
 body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) td :is(.score,.change,.goal-value,.positive,.negative){font-weight:inherit}
 body[data-palette] .radar-table td.main-metric{background:var(--table-selected,var(--selected));color:var(--green)}
 body[data-palette] #main #ratings :is(#strength-table,.snapshot-table) :is(th,td):first-child{width:24px;padding-inline:2px}
 body[data-palette] #main #global-table :is(th,td):first-child{width:28px;padding-inline:2px}
 body[data-palette] #main #ratings .snapshot-table.performance[data-columns=points] :is(th,td){padding-inline:3px}
 body[data-palette] #main #ratings .snapshot-table.projections:not(.outcome-table){min-width:0}
 body[data-palette] #main #ratings .snapshot-table.projections:not(.outcome-table) :is(th,td):nth-child(2){width:auto}
 body[data-palette] #main #ratings .snapshot-table.projections:not(.outcome-table) :is(th,td):nth-child(3){width:58px}
 body[data-palette] #main #ratings .snapshot-table.projections:not(.outcome-table) :is(th,td):nth-child(4){width:64px}
 body[data-palette] #main #ratings .snapshot-table.projections:not(.outcome-table) :is(th,td):nth-child(5){width:44px}
 body[data-palette] #main #ratings .outcome-table.many-outcomes{min-width:calc(132px + var(--outcome-count) * 44px)}
 body[data-palette] #main #ratings .outcome-table.many-outcomes :is(th,td):nth-child(2){width:auto}
 body[data-palette] #main #ratings .outcome-table.many-outcomes :is(th,td).probability-column{width:44px;padding-inline:2px}
}
@media(max-width:360px){:root{--table-team-size:13.5px}}
.table-scroll.numeric-overflow{overflow-x:auto;overscroll-behavior-x:contain}

/* A single weight scale for every numeric cell, in both colour themes.
   Nested score spans inherit it instead of bringing legacy bold weights. */
html[data-theme] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) tbody td:not(:nth-child(2)){font-weight:400}
html[data-theme] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) tbody td.main-metric:not(:nth-child(2)){font-weight:700}
html[data-theme] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) tbody td :is(.score,.change,.goal-value,.positive,.negative){font-weight:inherit}
@media(min-width:761px){
 html[data-theme] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) tbody :is(td.change-detail,td.numeric-change){font-weight:400}
}
@media(max-width:760px){
 /* Opaque sticky surfaces seal fractional scroll seams without painting
    outside the controls and covering neighbouring selectors. */

 html[data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) thead th{top:calc(var(--table-heading-top,var(--journey-height)) + var(--table-heading-height,61px) - 1px)!important;background-clip:border-box}
}

@media(min-width:761px){
 /* Give both change columns the same share as the other numeric columns. */
 html[data-theme] body[data-palette] #main :is(#strength-table,#global-table) :is(th,td):nth-child(n+3){width:auto}
}

/* Equal visible column counts use the same mobile proportions in every view. */
@media(max-width:760px){
 html[data-table-navigation] body[data-palette] #main :is(#ratings,#global) :is(#strength-table,#global-table,.snapshot-table){
  width:100%;table-layout:fixed;min-width:calc(40px + var(--numeric-column-count,3) * 76.667px);
 }
 html[data-table-navigation] body[data-palette] #main :is(#ratings,#global) :is(#strength-table,#global-table,.snapshot-table) :is(th,td):first-child{width:24px;min-width:0;padding-inline:2px}
 html[data-table-navigation] body[data-palette] #main :is(#ratings,#global) :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(2){width:40%;min-width:0;max-width:none;padding-right:8px}
 html[data-table-navigation] body[data-palette] #main :is(#ratings,#global) :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(n+3){width:auto;min-width:0;max-width:none;padding-inline:3px}
}

/* An overflowing table has its own scroll container. Page-level sticky offsets
   would push its headings over the data rows; keep those headings in the table. */
html[data-table-navigation] body[data-palette] #main :is(#ratings,#global) .table-scroll.numeric-overflow thead th{
 position:static!important;top:auto!important;
}
html[data-table-navigation] body[data-palette] #main :is(#ratings,#global) :is(#strength-table,#global-table,.snapshot-table) th:first-child button{
 min-width:0;width:100%;padding-inline:0;
}
/* No horizontal scrolling: standard tables distribute the available width;
   dense outcomes remain complete as labelled groups inside each team row. */
html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings,#global) .table-scroll{width:100%;max-width:100%;min-width:0;overflow:visible}
html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table){width:100%;max-width:100%;min-width:0!important;table-layout:fixed}
html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td){min-width:0!important;max-width:none}
html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club-name{min-width:0;overflow-wrap:normal;word-break:normal;hyphens:none}
@media(min-width:761px){
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):first-child{width:34px}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(2){width:clamp(155px,21%,240px)}
 /* Resolve to a length before fixed table layout: percentages inside clamp()
    leave this column auto-sized in Chromium, giving names a numeric-column share. */
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings .snapshot-table:is(.performance,.projections),#global:has(#global-measure-label:not([hidden]) option[value=performance]:checked) #global-table) :is(th,td):nth-child(2){width:clamp(185px,18vw,250px)}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(n+3){width:auto;padding-inline:4px}
}
@media(max-width:760px){
 /* Long single-word names must stay inside their column in every table view. */
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club-name{overflow-wrap:anywhere}
 /* Keep the complete Supremacy measure name visible beside the native arrow. */
 html[data-table-navigation] body[data-palette] #global-controls #global-measure-label{grid-column:1/-1;width:220px;max-width:100%;min-width:0}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):first-child{width:22px}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(2){width:38%;padding-right:7px}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(th,td):nth-child(n+3){width:auto;padding-inline:2px}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club{gap:6px;padding-right:0;min-width:0}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .club>img{width:22px;height:26px;flex-basis:22px;object-fit:contain}
 html[data-theme][data-table-navigation] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) thead th{top:calc(var(--table-heading-top) + var(--table-heading-height,52px) - 1px)!important}

}

/* Dense-row layout also protects narrow tablet content areas. */
/* Preserve the original compact Points columns at every phone width. */
@media(max-width:760px){
 html[data-theme][data-table-navigation] body[data-palette] #main #ratings #snapshot-view .snapshot-table.performance[data-columns=points]{min-width:0}
 html[data-theme][data-table-navigation] body[data-palette] #main #ratings #snapshot-view .snapshot-table.performance[data-columns=points] :is(th,td):nth-child(2){width:32%}
 html[data-theme][data-table-navigation] body[data-palette] #main #ratings #snapshot-view .snapshot-table.performance[data-columns=points] :is(th,td):nth-child(8){width:20%}
 html[data-theme][data-table-navigation] body[data-palette] #main #ratings #snapshot-view .snapshot-table.performance[data-columns=points] th button{overflow-wrap:normal;word-break:normal}
}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped]{display:block;table-layout:auto}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] :is(thead,tbody){display:block;width:100%}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] tr{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));width:100%;border-bottom:1px solid var(--line);padding:6px 8px 8px;column-gap:4px;row-gap:3px}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] :is(th,td){position:static!important;width:auto!important;min-width:0!important;grid-column:span 2;padding:7px 4px;border:0;white-space:normal}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped][data-metric-count="4"] :is(th,td):nth-child(n+3){grid-column:span 3}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] :is(th,td):first-child{grid-column:1;grid-row:1;text-align:left;padding-left:4px}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] :is(th,td):nth-child(2){grid-column:2/-1;grid-row:1;text-align:left}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] td:nth-child(n+3)::before{content:attr(data-column-label);display:block;margin-bottom:3px;color:var(--muted);font:400 11px/1.2 var(--font-ui);white-space:normal}
html[data-theme][data-table-navigation] body[data-palette] #main table[data-layout=grouped] th button{min-height:32px}

/* Supporting chart-value tables follow the same vertical-only reading flow. */
html[data-theme] body[data-palette] :is(.radar-table-wrap,.chart-values-scroll,.collection-data-wrap,.collection-values-body){max-width:100%;min-width:0;overflow-x:clip;overflow-y:auto}
html[data-theme] body[data-palette] :is(.radar-table,.chart-values table,.collection-data-table,.collection-values table){width:100%;max-width:100%;min-width:0;table-layout:fixed}
html[data-theme] body[data-palette] :is(.radar-table,.chart-values table,.collection-data-table,.collection-values table) :is(th,td){min-width:0;white-space:normal;overflow-wrap:normal;padding-inline:4px!important}
html[data-theme] body[data-palette] .chart-values td{white-space:normal!important}

/* Carryover is a labelled previous-season display, never a new-season score. */
#global-table .performance-season-label{display:block;max-width:13em;margin:.3rem auto 0;font-size:.68rem;font-weight:500;line-height:1.3;white-space:normal;color:var(--muted,#94a3b8)}

/* A single opaque layer covers the full desktop heading, including cell
   boundaries, while rows pass behind it. Keep the sort colours on the cells. */
@media (min-width: 761px) {
  html[data-table-navigation] body[data-palette] #main > header {
    background-color: var(--bg);
    box-shadow: 0 2px 0 var(--bg);
  }
  html[data-theme][data-table-navigation] body[data-palette] #main .table-heading-controls {
    background-color: var(--panel);
    box-shadow: 0 -2px 0 var(--panel), 0 2px 0 var(--panel);
  }
  html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings, #global) :is(#strength-table, #global-table, .snapshot-table) > thead {
    position: sticky;
    top: calc(var(--table-heading-top, var(--journey-height)) + var(--table-heading-height, 61px) - 1px);
    z-index: 20;
    isolation: isolate;
    background-color: var(--panel);
    box-shadow: 0 -1px 0 var(--panel), 0 1px 0 var(--line);
  }
  html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings, #global) :is(#strength-table, #global-table, .snapshot-table) > thead th {
    position: static !important;
  }
  /* These detail tables scroll inside their own panels. */
  body[data-palette] :is(.history-table, .chart-values) > thead {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: var(--panel);
    box-shadow: 0 1px 0 var(--line);
  }
  body[data-palette] :is(.rating-history .history-table, .chart-values) > thead th {
    position: static !important;
  }
}
