/* ============================================================
   Thème — Mes Clubs Favoris (mode sombre par défaut)
   ============================================================ */

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

:root {
  --bg: #1b1f30;
  --surface: #252a3d;
  --surface2: #303655;
  --accent: #4a9eff;
  --accent2: #6ec0ff;
  --text: #eaecf5;
  --text-muted: #9099bb;
  --success: #2ecc71;
  --danger: #e74c3c;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.28);
}

/* ─── Thème clair ─── */
[data-theme="light"] {
  --bg: #f5f3ef;
  --surface: #faf9f7;
  --surface2: #ebe7e0;
  --accent: #7a9abf;
  --accent2: #5c7fa8;
  --text: #3c3a35;
  --text-muted: #928e85;
  --success: #5a9e72;
  --danger: #b85555;
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
}

/* ─── Bouton toggle thème ─── */
.theme-toggle, .btn-clear-cache {
  background: var(--surface2);
  border: 1.5px solid var(--surface2);
  color: var(--text);
  border-radius: 8px;
  padding: .45rem .8rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
  white-space: nowrap;
}
.theme-toggle:hover, .btn-clear-cache:hover { border-color: var(--accent); color: var(--accent); }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── Header ─── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--surface2);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent2);
  white-space: nowrap;
}

.logo-link {
  text-decoration: none;
  transition: opacity .2s;
}
.logo-link:hover { opacity: .8; }

/* ─── Nav header ─── */
.header-nav {
  display: flex;
  gap: .2rem;
  margin-left: 1rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: .35rem .85rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--accent2); }

/* ─── Titre de page ─── */
.page-title {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color .2s;
  white-space: nowrap;
}
.back-link:hover { color: var(--text); }

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

.club-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface2);
  padding: 4px;
}

.club-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
}

/* ─── Boutons ─── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .55rem 1.1rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:active { transform: scale(.97); }

.btn-fav {
  margin-left: auto;
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent2);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.btn-fav:hover, .btn-fav.active {
  background: var(--accent);
  color: #fff;
}

/* ─── Main ─── */
.main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.top-bar h2 {
  font-size: 1.3rem;
  color: var(--text);
}

/* ─── Grille clubs ─── */
.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
}

.club-card {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative;
}
.club-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.club-card img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface2);
  padding: 6px;
}

.club-card span {
  font-weight: 600;
  font-size: .95rem;
  text-align: center;
  color: var(--text);
}

.club-card .card-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: color .2s;
}
.club-card .card-remove:hover { color: var(--danger); }

.empty-msg {
  color: var(--text-muted);
  grid-column: 1/-1;
  text-align: center;
  padding: 2rem 0;
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: .5rem;
  border-bottom: 2px solid var(--surface2);
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: .75rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .2s, border-color .2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* ─── Loader ─── */
.loader {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 0;
  font-size: 1rem;
}
.loader.hidden { display: none; }

/* ─── News / Comptes-rendus de matchs ─── */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Layout haut : thumbnail + équipes */
.nr-top {
  display: flex;
  flex-direction: column;
}

.nr-thumb img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

/* Bandeau équipes + score */
.nr-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
  padding: 1rem 1.2rem .75rem;
}

.nr-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  text-align: center;
}
.nr-team-away { text-align: center; }

.nr-badge {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.nr-team span {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.nr-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}

.nr-score {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent2);
  letter-spacing: .02em;
  line-height: 1;
}
.nr-dash { color: var(--text-muted); font-weight: 400; margin: 0 .1em; }
.nr-score-na { font-size: 1.1rem; font-weight: 700; color: var(--text-muted); }

.nr-league {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.nr-date {
  font-size: .72rem;
  color: var(--accent);
}

/* Ligne de détails */
.nr-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .9rem;
  padding: .55rem 1.2rem;
  border-top: 1px solid var(--surface2);
  background: var(--bg);
}

.nr-detail {
  font-size: .75rem;
  color: var(--text-muted);
}

.nr-video {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: none;
  background: rgba(61,142,255,.1);
  border: 1px solid rgba(61,142,255,.2);
  border-radius: 6px;
  padding: .25rem .7rem;
  transition: background .15s, color .15s;
}
.nr-video:hover {
  background: rgba(61,142,255,.2);
  color: var(--accent);
}

.nr-desc {
  padding: .6rem 1.2rem .9rem;
  font-size: .83rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--surface2);
}

