/* League Hub styles: refinements.css. Site-wide tables, install prompt, browse, account menu, MK Codeworx foundations and filter panels.
   Files load in this order: tokens.css, base.css, components.css, layout.css, pages.css, admin.css, refinements.css (App.razor). Later files override earlier ones; see docs/DESIGN-SYSTEM.md. */

/* ==== Tables, site-wide ====
   Whole words, always. .app-main inherits overflow-wrap:anywhere, which lets a table column shrink to a single letter;
   break-word only splits a word that cannot fit on a line by itself and never shrinks a column below its longest word.
   Headings still wrap between words, and a table that is still too wide scrolls inside its .source-table-wrap. */
.source-table :is(th, td), .source-table :is(th, td) :is(a, span, small, strong, b, code) { overflow-wrap: break-word; word-break: normal; }
/* Install prompt (InstallPrompt.razor): a dismissible card on the home page and a permanent entry on More. */
.install-prompt { margin-bottom: 16px; }
.install-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.install-prompt .install-actions { margin-left: auto; }
.install-entry h2 { margin: 0 0 6px; font-size: var(--fs-lg); }
.install-entry p { margin: 0 0 12px; }
.install-entry .install-actions { margin: 0; }
.share-icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
@media (max-width: 640px) { .install-prompt .install-actions { margin-left: 0; width: 100%; } }
/* Browse directory */
.browse-tabs a.active { background: var(--t-accent-soft); border-color: var(--t-accent); font-weight: 700; }
.browse-filter { margin-bottom: 8px; }
.browse-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--t-border); border-radius: var(--radius-md); background: var(--t-panel); overflow: hidden; }
.browse-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 16px; min-height: 52px; scroll-margin-top: 80px; }
.browse-row + .browse-row { border-top: 1px solid var(--t-border); }
.browse-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.browse-name { font-weight: 700; color: var(--t-foreground); overflow-wrap: anywhere; }
.browse-detail, .browse-more summary { color: var(--t-muted); font-size: var(--fs-md); overflow-wrap: anywhere; }
.browse-more summary { cursor: pointer; }
.browse-more summary span { color: var(--t-link); font-weight: 600; white-space: nowrap; }
.browse-more ul { margin: 4px 0 2px; padding-inline-start: 18px; font-size: var(--fs-md); }
.browse-row .favorite-pin { flex: 0 0 auto; margin-inline-start: auto; }
.browse-az { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.browse-az :is(a, button) { min-width: 34px; padding: 6px 8px; text-align: center; border: 1px solid var(--t-border); border-radius: var(--radius-md); background: var(--t-panel-raised); color: var(--t-foreground); font-weight: 650; }
.browse-az :is(a, button):is([aria-current="true"], [aria-pressed="true"]) { border-color: var(--t-accent); background: var(--t-accent-soft); }
.browse-az :is(span.disabled, button:disabled) { min-width: 34px; padding: 6px 8px; text-align: center; border: 1px solid var(--t-border); border-radius: var(--radius-md); color: var(--t-muted); opacity: .45; cursor: default; user-select: none; }
/* Release 2: next-match details, match actions, find-me form */
.next-detail{margin-top:8px}
.next-detail>summary{cursor:pointer;min-height:24px;font-size:var(--fs-sm);color:var(--t-muted)}
.next-detail>summary:hover,.next-detail>summary:focus-visible,.next-detail[open]>summary,.dash-list li:active .next-detail>summary{color:var(--t-link)}
.next-detail>summary:focus-visible{outline:2px solid var(--t-accent);outline-offset:2px}
.next-opponent{margin:8px 0 0;font-size:var(--fs-sm)}
.match-actions{display:flex;flex-wrap:wrap;gap:8px}
/* Release 4: larger tap targets, whole next-match row opens its details, stats freshness note */
.dash-line a,.dash-list small a,.dash-list li>span a,.dash-card-head a{display:inline-block;min-height:24px;line-height:24px}
.stats-freshness{margin:8px 0 0;font-size:var(--fs-sm)}
.dash-card a:not(.btn),footer a,.site-footer a{display:inline-block;min-height:24px;line-height:24px}
/* Links inside running text must not rely on colour alone (WCAG 1.4.1) */
main p a:not(.btn),main small a,main .metric-card span a,main .source-link a,main .team-location a,main .team-last-result a,main .data-note a{text-decoration:underline}
/* Account menu (sign-in). Uses the theme tokens so every theme works. */
.account-menu{position:relative}
.account-menu>summary{list-style:none;display:inline-flex;align-items:center;gap:8px;cursor:pointer;padding:5px 10px 5px 5px;border:1px solid var(--t-border);border-radius:999px;background:var(--t-secondary);color:var(--t-foreground);min-height:44px}
.account-menu>summary::-webkit-details-marker{display:none}
.account-menu>summary:focus-visible{outline:2px solid var(--t-accent);outline-offset:2px}
.account-initial{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:var(--t-accent);color:var(--t-accent-text);font-weight:700}
.account-avatar{width:32px;height:32px;border-radius:50%;object-fit:cover;flex:none}
.account-face{position:relative;display:inline-flex;flex:none}
/* Unread notifications: a small dot on the avatar, ringed in the button colour so it reads on any photo or theme. */
.account-unread-dot{position:absolute;top:-1px;right:-1px;width:11px;height:11px;border-radius:50%;background:var(--t-danger);box-shadow:0 0 0 2px var(--t-secondary)}
.account-name{max-width:12ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.account-panel{position:absolute;right:0;top:calc(100% + 6px);z-index:60;min-width:220px;padding:10px;border:1px solid var(--t-border);border-radius:var(--radius-lg,12px);background:var(--t-panel-raised);box-shadow:0 8px 24px rgba(0,0,0,.35);display:flex;flex-direction:column;gap:2px}
.account-panel a,.account-panel .account-signout{display:block;width:100%;text-align:left;padding:10px 12px;border-radius:8px;color:var(--t-foreground);background:none;border:0;font:inherit;cursor:pointer;text-decoration:none}
.account-panel a:hover,.account-panel .account-signout:hover{background:var(--t-secondary-hover)}
.account-panel a:focus-visible,.account-panel .account-signout:focus-visible{outline:2px solid var(--t-accent);outline-offset:-2px}
.account-heading{margin:2px 12px 6px;font-size:var(--fs-sm)}
.account-panel hr{border:0;border-top:1px solid var(--t-border);margin:6px 0}
.account-panel form{margin:0}
.account-details{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px}
.account-details dt{font-weight:650}
.account-details dd{margin:0;overflow-wrap:anywhere}
@media (max-width: 640px){.account-name{display:none}.account-menu>summary{padding:5px}}
/* Sign-in and theme buttons share the header slot the theme button used to occupy. */
.header-actions{grid-column:-2;display:flex;align-items:center;gap:8px;position:relative}
@media(max-width:1180px){.header-actions{grid-row:1}}
@media(max-width:800px){.header-actions{grid-column:2;grid-row:1}}
[data-browser-import][hidden], [data-browser-import] [hidden]{display:none !important}
[data-browser-import] .check{display:flex;gap:8px;align-items:flex-start;margin:8px 0}
/* Text boxes inside action strips (records search, verification evidence) take the same size and border as the other form fields. */
.action-strip input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]){flex:1 1 14rem;min-width:0;max-width:28rem;padding:0 12px;border-radius:var(--radius-md)}
.action-strip label{align-self:center}
/* Width tiers: data-heavy pages (SiteNavigation.IsWide: administration) widen the shell; reading pages keep --layout-max. */
.app-shell.layout-wide { max-width: var(--layout-wide); }
.app-shell.layout-wide .app-main { max-width: none; }
/* Tables: numbers right-aligned in tabular figures so values line up for comparison. Rank stays centered. */
.source-table .num:not(.rank) { text-align: right; font-variant-numeric: tabular-nums; }
.source-table .rank { font-variant-numeric: tabular-nums; }
/* Fit tables (standings): number columns take only the width they need; the team column takes the rest. */
.fit-table th.num, .fit-table td.num { width: auto; white-space: nowrap; padding-inline: 14px; }
/* Grids anchor left: columns size to their content and any spare width stays empty on the right. */
.source-table:not(.team-standings-table), .admin-main .source-table:not(.team-standings-table) { width: auto; min-width: 0; }
/* The card hugs its table, so the border ends with the last column instead of framing empty space. */
.source-table-wrap:has(> .source-table:not(.team-standings-table)) { width: fit-content; max-width: 100%; }
.fit-table th:first-child, .fit-table td:first-child { min-width: 6rem; }
@media (max-width: 640px) {
  .fit-table th.num, .fit-table td.num { padding-inline: 8px; }
  .fit-table th:first-child, .fit-table td:first-child { min-width: 0; padding-inline: 8px; }
  .fit-table th { font-size: var(--fs-sm); }
  /* My statistics: a player's own numbers are the point of the card, so keep them readable on a phone. */
}
/* Team page summary: a one-row table does not need the full content width on larger screens. */
@media (min-width: 641px) {
  .source-table-wrap:has(> .team-standings-table) { max-width: 44rem; }
  .source-table-wrap:has(> .team-standings-table.has-division) { max-width: 56rem; }
}
/* The one-row team summary has equal fixed columns: centered values read as a row of figures. */
.team-standings-table .num:not(.rank) { text-align: center; }
@media (max-width: 640px) { .team-standings-table td.num { text-align: left; } }
/* Wide tables that scroll sideways keep the player's name in view (Stats, Leaderboards). */
.source-table.sticky-name :is(th, td):nth-child(2) { position: sticky; left: 0; z-index: 2; white-space: nowrap; background: var(--t-panel); box-shadow: inset -1px 0 0 var(--t-border); }
.source-table.sticky-name tr:nth-child(even) td:nth-child(2) { background: var(--t-soft); }
.source-table.sticky-name th:nth-child(2) { z-index: 3; background: var(--t-panel-raised); }
/* Links in table cells meet the 24px target minimum (WCAG 2.5.8). */
.source-table td a { display: inline-block; min-height: 24px; line-height: 24px; }
/* Home "find my name": label above, then the box and button on one row with matching height and radius. */
.dash-find { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 24rem) auto; justify-content: start; align-items: center; gap: 6px 8px; margin-top: 8px; }
.dash-find label { grid-column: 1 / -1; font-weight: 700; }
@media (max-width: 480px) { .dash-find { grid-template-columns: minmax(0, 1fr); width: 100%; } .dash-find input[type=search] { font-size: 16px; } }
/* Page header: the help button stays beside the title text; the text column leaves room for the watermark's busiest part. */
.app-main h1 .help-tip { vertical-align: .2em; }
@media (min-width: 801px) { .page-title-row > :first-child { padding-inline-end: clamp(0px, 8vw, 120px); } }
/* Phones and small tablets: less chrome above the content, so data starts higher on the first screen. */
@media (max-width: 800px) {
  .app-header .header-inner { padding-block: 8px; row-gap: 8px; }
  .app-main { padding-top: var(--sp-4); }
  .record-breadcrumbs { margin-bottom: var(--sp-2); }
  .section-nav { margin-bottom: var(--sp-3); }
  .section-nav > summary { padding-block: 8px; }
  .page-title-row { min-height: 0; margin-bottom: var(--sp-3); padding: 12px 14px; flex-wrap: nowrap; align-items: flex-start; gap: var(--sp-3); }
  .page-title-row:has(> .page-title-links) { flex-wrap: wrap; }
  .page-title-row > :first-child, .page-title-row > :first-child:has(+ .page-title-links) { flex: 1 1 0; }
  .page-title-row:has(> .page-title-links) > :first-child { flex-basis: 100%; }
  .page-title-row > :not(:first-child) { flex: none; }
  /* The line above would otherwise re-fix .page-title-links at its unshrunk width (undoing layout.css's general
     shrink-and-wrap rule) once it drops to its own line, so a header with several actions (e.g. Import Status's
     four refresh buttons) would overflow the screen instead of wrapping onto a second line. */
  .page-title-row > .page-title-links { flex: 1 1 100%; min-width: 0; }
  /* These links already live in the mobile section menu above the banner. */
  .data-page-header > .page-title-links { display: none; }
  .match-stats { display: flex; flex-wrap: wrap; margin-block: var(--sp-3); gap: var(--sp-2); }
  .match-stats .stat { flex: 1 1 auto; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
  .match-stats .stat b { font-size: var(--fs-lg); }
  .app-main h1 { font-size: clamp(1.5rem, 1.05rem + 2.6vw, 1.95rem); }
  .page-title-row .sub { font-size: var(--fs-md); line-height: 1.45; }
  /* Tablet portrait still uses the bottom bar; keep its items together instead of spreading them across the width. */
  .mobile-bottom-nav { grid-auto-columns: minmax(0, 104px); justify-content: center; }
}
@media (max-width: 480px) {
  .page-title-row:has(h1 .label-with-help) { flex-wrap: wrap; }
  .page-title-row:has(h1 .label-with-help) > :first-child { flex-basis: 100%; }
  /* Five destinations fit readable labels on small phones; Favorites remains in More. */
  .mobile-bottom-nav { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mobile-bottom-nav a[href^="/favorites"] { display: none; }
  .import-notice { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
/* At the narrowest phone width, search stays available in the header and on the Search page. */
@media (max-width: 360px) {
  .mobile-bottom-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-bottom-nav a[href^="/search"] { display: none; }
}
/* MK Codeworx mark (from the MKCodeworx.Brand package; a mask, so it takes the theme's brand red). */
/* Inside a button the mark follows the button's own text color instead of always the accent (it IS the accent color on a primary button). */
.btn .mk-mark { background: currentColor; }

/* Calm link colour: brand red marks actions, navigation and "your own" items. Names inside tables, cards,
   page headers, breadcrumbs and the footer read as normal text with a quiet underline, and turn red on hover, focus or tap. */
.source-table td a:not(.btn),
.page-title-row .sub a,
.team-last-result strong a,
.next-match-summary a { color: var(--t-foreground); text-decoration: underline; text-decoration-color: var(--t-muted); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.source-table td a:not(.btn) strong { color: inherit; }
.page-title-row .sub a { color: var(--t-muted); }
.record-breadcrumbs a,
.footer-links a,
.app-footer a { color: var(--t-muted); }
.calendar-location-heading a { color: var(--t-foreground); text-decoration: none; }
.standings-division-title a { color: var(--t-foreground); text-decoration: none; }
.source-table td a:not(.btn):is(:hover, :focus-visible, :active),
.page-title-row .sub a:is(:hover, :focus-visible, :active),
.team-last-result strong a:is(:hover, :focus-visible, :active),
.next-match-summary a:is(:hover, :focus-visible, :active),
.record-breadcrumbs a:is(:hover, :focus-visible, :active),
.footer-links a:is(:hover, :focus-visible, :active),
.app-footer a:is(:hover, :focus-visible, :active),
.calendar-location-heading a:is(:hover, :focus-visible, :active),
.standings-division-title a:is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration-color: currentColor; text-decoration: underline; }
.source-table td a:not(.btn):is(:hover, :focus-visible, :active) strong { color: inherit; }

/* Match details card: names are plain text, the venue and address stack, and the actions line up as a grid on a phone. */
.match-dialog-heading h2, .match-dialog-heading h2 a { color: var(--t-foreground); text-decoration: none; }
.match-dialog-heading h2 a:is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; }
.match .teams { font-size: var(--fs-lg); line-height: 1.25; }
.match .teams a.team-name, .match .captains .captain-link, .match .venue-link, .match .team-location .venue-link { color: var(--t-foreground); text-decoration: none; }
.match .captains .captain-link { font-weight: 650; text-decoration: underline; text-decoration-color: var(--t-muted); text-decoration-thickness: 1px; }
.match .teams a.team-name:is(:hover, :focus-visible, :active), .match .captains .captain-link:is(:hover, :focus-visible, :active), .match .venue-link:is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-decoration-color: currentColor; }
.match-location { display: grid; gap: 2px; margin-top: 12px; }
.match-venue { font-size: var(--fs-md); display: flex; gap: 6px; align-items: baseline; }
.match-address { font-size: var(--fs-sm); color: var(--t-muted); padding-left: 1.45rem; }
.match-directions { justify-self: start; margin-left: 1.45rem; font-size: var(--fs-sm); }
.match-actions a.btn { text-decoration: none; }
.match-actions .btn { justify-content: center; text-align: center; }
@media (max-width: 640px) {
  .match .teams { display: grid; gap: 2px; margin: 12px 0 10px; font-size: var(--fs-xl, 1.25rem); }
  .match .teams .versus { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; }
  .match .captains { display: grid; gap: 4px; }
  .match-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .match-actions .btn:last-child { grid-column: 1 / -1; }
  .match-dialog .match { padding: 14px; }
}

/* Player Stats on a phone: every row is a small card (rank, player and average on top; team, league, games and wins beneath)
   so nothing scrolls sideways and the team column is no longer cut off. */
@media (max-width: 640px) {
  .source-table.table-cards { display: block; min-width: 0; width: 100%; }
  .source-table.table-cards thead { display: none; }
  .source-table.table-cards tbody { display: block; }
  .source-table.table-cards tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; position: relative; padding: 12px 12px 12px 3.4rem; border-bottom: 1px solid var(--t-border); }
  .source-table.table-cards tr:last-child { border-bottom: 0; }
  .source-table.table-cards td { display: block; padding: 0; border: 0; min-width: 0; min-height: 0; background: transparent !important; box-shadow: none !important; position: static !important; white-space: normal; text-align: left; }
  .source-table.table-cards td:nth-child(1) { position: absolute !important; left: 12px; top: 12px; width: 2.2rem; text-align: center; font-weight: 700; color: var(--t-muted); font-variant-numeric: tabular-nums; }
  .source-table.table-cards td:nth-child(2) { order: 1; flex: 1 1 0; font-size: var(--fs-base); }
  .source-table.table-cards td:nth-child(5) { order: 2; margin-left: auto; text-align: right; font-weight: 750; font-size: var(--fs-base); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .source-table.table-cards td:nth-child(3), .source-table.table-cards td:nth-child(4) { order: 3; flex-basis: 100%; font-size: var(--fs-sm); line-height: 1.4; color: var(--t-muted); }
  .source-table.table-cards td:nth-child(3):empty { display: none; }
  .source-table.table-cards td:nth-child(3) a, .source-table.table-cards td:nth-child(4) a { color: var(--t-muted); display: inline; line-height: inherit; min-height: 0; text-decoration: none; }
  .source-table.table-cards td:nth-child(3) a:is(:hover, :focus-visible, :active), .source-table.table-cards td:nth-child(4) a:is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; }
  .source-table.table-cards td:nth-child(6), .source-table.table-cards td:nth-child(7) { order: 4; font-size: var(--fs-sm); color: var(--t-muted); font-variant-numeric: tabular-nums; }
  .source-table.table-cards td:nth-child(6)::before { content: "Games "; }
  .source-table.table-cards td:nth-child(7)::before { content: "Wins "; }
  .source-table-wrap:has(> .source-table.table-cards) { overflow: visible; }
}

/* Expandable sections: the whole header row is the control. Anything that is a box with padding has the padding on the
   summary or button instead, so a tap or click anywhere on the header expands it. */
.standings-division-header { padding: 0; display: block; }
.standings-division-toggle { width: 100%; padding: 16px 18px; text-align: left; }
.standings-division-title { flex: 1; text-align: left; font-size: var(--fs-base); font-weight: 750; }
@media (max-width: 640px) { .standings-division-toggle { padding: 13px 12px; } }
details.data-note { padding: 0; }
details.data-note > summary { position: relative; list-style: none; padding: 14px 40px 14px 16px; font-weight: 700; color: var(--t-foreground); }
details.data-note > summary::-webkit-details-marker { display: none; }
details.data-note > summary::after, .favorite-manager > summary::after { content: ""; position: absolute; inset-inline-end: var(--sp-4); top: 50%; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); }
details.data-note[open] > summary::after, .favorite-manager[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
.favorite-manager > summary { position: relative; list-style: none; padding-inline-end: 28px; }
.favorite-manager > summary::-webkit-details-marker { display: none; }
.favorite-manager > summary::after { inset-inline-end: 0; }
details.data-note > :not(summary) { margin-inline: 16px; }
details.data-note > :last-child:not(summary) { margin-bottom: 14px; }
details.section-nav { padding: 0; }
details.section-nav > summary { padding-inline: 12px; }
details.section-nav > :not(summary) { margin-inline: 12px; }
/* Same chevron as the Filters bar: it points down when closed and up when open, in place of the browser's triangle. */
details.section-nav { border-radius: var(--radius-lg); }
details.section-nav > summary { position: relative; list-style: none; min-height: var(--control-h); display: flex; align-items: center; padding-inline: var(--sp-3) 40px; font-weight: 700; }
details.section-nav > summary::-webkit-details-marker { display: none; }
details.section-nav > summary::after { content: ""; position: absolute; inset-inline-end: var(--sp-4); top: 50%; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); }
details.section-nav[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }

