/* ==========================================================================
   Worlds entre potes — direction artistique « Nuit de finale », version allégée
   Voir docs/design/DA.md. Aucune ressource externe (CSP stricte) :
   polices et icônes sont servies depuis site/assets/.
   ========================================================================== */

/* ------------------------------------------------------------------ Polices */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("../assets/fonts/big-shoulders-display-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Police de repli ajustée sur les métriques d'Inter : limite le saut de mise
   en page pendant le chargement (font-display: swap). */
@font-face {
  font-family: "Inter repli";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  ascent-override: 90.4%;
  descent-override: 22.5%;
  line-gap-override: 0%;
  size-adjust: 107.1%;
}

/* ------------------------------------------------------------------- Tokens */

:root {
  /* Nuit */
  --nuit-0: #05060b;
  --nuit-1: #0a0d17;
  --nuit-2: #0f1321;
  --nuit-3: #161b2d;
  --trait: #1d2438;
  --trait-fort: #36415f;
  --voile: rgba(255, 255, 255, 0.035);

  /* Texte */
  --texte: #eef0f6;
  --doux: #a6aec3;
  --discret: #8a92a8;

  /* Signatures */
  --or: #f2b84b;
  --or-clair: #ffe2a0;
  --or-voile: rgba(242, 184, 75, 0.1);
  --cyan: #43e0ee;
  --cyan-voile: rgba(67, 224, 238, 0.07);

  /* Résultats */
  --victoire: #3ddc97;
  --defaite: #ff6f82;

  /* Rôles */
  --r-top: #f0ad7c;
  --r-jungle: #86d9a6;
  --r-mid: #8cc2f0;
  --r-adc: #f08fa0;
  --r-support: #c4b3e6;

  /* Typographie */
  --f-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", sans-serif;
  --f-texte: "Inter", "Inter repli", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Formes */
  --r-1: 3px;
  --r-2: 5px;
  --r-3: 8px;

  /* Espacement : sections séparées par l'espace ou un filet. */
  --section: clamp(2.25rem, 5vw, 3.5rem);

  /* Mise en page */
  --largeur: 1180px;
  --gouttiere: clamp(16px, 4vw, 40px);
  --barre-h: 60px;

  /* Mouvement (réservé au jeu) */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-court: 0.15s;

  color-scheme: dark;
}

/* ------------------------------------------------------------------- Socle */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--trait-fort) var(--nuit-0);
  scroll-padding-top: calc(var(--barre-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--nuit-0);
  color: var(--texte);
  font-family: var(--f-texte);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--or);
  color: #1a1003;
}

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 800;
  line-height: 1.05;
  margin: 0 0 0.5rem;
  color: var(--texte);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

/* Échelle resserrée : h1 40-48 px, h2 22 px, h3 18 px. */
h1 { font-size: clamp(2.25rem, 5vw, 3rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 0.85rem; }

a {
  color: var(--or);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { color: var(--or-clair); }

strong { color: var(--texte); font-weight: 650; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.num { text-align: right; font-variant-numeric: tabular-nums; }

.evitement {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--r-2);
  background: var(--or);
  color: #1a1003;
  font-weight: 700;
  text-decoration: none;
}

.evitement:focus { top: 10px; color: #1a1003; }

.contenu:focus { outline: none; }

/* --------------------------------------------------------------- Structure */

.barre {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5, 6, 11, 0.94);
  border-bottom: 1px solid var(--trait);
}

.barre-contenu {
  max-width: var(--largeur);
  min-height: var(--barre-h);
  margin: 0 auto;
  padding: 0 var(--gouttiere);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marque {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--texte);
  text-decoration: none;
  white-space: nowrap;
}

.marque:hover { color: var(--texte); }

.marque-logo {
  width: 30px;
  height: 30px;
  flex: none;
  background: url("../favicon.svg") center / contain no-repeat;
}

.marque-nom {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.marque-sous {
  margin-left: 0.2em;
  font-family: var(--f-texte);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--or);
}

.nav { display: flex; gap: 0.25rem; }

.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.8rem;
  color: var(--doux);
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav a:hover,
.nav a[aria-current="page"] { color: var(--texte); }

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 6px;
  height: 2px;
  background: var(--or);
}

.bandeau {
  margin: 0;
  padding: 0.5rem 16px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--or-clair);
  border-bottom: 1px solid var(--trait);
}

