/* View and league belong to the table heading, with no separate selector bars. */
html[data-table-navigation] #ratings>.section-top,
html[data-table-navigation] #ratings>.tabs,
html[data-table-navigation] #view-tabs-start,
html[data-table-navigation] #ratings .table-tools h3,
html[data-table-navigation] #global>h2,
html[data-table-navigation] #global>.period-controls,
html[data-table-navigation] #global-count{display:none!important}
html[data-table-navigation] :is(#ratings,#global){padding-top:4px}

html[data-table-navigation] #ratings .table-tools{border-top:0;padding-top:2px}
html[data-table-navigation] #ratings .table-tools>div>.view-about{margin-top:0}
html[data-table-navigation] #ratings .table-shell>.view-intro{padding:8px 12px;margin:0;border-top:1px solid var(--line)}
html[data-table-navigation] #ratings .table-shell>.view-intro p{font-size:12px;margin:0;color:var(--muted)}
html[data-table-navigation] #ratings .table-shell>.view-intro .reading-links{display:none}
html[data-table-navigation] #ratings .table-shell>.period-controls{padding:4px 12px;margin:0}
html[data-table-navigation] #ratings .table-shell :is(#strength-table,.snapshot-table) thead th{top:calc(var(--journey-height) + var(--table-heading-height,61px))!important}
html[data-table-navigation] #performance-toolbar{position:static!important}

html[data-table-navigation] #global-league-label{min-width:0;width:100%;max-width:100%;margin:0;justify-self:start}
html[data-table-navigation] #global-leagues{width:100%;min-width:0}
html[data-table-navigation] #global-league-label>span{display:none}
html[data-table-navigation] #global-leagues>summary{min-height:40px;display:flex;align-items:center;gap:8px;padding:5px;font-size:16px;font-weight:600;border:0;background:transparent;text-align:left}
html[data-table-navigation] #global-leagues .league-filter-panel{left:0;right:auto;min-width:min(310px,calc(100vw - 32px));z-index:60}
html[data-table-navigation] #global-leagues-summary{min-width:0;white-space:normal;overflow-wrap:anywhere}
html[data-table-navigation] #global-subtitle{padding:8px 12px;margin:0;font-size:12px}

html[data-table-navigation] #global .global-table-toolbar:has(>.column-switch){padding-block:0}
html[data-table-navigation] #global-table thead th{top:calc(var(--journey-height) + var(--table-heading-height,61px))!important}
@media(max-width:760px){
 html[data-table-navigation] :is(#ratings,#global){padding-top:2px}

 html[data-table-navigation] :is(#ratings,#global) .table-shell>.mobile-table-actions{padding:0 8px;margin:0;gap:10px;border-bottom:1px solid var(--line)}
 html[data-table-navigation] #ratings .table-tools{padding:0!important;border:0}
 html[data-table-navigation] #ratings .table-tools>div{display:none!important}
 html[data-table-navigation] #ratings .app-search-open .table-tools{padding:6px 8px!important}
 html[data-table-navigation] #global-league-label{display:flex;align-items:center;justify-content:flex-start}
 html[data-table-navigation] #global-league-label[hidden]{display:none!important}
 html[data-table-navigation] #global-leagues>summary{min-height:44px;font-size:14px;line-height:1.3;padding:3px 1px}
 html[data-table-navigation] #global-leagues .league-filter-panel{left:auto;right:0}
 html[data-table-navigation] #global-controls{padding:3px 8px}
 html[data-table-navigation] #global-controls .search{flex:1 0 100%}

}

/* Keep Supremacy search in an existing control row, without a separate search bar. */
html[data-table-navigation] #global-controls #global-snapshot-label{flex:0 1 auto;flex-direction:row;align-items:center;gap:7px;font-size:11px;width:auto;min-width:0}
html[data-table-navigation] #global-controls #global-snapshot-label[hidden]{display:none!important}
html[data-table-navigation] #global-controls .date-stepper{width:216px;min-width:0}
html[data-table-navigation] #global-controls .date-stepper select{margin:0}
html[data-table-navigation] #global .supremacy-search{display:flex;flex:0 1 144px;width:144px;max-width:144px;min-width:0;min-height:30px;height:30px;align-self:center;align-items:center;margin:0 0 0 auto;padding:3px 8px;border-radius:5px}
html[data-table-navigation] #global .supremacy-search input{min-width:0;width:100%;min-height:22px;height:22px;font-size:13px;line-height:22px;margin:0;padding:0}
@media(min-width:761px){
 html[data-table-navigation] #global .global-table-toolbar{display:none}
}
@media(max-width:760px){
 html[data-table-navigation] #global .mobile-table-actions>.app-search-toggle{display:none}
 html[data-table-navigation] #global .global-table-toolbar{display:flex;justify-content:space-between;align-items:center;flex-wrap:nowrap;gap:8px;padding:0 8px}
 html[data-table-navigation] #global .supremacy-search{flex:0 1 138px;width:138px;max-width:44%;min-height:36px;height:36px;padding:3px 7px}
 html[data-table-navigation] #global .supremacy-search input{min-height:28px;height:28px;line-height:28px;font-size:16px}
 html[data-table-navigation] #global-controls .date-stepper{width:208px}
}
/* One focus edge per field: the search wrapper owns the visible border. */
html[data-table-navigation] body[data-palette] #main #global .supremacy-search:focus-within{border:2px solid var(--green);box-shadow:none;outline:none}
html[data-table-navigation] body[data-palette] #global .supremacy-search input:is(:focus,:focus-visible){border:0;outline:none;box-shadow:none}
html[data-table-navigation] body[data-palette] #global-controls :is(select,button):focus-visible,
html[data-table-navigation] body[data-palette] #global-leagues>summary:focus-visible{outline:2px solid var(--focus);outline-offset:-2px;box-shadow:none}

@media(max-width:760px){html[data-table-navigation] #global-controls:has(#global-snapshot-label[hidden]){display:none}}
@media(forced-colors:active){html[data-table-navigation] body[data-palette] #main #global .supremacy-search:focus-within{border-color:Highlight}}

/* A single frame joins the context and view on every table page. */
.explore-logo-link{display:inline-flex;border-radius:6px}
.explore-logo-link:focus-visible{outline:2px solid var(--green);outline-offset:4px}

html[data-table-navigation] body[data-palette] #main #global-leagues>summary{
 min-height:0;height:auto;padding:10px 34px 10px 14px;gap:9px;border:0;border-radius:0;background:transparent;color:var(--picker-ink);font:600 16px/1.3 var(--font-ui);
}

/* A small label sits on the existing picker edge, without changing its size. */

/* Views lead, followed by their league or competition, in equal-width cells. */

html[data-table-navigation] #global-leagues>summary:after{display:grid;place-items:center;flex:none;width:22px;height:26px;margin-left:auto;background:none;color:var(--picker-ink);font-size:20px}

html[data-table-navigation] #global-controls #global-league-label{width:auto;flex:0 1 auto}
html[data-table-navigation] #global-controls #global-leagues>summary{font-size:13px;padding:5px 8px;min-height:36px;border:1px solid var(--line);border-radius:6px;color:var(--ink)}
@media(max-width:760px){

 html[data-table-navigation] body[data-palette] #main #global-leagues>summary{padding:3px 25px 3px 8px;gap:6px;font-size:14px;line-height:1.3}

 html[data-table-navigation] #global-leagues>summary:after{width:18px;height:24px;font-size:18px}
}

/* The league checklist shares Supremacy's branding and theme-aware badges. */
html[data-table-navigation] #global-leagues .league-filter-panel{
 border-color:color-mix(in srgb,var(--green) 30%,var(--line));border-top:3px solid var(--green);border-radius:12px;
 background:var(--panel);color:var(--ink);box-shadow:0 12px 32px #09172926;
}
#global-leagues .league-filter-heading{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;padding:2px 2px 12px}
#global-leagues .league-filter-heading strong{font:600 14px/1.3 var(--font-ui);color:var(--green)}
#global-leagues .league-filter-brand{display:flex;flex:0 0 104px;width:104px;height:24px}
#global-leagues .league-filter-brand img{width:100%;height:100%;object-fit:contain}
#global-leagues .league-filter-logo-dark{display:none}
html[data-theme=dark] #global-leagues .league-filter-logo-light{display:none}
html[data-theme=dark] #global-leagues .league-filter-logo-dark{display:block}
#global-leagues .league-filter-actions{gap:8px;padding:0 0 10px}
#global-leagues .league-filter-actions button{min-height:36px;padding:6px 12px;border:1px solid var(--line);border-radius:6px;background:var(--soft);color:var(--green);font:600 13px/1.3 var(--font-ui)}
#global-leagues .league-filter-actions button:hover{background:var(--selected)}
html[data-table-navigation] #global-leagues .league-filter-option{gap:10px;min-height:48px;margin:3px 0;padding:8px;border:1px solid transparent;border-radius:8px;font:500 14px/1.3 var(--font-ui)}
#global-leagues .league-filter-option:has(input:checked){background:var(--selected);color:var(--on-selected)}
#global-leagues .league-filter-option:hover{border-color:var(--green)}
#global-leagues .league-filter-option:focus-within{outline:2px solid var(--focus);outline-offset:-2px}
#global-leagues .league-filter-option input{accent-color:var(--green)}
#global-leagues .league-filter-option .league-badge{flex:0 0 38px;width:38px;height:30px}
#global-leagues .league-filter-name{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}

/* Anchor the mobile checklist to the whole row, even when its button wraps. */
@media(max-width:760px){
 html[data-table-navigation] #global-controls{position:relative}
 html[data-table-navigation] #global-controls #global-leagues{position:static}
 html[data-table-navigation] #global-controls #global-leagues .league-filter-panel{
  box-sizing:border-box;left:0;right:0;width:auto;min-width:0;max-width:100%;
 }
 html[data-table-navigation] #global-controls .league-filter-panel fieldset{max-height:min(280px,50dvh);overscroll-behavior:contain}
 html[data-table-navigation] #global-controls .league-filter-panel label{min-width:0}
 html[data-table-navigation] #global-controls .league-filter-panel label span{min-width:0;overflow-wrap:anywhere}
 html[data-table-navigation] #global-controls .league-filter-actions button{min-height:44px}
}

/* Desktop tables share the same available page width and control alignment. */
@media(min-width:761px){
 html[data-table-navigation] body[data-palette] #main :is(#global,#ratings){width:100%;max-width:none}

 html[data-table-navigation] body[data-palette] #main #global-snapshot-label{
  grid-column:1;grid-row:1;justify-self:start;display:flex;flex-direction:row;align-items:center;
  gap:7px;width:auto;min-width:0;max-width:100%;margin:0;font-size:12px;
 }

 html[data-table-navigation] body[data-palette] #main #global-league-label{grid-column:1/-1;grid-row:2;justify-self:start;width:auto;max-width:100%;margin:0}
 html[data-table-navigation] body[data-palette] #main #global-leagues>summary{height:auto;min-height:36px;font-size:14px}
 html[data-table-navigation] body[data-palette] #main #ratings .table-tools{padding:0 12px 10px}
 html[data-table-navigation] body[data-palette] #main #ratings .table-tools>div>:is(.view-description,.strength-direction){margin-right:0}
 html[data-table-navigation] body[data-palette] #main #ratings .table-tools:has(>div>h3:only-child):not(:has(>.search)){display:none}
 html[data-table-navigation] body[data-palette] #main #strength-view .table-options{display:none}
}
@media(min-width:761px) and (max-width:1100px){
 /* Two clear rows when a smaller desktop cannot fit all three controls. */

 html[data-table-navigation] body[data-palette] #main #global-snapshot-label{grid-column:1/-1}

 html[data-table-navigation] body[data-palette] #main #global-league-label{grid-row:3}
}
