/* Fit tables to their available panel width, including split desktop windows. */
.table-shell{container-type:inline-size}
#strength-table,.snapshot-table,.snapshot-table.performance{
 width:100%;min-width:0;table-layout:fixed;white-space:normal;
}
.snapshot-table th,.snapshot-table td{padding:8px 10px}
.snapshot-table th:first-child,.snapshot-table td:first-child{width:38px;min-width:0}
.snapshot-table th:nth-child(2),.snapshot-table td:nth-child(2){width:25%;min-width:0;max-width:none}
.snapshot-table th:last-child,.snapshot-table td:last-child{width:auto}
.snapshot-table th button{font-size:inherit;line-height:1.45;text-align:left;white-space:normal;overflow-wrap:normal}
.snapshot-table .club{min-width:0;white-space:normal;line-height:1.4}
.snapshot-table .club-name{min-width:0;overflow-wrap:normal}
.performance-column-switch{display:none}
/* Desktop projections keep the points forecast and every outcome together. */
@media(min-width:761px){
 #snapshot-view .combined-projections :is(th,td){padding-inline:6px}
 #snapshot-view .combined-projections :is(th,td):nth-child(2){width:22%}
 #snapshot-view .combined-projections th button{overflow-wrap:anywhere}
 #snapshot-view .combined-projections :is(th,td):nth-child(6){border-left:1px solid var(--line)}
}
@container(max-width:800px){
 .snapshot-table .rank-column{display:table-cell;width:30px}
 .snapshot-table th:nth-child(2),.snapshot-table td:nth-child(2){width:36%;position:static;box-shadow:none}
 .snapshot-table th,.snapshot-table td{padding:8px 7px;min-width:0;font-size:12px}
 .snapshot-table th{font-size:10px}
 .snapshot-table .club{font-size:12px;gap:8px}
 .snapshot-table .club-badge{width:25px;height:29px;flex-basis:25px}
 .performance-column-switch{display:flex;gap:4px;padding:9px 16px;border-top:1px solid var(--line)}
 .performance-column-switch button{min-height:44px;padding:10px 14px;border-radius:6px;font-size:12px;color:var(--muted)}
 .performance-column-switch button[aria-pressed=true]{background:var(--soft);color:var(--green);font-weight:600}
 .snapshot-table.performance[data-columns=levels] .points-column{display:none}
 .snapshot-table.performance[data-columns=points] .levels-column{display:none}
 #strength-table .compare-column{display:none}
 #strength-table th:first-child,#strength-table td:first-child{display:table-cell;width:30px;padding-inline:3px}
 #strength-table th:nth-child(2),#strength-table td:nth-child(2){width:36%;padding-left:6px;position:static}
 #strength-table th,#strength-table td{min-width:0!important;padding:6px;font-size:11px}
 #strength-table .club{font-size:12px;line-height:1.4;gap:8px;white-space:normal;min-height:48px}
 #strength-table .score,#strength-table .change{font-size:13px}
 #strength-table .bar{width:85%}
 .column-switch{display:flex;gap:2px;border:1px solid var(--line);border-radius:7px;padding:2px;background:var(--bg)}
 .column-switch button{min-height:44px;padding:9px 12px;border-radius:5px;color:var(--muted);font-size:12px}
 .column-switch button[aria-pressed=true]{background:var(--panel);color:var(--green);font-weight:700}
 #strength-view[data-columns=ratings] .change-detail{display:none}
 #strength-view[data-columns=changes] .rating-detail{display:none}
}
/* A solid fill keeps the selected column group clear without an extra icon. */
.table-shell .column-switch button,.table-shell .performance-column-switch button{
 background:transparent;color:var(--muted);font-weight:500;
}
.table-shell .column-switch button[aria-pressed=true],.table-shell .performance-column-switch button[aria-pressed=true]{
 background:var(--green);color:var(--bg);font-weight:700;
}
@container(max-width:400px){
 .snapshot-table th,.snapshot-table td{padding:8px 4px;font-size:12px}
 .snapshot-table th{font-size:9px;letter-spacing:-.1px}
 .snapshot-table th button{overflow-wrap:normal}
 .snapshot-table .club{font-size:11px;gap:6px}
 .snapshot-table .club-badge{width:22px;height:27px;flex-basis:22px}
 .snapshot-table td{height:66px}
 .snapshot-table.performance[data-columns=points] .club-column{width:30%}
 .snapshot-table.performance[data-columns=points] th:nth-child(6){width:15%}
 .snapshot-table.performance[data-columns=points] th:nth-child(7){width:14%}
 .snapshot-table.performance[data-columns=points] th:nth-child(8){width:17%}
 .performance-column-switch{padding:7px 10px}
 #strength-table th,#strength-table td{padding:6px 4px;font-size:10px}
 #strength-table .club{font-size:11px}
 #strength-table .score,#strength-table .change{font-size:12px}
 #strength-table th:first-child,#strength-table td:first-child,
 .snapshot-table th:first-child,.snapshot-table td:first-child{width:25px;font-size:9px;padding-inline:2px}
 #strength-table th:first-child button{min-width:0}
}