.contenu {
  flex: 1;
  width: 100%;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gouttiere) 4.5rem;
  overflow-x: clip;
}

.chargement {
  margin: 0;
  padding: 6rem 0;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--doux);
}

/* Indicateur de chargement : utile, donc gardé (coupé en mouvement réduit). */
.chargement::after {
  content: "";
  display: block;
  width: 120px;
  height: 2px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, transparent, var(--or), transparent) no-repeat;
  background-size: 50% 100%;
  animation: balayage-charge 1.2s var(--ease) infinite;
}

.pied {
  color: var(--discret);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.75rem 16px 2rem;
  border-top: 1px solid var(--trait);
}

.pied p { margin: 0 auto 0.25rem; max-width: 70ch; }
.pied a { color: var(--doux); }
.pied a:hover { color: var(--texte); }

/* ---------------------------------------------------------- Éléments communs */

/* Mobile d'abord : l'en-tête de page prend moins de haut, pour que le premier
   élément de jeu (choix, match) soit visible sans faire défiler. */
.entete-page { margin-bottom: 1.25rem; }

@media (min-width: 760px) {
  .entete-page { margin-bottom: var(--section); }
}

.sur-titre {
  margin: 0 0 0.5rem;
  color: var(--or);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Mobile d'abord : consigne compacte, pour que le jeu commence plus haut. */
.chapeau {
  color: var(--doux);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 60ch;
}

@media (min-width: 760px) {
  .chapeau { font-size: 1.05rem; line-height: 1.65; }
}

/* Section aérée : plus de cadre, un filet fin et de l'espace. */
.panneau {
  min-width: 0;
  margin-bottom: var(--section);
  padding-top: 1.5rem;
  border-top: 1px solid var(--trait);
}

.panneau-titre {
  margin-bottom: 1.25rem;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}

.sous-titre {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.aide { color: var(--doux); font-size: 0.9rem; }

.vide {
  color: var(--doux);
  padding: 1.5rem 0;
  text-align: center;
}

.info,
.erreur {
  padding: 0.5rem 0 0.5rem 0.9rem;
  font-size: 0.92rem;
  border-left: 2px solid;
}

.info { border-color: var(--cyan); color: #b9f5fb; }
.erreur { border-color: var(--defaite); color: #ffc2cb; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

/* Boutons ------------------------------------------------------------------ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  overflow: hidden;
  border-radius: var(--r-2);
  border: 1px solid var(--trait-fort);
  background: transparent;
  color: var(--texte);
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t-court), border-color var(--t-court), color var(--t-court);
}

.btn:hover:not(:disabled) {
  color: var(--texte);
  border-color: #56627f;
  background: var(--voile);
}

.btn:disabled { cursor: not-allowed; opacity: 0.45; }

.btn-primaire {
  border-color: var(--or);
  background: var(--or);
  color: #1a1003;
}

.btn-primaire:hover:not(:disabled) {
  color: #1a1003;
  border-color: var(--or-clair);
  background: #f7c766;
}

.btn-discret {
  border-color: transparent;
  color: var(--doux);
  font-family: var(--f-texte);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
  text-decoration-color: var(--trait-fort);
  text-underline-offset: 4px;
}

.btn-discret:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  text-decoration-color: var(--or);
}

.btn-large {
  min-height: 48px;
  padding: 0.65rem 1.4rem;
  font-size: 1.2rem;
}

.btn-discret.btn-large { font-size: 1rem; }

/* Déroulé automatique en cours : filet cyan qui défile sous le bouton. */
.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 1;
  border-color: rgba(67, 224, 238, 0.45);
  color: var(--cyan);
}

.btn[aria-busy="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent) no-repeat;
  background-size: 40% 100%;
  animation: balayage-charge 1.1s linear infinite;
}

/* Formulaires -------------------------------------------------------------- */

.label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--doux);
}

.champ {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.8rem;
  border-radius: var(--r-2);
  border: 1px solid #5a6684 /* 3,4:1 sur nuit-1 */;
  background: var(--nuit-1);
  color: var(--texte);
  font: inherit;
  transition: border-color var(--t-court);
}

.champ::placeholder { color: var(--discret); opacity: 1; }
.champ:hover { border-color: #7883a0; }

.champ:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 0;
  border-color: var(--cyan);
}

/* Rôles --------------------------------------------------------------------- */

.role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 3.2em;
  padding: 0.18em 0 0.16em;
  border-radius: var(--r-1);
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  font-family: var(--f-texte);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.role-top { color: var(--r-top); }
.role-jungle { color: var(--r-jungle); }
.role-mid { color: var(--r-mid); }
.role-adc { color: var(--r-adc); }
.role-support { color: var(--r-support); }

.tag {
  display: inline-block;
  margin-left: 0.45em;
  color: var(--discret);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Logos d'équipe et photos de joueurs ----------------------------------------
   Taille fixée par le contexte (--logo, --tete) : aucun saut de mise en page. */

.logo-equipe,
.logo-repli {
  width: var(--logo, 28px);
  height: var(--logo, 28px);
  flex: none;
  border-radius: var(--r-2);
}

/* Logo sans cadre ; un voile clair et un liseré flou d'1 px gardent lisibles
   les logos sombres sur le fond nuit. */
.logo-equipe {
  display: block;
  object-fit: contain;
  padding: calc(var(--logo, 28px) * 0.08);
  background: rgba(226, 230, 240, 0.1);
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.4));
}

