:root {
  --fond: #0b1220;
  --carte: #131c2e;
  --carte2: #1a2540;
  --trait: #263352;
  --texte: #e8edf7;
  --doux: #94a3c0;
  --vert: #3ee07a;
  --vert-fonce: #1f9e52;
  --or: #f5c542;
  --rouge: #ff6b6b;
  --rayon: 14px;
  --barre: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--barre) + env(safe-area-inset-bottom) + 12px);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }

/* ---------- en-tête : le nom tout en haut ---------- */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: rgba(11, 18, 32, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--trait);
}
.marque { font-weight: 900; font-size: 22px; letter-spacing: .08em; font-style: italic; }
.marque { display: flex; align-items: center; }
.marque img { display: block; height: 29px; width: auto; }
.avatar {
  position: absolute; right: 14px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--carte2); border: 1px solid var(--trait);
  font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.avatar.connecte { background: var(--vert-fonce); border-color: var(--vert); }

/* ---------- barre d'onglets en bas ---------- */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--barre) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(13, 21, 38, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--trait);
}
.onglets a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--doux); font-size: 11.5px; font-weight: 600; }
.onglets svg { width: 25px; height: 25px; fill: currentColor; }
.onglets a.actif { color: var(--vert); }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; outline: none; }

/* ---------- blocs ---------- */
h1 { font-size: 22px; margin: 6px 0 14px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--doux); margin: 22px 0 10px; font-weight: 700; }
h2:first-child { margin-top: 4px; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px; }
.carte + .carte { margin-top: 10px; }
.doux { color: var(--doux); }
.petit { font-size: 13px; }
.vide { color: var(--doux); text-align: center; padding: 22px 12px; border: 1px dashed var(--trait); border-radius: var(--rayon); }
.pile > * + * { margin-top: 10px; }
.ligne { display: flex; align-items: center; gap: 10px; }
.ligne .pousse { flex: 1; min-width: 0; }
.tronque { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sous-onglets (Stats : championnats / joueurs ; Analyse : joueurs / matchs) */
.segments { display: flex; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.segments a { flex: 1; text-align: center; padding: 9px 6px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--doux); }
.segments a.actif { background: var(--carte2); color: var(--texte); box-shadow: inset 0 0 0 1px var(--trait); }

.puces { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 10px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }
.puce { flex: none; padding: 7px 13px; border-radius: 999px; background: var(--carte); border: 1px solid var(--trait); font-size: 13.5px; font-weight: 600; color: var(--doux); cursor: pointer; }
.puce.actif { background: var(--vert); border-color: var(--vert); color: #06210f; }

/* ---------- matchs ---------- */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 11px 12px; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; }
.match + .match { margin-top: 8px; }
.match .eq { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; font-size: 14px; }
.match .eq.ext { flex-direction: row-reverse; text-align: right; }
.match .eq span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .score { text-align: center; font-weight: 800; font-size: 17px; min-width: 58px; }
.match .score small { display: block; font-size: 11px; font-weight: 600; color: var(--doux); }
.match .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 12px; color: var(--doux); margin-top: -2px; }
.logo { width: 24px; height: 24px; object-fit: contain; flex: none; }
.logo.grand { width: 56px; height: 56px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--carte2); border: 1px solid var(--trait); color: var(--doux); }
.badge.or { background: rgba(245, 197, 66, .14); border-color: rgba(245, 197, 66, .5); color: var(--or); }
.badge.vert { background: rgba(62, 224, 122, .12); border-color: rgba(62, 224, 122, .45); color: var(--vert); }
.badge.direct { background: var(--rouge); border-color: var(--rouge); color: #fff; }

/* ---------- joueurs ---------- */
.joueur { display: flex; align-items: center; gap: 11px; padding: 10px 12px; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; }
.joueur + .joueur { margin-top: 7px; }
.joueur .rang { width: 24px; text-align: center; font-weight: 800; color: var(--doux); }
.joueur .rang.r1 { color: var(--or); }
.joueur .nom { font-weight: 700; }
.joueur .sous { font-size: 12.5px; color: var(--doux); }
.joueur .val { font-weight: 800; font-size: 17px; text-align: right; }
.joueur .val small { display: block; font-size: 11px; color: var(--doux); font-weight: 600; }
.initiales { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--carte2); border: 1px solid var(--trait); position: relative; }
.initiales img { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; background: var(--fond); border-radius: 50%; padding: 1px; }
.poste { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: var(--carte2); color: var(--doux); }

