/* League labels share local badges across desktop and mobile selectors. */
.league-label {display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-align: left}
.league-label>span:last-child {min-width: 0; overflow-wrap: anywhere}
#league-bars .league-label {line-height: 1.4}
.flag-select-field {min-width: 0; width: 100%}
/* Dropdown containers must not inherit the padding and border of text disclosures. */
.flag-select {position: relative; margin: 6px 0 0; padding: 0; border: 0; min-width: 0; width: 100%}
.flag-select[open] {z-index: 90}
.flag-select>summary {display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 10px 12px; border: 1px solid var(--section-edge); border-radius: 8px; background: var(--surface-control); color: var(--ink); font-size: 1rem; font-weight: 400; line-height: 1.5; list-style: none}
#global .controls select, #global .controls input[type=search], #global .controls .flag-select>summary {height: 48px; min-height: 48px}
.flag-select>summary::-webkit-details-marker {display: none}
.flag-select>summary::marker {content: ''}
.flag-select>summary:hover {border-color: var(--section-color)}
.flag-select>summary:focus-visible, .flag-select-options button:focus-visible {outline: 2px solid var(--section-color); outline-offset: 2px}
.flag-select>summary>span:first-child {min-width: 0; overflow: hidden}
.flag-select>summary .league-label {display: flex}
.flag-select>summary .league-label>span:last-child {overflow: hidden; text-overflow: ellipsis; white-space: nowrap}
.flag-select[open]>summary .league-flag-chevron {transform: rotate(225deg); margin-top: 5px}
.flag-select-options {position: absolute; z-index: 80; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; gap: 3px; width: max-content; min-width: 100%; max-width: min(350px, calc(100vw - 64px)); max-height: min(54vh, 420px); overflow-y: auto; overscroll-behavior: contain; padding: 7px; border: 1px solid var(--section-edge); border-radius: 10px; background: var(--surface-control); box-shadow: 0 12px 30px #0003}
.flag-select:not([open])>.flag-select-options {display: none}
.flag-select-options button {display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font-size: .9375rem; font-weight: 400; line-height: 1.4; white-space: normal}
.flag-select-options button:hover {background: var(--section-tint)}
.flag-select-options button[aria-pressed="true"] {background: var(--section-fill, var(--section-color)); color: #fff}
.flag-select-options button[aria-pressed="true"]::after {content: ''; flex: 0 0 6px; width: 6px; height: 10px; margin: -3px 3px 0 0; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg)}
.club-picker .flag-select-field+label {margin-top: 12px}
@media (max-width: 800px) {
 .flag-select-options button {min-height: 48px}
}
.mobile-league-picker>.league-picker-label {display: block; margin: 0 0 6px; color: var(--muted); font-size: .8125rem; font-weight: 600; line-height: 1.4}
.mobile-league-picker:has(#league-picker:not([hidden]))>.league-picker-chevron {display: none}
#league-picker {position: relative; width: 100%; min-width: 0}
#league-picker-toggle {display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 10px 16px 10px 14px; border: 1px solid var(--section-edge); border-radius: 9px; background: var(--surface-control); color: var(--ink); font-size: 1.5rem; font-weight: 650; line-height: 1.35; list-style: none}
#league-picker-toggle::-webkit-details-marker {display: none}
#league-picker-toggle::marker {content: ''}
#league-picker-toggle:hover {border-color: var(--section-color)}
#league-picker-toggle:focus-visible, #league-picker-options a:focus-visible {outline: 2px solid var(--section-color); outline-offset: 3px}
#league-picker-current {display: flex; min-width: 0}
.league-flag-chevron {flex: 0 0 9px; width: 9px; height: 9px; margin: -4px 2px 0 0; border: solid var(--section-color); border-width: 0 2px 2px 0; transform: rotate(45deg)}
#league-picker[open] .league-flag-chevron {transform: rotate(225deg); margin-top: 5px}
#league-picker-options {position: absolute; z-index: 80; top: calc(100% + 6px); left: 0; right: 0; display: flex; flex-direction: column; align-items: stretch; gap: 3px; max-height: min(54vh, 420px); overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 7px; border: 1px solid var(--section-edge); border-radius: 10px; background: var(--surface-control); box-shadow: 0 12px 30px #0003}
#league-picker:not([open]) #league-picker-options {display: none}
#league-picker-options a {display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 9px 10px; border-radius: 6px; color: var(--ink); font-size: .9375rem; font-weight: 500; line-height: 1.4; white-space: normal; text-decoration: none}
#league-picker-options a:hover {background: var(--section-tint)}
#league-picker-options a[aria-current="page"] {background: var(--section-fill, var(--section-color)); color: #fff}
#league-picker-options a[aria-current="page"]::after {content: ''; flex: 0 0 6px; width: 6px; height: 10px; margin: -3px 3px 0 0; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg)}
@media (min-width: 801px) {
 /* Match the scale of nearby controls without inherited disclosure spacing. */
 #league-picker {margin: 0; padding: 0; border: 0}
 #league-picker-toggle {min-height: 46px; padding: 8px 14px 8px 12px; gap: 10px; font-size: 1.25rem; font-weight: 600}
 #league-picker-current .league-label {gap: 8px}
}
@media (max-width: 800px) {
 .mobile-league-picker>.league-picker-label {margin: 6px 0 0; font-size: .75rem}
 #league-picker-toggle {min-height: 46px; padding: 7px 10px 7px 0; border: 0; border-bottom: 1px solid var(--section-edge); border-radius: 0; background: transparent; font-size: clamp(1.125rem, 5.4vw, 1.375rem)}
 #league-picker-current .league-label {gap: 8px}
 #league-picker-options a {min-height: 48px}
}

/* Preserve each emblem's proportions and contrast on both themes. */
.league-badge {
  --badge-light-display: block;
  --badge-dark-display: none;
  display: inline-flex;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}
.league-badge img {width: 100%; height: 100%; object-fit: contain}
.league-badge-plate {padding: 2px; border-radius: 3px; background: #fff}
.league-badge-single {display: block}
.league-badge-light {display: var(--badge-light-display)}
.league-badge-dark {display: var(--badge-dark-display)}
html[data-theme="dark"] .league-badge,
#league-picker-options a[aria-current="page"] .league-badge,
.flag-select-options button[aria-pressed="true"] .league-badge,
#league-tabs a.active .league-badge {
  --badge-light-display: none;
  --badge-dark-display: block;
}
html[data-theme="dark"] #league-picker-options a[aria-current="page"] .league-badge,
html[data-theme="dark"] .flag-select-options button[aria-pressed="true"] .league-badge,
html[data-theme="dark"] #league-tabs a.active .league-badge {
  --badge-light-display: block;
  --badge-dark-display: none;
}
#league-picker-current .league-badge {flex-basis: 22px; width: 22px; height: 22px}

/* Small, non-interactive labels make the shared league order easy to scan. */
.league-menu-group {display: flex; flex-direction: column; gap: 3px; min-width: 0}
.league-menu-group:not(:first-child) {margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line)}
.league-menu-group-label {padding: 6px 10px 3px; color: var(--muted); font-size: .6875rem; font-weight: 600; line-height: 1.4; letter-spacing: .02em}