/* Mobile leaderboard labels differ from Player Stats. */
@media (max-width: 640px) {
  /* The Games / Wins labels belong to Player Stats only; the leaderboard's last two cells are "Wins / Games" and "Win %". */
  .source-table.sticky-name.leaderboard-table td:nth-child(6)::before { content: "Won / played "; }
  .source-table.sticky-name.leaderboard-table td:nth-child(7)::before { content: "Win rate "; }
}

/* Record links share interaction states; prose links keep their underline. */
.favorite-name { color: var(--t-foreground); text-decoration: none; }
.player-section-scope a, .player-record-item a { color: var(--t-foreground); }
.player-section-scope a, .player-record-item a, .browse-more ul a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.metric-card span a { text-decoration-color: var(--t-muted); }
.favorite-name:is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-decoration-color: currentColor; }

/* Standings headers use the same chevron as the player roster rows, on the left, in place of the old arrow on the right. */
.standings-division-toggle::after { content: none; }
.standings-chevron { width: 18px; height: 18px; flex: none; color: var(--t-accent); }

/* Result rows (Search, Browse, Favorites, Venues): the whole row is the link. The favorite pin sits above it as its own button. */
a.browse-link, a.browse-link:hover { color: var(--t-foreground); text-decoration: none; }
.browse-row:hover { background: var(--t-panel-raised); }
.browse-row:hover .browse-name, .browse-link:focus-visible .browse-name { color: var(--t-link); text-decoration: underline; text-underline-offset: 3px; }
.browse-link:focus-visible { outline: none; }
.browse-link:focus-visible::after { outline: 2px solid var(--t-accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.browse-link .browse-detail { color: var(--t-muted); }
.browse-link { gap: 2px; }
.browse-link .search-kind { color: var(--t-link); }
.browse-row { padding-block: 10px; }

/* The record type above a search result (Player, Team, Achievement...) is a small tag, not a heading. */
.search-kind, .header-search-results .search-kind, .browse-link .search-kind { font-size: var(--fs-min); font-weight: 750; letter-spacing: .08em; line-height: 1.2; }

/* A link inside a grid container would stretch across the whole card, so the blank space beside the text was clickable. */
.team-standing-heading > a { flex: 0 1 auto; }

/* Small calendar text uses the readable link colour; the accent fill colour is too dark for text on the dark theme. */
.calendar-more, .calendar-details-cue { color: var(--t-link); }

/* Inside a grid, a link would stretch across the card and the blank space beside the text would be clickable. */
.match .teams > a, .match .captains a, .match .team-location a { justify-self: start; }
.match .teams, .match .captains { justify-items: start; }

/* Team names in the phone standings cards are plain text like the table rows; a card for your own team is marked by its tag and accent edge. */
.team-standing-heading > a { color: var(--t-foreground); text-decoration: none; }
.team-standing-heading > a:is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-underline-offset: 3px; }

/* Names in table cells are inline, so only the text is the link even when a long name wraps onto a second line. */
.source-table td a:not(.btn) { display: inline; min-height: 0; }

/* League player list: "Player · Team" on one line with every game's average beneath, in a single column. */
.roster-with-team td { padding: 12px 14px; }
.roster-with-team .roster-player-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 8px; }
.roster-with-team .roster-player-name > a:first-child { font-weight: 700; }
.roster-with-team .roster-team { color: var(--t-muted); }
.roster-dot { color: var(--t-muted); }