/* ─── Google News articles ─── */
.gn-section {
  margin-bottom: 1.5rem;
}
.gn-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--surface2);
}
.gn-card {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: .75rem;
}
.gn-headline {
  font-size: .97rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: .35rem;
  color: var(--text);
}
.gn-card:hover .gn-headline {
  color: var(--accent);
}
.gn-card:hover {
  border-left-color: var(--accent2);
  background: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%);
}
.gn-meta {
  display: flex;
  gap: .75rem;
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .7rem;
}
.gn-source {
  font-weight: 600;
  color: var(--accent2);
}
.gn-body {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.6;
}
.gn-body p {
  margin-bottom: .6rem;
}
.gn-body p:last-child {
  margin-bottom: 0;
}

/* ─── Modal article actualité ─── */
.article-modal {
  max-width: 680px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 1.8rem 2rem;
}
.am-source-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}
.am-source {
  font-weight: 700;
  color: var(--accent2);
}
.am-title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: .75rem;
  color: var(--text);
}
.am-body {
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text);
}
.am-body p {
  margin-bottom: .85rem;
}
.am-body p:last-child {
  margin-bottom: 0;
}
.am-date {
  color: var(--text-muted);
}
.am-footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface2);
  text-align: center;
}
.am-read-more {
  display: inline-block;
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--accent);
  border-radius: 8px;
  padding: .6rem 1.4rem;
  transition: background .2s, transform .15s;
}
.am-read-more:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}
.gn-teaser {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: .4rem;
  margin-bottom: 0;
}

/* ─── Joueurs ─── */
.squad-block {
  margin-bottom: 2rem;
}
.squad-block-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1.4rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.squad-block-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1rem;
  background: var(--accent);
  border-radius: 2px;
}
.squad-section {
  margin-bottom: 2rem;
}
.squad-title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .9rem;
  padding: .25rem .7rem;
  background: var(--surface2);
  border-radius: 6px;
  display: inline-block;
}

/* Grille joueurs */
.players-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
}

/* Carte joueur */
.player-card {
  flex: 0 0 140px;
  width: 140px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: center;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.player-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  border-color: var(--accent);
}

/* Zone photo avec overlay numéro */
.player-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  background: linear-gradient(160deg, var(--surface2) 0%, var(--bg) 100%);
  overflow: hidden;
}
.player-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform .25s;
}
.player-card:hover .player-photo {
  transform: scale(1.04);
}
.player-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--surface2);
}
.player-jersey-badge {
  position: absolute;
  top: .4rem;
  left: .4rem;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1;
  padding: .2rem .4rem;
  border-radius: 4px;
  min-width: 1.5rem;
  text-align: center;
}

/* Infos sous la photo */
.player-info {
  padding: .55rem .5rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .18rem;
}
.player-name {
  font-weight: 700;
  font-size: .8rem;
  line-height: 1.25;
  color: var(--text);
}
.player-pos {
  font-size: .66rem;
  color: var(--accent2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.player-nationality {
  font-size: .65rem;
  color: var(--text-muted);
}

/* ─── Calendrier ─── */
.fixtures-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.fixture-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: .85rem 1rem .85rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0 1rem;
  transition: border-color .2s, box-shadow .2s;
  border-left: 3px solid transparent;
}

/* Badge compétition — pastille en haut à droite */
.fixture-card .fx-league {
  position: absolute;
  top: .55rem;
  right: .7rem;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 999px;
  padding: 2px 9px;
  pointer-events: none;
}
.fixture-card .fx-league.cup { color: #f59e0b; background: rgba(245,158,11,.12); }

/* Équipes */
.fx-team {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
  padding: .5rem 0;
}

/* Logo en grand fond transparent, fondu vers le centre */
.fx-team::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--team-logo);
  background-size: 78px;
  background-repeat: no-repeat;
  opacity: .22;
  pointer-events: none;
}
.fx-team.home::before {
  background-position: 8px center;
  -webkit-mask-image: linear-gradient(to right, black 30%, transparent 85%);
  mask-image: linear-gradient(to right, black 30%, transparent 85%);
}
.fx-team.away::before {
  background-position: calc(100% - 8px) center;
  -webkit-mask-image: linear-gradient(to left, black 30%, transparent 85%);
  mask-image: linear-gradient(to left, black 30%, transparent 85%);
}

.fx-team-inner {
  display: flex;
  align-items: center;
  gap: .45rem;
  z-index: 1;
  min-width: 0;
}
.fx-team.away .fx-team-inner { flex-direction: row-reverse; }

/* Petit logo net masqué — seul le fond watermark est affiché */
.fx-team img {
  display: none;
}
.fx-team span {
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Centre */
.fx-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 90px;
  text-align: center;
}

