:root {
  --vert: #1d3fb8;
  --vert-fonce: #142d8a;
  --fond: #f3f5fa;
  --carte: #ffffff;
  --texte: #161b2e;
  --gris: #687089;
  --bord: #dde2ee;
  --or: #e0a400;
  --rouge: #c62828;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fond); color: var(--texte); line-height: 1.45;
}
a { color: var(--vert); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .7rem 1rem; background: var(--vert); color: #fff;
}
.logo { color: #fff; font-weight: 800; font-size: 1.2rem; text-decoration: none; }
nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav a { color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: 999px; font-size: .95rem; }
nav a.actif { background: rgba(255,255,255,.2); font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; min-height: 60vh; }
h1 { font-size: 1.4rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .6rem; color: var(--gris); text-transform: capitalize; }
.muted { color: var(--gris); }
.center { text-align: center; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; }

/* Match */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; }
.match .comp { grid-column: 1 / -1; font-size: .78rem; color: var(--gris); display: flex; justify-content: space-between; }
.equipe { display: flex; align-items: center; gap: .45rem; font-weight: 600; min-width: 0; }
.equipe span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equipe.ext { justify-content: flex-end; text-align: right; }
.equipe img { width: 26px; height: 26px; object-fit: contain; flex: none; }
.score { display: flex; align-items: center; gap: .3rem; }
.score input {
  width: 2.6rem; height: 2.6rem; text-align: center; font-size: 1.15rem; font-weight: 700;
  border: 2px solid var(--bord); border-radius: 8px; background: #fff;
}
.score input:focus { outline: none; border-color: var(--vert); }
.score .res { font-size: 1.3rem; font-weight: 800; min-width: 4.5rem; text-align: center; }
.match .bas { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--bord); }
.badge.p3 { background: var(--or); color: #fff; }
.badge.p1 { background: var(--vert); color: #fff; }
.badge.p0 { background: #e9ecea; color: var(--gris); }
.badge.live { background: var(--rouge); color: #fff; }

/* Boutons & formulaires */
button, .btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  background: var(--vert); color: #fff; padding: .6rem 1rem; border-radius: 8px;
}
button:hover { background: var(--vert-fonce); }
button.secondaire { background: #fff; color: var(--vert); border: 1px solid var(--vert); }
button.petit { padding: .35rem .75rem; font-size: .88rem; }
button:disabled { opacity: .5; cursor: default; }
form.pile { display: grid; gap: .7rem; }
label { font-size: .9rem; font-weight: 600; display: grid; gap: .25rem; }
input[type=text], input[type=email], input[type=password], select {
  font: inherit; padding: .6rem .7rem; border: 1px solid var(--bord); border-radius: 8px; background: #fff; width: 100%;
}
.onglets { display: flex; gap: .4rem; margin-bottom: 1rem; }
.onglets button { flex: 1; }
.ligne { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.ligne > input { flex: 1; min-width: 160px; }

/* Classement */
table { width: 100%; border-collapse: collapse; background: var(--carte); border-radius: var(--radius); overflow: hidden; }
th, td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--bord); }
th { background: #eaeefa; font-size: .8rem; text-transform: uppercase; color: var(--gris); }
td.num, th.num { text-align: right; }
tr.moi td { background: #fff8e1; font-weight: 700; }

.code { font-family: ui-monospace, monospace; font-weight: 800; letter-spacing: .1em; background: #eaeefa; padding: .1rem .45rem; border-radius: 6px; }

.ad-slot { max-width: 760px; margin: 0 auto; min-height: 0; }
.ad-slot:not(:empty) { padding: 0 1rem; }

.footer { text-align: center; font-size: .8rem; color: var(--gris); padding: 2rem 1rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: #17211b; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; font-size: .92rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 50; max-width: 90vw;
}
.toast.erreur { background: var(--rouge); }

@media (max-width: 480px) {
  .equipe img { width: 20px; height: 20px; }
  .equipe { font-size: .9rem; }
  .score input { width: 2.3rem; height: 2.3rem; }
}

/* Filtres championnats */
.puces { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .4rem; scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }
.puce {
  flex: none; background: #fff; color: var(--texte); border: 1px solid var(--bord);
  padding: .4rem .85rem; border-radius: 999px; font-size: .88rem; font-weight: 600; white-space: nowrap;
}
.puce:hover { background: #eaeefa; }
.puce.active { background: var(--vert); color: #fff; border-color: var(--vert); }

/* Photos de profil */
.avatar { border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; background: #eaeefa; }
.avatar.vide { display: inline-flex; align-items: center; justify-content: center; background: var(--vert); color: #fff; font-weight: 800; }
nav a .avatar { border: 2px solid rgba(255,255,255,.7); margin-right: .2rem; }
.joueur { display: flex; align-items: center; gap: .5rem; }
.ecusson { width: 20px; height: 20px; object-fit: contain; }
.profil-tete { display: flex; align-items: center; gap: 1rem; }
.btn.petit { padding: .4rem .8rem; font-size: .88rem; }

/* Bandeau prochain match + chronos */
.bandeau { display: grid; gap: .3rem; text-align: center; border-color: var(--vert); background: #f1f4ff; }
.chrono { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--gris); font-weight: 600; }
.chrono.gros { font-size: 1.6rem; font-weight: 800; color: var(--vert); }
.chrono.bientot { color: #d98200; }
.chrono.urgent { color: var(--rouge); }
.chrono.gros.urgent { animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .55; } }
.astuce { font-size: .85rem; margin: .2rem 0 0; }

/* Saisie rapide */
.prono .score input.case { caret-color: transparent; }
.prono.fait .score input.case { border-color: var(--vert); background: #f1f4ff; }
.prono.ferme { opacity: .6; }
.etat { font-size: .85rem; }
.ok-txt { color: var(--vert); font-weight: 600; }
.erreur-txt { color: var(--rouge); font-weight: 600; }

/* Journées */
.groupe { margin-bottom: 1.2rem; }
.groupe-tete { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: 1.3rem 0 .6rem; }
.groupe-tete h2 { margin: 0; }
.groupe-tete .chrono { font-size: .9rem; }
.groupe.ferme .carte { opacity: .85; }
.groupe-tete h2 { text-transform: none; }
.groupe-tete h2::first-letter { text-transform: uppercase; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.stat { display: grid; text-align: center; padding: .7rem; }
.stat b { font-size: 1.5rem; color: var(--vert); }
.stat span { font-size: .8rem; color: var(--gris); }
.barre-admin { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; position: sticky; top: 3.6rem; z-index: 5; }
.barre-admin label { display: flex; }
.joueur-admin { display: flex; align-items: center; gap: .7rem; }
.joueur-admin .infos { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.joueur-admin .actions { display: flex; gap: .35rem; }
.joueur-admin input[type=checkbox], .barre-admin input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--vert); }
.petit-txt { font-size: .8rem; }
a.btn { text-decoration: none; display: inline-block; }
button.danger { background: #fff; color: var(--rouge); border: 1px solid var(--rouge); }
button.danger:hover { background: #fdecea; }

/* Cases de score : petites et carrées (prioritaire sur le style des champs texte) */
.score input.case {
  width: 2.6rem; height: 2.6rem; padding: 0; flex: none;
  text-align: center; font-size: 1.2rem; font-weight: 800;
  border: 2px solid var(--bord); border-radius: 8px; background: #fff;
}
.score input.case:focus { outline: none; border-color: var(--vert); box-shadow: 0 0 0 3px rgba(29,63,184,.18); }
.score input.case:disabled { background: #f3f5f4; color: var(--gris); }
@media (max-width: 480px) { .score input.case { width: 2.3rem; height: 2.3rem; font-size: 1.1rem; } }
.groupe-tete .chrono, .groupe-tete .badge { white-space: nowrap; }
.barre-admin label { display: flex; align-items: center; gap: .45rem; font-weight: 600; }
.admin-info { background: #fff8e1; border-color: #f0d58a; font-size: .9rem; }

/* Ligues & invitations */
.champs { display: flex; flex-wrap: wrap; gap: .4rem; }
.case-champ { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; font-size: .88rem;
  border: 1px solid var(--bord); border-radius: 999px; padding: .3rem .7rem; background: #fff; cursor: pointer; }
.case-champ input { accent-color: var(--vert); }
.case-champ:has(input:checked) { border-color: var(--vert); background: #f1f4ff; }
.reglages { margin-top: .7rem; display: grid; gap: .6rem; }
.bloc-invit { border-top: 1px solid var(--bord); margin-top: .8rem; padding-top: .7rem; }
.invits { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; }
.invits li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .88rem; }
.email-invit { flex: 1; min-width: 140px; overflow-wrap: anywhere; }
.invitation { text-align: center; border-color: var(--vert); background: #f1f4ff; }
input.verrouille { background: #eaeefa; color: var(--gris); }
.fenetre-fond { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: grid; place-items: center; padding: 1rem; }
.fenetre { width: min(380px, 100%); display: grid; gap: .6rem; margin: 0; }
.qr { width: 220px; height: 220px; margin: 0 auto; image-rendering: pixelated; }
.lien-invit { font-size: .8rem !important; }

/* Un élément masqué reste toujours masqué */
[hidden] { display: none !important; }
.mode-test { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.mode-test.actif { border-color: #f0b400; background: #fff8e1; }

/* Lots & barème */
.lot { font-size: .92rem; }
.info-ligue { display: grid; gap: .25rem; margin-bottom: .8rem; border-color: var(--or); background: #fffbef; }
.bareme { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.bareme label { font-size: .82rem; }
.bareme input { text-align: center; font-weight: 700; }
.invits li.inactif { opacity: .5; }
.bareme input { font: inherit; width: 100%; padding: .5rem; border: 1px solid var(--bord); border-radius: 8px; background: #fff; }
.stock-label { font-size: .88rem; }
.stock-input { width: 6rem !important; flex: none !important; font: inherit; padding: .45rem; border: 1px solid var(--bord); border-radius: 8px; text-align: center; }
.stock-edit button { min-width: 2.2rem; }

/* Acceptation du règlement */
.case-reglement { display: flex !important; align-items: flex-start; gap: .55rem; font-weight: 500; font-size: .88rem; line-height: 1.4; }
.case-reglement input { width: 1.15rem; height: 1.15rem; margin-top: .1rem; flex: none; accent-color: var(--vert); }

/* Connexion Google */
.separateur { display: flex; align-items: center; gap: .6rem; color: var(--gris); font-size: .85rem; margin: .9rem 0; }
.separateur::before, .separateur::after { content: ""; flex: 1; height: 1px; background: var(--bord); }
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: #fff; color: #1f1f1f; border: 1px solid #c4c7c5; font-weight: 600; }
.btn-google:hover { background: #f5f7f6; }
.badge.verrou { align-self: center; background: #eaeefa; color: var(--vert); }
.captcha { display: flex; justify-content: center; min-height: 78px; }
.case-reglement.rester { margin-top: -.2rem; }

/* Bannière partenaire (sous la barre du haut) */
.ep-zone { max-width: 760px; margin: .8rem auto 0; padding: 0 1rem; text-align: center; }
.ep-zone a { display: block; }
.ep-mention { display: block; font-size: .65rem; color: var(--gris); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .2rem; }
.ep-img { display: block; width: 100%; max-width: 728px; height: auto; margin: 0 auto; border-radius: 6px; }
.ep-vide {
  max-width: 728px; aspect-ratio: 728 / 90; margin: 0 auto; border: 2px dashed var(--bord); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  background: #fff; color: var(--gris); font-size: .85rem;
}
.ep-vide .taille-tel { display: none; }
@media (max-width: 600px) {
  .ep-img { max-width: 320px; }
  .ep-vide { max-width: 320px; aspect-ratio: 320 / 100; }
  .ep-vide .taille-pc { display: none; }
  .ep-vide .taille-tel { display: inline; }
}
.ep-zone-bas { margin: 2rem auto 0; }
.ep-zone a.ep-lien { display: block; }
.ep-img { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.ep-site { display: inline-block; margin-top: .3rem; font-size: .85rem; font-weight: 600; color: var(--vert); text-decoration: none; }
a.ep-site:hover { text-decoration: underline; }

/* Vidéo d'ouverture plein écran */
.ep-intro { position: fixed; inset: 0; z-index: 100; background: rgba(5, 12, 28, .88); display: grid; place-items: center; padding: 1rem; transition: opacity .3s; }
.ep-intro.ferme { opacity: 0; }
.ep-intro-cadre { position: relative; width: min(92vw, 76vh, 620px); aspect-ratio: 1; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #0A1628; margin-top: 2.6rem; }
.ep-intro-cadre video { width: 100%; height: 100%; display: block; object-fit: cover; cursor: pointer; border-radius: 16px; }
/* croix au-dessus de la vidéo, à droite (ne cache pas le logo) */
.ep-intro-croix { position: absolute; top: -2.9rem; right: 0; z-index: 2; width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #0A1628; font-size: 1.15rem; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.3); animation: ep-apparait .3s; }
.ep-intro-croix:hover { background: #fff; }
.ep-intro-barre { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.15); border-radius: 0 0 16px 16px; overflow: hidden; }
.ep-intro-barre span { display: block; height: 100%; width: 0; background: #3eb2e6; }
@keyframes ep-apparait { from { opacity: 0; transform: scale(.7); } }

/* Bannière : arrive par la droite toutes les 5 secondes */
.ep-zone { overflow: hidden; }
@keyframes ep-arrivee {
  0%   { transform: translateX(110%); opacity: 0; }
  14%  { transform: translateX(0);    opacity: 1; }
  92%  { transform: translateX(0);    opacity: 1; }
  100% { transform: translateX(0);    opacity: 0; }
}
@media (min-width: 601px) {
  .ep-zone .ep-img, .ep-zone .ep-vide { animation: ep-arrivee 5s ease-out infinite; }
}
/* entre les journées : animée aussi sur téléphone */
.ep-entre { margin: 1.4rem auto; padding: 0; }
.ep-entre .ep-img, .ep-entre .ep-vide { animation: ep-arrivee 5s ease-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .ep-zone .ep-img, .ep-zone .ep-vide { animation: none !important; }
}

/* Bouton Connexion / Inscription (visiteurs) */
.btn-connexion { background: #fff; color: var(--vert); font-weight: 700; text-decoration: none; padding: .45rem .9rem; border-radius: 999px; font-size: .92rem; white-space: nowrap; }
.btn-connexion:hover { background: #eaeefa; }

/* Accueil public */
.pub-hero { text-align: center; padding: 1.4rem 1.2rem; }
.pub-hero h1 { margin: 0 0 .6rem; }
.pub-hero p { color: var(--gris); margin: 0 0 1rem; }
a.secondaire-lien { background: #fff; color: var(--vert); border: 1px solid var(--vert); }
.pub-liste { padding: .3rem .9rem; }
.pub-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; padding: .65rem 0; border-bottom: 1px solid var(--bord); }
.pub-match:last-child { border-bottom: 0; }
.pub-comp { grid-column: 1 / -1; font-size: .72rem; color: var(--gris); margin-bottom: -.2rem; }
.pub-score { font-weight: 800; font-size: 1.1rem; min-width: 4.2rem; text-align: center; }
.pub-score.heure { font-size: .92rem; color: var(--vert); }
.pub-etapes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.pub-etapes .carte { margin: 0; }
.pub-etapes p { margin: .3rem 0 0; font-size: .9rem; }
@media (max-width: 480px) { .pub-etapes { grid-template-columns: 1fr; } .btn-connexion { font-size: .82rem; padding: .4rem .7rem; } }