/* Logo glissé dans une ligne de texte ou une cellule de tableau. */
.ep-adv .logo-equipe,
.champion-ligne .logo-equipe,
.tableau-classement .logo-equipe { display: inline-block; vertical-align: middle; margin-right: 0.15rem; }
.ep-adv .logo-repli,
.champion-ligne .logo-repli,
.tableau-classement .logo-repli { vertical-align: middle; margin-right: 0.15rem; }
.tableau-classement { --logo: 24px; }

.tete-joueur,
.tete-repli {
  width: var(--tete, 32px);
  height: var(--tete, 32px);
  flex: none;
  border-radius: 50%;
  background: var(--nuit-3);
}

.tete-joueur {
  display: block;
  object-fit: cover;
  object-position: 50% 18%;
}

/* Sans image : monogramme ou initiales dans une forme neutre. */
.logo-repli,
.tete-repli {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--trait-fort);
  background: var(--nuit-2);
  color: var(--doux);
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.logo-repli { font-size: max(0.55rem, calc(var(--logo, 28px) * 0.36)); }
.tete-repli { font-size: calc(var(--tete, 32px) * 0.4); }

/* Pastilles de games (une par game) */
.pastilles { display: inline-flex; flex-wrap: wrap; gap: 4px; }

.pastille {
  width: 10px;
  height: 6px;
  border-radius: 1px;
}

.p-gagne { background: var(--victoire); }
.p-perdu { background: var(--defaite); opacity: 0.8; }

/* Tableaux ------------------------------------------------------------------ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--trait);
  text-align: left;
}

thead th {
  color: var(--discret);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom-color: var(--trait-fort);
}

tbody tr:hover { background: var(--voile); }

.introuvable { text-align: center; padding: 4rem 0; }

/* ================================================================= Accueil */

.hero { padding: clamp(1rem, 5vw, 3.5rem) 0 var(--section); }
.hero > * { max-width: 680px; }

.hero-titre {
  max-width: 16ch;
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 6.5vw, 3.75rem);
  font-weight: 800;
  line-height: 1;
}