/* Score match joué */
.fx-score {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .35rem;
  letter-spacing: .01em;
}
.fx-dash { color: var(--text-muted); font-weight: 400; font-size: 1rem; }
.fx-vs { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.fx-date { font-size: .72rem; color: var(--text-muted); }

/* Date match à venir */
.fx-time {
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(61,142,255,.1);
  border: 1px solid rgba(61,142,255,.25);
  border-radius: 8px;
  padding: .3rem .65rem;
  white-space: nowrap;
}

/* États */
.fixture-card.past { opacity: .72; border-left-color: var(--surface2); }
.fixture-card.past.clickable { cursor: pointer; }
.fixture-card.past.clickable:hover { opacity: 1; background: var(--surface2); }
.fixture-card.upcoming { border-left-color: var(--accent); }
.fixture-card.cup.upcoming { border-left-color: #f59e0b; }
.fixture-card.cup.past { border-left-color: rgba(245,158,11,.4); }

/* ─── Grille des ligues (page accueil) ─── */
.leagues-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
}

.league-card {
  flex: 1 1 280px;
  max-width: calc(33.33% - 0.85rem);
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-left: 4px solid var(--lc, var(--accent));
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.league-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.league-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.1rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--surface2);
}

/* Logo officiel de la compétition */
.league-logo-wrap {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.league-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.league-flag { font-size: 1.4rem; line-height: 1; }

.league-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.league-card-body {
  padding: .4rem .75rem;
  flex: 1;
}

/* Lignes du top 5 dans la carte */
.lc-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--surface2);
}
.lc-row:last-child { border-bottom: none; }

.lc-rank {
  width: 18px;
  text-align: center;
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}

.lc-logo, .lc-logo-placeholder {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.lc-team {
  flex: 1;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lc-pts {
  font-size: .82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.league-card-btn {
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--surface2);
  color: var(--lc, var(--accent));
  font-size: .82rem;
  font-weight: 600;
  padding: .65rem 1.1rem;
  cursor: pointer;
  text-align: right;
  transition: background .15s, color .15s;
}
.league-card:hover .league-card-btn { background: color-mix(in srgb, var(--lc, var(--accent)) 10%, transparent); }

/* Modal classement complet */
.league-modal {
  max-width: 1200px;
  width: 98%;
  max-height: 94vh;
  overflow-y: auto;
  padding: 0;
}
.league-modal::-webkit-scrollbar { width: 4px; }
.league-modal::-webkit-scrollbar-track { background: transparent; }
.league-modal::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }
.league-modal { scrollbar-width: thin; scrollbar-color: var(--surface2) transparent; }

.modal-league-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1rem 3.5rem 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  /* border-bottom: 3px solid ... est appliqué inline depuis JS */
}

.modal-league-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
}

.league-modal .modal-close {
  position: absolute;
  top: .9rem;
  right: 1rem;
  background: var(--surface2);
  color: var(--text-muted);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.league-modal .modal-close:hover { background: var(--surface2); color: var(--text); }

.league-modal .standings-wrapper { padding: .75rem 1.25rem 1.5rem; }

/* ─── Classement ─── */
.standings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1px;
  padding: .75rem 1.25rem 1.5rem;
  background: var(--surface2);
}
.standings-two-col .standings-wrapper {
  background: var(--surface);
}

.standings-wrapper {
  overflow-x: auto;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  white-space: nowrap;
}

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

.standings-table th {
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.standings-table td:nth-child(2) { text-align: left; }
.standings-table th:nth-child(2) { text-align: left; }

.standings-table .highlight td { color: var(--accent2); font-weight: 700; }

.standings-table .team-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 5px;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 2rem;
  width: 90%;
  max-width: 520px;
  position: relative;
  box-shadow: var(--shadow);
}

/* Override taille pour le modal classement */
.modal.league-modal {
  width: 98%;
  max-width: 1200px;
  max-height: 94vh;
  padding: 0;
}

.modal h3 { margin-bottom: 1rem; font-size: 1.1rem; }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.search-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  padding: .55rem .9rem;
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
.search-bar input:focus { border-color: var(--accent); }

.search-results {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 300px;
  overflow-y: auto;
}

.result-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.result-item:hover { background: var(--surface2); }

.result-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface2);
  padding: 2px;
}

.result-item span {
  font-weight: 600;
  font-size: .9rem;
}

/* ─── Onglets calendrier ─── */
.fx-tabs-header {
  display: flex;
  gap: .5rem;
  margin-bottom: .75rem;
}

.fx-tab-btn {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface2);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.fx-tab-btn:hover {
  color: var(--text);
  background: var(--surface2);
}
.fx-tab-btn.active {
  background: rgba(61,142,255,.08);
  border-color: rgba(61,142,255,.2);
  color: var(--accent2);
}

