:root {
  --bg: #0c1220;
  --bg-card: #141c2e;
  --bg-elevated: #1a2438;
  --border: #2a3650;
  --text: #e8edf5;
  --text-muted: #8b9bb8;
  --accent: #00a651;
  --accent-gold: #f5c518;
  --accent-blue: #3b82f6;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --font: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(0, 166, 81, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: rgba(20, 28, 46, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header.compact { padding: 0.75rem 0; }

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 1rem; }
.brand-icon {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
}

.brand-icon img {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
}
.brand h1 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.subtitle { margin: 0.15rem 0 0; color: var(--text-muted); font-size: 0.85rem; }
.archive-note { color: var(--accent); font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.lang-toggle {
  min-width: 4.25rem;
  justify-content: center;
  font-weight: 600;
}

.header-actions--compact { gap: 0.5rem; }
.meta-text { color: var(--text-muted); font-size: 0.8rem; }

.back-link { color: var(--text); font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #008040);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }

.btn-icon { display: inline-block; transition: transform 0.5s; }
.btn.loading .btn-icon { animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
  display: flex;
  gap: 0.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem 0;
  overflow-x: auto;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-title { font-size: 1.2rem; margin: 0 0 1rem; font-weight: 600; }
.panel-title .meta-text { font-size: 0.85rem; font-weight: 400; }
.day-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.day-heading:first-child { margin-top: 0; }
.section-subtitle { font-size: 1rem; margin: 2rem 0 1rem; color: var(--text-muted); }

.loading, .error-banner, .refresh-status {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.loading { background: var(--bg-card); text-align: center; color: var(--text-muted); }
.error-banner { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--danger); color: #fca5a5; }
.refresh-status { background: rgba(0, 166, 81, 0.12); border: 1px solid var(--accent); color: #86efac; }
.hidden { display: none !important; }

.filter-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-row label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.filter-row input, .filter-row select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  font-family: inherit;
}

.match-list { display: flex; flex-direction: column; gap: 0.75rem; }

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.match-card.finished { border-left: 3px solid var(--accent); }
.match-card.scheduled { border-left: 3px solid var(--accent-blue); }

.match-card--linked {
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.match-card--linked:hover {
  border-color: rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.04);
}

.match-card-hit {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  text-decoration: none;
  color: inherit;
}

.match-card-hit:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.match-card-inner {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.match-card-inner a {
  pointer-events: auto;
  cursor: pointer;
}

.match-card--linked .score-block {
  pointer-events: none;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.match-meta .stage-badge {
  background: var(--bg-elevated);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  color: var(--accent-gold);
}

.match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.team-side {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.team-side.away { flex-direction: row-reverse; text-align: right; }

.team-flag { width: 32px; height: 22px; object-fit: cover; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.team-flag.placeholder { background: var(--bg-elevated); }

.team-flag-link {
  display: inline-flex;
  line-height: 0;
  border-radius: 2px;
}

.team-flag-link:hover .team-flag {
  outline: 2px solid var(--accent-gold);
  outline-offset: 1px;
}

.maps-link,
.wiki-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
}

.maps-link:hover,
.wiki-link:hover {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.team-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
}

.team-name:hover { color: var(--accent-gold); }

.score-block {
  text-align: center;
  min-width: min(100%, 17rem);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.score { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.05em; }
.score.vs { font-size: 1rem; color: var(--text-muted); font-weight: 500; }

.goals-timeline {
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  line-height: 1.35;
}

.goals-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.25rem 0.45rem;
  align-items: center;
}

.goals-row + .goals-row {
  margin-top: 0.2rem;
}

.goals-cell--minute {
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  min-width: 2.35rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.goals-cell--home {
  text-align: right;
  min-width: 0;
}

.goals-cell--away {
  text-align: left;
  min-width: 0;
}

.goal-side {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  max-width: 100%;
}

.goal-side--home {
  justify-content: flex-end;
}

.goal-side--away {
  justify-content: flex-start;
}

.event-side {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  max-width: 100%;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  line-height: 1.25;
}

.event-side--goal {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.42);
}

.event-side--goal .goal-player {
  color: #bbf7d0;
  font-weight: 600;
}

.event-side--goal-og {
  background: rgba(76, 29, 149, 0.22);
  border: 1px solid rgba(109, 40, 217, 0.45);
}

.event-side--goal-og .goal-player {
  color: #ddd6fe;
}

.event-side--card {
  border: 1px solid transparent;
  padding: 0.15rem 0.4rem;
}

.event-side--card .goal-player {
  font-weight: 500;
}

.event-side--card-yellow {
  background: rgba(250, 204, 21, 0.22);
  border-color: rgba(250, 204, 21, 0.48);
}

.event-side--card-yellow .goal-player {
  color: #fef08a;
}

.event-side--card-red {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.48);
}

.event-side--card-red .goal-player {
  color: #fecaca;
}

.event-side--home {
  justify-content: flex-end;
}

.event-side--away {
  justify-content: flex-start;
}

.event-marker {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.event-marker--yellow {
  background: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.55);
}

.event-marker--red {
  background: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.55);
}

.goals-row--halftime {
  display: block;
  margin: 0.4rem 0;
  padding: 0.1rem 0;
}

.goals-halftime-line {
  width: 100%;
  border-top: 1px dashed rgba(148, 163, 184, 0.55);
}

.event-icon {
  flex-shrink: 0;
  vertical-align: middle;
  object-fit: contain;
}

.event-icon--goal,
.event-icon--goal-og {
  width: 13px;
  height: 13px;
}

.event-icon--goal-og {
  filter: sepia(0.85) saturate(2.8) hue-rotate(330deg) brightness(0.92);
}

.event-icon--yellow,
.event-icon--red {
  width: 10px;
  height: 13px;
}

.goal-side-sep {
  opacity: 0.55;
}

.goals-list {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

.goals-list--home {
  align-items: flex-start;
  text-align: left;
}

.goals-list--away {
  align-items: flex-end;
  text-align: right;
}

.goal-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
}

.goals-list--away .goal-entry {
  flex-direction: row-reverse;
}

.goal-team-flag {
  width: 16px;
  height: 11px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.goal-team-flag.placeholder {
  display: inline-block;
  background: var(--bg-elevated);
}

.goal-player {
  color: var(--text-muted);
}

.goal-minute {
  color: var(--text-muted);
  opacity: 0.85;
  white-space: nowrap;
}

.goal-og,
.goal-pen {
  color: var(--text-muted);
  opacity: 0.85;
  white-space: nowrap;
  font-size: 0.9em;
}

.match-details {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.venue-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.venue-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.nat-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: 0.15rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.referee-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-header {
  background: var(--bg-elevated);
  padding: 0.6rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-gold);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.standings-table th, .standings-table td {
  padding: 0.45rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.standings-table th:first-child, .standings-table td:first-child { text-align: left; padding-left: 0.75rem; }

.standings-table tr:hover { background: rgba(255,255,255,0.03); }

.standings-team {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.standings-team img { width: 20px; height: 14px; object-fit: cover; border-radius: 1px; }

.knockout-bracket {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.bracket-flow {
  display: flex;
  gap: 1.5rem;
  min-width: max-content;
}

.bracket-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 160px;
}

.bracket-col h4 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bracket-slot {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bracket-slot.highlight { color: var(--text); border-color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* Team page */
.team-page { padding-top: 1rem; }

.team-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.team-flag-wrap {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.team-flag-lg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.team-hero h1 { margin: 0; font-size: 1.75rem; }
.coach-info {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
}
.coach-source { font-size: 0.78rem; color: var(--text-muted); }

.team-section { margin-bottom: 2rem; }
.team-section h2 { font-size: 1.1rem; margin-bottom: 1rem; }

.table-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.squad-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  background: var(--bg-card);
}

.squad-table thead th {
  background: var(--bg-elevated);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

.squad-sticky-head {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--team-sticky-top, 53px);
  z-index: 90;
  background: rgba(26, 36, 56, 0.98);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.squad-sticky-head.hidden { display: none; }

.squad-sticky-head-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  overflow: visible;
  will-change: transform;
}

.squad-table-head-clone {
  margin: 0;
  table-layout: fixed;
}

.squad-table-head-clone th {
  border-bottom: none;
}

.squad-table td {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
}

.squad-table tr:hover { background: rgba(255,255,255,0.03); }

.pos-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pos-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.squad-row.pos-gk { background: rgba(234, 179, 8, 0.07); }
.squad-row.pos-df { background: rgba(59, 130, 246, 0.07); }
.squad-row.pos-mf { background: rgba(0, 166, 81, 0.07); }
.squad-row.pos-fw { background: rgba(239, 68, 68, 0.07); }

.squad-row.pos-gk { box-shadow: inset 3px 0 0 #eab308; }
.squad-row.pos-df { box-shadow: inset 3px 0 0 #3b82f6; }
.squad-row.pos-mf { box-shadow: inset 3px 0 0 #00a651; }
.squad-row.pos-fw { box-shadow: inset 3px 0 0 #ef4444; }

.pos-badge.pos-gk { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.pos-badge.pos-df { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.pos-badge.pos-mf { background: rgba(0, 166, 81, 0.2); color: #86efac; }
.pos-badge.pos-fw { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.pos-badge.pos-other { background: rgba(139, 155, 184, 0.2); color: var(--text-muted); }

.squad-row:hover { filter: brightness(1.08); }

.player-name { cursor: pointer; position: relative; font-weight: 500; }
.player-name-zh { color: var(--text-muted); font-size: 0.88em; margin-left: 0.4em; font-weight: 400; }
.player-name.captain::after { content: ' (C)'; color: var(--accent-gold); font-size: 0.75rem; }
.player-name.vice-captain::after { content: ' (VC)'; color: var(--text-muted); font-size: 0.75rem; }

.club-cell { display: flex; align-items: center; gap: 0.4rem; }
.club-flag { width: 18px; height: 12px; object-fit: cover; border-radius: 1px; }

.player-popup {
  position: fixed;
  z-index: 1000;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  box-shadow: var(--shadow);
  pointer-events: none;
  max-width: 220px;
}

.player-popup img#playerPhoto {
  width: 180px;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.player-popup p {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  text-align: center;
  font-weight: 500;
}

.player-popup-meta {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
}

.player-popup-club {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  line-height: 1.3;
}

.player-popup-club .club-flag {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 1px;
  flex-shrink: 0;
}

/* Statistics tab */
.stats-page { display: flex; flex-direction: column; gap: 1.5rem; }

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1.1;
}

.stat-label { font-size: 0.85rem; font-weight: 600; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); }

.stats-wiki-note {
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.stats-grid-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-block-full { width: 100%; }

.stats-block-records .stats-highlights-records {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-block-records .stats-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  overflow-x: visible;
}

.stats-block-records .stats-match-team {
  min-width: 0;
}

.stats-block-records .stats-match-team:first-of-type .stats-team-inline {
  justify-content: flex-end;
}

.stats-block-records .stats-match-team .stats-team-inline {
  flex-wrap: wrap;
}

.stats-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  min-width: 0;
}

.stats-block-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 600;
}

.stats-subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stats-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stats-table-wrap--scroll {
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.stats-table th,
.stats-table td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.stats-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stats-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.stats-table .rank-col { width: 2rem; color: var(--text-muted); white-space: nowrap; }
.stats-table .num-col { text-align: center; white-space: nowrap; }
.stats-table .min-col { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.stats-table .group-col { text-align: center; color: var(--text-muted); white-space: nowrap; width: 2.5rem; }

.stats-table .stats-team-col {
  white-space: nowrap;
  min-width: 8rem;
  max-width: 11rem;
}

.stats-team-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  vertical-align: middle;
}

.stats-team-inline .team-flag-link {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.stats-team-inline .team-flag {
  flex-shrink: 0;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
}

.stats-team-inline .team-name {
  white-space: nowrap;
  font-size: 0.85rem;
}

.stats-table-scorers .stats-team-col { min-width: 9rem; }
.stats-table-standings .stats-team-col { min-width: 7.5rem; max-width: 10rem; }
.stats-table-standings { font-size: 0.8rem; }

.stats-match-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  overflow-x: auto;
}

.stats-match-team {
  flex: 0 0 auto;
  min-width: 0;
}

.stats-match-row .stats-team-inline .team-name { font-size: 0.8rem; }

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 1rem !important;
}

.stats-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stats-match-list,
.stats-bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats-score {
  font-weight: 700;
  color: var(--accent-gold);
  padding: 0 0.25rem;
}

.stats-match-card {
  list-style: none;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0;
}

.stats-match-card:last-child {
  border-bottom: none;
}

.stats-match-card--compact {
  padding: 0.5rem 0;
}

.stats-match-card .stats-match-row {
  border-bottom: none;
  padding: 0 0 0.35rem;
}

.stats-match-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.stats-match-timeline {
  margin-top: 0.15rem;
}

.stats-match-timeline .goals-timeline {
  margin-top: 0;
  font-size: 0.72rem;
}

.stats-match-list--events {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stats-hint {
  margin: -0.35rem 0 0.75rem;
}

.stats-event-col {
  white-space: normal;
  min-width: 8rem;
}

.stats-event-chip {
  display: inline-flex;
  margin: 0.12rem 0.2rem 0.12rem 0;
  padding: 0.1rem 0.3rem;
  font-size: 0.72rem;
}

.stats-event-chip .goal-minute {
  font-weight: 600;
}

.stats-bar-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.stats-bar-list strong { color: var(--accent); }

/* Roster (all players / coaches) tab */
#panel-roster.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 10rem);
}

.roster-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
}

.roster-subtabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.roster-subtab {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.roster-subtab:hover { color: var(--text); }

.roster-subtab.active {
  color: var(--accent-gold);
  border-color: rgba(245, 197, 24, 0.45);
  background: rgba(245, 197, 24, 0.08);
}

.roster-hint { margin: 0; }

.roster-table-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.roster-table-wrap {
  flex: 1;
  min-height: 0;
  max-height: calc(100dvh - 16rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.roster-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--border);
}

.roster-table .roster-team-col {
  min-width: 8.5rem;
  white-space: nowrap;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-th:hover { color: var(--text); }

.sortable-th.is-active { color: var(--accent-gold); }

.sort-ind {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.72em;
  opacity: 0.85;
}

.sort-ind-idle { opacity: 0.35; font-size: 0.65em; }

.roster-table .num-col { text-align: center; white-space: nowrap; }

.roster-table .club-country-col {
  white-space: nowrap;
  min-width: 6.5rem;
}

.roster-table .club-country-col .club-country-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.roster-table .club-country-col .nat-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.roster-table .club-country-col .club-country-code {
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Venues tab */
.venues-page-root { display: flex; flex-direction: column; gap: 0.85rem; }

.venues-map-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem;
}

.venues-map {
  height: min(42vh, 360px);
  min-height: 220px;
  width: 100%;
  border-radius: 8px;
  z-index: 1;
}

.venues-map .leaflet-control-zoom a {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.venues-map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.88);
  color: #333;
  font-size: 0.68rem;
}

.venues-map .leaflet-control-attribution a {
  color: #0078a8;
}

.venues-hint { margin: 0; }

.venues-page { display: flex; flex-direction: column; gap: 2rem; }

.venue-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
}

.venue-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.venue-flag-lg {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.venue-section-titles {
  flex: 1;
  min-width: 0;
}

.venue-section-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.venue-section-name a {
  color: var(--text);
  text-decoration: none;
}

.venue-section-name a:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.venue-section-meta {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.venue-match-count {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  white-space: nowrap;
}

.venue-section .match-list { gap: 0.65rem; }

/* Referees tab */
.referees-page-root { display: flex; flex-direction: column; gap: 0.85rem; }

.referees-hint { margin: 0; }

.referee-section-heading { margin-top: 0.25rem; margin-bottom: 0.75rem; }

.referees-by-official {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
}

.referee-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
}

.referee-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.referee-section-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.referee-section-titles {
  flex: 1;
  min-width: 0;
}

.referee-section-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.referee-section-meta {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.referee-match-count {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  white-space: nowrap;
}

.referee-section .match-list { gap: 0.65rem; }

.referee-summary-table .num-col { text-align: center; width: 6rem; }

.referee-summary-name { font-weight: 600; }

.referee-summary-country .country-flag-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.stats-rank-badge {
  display: none;
}

@media (max-width: 640px) {
  .container { padding: 1rem 0.75rem; }

  .stats-page { gap: 1rem; }

  .stats-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .stat-card {
    padding: 0.75rem 0.85rem;
  }

  .stat-value { font-size: 1.45rem; }

  .stats-block {
    padding: 0.85rem 0.75rem;
    border-radius: 10px;
  }

  .stats-block-title {
    font-size: 0.95rem;
    margin-bottom: 0.65rem;
  }

  .stats-wiki-note {
    font-size: 0.8rem;
    padding: 0.65rem 0.75rem;
  }

  .stats-highlights { grid-template-columns: 1fr; gap: 0.85rem; }

  .stats-block-records .stats-highlights-records { grid-template-columns: 1fr; }

  .stats-grid,
  .stats-grid-pair { grid-template-columns: 1fr; gap: 1rem; }

  /* Card-style tables (scorers, team ranks, suspensions) */
  .stats-table--stack thead { display: none; }

  .stats-table--stack tbody tr {
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.55rem;
    padding: 0.55rem 0.7rem;
  }

  .stats-table--stack tbody tr:last-child { margin-bottom: 0; }

  .stats-table--stack tbody tr:hover { background: var(--bg-elevated); }

  .stats-table--stack td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3rem 0;
    border-bottom: none;
    text-align: right;
    white-space: normal;
    min-width: 0;
    max-width: none;
  }

  .stats-table--stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    text-align: left;
  }

  .stats-table--stack td.empty-cell {
    display: block;
    text-align: center;
  }

  .stats-table--stack td.empty-cell::before { display: none; }

  .stats-table--stack .rank-col { display: none; }

  .stats-table-standings.stats-table--stack .rank-col { display: block; }

  .stats-table--stack .stats-team-col {
    justify-content: flex-end;
  }

  .stats-table--stack .stats-team-inline {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .stats-table--stack .stats-team-inline .team-name {
    white-space: normal;
    text-align: right;
  }

  /* Scorers / suspensions: player name as card header */
  .stats-table--stack td.player-col {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 0 0.45rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .stats-table--stack td.player-col::before { display: none; }

  .stats-table-scorers .stats-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    margin-right: 0.45rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: rgba(245, 197, 24, 0.15);
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 700;
    vertical-align: middle;
  }

  .stats-table-scorers td.min-col {
    align-items: flex-start;
    text-align: right;
  }

  .stats-table-scorers td.min-col::before { padding-top: 0.1rem; }

  /* Team rank tables: team as card header */
  .stats-table--stack:not(.stats-table-scorers):not(.stats-table-standings) td.stats-team-col {
    display: block;
    padding: 0 0 0.45rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .stats-table--stack:not(.stats-table-scorers):not(.stats-table-standings) td.stats-team-col::before { display: none; }

  .stats-table--stack:not(.stats-table-scorers):not(.stats-table-standings) .stats-team-inline {
    justify-content: flex-start;
  }

  .stats-table--stack:not(.stats-table-scorers):not(.stats-table-standings) .stats-team-inline .team-name {
    text-align: left;
  }

  /* Standings: compact grid card */
  .stats-table-standings.stats-table--stack tbody tr {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.2rem 0.35rem;
    align-items: center;
  }

  .stats-table-standings.stats-table--stack .group-col {
    grid-column: 1;
    grid-row: 1;
    display: block;
    font-size: 0.78rem;
    color: var(--accent-gold);
    font-weight: 700;
    padding: 0;
  }

  .stats-table-standings.stats-table--stack .group-col::before {
    content: '组 ';
    color: var(--text-muted);
    font-weight: 600;
  }

  .stats-table-standings.stats-table--stack .rank-col {
    grid-column: 2;
    grid-row: 1;
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0;
    text-align: left;
  }

  .stats-table-standings.stats-table--stack .rank-col::before {
    content: '#';
    margin-right: 0.1rem;
  }

  .stats-table-standings.stats-table--stack .stats-team-col {
    grid-column: 1 / -1;
    grid-row: 2;
    display: block;
    padding: 0 0 0.45rem;
    margin-bottom: 0.15rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .stats-table-standings.stats-table--stack .stats-team-col::before { display: none; }

  .stats-table-standings.stats-table--stack .stats-team-inline {
    justify-content: flex-start;
  }

  .stats-table-standings.stats-table--stack .num-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.15rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
  }

  .stats-table-standings.stats-table--stack .num-col::before {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 0.1rem;
  }

  .stats-table-standings.stats-table--stack .num-col:last-child {
    background: rgba(245, 197, 24, 0.1);
  }

  .stats-table-standings.stats-table--stack .num-col:last-child strong {
    color: var(--accent-gold);
  }

  .stats-table-standings.stats-table--stack td:nth-child(4) { grid-row: 3; grid-column: 1; }
  .stats-table-standings.stats-table--stack td:nth-child(5) { grid-row: 3; grid-column: 2; }
  .stats-table-standings.stats-table--stack td:nth-child(6) { grid-row: 3; grid-column: 3; }
  .stats-table-standings.stats-table--stack td:nth-child(7) { grid-row: 3; grid-column: 4; }
  .stats-table-standings.stats-table--stack td:nth-child(8) { grid-row: 4; grid-column: 1 / 3; }
  .stats-table-standings.stats-table--stack td:nth-child(9) { grid-row: 4; grid-column: 3 / 5; }

  /* Match highlight rows: vertical stack */
  .stats-match-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.65rem 0;
    overflow-x: visible;
  }

  .stats-match-row .stats-score {
    order: -1;
    align-self: center;
    font-size: 1.05rem;
    padding: 0.15rem 0;
  }

  .stats-match-row .stats-match-team {
    display: flex;
    justify-content: center;
  }

  .stats-match-row .stats-team-inline {
    justify-content: center;
  }

  .stats-match-row .stage-badge {
    align-self: center;
    margin-top: 0.15rem;
  }

  .match-body { grid-template-columns: 1fr; text-align: center; }
  .team-side, .team-side.away { flex-direction: column; text-align: center; }
  .brand h1 { font-size: 1.1rem; }

  .roster-table-wrap { max-height: calc(100dvh - 18rem); }

  .roster-table thead th:first-child,
  .roster-table .roster-team-col {
    position: sticky;
    left: 0;
    z-index: 4;
    background: var(--bg-elevated);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.2);
  }

  .roster-table tbody .roster-team-col {
    background: var(--bg-card);
    z-index: 1;
  }

  .roster-table tbody tr:hover .roster-team-col {
    background: rgba(255, 255, 255, 0.03);
  }

  .venue-section { padding: 0.85rem 0.75rem 1rem; }

  .venue-section-head {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .venue-match-count { margin-left: auto; }

  .venues-map {
    height: min(38vh, 300px);
    min-height: 200px;
  }

  .referee-section { padding: 0.85rem 0.75rem 1rem; }

  .referee-section-head {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .referee-match-count { margin-left: auto; }
}

/* Match compare (VS lineup view) */
.match-compare-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px dashed var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.match-compare-link:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: rgba(255, 200, 87, 0.08);
}

.match-compare-icon {
  font-size: 0.85em;
  opacity: 0.9;
}

.match-compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

.match-compare-chip:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.match-compare-container {
  max-width: 1400px;
}

.match-compare-hero {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1rem 0 0.5rem;
}

/* VS page uses association crests, not 3:2 flags — show full logo without cropping */
.match-compare-page .team-flag-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.match-compare-page .team-flag,
.match-compare-page .team-flag-link .team-flag {
  width: auto;
  height: auto;
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
}

.match-compare-page .team-flag.placeholder {
  width: 36px;
  height: 36px;
  border-radius: 4px;
}

.match-compare-page .match-headline-team .team-flag,
.match-compare-page .match-headline-team .team-flag-link .team-flag {
  max-width: 48px;
  max-height: 48px;
}

.match-compare-page .match-headline-team .team-flag.placeholder {
  width: 48px;
  height: 48px;
}

.match-compare-page .schedule-compact-body .team-flag {
  max-width: 32px;
  max-height: 32px;
}

.match-compare-page .schedule-compact-body .team-flag.placeholder {
  width: 32px;
  height: 32px;
}

.match-compare-page .lineup-pitch-head .team-flag,
.match-compare-page .lineup-pitch-head .team-flag-link .team-flag {
  max-width: 40px;
  max-height: 40px;
}

.match-compare-page .lineup-pitch-head .team-flag.placeholder {
  width: 40px;
  height: 40px;
}

.match-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.35rem;
}

.match-headline-team {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.match-headline-vs {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.match-meta-line {
  margin: 0;
}

.match-details-line {
  margin: 0.35rem 0 0;
  text-align: center;
  line-height: 1.5;
}

.match-details-line.hidden {
  display: none;
}

.match-detail-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.match-detail-sep {
  opacity: 0.55;
}

.match-detail-weather-sub {
  font-size: 0.85em;
  opacity: 0.85;
}

.match-details-line .venue-flag {
  width: 18px;
  height: auto;
  vertical-align: middle;
}

.match-detail-ref-country .nat-flag {
  width: 16px;
  height: auto;
}

.club-country-col {
  white-space: nowrap;
}

.club-country-flag {
  width: 18px;
  height: auto;
  vertical-align: middle;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.compare-column {
  min-width: 0;
}

.compare-team-hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.compare-team-hero .team-flag-wrap {
  width: auto;
  min-width: 72px;
  height: auto;
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  overflow: visible;
}

.compare-team-hero .team-flag-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.compare-team-hero .team-flag-wrap .team-flag,
.compare-team-hero .team-flag-link .team-flag {
  width: auto;
  height: auto;
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
  object-position: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.match-compare-page .compare-team-hero .team-flag.placeholder {
  width: 64px;
  height: 64px;
}

.compare-team-name {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.compare-section-title {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.compare-squad-section {
  margin-bottom: 0.5rem;
}

.pos-legend-compact {
  margin-bottom: 0.5rem;
}

.compare-table-wrap {
  overflow: visible;
  max-height: none;
}

.squad-table-compact {
  font-size: 0.82rem;
}

.squad-table-compact th,
.squad-table-compact td {
  padding: 0.35rem 0.4rem;
}

.schedule-compact-list .schedule-compact {
  display: block;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.schedule-compact-link {
  color: inherit;
  text-decoration: none !important;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.schedule-compact-link:hover,
.schedule-compact-link:focus,
.schedule-compact-link:focus-visible {
  text-decoration: none !important;
}

.schedule-compact-link * {
  text-decoration: none !important;
}

.schedule-compact-link:hover *,
.schedule-compact-link:focus * {
  text-decoration: none !important;
}

.schedule-compact-link:hover,
.schedule-compact-link:focus-visible {
  border-color: var(--accent-gold);
  background: rgba(212, 175, 55, 0.06);
}

.schedule-compact-link:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.schedule-compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.schedule-compact-body {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.schedule-compact-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.schedule-compact-venue {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.schedule-compact-venue .venue-flag {
  width: 16px;
  height: auto;
}

.schedule-compact-temp {
  white-space: nowrap;
}

.schedule-compact-score {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent-gold);
  font-size: 0.9rem;
}

@media (max-width: 960px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .match-headline {
    flex-direction: column;
  }
}

/* Match compare — starting XI pitch */
.compare-lineups-wrap {
  margin-bottom: 1.5rem;
}

.compare-lineups-section {
  margin-bottom: 0.5rem;
}

.lineup-section-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.lineup-section-toolbar .compare-section-title {
  margin: 0;
}

.lineup-refresh-btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
}

.lineup-refresh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lineup-section-meta {
  text-align: center;
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
}

.compare-section-title--center {
  text-align: center;
}

.lineup-section-hint,
.lineup-section-empty {
  text-align: center;
  margin: 0 0 1rem;
}

.compare-lineups-grid {
  align-items: stretch;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 720px) {
  .compare-lineups-grid {
    grid-template-columns: 1fr;
  }
}

.lineup-pitch {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

.lineup-pitch-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  padding: 0 0.15rem;
}

.lineup-pitch-head strong {
  display: block;
  line-height: 1.25;
}

.lineup-formation {
  display: inline-block;
  margin-top: 0.2rem;
  margin-left: 0;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  vertical-align: middle;
}

.lineup-field {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0.45rem 0.15rem 0.55rem;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.022) 0,
      rgba(255, 255, 255, 0.022) 12.5%,
      transparent 12.5%,
      transparent 25%
    ),
    linear-gradient(180deg, #1e7a42 0%, #186636 45%, #14552d 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.lineup-players {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: repeat(var(--lineup-lanes, 4), minmax(4.25rem, 1fr));
  gap: 0.55rem;
  padding: 0.35rem 0.05rem 0.45rem;
  min-height: calc(var(--lineup-lanes, 4) * 4.25rem + (var(--lineup-lanes, 4) - 1) * 0.55rem + 0.8rem);
}

.lineup-lane {
  position: relative;
  min-height: 4.25rem;
}

.lineup-pitch-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.lineup-mark-center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.lineup-mark-box {
  position: absolute;
  left: 50%;
  width: 40%;
  height: 14%;
  transform: translateX(-50%);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
}

.lineup-mark-box--top {
  top: 0;
  border-top: none;
  border-radius: 0 0 4px 4px;
}

.lineup-mark-box--bottom {
  bottom: 0;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

.lineup-half-line {
  position: absolute;
  top: 50%;
  left: 6%;
  right: 6%;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
  z-index: 0;
}

.lineup-row {
  display: none;
}

.lineup-player {
  position: absolute;
  top: 0;
  left: var(--lineup-x, 50%);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  width: 4.6rem;
  max-width: none;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.2;
  cursor: default;
  z-index: 1;
}

.lineup-player--hover {
  cursor: pointer;
  transition: transform 0.15s ease, z-index 0s;
}

.lineup-player--hover:hover {
  z-index: 5;
  transform: translateX(-50%) translateY(-2px) scale(1.04);
}

.lineup-player-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 50%;
  background: rgba(8, 14, 24, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.lineup-player.pos-gk .lineup-player-mark {
  border-color: rgba(245, 197, 24, 0.75);
  background: rgba(20, 18, 8, 0.9);
}

.lineup-player.pos-def .lineup-player-mark {
  border-color: rgba(96, 165, 250, 0.55);
}

.lineup-player.pos-mid .lineup-player-mark {
  border-color: rgba(74, 222, 128, 0.5);
}

.lineup-player.pos-fwd .lineup-player-mark {
  border-color: rgba(251, 146, 60, 0.6);
}

.lineup-num {
  font-weight: 800;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
}

.lineup-name {
  width: 100%;
  font-weight: 700;
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: normal;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.lineup-name.wiki-link {
  font-size: inherit;
  text-decoration: none;
}

.lineup-name.wiki-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lineup-player--hover .lineup-name {
  pointer-events: none;
}

.lineup-cap {
  position: absolute;
  top: -0.15rem;
  right: -0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.95rem;
  height: 0.95rem;
  padding: 0 0.2rem;
  font-size: 0.55rem;
  font-weight: 800;
  color: #1a1200;
  background: var(--accent-gold);
  border-radius: 999px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.lineup-pos {
  display: none;
}

.lineup-manager {
  margin: 0;
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-muted);
}

.lineup-pitch--empty {
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 12px;
  min-height: 160px;
}

.lineup-empty {
  text-align: center;
  margin: 0.75rem 0 0;
}

.lineup-empty-sub {
  font-size: 0.78rem;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .lineup-players {
    grid-template-rows: repeat(var(--lineup-lanes, 4), minmax(3.85rem, 1fr));
    gap: 0.45rem;
    min-height: calc(var(--lineup-lanes, 4) * 3.85rem + (var(--lineup-lanes, 4) - 1) * 0.45rem + 0.7rem);
  }

  .lineup-lane {
    min-height: 3.85rem;
  }

  .lineup-player {
    width: 4.1rem;
  }

  .lineup-player-mark {
    width: 2.5rem;
    height: 2.5rem;
  }

  .lineup-num {
    font-size: 0.85rem;
  }

  .lineup-name {
    font-size: 0.62rem;
  }
}

@media (min-width: 960px) and (max-width: 1100px) {
  .compare-lineups-grid .lineup-players {
    gap: 0.4rem;
  }

  .compare-lineups-grid .lineup-player {
    width: 4.2rem;
  }

  .compare-lineups-grid .lineup-player-mark {
    width: 2.65rem;
    height: 2.65rem;
  }

  .compare-lineups-grid .lineup-name {
    font-size: 0.64rem;
  }
}