.hero-accent { color: var(--or); }
.hero .chapeau { font-size: clamp(1.05rem, 2vw, 1.15rem); }
.hero .actions { margin-top: 1.75rem; }

/* Les trois étapes : colonnes séparées par un filet, sans cartes. */
.regles {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--section);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1.5rem 2.5rem;
}

.regle {
  padding-top: 1.25rem;
  border-top: 1px solid var(--trait);
}

.regle h2 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.regle p { margin: 0; color: var(--doux); font-size: 0.95rem; }

.regle-num {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--or);
}

.regle-num::before { content: "0"; }

/* =================================================================== Draft */

/* Mobile d'abord : on pique en premier. L'offre passe devant « Mon équipe »,
   qui n'est qu'un récapitulatif (les postes libres sont déjà les titres des
   cartes de l'offre). Sur grand écran, la colonne de gauche reprend sa place. */
.grille-draft {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.grille-draft > .offre { order: 1; }
.grille-draft > .mon-equipe { order: 2; }

@media (min-width: 960px) {
  .grille-draft { grid-template-columns: 300px minmax(0, 1fr); gap: 2.5rem; }
  .grille-draft > .offre,
  .grille-draft > .mon-equipe { order: 0; }
  .mon-equipe { position: sticky; top: calc(var(--barre-h) + 16px); }
}

/* « Mon équipe » : une carte de jeu, donc gardée, mais à plat. */
.mon-equipe {
  --tete: 40px;
  margin: 0;
  padding: 1.1rem 1.1rem 0.6rem;
  border: 1px solid rgba(67, 224, 238, 0.28);
  border-radius: var(--r-3);
  background: var(--nuit-1);
}

.mon-equipe .panneau-titre { margin-bottom: 0.75rem; font-size: 1.1rem; color: var(--cyan); }
.mon-equipe-nom { margin-bottom: 0.5rem; }

.postes { list-style: none; margin: 0; padding: 0; }

.poste {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 56px;
  padding: 0.5rem 0;
}

.poste + .poste { border-top: 1px solid var(--trait); }

.poste-nom {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.poste-equipe {
  display: block;
  color: var(--doux);
  font-size: 0.8rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poste-joueur { font-weight: 650; overflow-wrap: anywhere; }
.poste-libre .role { opacity: 0.55; }
.a-recruter { color: var(--discret); font-size: 0.92rem; }

/* Poste qui vient d'être pourvu : bref éclat (retour de jeu). */
.poste-nouveau { animation: poste-pose 0.5s var(--ease) both; }

/* Petit écran : les cinq postes en une rangée de tuiles. */
@media (max-width: 959px) {
  .mon-equipe { --tete: 32px; padding: 0.8rem 0.8rem 0.7rem; }
  .mon-equipe .panneau-titre { margin-bottom: 0.5rem; font-size: 1rem; }
  .postes {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.6rem;
  }
  .poste,
  .poste + .poste {
    flex-direction: column;
    justify-content: space-between;
    gap: 0.3rem;
    min-height: 0;
    padding: 0.45rem 0.2rem;
    text-align: center;
    border: 1px dashed var(--trait-fort);
    border-radius: var(--r-2);
  }
  .postes .poste-pris { border: 1px solid transparent; background: var(--nuit-3); }
  .poste-nom { width: 100%; align-items: center; font-size: 0.8rem; }
  .poste-joueur {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
  }
  .poste .poste-equipe { display: none; }
  .a-recruter { font-size: 0; }
  .a-recruter::after { content: "libre"; font-size: 0.75rem; }
  .poste .role { width: 100%; max-width: 3.2em; }
}

.barre-offre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.rerolls {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0;
  color: var(--doux);
}

.compteur {
  font-family: var(--f-display);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--or-clair);
}

.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}

/* Carte d'une équipe proposée : carte de jeu, à plat, sans ombre ni liseré. */
.carte-equipe {
  --logo: 48px;
  --tete: 36px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--trait);
  border-radius: var(--r-3);
  background: var(--nuit-1);
  transition: border-color var(--t-court);
}

