.match-final-score { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 750; }
/* The rectangular page-colour backing hides the card's rails behind the top corners. */
.match-card > summary { display: block; padding: 0; }
.match-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 14px 12px;
}
.match-card:not([open]) .match-tabs { display: none; }
.match-card[open] {
  isolation: isolate;
  --match-page: #f5f8fc;
  --match-surface: #fff;
  --match-border: #dce5f0;
}
.match-card[open] > summary {
  position: sticky;
  top: 0;
  z-index: 2;
  /* Share the card's top edge instead of drawing a second line below it. */
  margin-top: -1px;
  margin-inline: -1px;
  padding-inline: 0;
  background: var(--match-page);
  border-radius: 0;
  box-shadow: none;
}
.match-card[open] .match-header-main { padding-inline: 13px; }
.match-card[open] > summary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: 12px 12px 0 0;
  background: var(--match-surface);
  box-shadow: inset 0 0 0 1px var(--match-border);
}
:root[data-theme="dark"] .match-card[open] {
  --match-page: #101722;
  --match-surface: var(--dark-surface);
  --match-border: var(--dark-border);
}

.match-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px,4vw,24px);
  padding: 0 12px;
  border-top: 1px solid var(--match-border);
  cursor: default;
}
.match-tab {
  min-height: 44px;
  padding: 11px 0 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #245fc9;
  font-size: 12px;
  font-weight: 650;
  line-height: 20px;
}
.match-tab[aria-selected="true"] { border-bottom-color: currentColor; }
.match-tab:disabled { color: #8b95a5; cursor: default; opacity: 1; }
.match-tab:focus-visible { outline: 2px solid #4b82df; outline-offset: 2px; }
:root[data-theme="dark"] .match-tab { color: var(--dark-blue); }
:root[data-theme="dark"] .match-tab:disabled { color: #738299; }
/* The combined sticky header already draws the single divider below the tabs. */
.match-card[open] > .match-offers,
.match-card[open] > .referee-panel { border-top: 0; }

.referee-panel { padding: 14px 12px; border-top: 1px solid var(--match-border); }
.referee-panel-name { margin: 0; font-size: 13px; font-weight: 700; }
.referee-panel-league, .referee-sample, .referee-empty { color: #66768a; font-size: 11px; }
.referee-panel-league { margin: 4px 0 12px; }
.referee-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin: 12px 0; }
.referee-metrics > div { display: grid; gap: 5px; padding: 12px 6px; border-radius: 8px; background: #f2f5fa; text-align: center; }
.referee-metrics dt { color: #66768a; font-size: 10px; }
.referee-metrics dd { margin: 0; font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.referee-empty { margin: 12px 0 0; line-height: 1.5; }
.referee-history-match { padding: 12px 0; border-top: 1px solid var(--match-border); font-size: 12px; }
.referee-history-league { margin: 0 0 8px; color: #66768a; font-size: 10px; }
.match-brief-panel { padding: 12px; }
.brief-content { display: grid; gap: 12px; }
.brief-card { min-width: 0; padding: 14px 12px; border: 1px solid #dce5f0; border-radius: 12px; }
.brief-card h3 { margin: 0 0 14px; font-size: 14px; }
.brief-note { margin: 10px 0 0; color: #66768a; font-size: 10px; line-height: 1.5; }
.brief-form-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; margin: 10px 0; font-size: 12px; }
.brief-form-row > strong { min-width: 0; overflow-wrap: anywhere; }
.brief-form-chips { display: grid; grid-template-columns: repeat(5,22px); gap: 4px; }
.brief-chip { display: grid; place-items: center; height: 24px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700; }
.brief-result-W { background: #337a56; }
.brief-result-D,.brief-result-unknown { background: #657c78; }
.brief-result-L { background: #c35b62; }
.brief-comparison-legend,.brief-stat-venue,.brief-stat-count { display: flex; justify-content: space-between; gap: 10px; }
.brief-comparison-legend { font-size: 12px; margin-bottom: 15px; }
.brief-comparison-legend > :last-child { text-align: right; }
.brief-stat { margin: 14px 0; }
.brief-stat-head { display: grid; grid-template-columns: 50px minmax(0,1fr) 50px; align-items: center; gap: 8px; font-size: 13px; }
.brief-stat-head > span { text-align: center; font-size: 11px; color: #66768a; }
.brief-stat-head > :last-child { text-align: right; }
.brief-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 7px 0 5px; }
.brief-bar { display: flex; height: 6px; border-radius: 4px; overflow: hidden; background: #e3eaf3; }
.brief-bar.home { justify-content: flex-end; }
.brief-bar i { height: 100%; border-radius: 4px; background: #48976c; }
.brief-bar.away i { background: #4c95ef; }
.brief-stat-venue,.brief-stat-count { color: #66768a; font-size: 9px; }
.brief-stat-venue > :last-child,.brief-stat-count > :last-child { text-align: right; }
.brief-stat-count { margin-top: 3px; }
.brief-h2h { display: flex; gap: 7px; }
.brief-h2h-item { display: grid; flex: 1; gap: 5px; text-align: center; }
.brief-h2h-item time { margin: 0; font-size: 9px; }
.brief-h2h-score { padding: 8px 4px; border-radius: 6px; color: white; font-size: 13px; }
.brief-h2h-tally { font-size: 11px; line-height: 1.6; }
.brief-scorers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-size: 12px; }
.brief-scorer { display: grid; grid-template-columns: 8px minmax(0,1fr) 16px; align-items: center; gap: 5px; margin-top: 12px; font-size: 11px; }
.brief-scorer > span { overflow-wrap: anywhere; }
.brief-lineup-dot { width: 7px; height: 7px; border-radius: 50%; background: #8793a5; }
.brief-lineup-dot.final { background: #18b976; }
.brief-lineup-dot.probable { background: #d4aa3c; }
:root[data-theme="dark"] .brief-card { background: var(--dark-surface); border-color: var(--dark-border); }
:root[data-theme="dark"] .brief-note,:root[data-theme="dark"] .brief-stat-head > span,
:root[data-theme="dark"] .brief-stat-venue,:root[data-theme="dark"] .brief-stat-count,
:root[data-theme="dark"] .referee-history-league { color: var(--dark-muted); }
:root[data-theme="dark"] .brief-bar { background: #27384a; }
.referee-history-heading, .referee-history-team { display: grid; grid-template-columns: minmax(0,1fr) 32px 46px 36px 42px; align-items: baseline; gap: 6px; }
.referee-history-heading { margin-bottom: 8px; color: #66768a; font-size: 10px; }
.referee-history-total { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.referee-offsides-total { text-decoration: none; }
.referee-history-team > span { min-width: 0; overflow-wrap: anywhere; }
.referee-history-team-name { display: flex; align-items: baseline; gap: 8px; }
.referee-history-goals { flex: 0 0 auto; font-size: 12px; }
.referee-history-team + .referee-history-team { margin-top: 5px; }
.referee-history-team strong { text-align: right; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .referee-panel-league,
:root[data-theme="dark"] .referee-sample,
:root[data-theme="dark"] .referee-empty,
:root[data-theme="dark"] .referee-metrics dt,
:root[data-theme="dark"] .referee-history-heading { color: var(--dark-muted); }
:root[data-theme="dark"] .referee-metrics > div { background: #202e40; }

.match-lineup-panel[hidden] { display: none; }
.lineup-panel { padding: 12px; color: #203548; }
.lineup-section-label { margin: 12px 0 5px; padding: 8px; border-radius: 4px; text-align: center; text-transform: uppercase; letter-spacing: .07em; font-size: 10px; background: #edf0f4; }
.lineup-section-label:first-child { margin-top: 0; }
.lineup-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; padding: 10px 8px; }
.lineup-pair:nth-of-type(even) { background: #f4f6f8; border-radius: 4px; }
.lineup-player { min-width: 0; font-size: 11px; }
.lineup-player.away, .lineup-team-head .lineup-player:last-child { text-align: right; }
.lineup-player-main { display: flex; align-items: center; gap: 5px; min-width: 0; }
.lineup-player.away .lineup-player-main { justify-content: flex-end; }
.lineup-player-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lineup-number { flex: 0 0 auto; font-size: 10px; font-variant-numeric: tabular-nums; }
.lineup-flag { flex: 0 0 14px; width: 14px; height: 10px; object-fit: contain; }
.lineup-reason, .lineup-state { display: block; margin-top: 3px; color: #718093; font-size: 10px; overflow-wrap: anywhere; }
.lineup-empty { padding: 12px; color: #718093; font-size: 11px; }
.lineup-retry { margin: 0 12px 12px; padding: 7px 12px; border: 1px solid #45658a; border-radius: 5px; background: transparent; color: inherit; }
:root[data-theme="dark"] .lineup-panel { color: var(--dark-text,#dce7f7); }
:root[data-theme="dark"] .lineup-section-label { background: #202e40; }
:root[data-theme="dark"] .lineup-pair:nth-of-type(even) { background: #1e2a3a; }
:root[data-theme="dark"] .lineup-empty,
:root[data-theme="dark"] .lineup-reason,
:root[data-theme="dark"] .lineup-state { color: var(--dark-muted,#a5b7d0); }