/* Let headings follow the page scroll, rather than an inner table scroll area. */
:root{--league-tabs-height:48px}
.table-shell,.table-shell>.table-scroll{overflow:visible}
.table-shell #strength-table thead th,.table-shell .snapshot-table thead th{
 position:sticky;top:var(--league-tabs-height);z-index:3;
 background:var(--bg);box-shadow:inset 0 -1px var(--line),0 1px var(--line);
}
.table-shell .table-foot{border-radius:0 0 10px 10px}
.table-shell .club{scroll-margin-top:calc(var(--league-tabs-height) + 100px)}
.rating-history .table-scroll{overflow:visible}
.rating-history .history-table thead th{position:sticky!important;top:0;z-index:2;background:var(--bg)}
@container(max-width:320px){
 .snapshot-table.performance[data-columns=points] .club{font-size:10px;gap:4px}
 .snapshot-table.performance[data-columns=points] .club-badge{width:20px;flex-basis:20px}
}
@media(max-width:760px){
 :root{--league-tabs-height:106px}
}
/* History stays readable within the club profile on a narrow screen. */
.history-table{min-width:0;table-layout:fixed;white-space:normal}
.history-table th:first-child,.history-table td:first-child{width:27%!important}
.history-table th,.history-table td{font-size:10px;padding:7px 3px;line-height:1.4;overflow-wrap:anywhere}
@media(max-width:760px){
 #strength-table th:first-child,#strength-table td:first-child{display:table-cell}
 .snapshot-table th,.snapshot-table td{min-width:0!important}
 .snapshot-table th:nth-child(2),.snapshot-table td:nth-child(2){position:static;box-shadow:none}
}
/* Align short numerical values with their headings in every league table. */
:is(#strength-table,.snapshot-table) :is(th,td):not(:nth-child(2)){
 text-align:center;font-variant-numeric:tabular-nums;
}
:is(#strength-table,.snapshot-table) th:not(:nth-child(2)) button{
 width:100%;text-align:center;
}
#strength-table .bar{margin-inline:auto}
#strength-table :is(th,td):nth-child(n+3){padding-inline:6px}
#snapshot-view .snapshot-table .club-name{overflow-wrap:anywhere}
.rating-history .history-table :is(th,td):not(:first-child){
 text-align:center!important;font-variant-numeric:tabular-nums;
}
/* Both forecasts share one scale and grow outwards from goal difference. */
#snapshot-view .snapshot-table.goals td.main-metric{
 background:transparent;color:var(--ink);
}
.snapshot-table.goals{
 --goal-label-space:38px;--goal-block:10%;--goal-gap:3px;
 --goal-for-fill:var(--green);--goal-against-fill:color-mix(in srgb,var(--green) 78%,var(--ink));
}
.snapshot-table.goals :is(th,td).goal-centre{width:72px;padding-inline:4px}
.snapshot-table.goals :is(th,td):is(.goal-attack,.goal-defence){width:auto;padding-inline:6px}
.snapshot-table.goals .goal-visual{
 position:relative;width:calc(100% - var(--goal-label-space));height:18px;
}
.snapshot-table.goals .goal-visual-for{margin-left:var(--goal-label-space)}
.snapshot-table.goals .goal-visual-against{margin-right:var(--goal-label-space)}
.snapshot-table.goals .goal-value{
 position:absolute;z-index:1;top:50%;transform:translateY(-50%);min-width:3.8ch;
 font-size:13px;line-height:1.3;font-variant-numeric:tabular-nums;white-space:nowrap;
}
.snapshot-table.goals .goal-visual-for .goal-value{right:calc(var(--goal-fill) + 6px);text-align:right}
.snapshot-table.goals .goal-visual-against .goal-value{left:calc(var(--goal-fill) + 6px);text-align:left}
.snapshot-table.goals .goal-bar{
 display:block;position:absolute;inset:0;width:100%;height:100%;
 background:color-mix(in srgb,var(--soft) 50%,transparent);
 mask:repeating-linear-gradient(90deg,#000 0 calc(var(--goal-block) - var(--goal-gap)),transparent calc(var(--goal-block) - var(--goal-gap)) var(--goal-block));
}
.snapshot-table.goals .goal-bar i{
 position:absolute;inset:0 auto 0 0;background:var(--goal-for-fill);
}
.snapshot-table.goals .goal-bar-for{transform:scaleX(-1)}
.snapshot-table.goals .goal-bar-against i{
 background:repeating-linear-gradient(45deg,var(--goal-against-fill) 0 3px,transparent 3px 6px);
}
@container(max-width:800px){
 .snapshot-table.goals{--goal-block:12.5%;--goal-gap:2px}
 .snapshot-table.goals :is(th,td).goal-centre{width:56px}
 .snapshot-table.goals .goal-visual{width:100%;height:33px;margin-inline:0}
 .snapshot-table.goals .goal-value{top:0;transform:none;width:3.8ch;min-width:0;font-size:11px;line-height:15px;text-align:center}
 .snapshot-table.goals .goal-visual-for .goal-value{right:clamp(0px,calc(var(--goal-fill) - 1.9ch),calc(100% - 3.8ch));text-align:center}
 .snapshot-table.goals .goal-visual-against .goal-value{left:clamp(0px,calc(var(--goal-fill) - 1.9ch),calc(100% - 3.8ch));text-align:center}
 .snapshot-table.goals .goal-bar{inset:auto 0 0;height:14px}
}
@container(max-width:400px){
 .snapshot-table.goals{--goal-block:16.666667%}
 .snapshot-table.goals :is(th,td).goal-centre{width:48px}
 .snapshot-table.goals :is(th,td):is(.goal-attack,.goal-defence){padding-inline:4px}
}

/* Keep the scale explanation readable above ratings on every screen. */
.index-guide{align-items:flex-start;font-size:12px;line-height:1.7}
.index-guide p{flex:1;min-width:0;max-width:none}
.strength-scale-explanation{margin:0 0 16px;font-size:12px;line-height:1.7}

/* Show one explanation at the existing mobile breakpoint. Hidden copy stays out of the accessibility tree. */
.strength-explanation-mobile{display:none}
.inline-column-guide{display:inline;border:0;padding:0;margin:0;background:none;color:var(--green);font:inherit;line-height:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
.inline-column-guide:focus-visible{outline:2px solid var(--green);outline-offset:3px;border-radius:2px}
@media(max-width:760px){
 .strength-explanation-desktop{display:none}
 .strength-explanation-mobile{display:inline}
}

/* Equal label lines keep every performance heading on the same baseline. */
.snapshot-table.performance thead th{vertical-align:top}
.snapshot-table.performance .level-heading{display:inline-flex;flex-direction:column;align-items:center;line-height:1.45;vertical-align:top}
.snapshot-table.performance .level-heading>span{white-space:nowrap}
.snapshot-table.performance .level-sort{display:block;line-height:1.2;margin-top:3px}
#performance-toolbar .period-controls:empty{display:none}
@media(max-width:760px){
 #ratings .table-tools>.search{display:none}
 #strength-view .table-tools{display:none}
 #performance-toolbar{position:sticky;top:var(--league-tabs-height);z-index:4;background:var(--panel);border-top:1px solid var(--line)}
 #performance-toolbar .period-controls{margin:0;padding:8px 10px;gap:6px;flex-wrap:nowrap}
 #performance-toolbar .period-controls button{flex:1;min-width:0}
 #performance-toolbar .performance-column-switch{display:flex;padding:7px 10px;gap:6px}
 #performance-toolbar .performance-column-switch button{flex:1;min-width:0;padding-inline:7px}
 .table-shell .snapshot-table.performance thead th{top:calc(var(--league-tabs-height) + var(--performance-toolbar-height,0px))}
 .table-shell:has(.snapshot-table.performance) .club{scroll-margin-top:calc(var(--league-tabs-height) + var(--performance-toolbar-height,0px) + 100px)}
}