.carte-equipe:not(.grisee):hover { border-color: var(--trait-fort); }

/* Nouvelle offre : simple fondu (signale le changement de tirage). */
.carte-equipe.entree { animation: fondu 0.3s var(--ease) both; }
.carte-equipe.choisie { border-color: var(--or); }
.carte-equipe.grisee { opacity: 0.5; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Rappel des trois équipes tirées, au-dessus des postes. */

.carte-tete {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--trait);
}

.carte-tete > div { flex: 1; min-width: 0; }

.carte-nom {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.annee { color: var(--or); }

.carte-meta {
  margin: 0.35rem 0 0;
  color: var(--doux);
  font-size: 0.8rem;
  line-height: 1.45;
}

.liste-choix { list-style: none; margin: 0; padding: 0; }

.choix {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0.35rem 0.5rem;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--texte);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--t-court), border-color var(--t-court);
}

.choix:hover:not(:disabled) { background: var(--nuit-3); }

.choix.actif,
.choix.actif:hover:not(:disabled) {
  background: var(--or-voile);
  border-color: rgba(242, 184, 75, 0.6);
}

.choix:disabled { cursor: not-allowed; }
.choix.indispo { color: var(--discret); }
.choix.indispo .role,
.choix.indispo .tete-joueur,
.choix.indispo .tete-repli { opacity: 0.45; }

.choix-nom {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.choix-raison {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--discret);
}

.carte-raison {
  margin: 0.75rem 0 0;
  color: var(--doux);
  font-size: 0.88rem;
}

.confirmation {
  margin-top: auto;
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.confirmation .btn { width: 100%; }

/* ================================================================= Tournoi */

.entete-tournoi h1 { overflow-wrap: anywhere; }

/* Match en cours : carte de jeu, sans repères d'angle ni halo. */
.etape {
  margin-bottom: var(--section);
  padding: clamp(1rem, 3vw, 1.75rem);
  border: 1px solid var(--trait);
  border-radius: var(--r-3);
  background: var(--nuit-1);
  scroll-margin-top: calc(var(--barre-h) + 16px);
}

.etape-titre {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.14em;
  color: var(--doux);
  text-align: center;
}

/* Point « en direct » : un simple rond cyan. */
.etape-titre::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--cyan);
}