.fx-tab-pane {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 75vh;
  overflow-y: auto;
  padding-right: 2px;
}
.fx-tab-pane.hidden { display: none; }

/* ─── Mise en page 2 colonnes (conservé pour compatibilité) ─── */
.fixtures-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.fx-col {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-width: 0;
}

/* En-têtes de colonnes */
.fx-col-header {
  margin-bottom: .2rem;
}
.fx-col-header .fx-tab-btn {
  width: 100%;
}

/* Colonne active : cartes passées en bleu */
.fx-col.active .fixture-card.past {
  border-left-color: var(--accent);
  opacity: 1;
}
/* Colonne inactive : cartes à venir atténuées */
.fx-col:not(.active) .fixture-card.upcoming {
  border-left-color: var(--surface2);
  opacity: .72;
}

.fx-toggle-count {
  margin-left: auto;
  background: var(--surface2);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Bouton accordéon (visible sur mobile) */
.fx-toggle {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius);
  padding: .6rem .9rem;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: color .15s;
  text-align: left;
}
.fx-toggle:hover { color: var(--text); }
.fx-toggle-icon { font-size: .65rem; }

/* Corps des colonnes */
.fx-col-body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 2px;
}

/* Scrollbar discrète */
.fx-col-body::-webkit-scrollbar { width: 4px; }
.fx-col-body::-webkit-scrollbar-track { background: transparent; }
.fx-col-body::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }

/* Accordéon — masquer le contenu (classe CSS, pas l'attr hidden) */
.fx-past-body.collapsed { display: none; }

.fx-empty {
  color: var(--text-muted);
  font-size: .85rem;
  padding: .5rem 0;
  text-align: center;
}

/* ─── Modal détail du match ─── */
.match-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
}
.match-modal-overlay.hidden { display: none; }

.match-modal {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.match-modal-close {
  position: sticky;
  top: 0;
  align-self: flex-end;
  margin: .75rem .75rem 0 0;
  z-index: 1;
  background: var(--surface2);
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.match-modal-close:hover { color: var(--text); background: var(--surface2); }

/* En-tête score */
.mm-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem 1.5rem .75rem;
  border-bottom: 1px solid var(--surface2);
  margin-top: -30px; /* compense le bouton close sticky */
}
.mm-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  text-align: center;
}
.mm-team img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.mm-team-name {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
}
.mm-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}
.mm-score {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent2);
  letter-spacing: .05em;
  line-height: 1;
}
.mm-score-sep {
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 .1em;
}
.mm-meta {
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
}
.mm-halftime {
  font-size: .7rem;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: .15rem;
}
.mm-video {
  display: inline-block;
  margin-top: .4rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: none;
  background: rgba(61,142,255,.1);
  border: 1px solid rgba(61,142,255,.2);
  border-radius: 6px;
  padding: .25rem .8rem;
  transition: background .15s;
}
.mm-video:hover { background: rgba(61,142,255,.22); }

/* Corps : timeline des événements */
.mm-body {
  padding: .75rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.mm-event {
  display: grid;
  grid-template-columns: 1fr 2.5rem 1fr;
  align-items: center;
  gap: .25rem;
  padding: .3rem 0;
  font-size: .83rem;
  border-bottom: 1px solid var(--surface2);
}
.mm-event:last-child { border-bottom: none; }

/* Côté domicile : aligné à droite */
.mm-event-home {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
/* Côté extérieur : aligné à gauche */
.mm-event-away {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.mm-event-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.mm-event-icon { font-size: 1rem; line-height: 1; }
.mm-event-minute {
  font-size: .65rem;
  color: var(--text-muted);
  font-weight: 600;
}
.mm-player { font-weight: 600; color: var(--text); }
.mm-player-sub { font-size: .72rem; color: var(--text-muted); }

.mm-empty {
  color: var(--text-muted);
  font-size: .85rem;
  text-align: center;
  padding: 1.5rem 0;
}
.mm-loader {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  font-size: .9rem;
}

/* ─── Utilitaires ─── */
.hidden { display: none !important; }

@media (max-width: 768px) {
  .fixtures-layout { grid-template-columns: 1fr; }
  .fx-col-body { max-height: none; overflow-y: visible; }
  /* Sur mobile : réactiver l'accordéon pour les matchs passés */
  .fx-past-body:not(.collapsed) { display: flex; }
}


@media (max-width: 600px) {
  .fixture-card { grid-template-columns: 1fr; gap: .5rem; }
  .fx-team.away { flex-direction: row; justify-content: center; }
  .fx-team { justify-content: center; }
  .fx-center { width: 100%; }
  .fixture-card .fx-league { position: static; margin-bottom: .2rem; align-self: center; }
}