/* ---------- formulaires ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--doux); margin: 12px 0 5px; }
input[type=text], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--trait); background: var(--carte2); outline: none; font-size: 16px;
}
input:focus, select:focus, textarea:focus { border-color: var(--vert); }
textarea { min-height: 96px; resize: vertical; }
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 700; cursor: pointer; background: var(--vert); color: #06210f; }
.bouton.plein { width: 100%; }
.bouton.second { background: var(--carte2); color: var(--texte); border: 1px solid var(--trait); }
.bouton.danger { background: transparent; color: var(--rouge); border: 1px solid rgba(255, 107, 107, .4); }
.bouton.mini { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.bouton:disabled { opacity: .5; }
.icone-bt { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--trait); background: var(--carte2); display: grid; place-items: center; cursor: pointer; flex: none; font-size: 15px; }
.erreur { color: var(--rouge); font-size: 14px; margin-top: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- fiches ---------- */
.tete { display: flex; align-items: center; gap: 14px; }
.tete h1 { margin: 0; }
.chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chiffre { background: var(--carte2); border-radius: 11px; padding: 10px 6px; text-align: center; }
.chiffre b { display: block; font-size: 20px; }
.chiffre span { font-size: 11.5px; color: var(--doux); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--trait); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--doux); font-weight: 600; font-size: 12px; }
.defile { overflow-x: auto; }

.score-geant { text-align: center; }
.score-geant .equipes { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.score-geant .equipes div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; }
.score-geant .sc { font-size: 34px; font-weight: 900; letter-spacing: .04em; }
.evenements { margin-top: 10px; font-size: 13px; color: var(--doux); display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; }
.evenements .ext { text-align: right; }

.compo .joueur { padding: 8px 10px; }
.compo .joueur.choisi { border-color: var(--vert); background: rgba(62, 224, 122, .08); }
.top5-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; border: 1px solid var(--trait); flex: none; cursor: pointer; background: var(--carte2); color: var(--doux); }
.top5-num.pris { background: var(--vert); color: #06210f; border-color: var(--vert); }
.stat-mini { font-size: 12px; color: var(--doux); }

.statut { text-align: center; }
.statut .voix { font-size: 46px; font-weight: 900; color: var(--vert); line-height: 1; }
.jauge { height: 10px; border-radius: 99px; background: var(--carte2); overflow: hidden; margin: 12px 0 6px; }
.jauge i { display: block; height: 100%; background: linear-gradient(90deg, var(--vert-fonce), var(--vert)); border-radius: 99px; }

/* ---------- fenêtre (ajout d'un joueur, repère d'une perf) ---------- */
.voile { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.fenetre { background: var(--carte); border: 1px solid var(--trait); border-radius: 18px 18px 0 0; width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.fenetre h3 { margin: 0 0 10px; font-size: 18px; }
@media (min-width: 700px) { .voile { align-items: center; } .fenetre { border-radius: 18px; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--barre) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s; background: var(--texte); color: var(--fond); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 50; pointer-events: none; max-width: calc(100% - 32px); }
#toast.vu { opacity: 1; transform: translateX(-50%) translateY(0); }

.chargement { text-align: center; color: var(--doux); padding: 40px 0; }
.lien { color: var(--vert); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; }
.encart { background: linear-gradient(135deg, rgba(62, 224, 122, .14), rgba(62, 224, 122, .03)); border: 1px solid rgba(62, 224, 122, .35); border-radius: var(--rayon); padding: 14px; }