.duel-infos {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  color: var(--doux);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.format {
  color: var(--or-clair);
  font-family: var(--f-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Score : notre camp à gauche (cyan), l'adversaire à droite. */
.duel-score {
  --logo: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.5rem, 3vw, 2rem);
  margin: 1.5rem 0;
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid var(--trait);
}

.camp {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.camp-nous { align-items: flex-start; }
.camp-eux { align-items: flex-end; text-align: right; }

.camp-nom {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(1.15rem, 3vw, 1.75rem);
  line-height: 1;
  text-transform: uppercase;
  color: var(--texte);
  overflow-wrap: anywhere;
}

.camp-nous .camp-nom { color: var(--cyan); }
.camp-region { color: var(--doux); font-size: 0.8rem; }

.score {
  display: flex;
  align-items: center;
  gap: 0.15em;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  line-height: 1;
  color: var(--doux);
  font-variant-numeric: tabular-nums;
}

.score > span:not(.score-sep) {
  display: inline-block;
  min-width: 0.6em;
  text-align: center;
}

.score > span:not(.mene):not(.score-sep):has(~ .mene),
.score > .mene ~ span:not(.score-sep) { color: var(--discret); }

.score .mene { color: var(--or-clair); }
.score-sep { color: var(--trait-fort); font-weight: 400; }

.duel-gagne .score .mene { color: var(--victoire); }
.duel-perdu .score .mene { color: var(--defaite); }

/* Le chiffre qui vient de changer « saute » (retour de jeu). */
.score .saute { animation: score-saut 0.45s var(--ease) both; }

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.game {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  min-height: 46px;
  padding: 0.5rem 0.9rem;
  border-left: 3px solid var(--trait-fort);
  background: var(--nuit-2);
}

.game-gagne { border-left-color: var(--victoire); }
.game-perdu { border-left-color: var(--defaite); }

/* Game qui vient d'être dévoilée : balayage court. */
.game.nouveau { animation: game-revele 0.4s var(--ease) both; }

.game-attente {
  justify-content: center;
  color: var(--discret);
  border-left-color: transparent;
  background: none;
  outline: 1px dashed var(--trait);
  outline-offset: -1px;
  font-size: 0.92rem;
}

.game-num {
  min-width: 4.2em;
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.game-res {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-gagne .game-res { color: var(--victoire); }
.game-perdu .game-res { color: var(--defaite); }

.game-duree { color: var(--doux); font-size: 0.88rem; font-variant-numeric: tabular-nums; }

.game-score {
  font-family: var(--f-display);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--texte);
  margin-left: auto;
}

.verdict {
  margin: 1.5rem 0 0;
  padding: 0.6rem 1rem 0.5rem;
  border-top: 1px solid;
  border-bottom: 1px solid;
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 3.5vw, 1.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
}

.verdict-gagne { color: var(--victoire); border-color: rgba(61, 220, 151, 0.35); }
.verdict-perdu { color: var(--defaite); border-color: rgba(255, 93, 115, 0.35); }
.verdict--qualifie { color: var(--cyan); border-color: rgba(67, 224, 238, 0.4); }
.verdict--elimine { color: var(--doux); border-color: var(--trait-fort); }

.verdict--champion {
  color: #1d1204;
  border-color: var(--or);
  background: var(--or);
}

.verdict.nouveau { animation: tampon 0.4s var(--ease) both; }

.etape > .actions { justify-content: center; margin-top: 1.5rem; }

.spectateur > p { color: var(--doux); text-align: center; }

/* Onglets ------------------------------------------------------------------- */

.onglets {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--trait);
}

.onglets::-webkit-scrollbar { display: none; }

.onglet {
  flex: none;
  min-height: 48px;
  padding: 0.5rem 1rem;
  border: 0;
  background: transparent;
  color: var(--doux);
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
}

.onglet:hover { color: var(--texte); }
.onglet.actif { color: var(--texte); box-shadow: inset 0 -2px 0 var(--or); }
.onglet:focus-visible { outline-offset: -3px; }

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

.puce {
  min-width: 44px;
  min-height: 40px;
  padding: 0.3rem 0.8rem;
  border-radius: var(--r-2);
  border: 1px solid var(--trait);
  background: transparent;
  color: var(--doux);
  font-family: var(--f-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.puce:hover { color: var(--texte); border-color: var(--trait-fort); }
.puce.actif { background: var(--or); border-color: var(--or); color: #1a1003; }

/* Listes de matchs : des cartes de match, à plat. -------------------------- */

.liste-matchs {
  --logo: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 0.6rem;
}

.spectateur .liste-matchs { margin-top: 1rem; }

.match {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "fmt a"
    "fmt b"
    "fmt dots";
  column-gap: 0.75rem;
  row-gap: 0.1rem;
  padding: 0.55rem 0.8rem 0.6rem 0.55rem;
  border: 1px solid var(--trait);
  border-radius: var(--r-2);
}

.match-nous { border-color: rgba(67, 224, 238, 0.45); }

.m-format {
  grid-area: fmt;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.45rem 0 0.2rem;
  border-right: 1px solid var(--trait);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--discret);
  font-family: var(--f-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.m-equipe {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 28px;
  color: var(--doux);
}

.m-equipe:nth-of-type(2) { grid-area: a; }
.m-equipe:nth-of-type(3) { grid-area: b; }
.match .pastilles { grid-area: dots; margin-top: 0.3rem; }

.m-nom {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.m-score {
  min-width: 1.3em;
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  color: var(--discret);
}

.m-gagnant { color: var(--texte); }
.m-gagnant .m-nom { font-weight: 650; }
.m-gagnant .m-score { color: var(--or-clair); }
.m-nous .m-nom { color: var(--cyan); }

/* Classement suisse --------------------------------------------------------- */

.tableau-classement td:first-child {
  width: 2.8rem;
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--discret);
}

.tableau-classement td:nth-child(2) { font-weight: 600; }
.tableau-classement td:nth-child(4) { font-weight: 650; }
.tableau-classement tr:has(.statut-q) td:first-child { color: var(--victoire); }
.tableau-classement tr:has(.statut-e) td:nth-child(2) { color: var(--doux); font-weight: 500; }
.tableau-classement tr.ligne-nous td { color: var(--cyan); font-weight: 650; background: var(--cyan-voile); }

.statut {
  color: var(--doux);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.statut-q { color: #8af2c4; }
.statut-e { color: #ffa9b5; }

/* Tableau final (arbre) ------------------------------------------------------ */

.arbre {
  --arbre-gap: 2.5rem;
  --arbre-vgap: 0.9rem;
  --logo: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

.arbre-titre {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: var(--doux);
}

.arbre-col:last-child .arbre-titre { color: var(--or); }

.b-match { position: relative; margin-bottom: 0.6rem; }

.b-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--trait);
  background: var(--nuit-0);
  color: var(--doux);
  font-size: 0.92rem;
}

.b-ligne:first-child { border-radius: var(--r-2) var(--r-2) 0 0; }
.b-ligne:last-child { border-radius: 0 0 var(--r-2) var(--r-2); }
.b-ligne + .b-ligne { border-top: 0; }

.b-nom {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b-score {
  min-width: 1em;
  font-family: var(--f-display);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.b-gagnant { color: var(--texte); font-weight: 650; }
.b-gagnant .b-score { color: var(--or-clair); }
.b-nous .b-nom { color: var(--cyan); }
.b-match-nous .b-ligne { border-color: rgba(67, 224, 238, 0.4); }
.arbre-col:last-child .b-ligne { min-height: 50px; font-size: 1rem; }

.b-champion {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0;
  border-top: 1px solid rgba(242, 184, 75, 0.45);
  font-family: var(--f-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--or-clair);
}

@media (min-width: 760px) {
  .arbre {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--arbre-gap);
    row-gap: 0;
  }
  .arbre-col { display: flex; flex-direction: column; }
  .arbre-matchs {
    position: relative;
    flex: 1;
    display: grid;
    grid-auto-rows: 1fr;
    row-gap: var(--arbre-vgap);
  }
  /* Chaque match remplit sa rangée : les rangées des colonnes suivantes
     tombent pile au milieu de la paire qui les alimente. */
  .arbre .b-match {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
  }
  /* Accolade vers le tour suivant (tracée depuis le premier match de chaque paire). */
  .arbre-col:not(:last-child) .b-match:nth-child(odd)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    width: calc(var(--arbre-gap) / 2);
    height: calc(100% + var(--arbre-vgap));
    border: 1px solid var(--trait-fort);
    border-left: 0;
    border-radius: 0 6px 6px 0;
    pointer-events: none;
  }
  /* Arrivée depuis le tour précédent. */
  .arbre-col:not(:first-child) .b-match::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    width: calc(var(--arbre-gap) / 2);
    border-top: 1px solid var(--trait-fort);
    pointer-events: none;
  }
  .arbre-col:last-child .arbre-matchs { grid-template-rows: 1fr; }
  .arbre-col:last-child .b-champion {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(50% + 4rem);
    margin: 0;
  }
}

/* ===================================================================== Fin */

.entete-fin {
  padding: clamp(1rem, 5vw, 3rem) 0 0;
  text-align: center;
}

.entete-fin .chapeau { margin-left: auto; margin-right: auto; }

.resultat {
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 6.5vw, 3.75rem);
  font-weight: 800;
  line-height: 1;
}

.fin-champion .resultat,
.fin-finalist .resultat { color: var(--or-clair); }
.fin-swiss .resultat { color: var(--doux); }

.champion-ligne { --logo: 32px; color: var(--doux); }

.grille-fin {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 3rem;
}

@media (min-width: 900px) {
  .grille-fin { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* Parcours : ligne de temps, sans cadres. */
.parcours {
  --logo: 32px;
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.4rem;
}

.parcours::before {
  content: "";
  position: absolute;
  top: 1.1rem;
  bottom: 1.1rem;
  left: 0.4rem;
  width: 1px;
  background: var(--trait-fort);
}

.etape-parcours {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.9rem;
  padding: 0.75rem 0;
}

.etape-parcours + .etape-parcours { border-top: 1px solid var(--trait); }

.etape-parcours::before {
  content: "";
  position: absolute;
  top: 1.05rem;
  left: calc(-1.4rem + 0.4rem - 4px + 0.5px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--trait-fort);
}

.ep-gagne::before { background: var(--victoire); }
.ep-perdu::before { background: var(--defaite); }

.ep-etape {
  color: var(--or);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ep-bo { color: var(--discret); }
.ep-adv { grid-column: 1; color: var(--doux); }
.ep-adv strong { color: var(--texte); }

.ep-score {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  font-family: var(--f-display);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}

.ep-gagne .ep-score { color: var(--victoire); }
.ep-perdu .ep-score { color: var(--defaite); }
.etape-parcours .pastilles { grid-column: 1; margin-top: 0.2rem; }

.cinq { --tete: 48px; list-style: none; margin: 0; padding: 0; }

.cinq-joueur {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 56px;
  padding: 0.55rem 0;
}

.cinq-joueur + .cinq-joueur { border-top: 1px solid var(--trait); }
.cinq-nom { flex: 1; min-width: 0; }
.cinq-nom strong { display: block; }

/* Petit logo en ligne dans le sous-titre d'un joueur. */
.poste-equipe { --logo: 18px; }
.poste-equipe .logo-equipe { display: inline-block; vertical-align: -0.3em; padding: 1px; }
.poste-equipe .logo-repli { display: none; } /* trop petit pour un monogramme lisible */

.actions-fin { justify-content: center; }

.graine {
  margin-top: 2rem;
  text-align: center;
  color: var(--discret);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* ============================================================== Animations
   Seulement ce qui sert le jeu : nouvelle offre, poste pourvu, game dévoilée,
   score qui change, verdict. Tout est coupé avec prefers-reduced-motion. */

@keyframes fondu {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes poste-pose {
  from { background-color: rgba(242, 184, 75, 0.18); }
}

@keyframes game-revele {
  from { opacity: 0.3; clip-path: inset(0 100% 0 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes score-saut {
  from { transform: scale(1.25); color: #ffffff; }
  to { transform: none; }
}

@keyframes tampon {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: none; }
}

@keyframes balayage-charge {
  from { background-position: -100% 0; }
  to { background-position: 200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ================================================================== Mobile */

@media (max-width: 560px) {
  :root { --barre-h: 56px; }
  .marque { gap: 0.5rem; }
  .marque-logo { width: 28px; height: 28px; }
  .marque-nom { font-size: 1.3rem; }
  .marque-sous { display: none; }
  .nav a { padding: 0 0.55rem; font-size: 1.05rem; letter-spacing: 0.04em; }
  .nav a[aria-current="page"]::after { left: 0.55rem; right: 0.55rem; }
  .actions .btn { flex: 1 1 auto; }
  .duel-score { --logo: 40px; gap: 0.5rem; }
  .onglet { padding: 0.5rem 0.55rem; font-size: 1rem; letter-spacing: 0.03em; }
  .tableau-classement th,
  .tableau-classement td { padding: 0.5rem 0.35rem; font-size: 0.86rem; }
  .tableau-classement td:first-child { width: 2rem; font-size: 1.05rem; }
}