/* Link style: the name a row is about is bold with no underline; secondary links (team, league, venue beside it) are muted with no
   underline; both turn red and underlined on hover, focus or tap. Only links inside sentences keep their underline. */
.source-table td a:not(.btn) { color: var(--t-muted); font-weight: 400; text-decoration: none; }
.source-table td:first-child a:not(.btn),
.source-table td a:not(.btn):has(> strong),
.fit-table td:nth-child(2) a:not(.btn) { color: var(--t-foreground); font-weight: 650; }
.source-table.roster-with-team td a.roster-team:not(.btn) { color: var(--t-muted); font-weight: 400; }
.source-table td a:not(.btn):is(:hover, :focus-visible, :active),
.source-table td:first-child a:not(.btn):is(:hover, :focus-visible, :active),
.source-table td a:not(.btn):has(> strong):is(:hover, :focus-visible, :active),
.fit-table td:nth-child(2) a:not(.btn):is(:hover, :focus-visible, :active),
.source-table.roster-with-team td a.roster-team:not(.btn):is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
.record-breadcrumbs a, .page-title-row .sub a { text-decoration: none; }
.team-last-result strong a, .next-match-summary a { text-decoration: none; font-weight: 650; }
.metric-card span a, .browse-more ul a { color: var(--t-muted); text-decoration: none; }
.player-section-scope a, .player-record-item a { text-decoration: none; font-weight: 650; }
.match .captains .captain-link { text-decoration: none; }
main small a:not(.btn), .dash-list small a:not(.btn) { color: var(--t-muted); text-decoration: none; }
.record-breadcrumbs a:is(:hover, :focus-visible, :active),
.page-title-row .sub a:is(:hover, :focus-visible, :active),
.team-last-result strong a:is(:hover, :focus-visible, :active),
.next-match-summary a:is(:hover, :focus-visible, :active),
.metric-card span a:is(:hover, :focus-visible, :active),
.browse-more ul a:is(:hover, :focus-visible, :active),
.player-section-scope a:is(:hover, :focus-visible, :active),
.player-record-item a:is(:hover, :focus-visible, :active),
main small a:not(.btn):is(:hover, :focus-visible, :active),
.dash-list small a:not(.btn):is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
main .metric-card span a:not(.btn) { text-decoration: none; }
main .metric-card span a:not(.btn):is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
.source-table td a:not(.btn) strong { text-decoration: none; }
.team-last-result strong a:not(.btn), .next-match-summary a:not(.btn) { text-decoration: none; }
.team-last-result strong a:not(.btn):is(:hover, :focus-visible, :active), .next-match-summary a:not(.btn):is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }

/* Player Stats shows 50 rows at a time. */
.stats-more { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: .85rem 0 1rem; }
.stats-more .sub { margin: 0; }

/* Original Reports links on the league page: a 24px-high tap target, still only as wide as the text. */
main a.original-report-link:not(.btn) { display: inline-block; padding-block: .2rem; line-height: 1.3; }

/* "Show more" under a paged roster or stats table. */
.roster-more { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: .85rem 0 1rem; }
.roster-more .sub { margin: 0; }

/* Player Stats on tablets: Rank is a narrow column (the general 10rem first-column minimum is for name columns),
   and cells are a little tighter so every column, Wins included, fits without sideways scrolling. */
@media (min-width: 641px) {
  .source-table.sticky-name { min-width: 0; }
  .source-table.sticky-name :is(th, td):first-child { min-width: 0; }
}
@media (min-width: 641px) and (max-width: 1100px) {
  .source-table.sticky-name :is(th, td) { padding-inline: 8px; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .source-table.sticky-name :is(th, td) { padding-inline: 6px; font-size: var(--fs-md); }
  .source-table.sticky-name :is(th, td):nth-child(2) { white-space: normal; }
}

/* Home standings: the league name above the table is a bold primary name, not a sentence link. */
main .dash-tab-heading a:not(.btn) { color: var(--t-foreground); text-decoration: none; }
main .dash-tab-heading a:not(.btn):is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; }

