/* Page publique — pensée d'abord pour le téléphone. Mêmes couleurs que la console. */
:root { --bord: #d0d0cc; --accent: #185fa5; --fond: #faf9f6; --vert: #2e7d32; --rouge: #a32d2d;
        --gris: #6f6f6b; --texte: #2c2c2a; --clair-accent: #eef4fb; --orange: #a35a00; --clair-orange: #fbe9d0; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: system-ui, sans-serif; background: var(--fond); margin: 0; color: var(--texte); font-size: 1rem; }

/* ---------- En-tête ---------- */
header { background: #fff; border-bottom: 1px solid var(--bord); padding: .7rem 1rem 0;
         position: sticky; top: 0; z-index: 5; }
.ligne-titre { display: flex; align-items: center; gap: .6rem; }
h1 { font-size: 1.25rem; font-weight: 650; margin: 0; flex: 1; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 1.3rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.direct { color: var(--gris); font-size: .9rem; }
.direct.ok { color: var(--vert); }
select { font: inherit; padding: .45rem .6rem; min-height: 2.75rem; max-width: 100%; border: 1px solid var(--bord);
         border-radius: 8px; background: #fff; color: var(--texte); }
header select { margin-top: .5rem; width: 100%; }
.avancement { margin: .35rem 0 0; color: var(--gris); font-size: .9rem; font-variant-numeric: tabular-nums; }
.fin-estimee { color: var(--accent); white-space: nowrap; }
.onglets { display: flex; margin-top: .4rem; overflow-x: auto; scrollbar-width: none; }
.onglets a { flex: 1 0 auto; text-align: center; padding: .7rem .7rem; color: var(--gris); text-decoration: none;
             font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.onglets a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
/* Flèches ‹ › : il reste des onglets à voir de ce côté (public.js, flechesOnglets) */
.cadre-onglets { position: relative; }
.fleche-onglets { position: absolute; top: .4rem; bottom: 3px; z-index: 1; width: 2.2rem; min-height: 0; padding: 0;
                  border: 0; border-radius: 0; color: var(--accent); font-size: 1.6rem; font-weight: 700; line-height: 1;
                  cursor: pointer; }
.fleche-onglets.gauche { left: 0; justify-content: flex-start; padding-left: .1rem;
                         background: linear-gradient(to right, #fff 45%, rgba(255, 255, 255, 0)); }
.fleche-onglets.droite { right: 0; justify-content: flex-end; padding-right: .1rem;
                         background: linear-gradient(to left, #fff 45%, rgba(255, 255, 255, 0)); }
.fleche-onglets:hover, .fleche-onglets:focus { background-color: transparent; color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 0 1rem 5rem; }

/* ---------- Boutons ---------- */
button { font: inherit; display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem;
         padding: .5rem 1rem; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent);
         color: #fff; cursor: pointer; }
.secondaire { background: #fff; color: var(--accent); }
.petit { min-height: 2.3rem; padding: .25rem .75rem; font-size: .9rem; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #8bb8e8; outline-offset: 2px; }
.segments { display: inline-flex; border: 1px solid var(--accent); border-radius: 8px; overflow: hidden; }
.segment { border: 0; border-radius: 0; background: #fff; color: var(--accent); }
.segment + .segment { border-left: 1px solid var(--accent); }
.segment.actif { background: var(--accent); color: #fff; }
.barre { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.barre select { flex: 1 1 14rem; }

/* ---------- Messages ---------- */
#etat { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 20; margin: 0;
        max-width: min(36rem, calc(100vw - 2rem)); padding: .7rem 1.1rem; border-radius: 8px;
        background: var(--texte); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
#etat:empty { display: none; }
#etat.erreur { background: var(--rouge); }
.vide { color: var(--gris); }
.aide { color: var(--gris); font-size: .9rem; margin: .5rem 0; }

/* ---------- Terrains ---------- */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .7rem; }
.terrain { background: #fff; border: 1px solid var(--bord); border-radius: 10px; padding: .7rem .8rem; }
.terrain.libre { border-style: dashed; }
.terrain.ferme { background: #f1f1ee; color: var(--gris); }
.terrain.en-cours { border-left: 5px solid var(--accent); }
.terrain.appele { border-left: 5px solid var(--orange); }
.tete-terrain { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.tete-terrain h3 { margin: 0; font-size: 1.1rem; }
.badge { border-radius: 999px; padding: .15rem .65rem; font-size: .85rem; font-weight: 600; background: #ecece8; color: var(--gris); }
.badge.en-cours { background: var(--clair-accent); color: var(--accent); }
.badge.appele { background: var(--clair-orange); color: var(--orange); }
.badge.gagne { background: #e3f1e4; color: var(--vert); }
.badge.perdu { background: #fbe4e4; color: var(--rouge); }
.meta { color: var(--gris); font-size: .9rem; }
.terrain .meta { display: block; margin: .3rem 0 .4rem; }
.pied { margin: .5rem 0 0; color: var(--gris); font-size: .85rem; }
.chrono { font-variant-numeric: tabular-nums; }

.score { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.score th, .score td { padding: .25rem .2rem; border-top: 1px solid #ecece8; }
.score tr:first-child th, .score tr:first-child td { border-top: 0; }
.score th.nom { text-align: left; font-weight: 500; width: 100%; overflow-wrap: anywhere; }
.score tr.gagnant th.nom { font-weight: 700; }
.score td.set { text-align: center; min-width: 2.2rem; font-size: 1.15rem; color: var(--gris); }
.score td.set.gagne { color: var(--texte); font-weight: 700; }
.score td.set:last-child { color: var(--texte); }
.pastille { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; margin-right: .4rem;
            background: var(--bord); vertical-align: baseline; }
.pastille.gagnant { background: var(--vert); }
.pastille.perdant { background: var(--rouge); }

.prochains { list-style: none; padding: 0; margin: 0; }
.prochains li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; background: #fff;
                border: 1px solid var(--bord); border-radius: 8px; padding: .5rem .8rem; margin-bottom: .4rem; }
.prochains .place { font-weight: 700; color: var(--accent); min-width: 1.6rem; font-variant-numeric: tabular-nums; }
.prochains .vs { flex-basis: 100%; }
.contre { color: var(--gris); }

/* ---------- Mes matchs ---------- */
.recherche span { display: block; font-weight: 600; margin-bottom: .3rem; }
.recherche input { width: 100%; font-size: 1.1rem; padding: .6rem .9rem; min-height: 3rem;
                   border: 2px solid var(--bord); border-radius: 10px; background: #fff; }
.recherche input:focus { border-color: var(--accent); outline: none; }
.propositions { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.proposition { justify-content: flex-start; background: #fff; color: var(--texte); border-color: var(--bord);
               text-align: left; white-space: normal; }
.entete-joueur { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.entete-joueur:empty { display: none; }
.nom-joueur { font-size: 1.15rem; font-weight: 650; margin: 0; }
.liste-matchs, .liste-resultats { list-style: none; padding: 0; margin: 0; }
.liste-matchs li, .liste-resultats li { background: #fff; border: 1px solid var(--bord); border-radius: 10px;
                                        padding: .6rem .8rem; margin-bottom: .5rem; }
.liste-matchs li.appele { border-left: 5px solid var(--orange); }
.liste-matchs li.en_cours { border-left: 5px solid var(--accent); }
.haut-match { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.adversaire { margin: .3rem 0 0; }
.partenaire { color: var(--gris); }
.info { margin: .3rem 0 0; color: var(--accent); font-weight: 600; }
.alerte { margin: .45rem 0 0; background: var(--clair-orange); color: var(--orange); font-weight: 700;
          border-radius: 8px; padding: .5rem .7rem; }
.detail-score { margin: .3rem 0 0; color: var(--gris); font-variant-numeric: tabular-nums; }
.heure-fin { color: var(--gris); font-size: .85rem; font-variant-numeric: tabular-nums; }
.badge-resultat { background: var(--clair-orange); color: var(--orange); border-radius: 999px; padding: .05rem .5rem;
                  font-size: .8rem; font-weight: 600; margin-right: .4rem; }

/* ---------- Résultats ---------- */
.liste-resultats .equipe { margin: .25rem 0 0; }
.liste-resultats .equipe-gagnante, .liste-resultats .equipe.gagnante { font-weight: 650; }

/* ---------- Classements ---------- */
.bloc-poule { margin-top: 1rem; }
.entete-poule { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .8rem; margin-bottom: .4rem; }
.entete-poule h3 { margin: 0; }
.badge-poule { background: #ecece8; border-radius: 999px; padding: .1rem .6rem; font-size: .85rem; color: var(--gris); }
.badge-poule.terminee { background: #e3f1e4; color: var(--vert); font-weight: 600; }
.table-defilante { overflow-x: auto; }
.classement { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--bord);
              font-variant-numeric: tabular-nums; }
.classement th, .classement td { padding: .5rem .6rem; text-align: center; border-bottom: 1px solid #ecece8; white-space: nowrap; }
.classement th { color: var(--gris); font-weight: 600; font-size: .85rem; }
.classement .equipe { text-align: left; white-space: normal; width: 100%; }
.classement.complet .equipe { min-width: 9rem; }
.classement td.rang { font-weight: 700; }
.classement tbody tr:first-child td.rang { color: var(--vert); }
.classement td.vd { font-weight: 600; }
.classement td.critere { text-align: left; color: var(--gris); font-size: .85rem; }
.classement tr.retiree td { color: var(--gris); }
.etiquette { margin-left: .4rem; font-size: .75rem; border-radius: 999px; padding: .05rem .5rem;
             background: #ecece8; color: var(--gris); white-space: nowrap; }
.etiquette.egalite { background: var(--clair-orange); color: var(--orange); font-weight: 600; }

@media (max-width: 420px) {
  header { padding: .6rem .7rem 0; }
  main { padding: 0 .7rem 5rem; }
  .onglets a { padding: .65rem .5rem; font-size: .95rem; }
}

/* Tableaux à élimination (l'arbre lui-même : arbre.css) */
.bloc-tableau { margin: 1rem 0 1.6rem; }
.bloc-tableau h3 { margin-bottom: .5rem; }
.titre-arbre { margin: .9rem 0 .4rem; font-size: .95rem; color: var(--gris); }

/* Mes matchs : « Voir ma poule » */
.boutons-poules { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .8rem; }
.boutons-poules .actif { background: var(--accent); color: #fff; border-color: var(--accent); }
.ma-poule { margin: 0 0 1.2rem; }
table.classement tr.moi td { background: #fff4d6; font-weight: 700; }

/* ---------- Onglet « Saison » (saison.js) : classement de la saison scolaire ----------
   Noms de classes PROPRES à l'onglet (préfixe saison- ou sous .table-saison / .tournoi-ecole) :
   « a-venir » est déjà l'état d'un match dans arbre.js (18 nov. : collision corrigée). */
.saison-a-venir { margin: 2rem auto 1rem; max-width: 30rem; padding: 2rem 1rem; text-align: center; font-size: 1.5rem; font-weight: 700;
           color: var(--accent); background: #fff; border: 2px dashed var(--accent); border-radius: 14px; }
.saison-centre { text-align: center; }
.defile-saison { overflow-x: auto; background: #fff; border: 1px solid var(--bord); border-radius: 10px; }
.table-saison { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-saison th { text-align: left; color: var(--gris); font-size: .8rem; font-weight: 600; padding: .5rem .55rem;
                   border-bottom: 2px solid var(--bord); white-space: nowrap; }
.table-saison td { padding: .5rem .55rem; border-bottom: 1px solid #ecece8; }
.table-saison tr:last-child td { border-bottom: 0; }
.table-saison .nombre { text-align: right; width: 1%; white-space: nowrap; }
.table-saison td.total { font-weight: 700; color: var(--accent); }
.table-saison tbody tr:nth-child(-n+3) td:first-child { font-weight: 700; }
.table-saison tr.egalite td:first-child { color: var(--accent); }
.table-saison.joueurs td:nth-child(3) { color: var(--gris); font-size: .9rem; }
.carte-ecole { background: #fff; border: 1px solid var(--bord); border-radius: 10px; margin: .5rem 0; }
.carte-ecole summary { display: flex; align-items: center; gap: .7rem; padding: .75rem .8rem; cursor: pointer; min-height: 2.75rem; }
.carte-ecole[open] summary { border-bottom: 1px solid #ecece8; }
.rang-ecole { font-weight: 700; min-width: 1.8rem; text-align: right; }
.nom-ecole { flex: 1; }
.total-ecole { font-weight: 700; color: var(--accent); }
.tournoi-ecole { padding: .4rem .8rem .7rem; }
.tournoi-ecole h3 { font-size: .95rem; margin: .5rem 0 .3rem; }
.tournoi-ecole .deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.2rem; }
.tournoi-ecole .petit-titre { margin: .2rem 0; font-size: .8rem; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .03em; }
.tournoi-ecole ul { list-style: none; margin: 0; padding: 0; }
.tournoi-ecole li { display: flex; justify-content: space-between; gap: .5rem; padding: .25rem 0; border-bottom: 1px solid #f2f2ee; }
.tournoi-ecole li .pts { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 560px) {
  .tournoi-ecole .deux-colonnes { grid-template-columns: 1fr; }
  .table-saison th, .table-saison td { padding: .45rem .4rem; }
  .table-saison.joueurs td:nth-child(3) { font-size: .8rem; }
}