/* Calendar subscribe menu on team pages. */
.subscribe-menu { display: inline-block; vertical-align: top; max-width: 100%; }
.subscribe-menu > summary { display: inline-flex; list-style: none; cursor: pointer; padding: 10px 14px; box-sizing: border-box; }
.action-strip:has(> .subscribe-menu) { align-items: flex-start; }
.subscribe-menu > summary::-webkit-details-marker { display: none; }
.subscribe-menu[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.subscribe-options { margin-top: .5rem; padding: .85rem 1rem 1rem; background: var(--t-panel); border: 1px solid var(--t-border); border-radius: 12px; width: min(26rem, 100%); }
.subscribe-options .data-note { margin: 0 0 .6rem; padding: 0; border: 0; background: none; box-shadow: none; color: var(--t-muted); font-size: var(--fs-min); }
.subscribe-list { list-style: none; margin: 0 0 .85rem; padding: 0; display: grid; gap: .35rem; }
.subscribe-list a { display: flex; flex-direction: column; justify-content: center; min-height: 2.75rem; padding: .4rem .7rem; border: 1px solid var(--t-border); border-radius: 10px; font-weight: 650; text-decoration: none; color: var(--t-foreground); }
.subscribe-list a:is(:hover, :focus-visible, :active) { color: var(--t-link); border-color: var(--t-link); }
.subscribe-hint { display: block; font-weight: 400; font-size: var(--fs-min); color: var(--t-muted); }
.subscribe-copy { display: grid; gap: .5rem; }
.subscribe-copy label { display: grid; gap: .35rem; font-size: var(--fs-min); color: var(--t-muted); }
.subscribe-copy input { width: 100%; font-size: var(--fs-min); }
.subscribe-copy .btn { justify-self: start; }

/* Schedule Changes cards: what changed, in the league and week it belongs to. Not links, so no hover highlight. */
.explore-result.change-item:hover { background: var(--t-panel-raised); border-color: var(--t-border); }
.change-item .change-where a { text-decoration: none; }
.change-item .change-type { align-self: flex-start; margin-bottom: 2px; }

/* Schedule Changes (public and admin): grouped by update, with the part that moved marked. */
.change-batch { margin: 1.4rem 0 1.6rem; }
.change-batch-title { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 .25rem; font-size: 1.05rem; }
.change-batch-leagues { margin: 0 0 .7rem; color: var(--t-muted); }
.change-item .change-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; overflow-wrap: anywhere; }
.change-item .change-label { flex: 0 0 auto; min-width: 2.4rem; white-space: nowrap; color: var(--t-muted); font-size: var(--fs-min); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.change-diff { font-weight: 750; background: var(--t-accent-soft); border-radius: 5px; padding: 0 .3em; }
.change-item .change-new { color: var(--t-link); font-weight: 650; }
.change-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.change-chip { display: inline-flex; align-items: baseline; gap: .4rem; min-height: 2.5rem; padding: .35rem .85rem; border: 1px solid var(--t-border); border-radius: 999px; background: var(--t-panel-raised); color: var(--t-foreground); font: inherit; cursor: pointer; }
.change-chip strong { font-size: 1.05rem; }
.change-chip[aria-pressed="true"] { background: var(--t-accent-soft); border-color: var(--t-accent); }
.change-filters { margin-bottom: 1rem; }
.change-table td, .change-table th { vertical-align: top; }
.change-batch-row th { background: var(--t-panel-raised); text-align: left; font-weight: 650; padding-block: .6rem; }
.change-batch-row .change-hidden { color: var(--t-muted); font-weight: 400; }
.change-table .change-address { display: block; margin-top: .15rem; color: var(--t-muted); font-size: var(--fs-min); overflow-wrap: anywhere; }
main p.change-batch-leagues a:not(.btn) { color: var(--t-muted); text-decoration: none; }
main p.change-batch-leagues a:not(.btn):is(:hover, :focus-visible, :active) { color: var(--t-link); text-decoration: underline; }

/* Admin Schedule Changes on phones: each change is a card, so Was and Now are never off-screen. */
@media (max-width: 640px) {
  .source-table.change-table, .source-table.change-table tbody { display: block; min-width: 0; width: 100%; }
  .source-table.change-table thead { display: none; }
  .source-table.change-table .change-batch-row, .source-table.change-table .change-batch-row th { display: block; width: 100%; }
  .source-table.change-table tr:not(.change-batch-row) { display: grid; gap: .35rem; padding: .85rem .9rem; border-bottom: 1px solid var(--t-border); }
  .source-table.change-table tr:not(.change-batch-row) td { display: block; padding: 0; border: 0; min-width: 0; min-height: 0; background: transparent; }
  .source-table.change-table td:first-child { min-width: 0; }
  .source-table.change-table .chg-was::before, .source-table.change-table .chg-now::before, .source-table.change-table .chg-players::before {
    display: inline-block; min-width: 4.6rem; margin-right: .4rem; color: var(--t-muted); font-size: var(--fs-min); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  }
  .source-table.change-table .chg-was::before { content: "Was"; }
  .source-table.change-table .chg-now::before { content: "Now"; }
  .source-table.change-table .chg-players::before { content: "Players see it"; }
  .source-table.change-table .chg-legacy { color: var(--t-muted); }
}
main .change-batch-row th a:not(.btn) { text-decoration: underline; }

/* Favorites page search: each result is one button that adds it to your favorites; nothing opens and there is no pin. */
button.favorite-result { background: none; border: 0; padding: 0; font: inherit; color: var(--t-foreground); text-align: left; cursor: pointer; }
button.favorite-result:disabled { cursor: default; opacity: 1; }
.favorite-result-state { position: relative; flex: 0 0 auto; padding: 0 8px; font-size: var(--fs-md); font-weight: 650; color: var(--t-link); white-space: nowrap; pointer-events: none; }
.favorite-result.added .browse-name, .browse-row:hover .favorite-result.added .browse-name { color: var(--t-foreground); text-decoration: none; }
.browse-row:has(.favorite-result.added) .favorite-result-state { color: var(--t-muted); }

/* Search results and saved favorites use individual cards at every width. */
.favorite-list, .league-search-results .browse-list {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,17rem),1fr));
  gap:var(--sp-3); overflow:visible; border:0; background:transparent;
}
.favorite-list .favorite-item, .league-search-results .browse-list .browse-row {
  border:1px solid var(--t-border); border-radius:var(--radius-lg); background:var(--t-panel); min-width:0;
}
.favorite-list .favorite-item:hover, .league-search-results .browse-list .browse-row:hover { background:var(--t-panel-raised); }

/* Browse: filter and count share one slim bar; results flow into columns; the A-Z bar stays in view on large screens. */
.browse-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--sp-3) var(--sp-5); margin: var(--sp-4) 0 var(--sp-3); }
.browse-toolbar .browse-filter { gap: 6px; margin: 0; flex: 0 1 22rem; }
.browse-count { margin: 0 0 var(--sp-3); text-align: end; color: var(--t-muted); }
.browse-az { gap: 3px; }
.browse-az :is(a, button), .browse-az :is(span.disabled, button:disabled) { min-width: 30px; padding: 6px 6px; }
@media (min-width: 900px) {
  .browse-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: var(--sp-3); border: 0; background: transparent; overflow: visible; }
  .browse-row { border: 1px solid var(--t-border); border-radius: var(--radius-lg); background: var(--t-panel); }
  .browse-row + .browse-row { border-top: 1px solid var(--t-border); }
  .browse-az { position: sticky; top: var(--sticky-filter-height, 0px); z-index: 3; padding: 8px 0; margin-bottom: 4px; background: var(--t-page); }
  .browse-row { scroll-margin-top: 70px; }
}
/* A-Z letters sit in an even grid: one row when there is room, otherwise two or three rows of equal length. */
.browse-az { display: grid; grid-template-columns: repeat(var(--az-3, 9), minmax(0, 1fr)); gap: 3px; }
.browse-az :is(a, button), .browse-az :is(span.disabled, button:disabled) { min-width: 0; padding-inline: 0; }
@media (min-width: 641px) { .browse-az { grid-template-columns: repeat(var(--az-2, 14), minmax(0, 1fr)); } }
@media (min-width: 1250px) { .browse-az { grid-template-columns: repeat(var(--az-1, 27), minmax(0, 1fr)); } }
/* Below 900px the letters shrink into two even rows that stay pinned, so everything is visible without scrolling. */
@media (max-width: 899px) {
  .browse-az { display: grid; grid-template-columns: repeat(var(--az-2, 13), minmax(0, 1fr)); gap: 3px; position: sticky; top: var(--sticky-filter-height, 0px); z-index: 3; padding: 6px 0; margin-bottom: 4px; background: var(--t-page); }
  .browse-az :is(a, button), .browse-az :is(span.disabled, button:disabled) { min-width: 0; padding: 7px 0; font-size: var(--fs-sm); line-height: 1.2; }
  .browse-row { scroll-margin-top: 90px; }
}

/* Browse letters: pressed feedback, and the row you jumped to flashes. */
.browse-az :is(a, button):active { background: var(--t-accent-soft); border-color: var(--t-accent); transform: scale(.94); }

/* Admin link: between 801px and 1180px it shares the first header row with the area switch instead of dropping onto its own row. */
@media (min-width: 801px) and (max-width: 1180px) {
  .app-header .scope-switch { grid-column: 2; grid-row: 1; justify-self: start; }
  .app-header .main-nav { grid-column: 2; grid-row: 1; justify-self: end; }
}

/* Data labels end in a colon: definition-list terms and the Was/Now tags. */
dt::after, .change-item .change-label::after { content: ":"; }
