/* ==========================================================================
   styles.css — Issambres Games 2026
   Ambiance « Olympiades méditerranéennes » : bleu mer, sable, jaune soleil.
   Mobile d'abord (360–430 px), puis tablette et mode TV (body.tv).
   Sommaire : 1. Variables et thème sombre  2. Base  3. En-tête et bandeaux
   4. Composants (cartes, onglets, boutons, badges, champs)  5. Classements
   6. Matchs  7. Navigation et bouton + Match  8. Couches (modales) et toasts
   9. Identification  10. Saisie d'un match  11. Fiche, stats, trophées
   12. Admin  13. Mode TV  14. Animations
   ========================================================================== */

/* 1. Variables ------------------------------------------------------------ */
:root {
  --mer-950: #041f36;
  --mer-900: #06325a;
  --mer-700: #0a4f8a;
  --mer-500: #1476c6;
  --mer-300: #7db9ea;
  --mer-100: #dcecf8;
  --lagon: #139a8b;
  --sable-50: #fbf5ea;
  --sable-100: #f5ead3;
  --sable-200: #ecdcb8;
  --sable-500: #c49a55;
  --soleil: #ffc62b;
  --soleil-fonce: #e3a300;
  --corail: #e2572d;
  --vert: #1f8a4c;
  --rouge: #c8322a;
  --orange: #d97706;
  --or: #f2b705;
  --argent: #a8b4bf;
  --bronze: #c9803f;

  --fond: var(--sable-50);
  --carte: #ffffff;
  --carte-2: #fdf9f1;
  --texte: #0d1b2a;
  --texte-2: #4b5a69;
  --texte-3: #7d8994;
  --bord: #eadfc8;
  --accent: var(--mer-700);
  --accent-texte: #ffffff;
  --ombre: 0 1px 2px rgba(6, 50, 90, .06), 0 4px 14px rgba(6, 50, 90, .08);

  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --police-titre: "Avenir Next Condensed", "AvenirNextCondensed-Bold", "Roboto Condensed", "sans-serif-condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --rayon: 16px;
  --nav-h: 64px;
  --sur: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #07131f;
    --carte: #0f2233;
    --carte-2: #13293d;
    --texte: #f4ede0;
    --texte-2: #b3c1cd;
    --texte-3: #8595a4;
    --bord: #1e3a52;
    --accent: #5aa9ec;
    --accent-texte: #041f36;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --sable-100: #1a3044;
    --sable-200: #24405a;
    --mer-100: #16344f;
  }
}

/* 2. Base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--police); font-size: 16px; line-height: 1.4;
  background: var(--fond); color: var(--texte);
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain;
}
body.couche-ouverte { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--police-titre); font-weight: 800; letter-spacing: .01em; }
.num, .valeur, .pct { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
main#ecran { padding: 12px 16px calc(var(--nav-h) + 96px + var(--sur)); max-width: 760px; margin: 0 auto; outline: none; }
.discret { color: var(--texte-3); font-size: .85rem; }
.centre { text-align: center; }
.chargement { text-align: center; padding: 80px 0; color: var(--texte-2); }

/* 3. En-tête et bandeaux -------------------------------------------------- */
#entete {
  position: relative; color: #fff; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 26px;
  background:
    radial-gradient(circle at 88% -20%, rgba(255, 198, 43, .35), transparent 42%),
    linear-gradient(160deg, var(--mer-900) 0%, var(--mer-700) 70%, #0f64a8 100%);
}
#entete::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 18px;
  background: var(--fond);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 18' preserveAspectRatio='none'%3E%3Cpath d='M0 10 Q15 2 30 10 T60 10 T90 10 T120 10 V18 H0Z'/%3E%3C/svg%3E") center / 120px 18px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 18' preserveAspectRatio='none'%3E%3Cpath d='M0 10 Q15 2 30 10 T60 10 T90 10 T120 10 V18 H0Z'/%3E%3C/svg%3E") center / 120px 18px repeat-x;
}
.entete-haut { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 auto; }
.entete-titre { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.soleil { flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe38a, var(--soleil) 55%, var(--soleil-fonce)); box-shadow: 0 0 0 4px rgba(255, 198, 43, .22); }
.entete-titre h1 { margin: 0; font-size: 1.45rem; line-height: 1; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete-titre h1 b { color: var(--soleil); font-weight: 800; }
.entete-titre p { margin: 3px 0 0; font-size: .78rem; color: #f3e3c2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete-moi { max-width: 760px; margin: 8px auto 0; font-size: .85rem; color: #d9e8f5; }
.entete-moi strong { color: #fff; }
.entete-moi button { background: none; border: 0; padding: 4px 2px; color: #bcd6ee; text-decoration: underline; font-size: .8rem; cursor: pointer; }
.pastille-sync {
  flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; border-radius: 99px; padding: 6px 10px; font-size: .75rem; font-weight: 600; min-height: 32px;
}
.pastille-sync::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #9fb3c4; }
.pastille-sync.ok::before { background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .25); }
.pastille-sync.attente::before { background: #ffb020; box-shadow: 0 0 0 3px rgba(255, 176, 32, .3); }
.pastille-sync.hors-ligne::before { background: #ff5a4a; box-shadow: 0 0 0 3px rgba(255, 90, 74, .3); }

#bandeau { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.bandeau { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: .88rem; font-weight: 600; }
.bandeau span { flex: 1; }
.bandeau.attente { background: #fff1d6; color: #6b4200; }
.bandeau.erreur { background: #fde2df; color: #7a1a13; }
.bandeau.maj { background: var(--mer-100); color: var(--mer-900); }
@media (prefers-color-scheme: dark) {
  .bandeau.attente { background: #3b2a08; color: #ffd48a; }
  .bandeau.erreur { background: #3d1512; color: #ffb3aa; }
  .bandeau.maj { color: #cfe6fb; }
}

/* 4. Composants ----------------------------------------------------------- */
.section-titre { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.section-titre h2 { margin: 0; font-size: 1.2rem; text-transform: uppercase; position: relative; padding-bottom: 4px; }
.section-titre h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 4px; border-radius: 2px; background: var(--soleil); }
.section-titre .discret { text-align: right; }
.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 14px; margin-bottom: 12px; }
.carte h3 { margin: 0 0 8px; font-size: 1.05rem; }
.message-accueil { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--texte-2); }
.message-accueil p { margin: 0; flex: 1; }

.onglets { display: flex; gap: 4px; background: var(--sable-100); border-radius: 14px; padding: 4px; margin: 14px 0 10px; }
.onglet { flex: 1; min-height: 44px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; color: var(--texte-2); cursor: pointer; padding: 6px 8px; font-size: .92rem; }
.onglet.actif { background: var(--carte); color: var(--accent); box-shadow: var(--ombre); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-texte); transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.secondaire { background: transparent; color: var(--accent); border-color: currentColor; }
.btn.discret-btn { background: var(--sable-100); color: var(--texte); }
.btn.soleil { background: var(--soleil); color: #1b1300; }
.btn.danger { background: var(--rouge); color: #fff; }
.btn.vert { background: var(--vert); color: #fff; }
.btn.bloc { display: flex; width: 100%; }
.btn.petit { min-height: 38px; padding: 6px 12px; font-size: .88rem; border-radius: 11px; }
.rangee-btn { display: flex; gap: 8px; flex-wrap: wrap; }
.rangee-btn > .btn { flex: 1 1 auto; }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 8px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; background: var(--sable-100); color: var(--texte-2); white-space: nowrap; }
.badge.rouge { background: #fde2df; color: #9b1c12; }
.badge.orange { background: #fff1d6; color: #7a4a00; }
.badge.bleu { background: var(--mer-100); color: var(--mer-700); }
.badge.vert { background: #daf3e4; color: #115c32; }
@media (prefers-color-scheme: dark) {
  .badge.rouge { background: #4a1914; color: #ffb3aa; }
  .badge.orange { background: #3b2a08; color: #ffd48a; }
  .badge.bleu { color: #cfe6fb; }
  .badge.vert { background: #0f3a22; color: #9be7bb; }
}

.champ { display: block; margin-bottom: 12px; }
.champ > span { display: block; font-size: .8rem; font-weight: 700; color: var(--texte-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.champ input, .champ select, .champ textarea, input.champ-seul, select.champ-seul {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--bord); background: var(--carte); font-size: 1rem;
}
.champ textarea { min-height: 220px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: none; border-color: var(--mer-500); }
.champs-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filtres { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.puces { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.puce { min-height: 38px; border-radius: 99px; border: 2px solid var(--bord); background: var(--carte); padding: 4px 14px; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--texte-2); }
.puce.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }

.avatar {
  --c: #1f6fd1; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; background: var(--c); color: #fff;
  font-family: var(--police-titre); font-weight: 800; font-size: .95rem; letter-spacing: .02em;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15);
}
.avatar.petit { width: 26px; height: 26px; font-size: .7rem; }
.avatar.grand { width: 64px; height: 64px; font-size: 1.5rem; }
.vide { text-align: center; color: var(--texte-3); padding: 24px 12px; }
.vide .emoji { font-size: 2.4rem; display: block; margin-bottom: 6px; }
.encart { background: linear-gradient(135deg, var(--mer-100), var(--sable-100)); border-radius: var(--rayon); padding: 14px; margin-bottom: 12px; font-size: .9rem; position: relative; }
.encart h3 { margin: 0 0 6px; }
.encart ol { margin: 6px 0 0; padding-left: 20px; }
.fermer-x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; font-size: 1.2rem; cursor: pointer; color: var(--texte-2); }

/* 5. Classements ---------------------------------------------------------- */
.classement { list-style: none; margin: 0; padding: 0; }
.ligne {
  display: flex; align-items: center; gap: 10px; background: var(--carte); border-radius: 14px; padding: 10px 12px;
  margin-bottom: 8px; box-shadow: var(--ombre); cursor: pointer; min-height: 60px; position: relative;
}
.ligne.moi { box-shadow: var(--ombre), inset 0 0 0 2px var(--soleil); }
.ligne.nc { opacity: .62; box-shadow: none; background: var(--carte-2); }
.rang { flex: none; width: 34px; text-align: center; font-family: var(--police-titre); font-weight: 800; font-size: 1.25rem; color: var(--texte-2); }
.medaille { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; color: #3b2a00; font-size: 1rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.medaille.or { background: radial-gradient(circle at 35% 30%, #fff1a8, var(--or)); }
.medaille.argent { background: radial-gradient(circle at 35% 30%, #fff, var(--argent)); color: #26323d; }
.medaille.bronze { background: radial-gradient(circle at 35% 30%, #ffd6ad, var(--bronze)); color: #3a1e05; }
.ligne .nom { flex: 1; min-width: 0; }
.ligne .nom strong { display: block; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne .nom small { display: block; color: var(--texte-3); font-size: .78rem; }
.ligne .valeur { text-align: right; font-family: var(--police-titre); font-weight: 800; font-size: 1.5rem; color: var(--accent); line-height: 1; }
.ligne .valeur small { display: block; font-family: var(--police); font-weight: 600; font-size: .7rem; color: var(--texte-3); margin-top: 3px; }
.ligne.nc .valeur { font-size: 1rem; color: var(--texte-3); }
.fleche { font-size: .75rem; font-weight: 800; margin-left: 4px; }
.fleche.monte { color: var(--vert); } .fleche.descend { color: var(--rouge); }
.mention-attente { font-size: .8rem; color: var(--orange); font-weight: 600; margin: 4px 0 10px; }

.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-3); text-align: right; padding: 6px 4px; font-weight: 700; }
.tableau th:nth-child(2), .tableau td:nth-child(2) { text-align: left; }
.tableau td { padding: 8px 4px; border-top: 1px solid var(--bord); text-align: right; font-variant-numeric: tabular-nums; }
.tableau td:first-child { text-align: center; width: 36px; }
.tableau tr.nc td { color: var(--texte-3); }
.tableau tr.moi td { background: rgba(255, 198, 43, .14); }
.tableau .joueur-cellule { display: flex; align-items: center; gap: 8px; }
.tableau .pct { font-weight: 800; color: var(--accent); }
.defile-x { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }

/* 6. Matchs --------------------------------------------------------------- */
.match {
  display: block; width: 100%; text-align: left; background: var(--carte); border: 0; border-radius: 14px; box-shadow: var(--ombre);
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; border-left: 5px solid var(--mer-300);
}
.match .meta { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--texte-3); flex-wrap: wrap; }
.match .meta .epr { font-weight: 800; color: var(--texte-2); }
.match .resume { margin-top: 3px; font-weight: 600; font-size: .95rem; }
.match .motif { margin-top: 4px; font-size: .82rem; color: var(--rouge); }
.match.conteste { border-left-color: var(--rouge); background: linear-gradient(90deg, rgba(200, 50, 42, .07), transparent 40%), var(--carte); }
.match.conteste .resume { color: var(--rouge); }
.match.annule { border-left-color: var(--texte-3); opacity: .6; box-shadow: none; }
.match.annule .resume { text-decoration: line-through; }
.match.attente { border-left-color: var(--orange); border-left-style: dashed; }

/* 7. Navigation et bouton + Match ------------------------------------------- */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + var(--sur)); padding-bottom: var(--sur);
  background: var(--carte); box-shadow: 0 -1px 0 var(--bord), 0 -6px 20px rgba(6, 50, 90, .06);
}
#nav button { flex: 1; max-width: 110px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--texte-3); cursor: pointer; position: relative; }
#nav button .ico { font-size: 1.35rem; line-height: 1; filter: grayscale(.6); opacity: .8; }
#nav button.actif { color: var(--accent); }
#nav button.actif .ico { filter: none; opacity: 1; }
#nav button.actif::before { content: ""; position: absolute; top: 5px; width: 22px; height: 4px; border-radius: 2px; background: var(--soleil); }
#fab {
  position: fixed; z-index: 21; right: 16px; bottom: calc(var(--nav-h) + 14px + var(--sur));
  display: inline-flex; align-items: center; gap: 6px; min-height: 58px; padding: 0 22px 0 18px; border: 0; border-radius: 20px;
  background: var(--soleil); color: #1b1300; font-family: var(--police-titre); font-size: 1.25rem; font-weight: 800; text-transform: uppercase;
  box-shadow: 0 6px 18px rgba(227, 163, 0, .45), 0 2px 4px rgba(0, 0, 0, .15); cursor: pointer;
}
#fab span { font-size: 1.7rem; line-height: 1; margin-top: -2px; }
#fab:active { transform: scale(.96); }
body.sans-chrome #fab, body.sans-chrome #nav, body.sans-chrome #entete, body.sans-chrome #bandeau { display: none; }
body.sans-fab #fab { display: none; }

/* 8. Couches (modales, feuilles) et toasts ---------------------------------- */
.couche { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.couche-fond { position: absolute; inset: 0; background: rgba(4, 20, 36, .5); opacity: 0; transition: opacity .18s; }
.couche-boite {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; background: var(--fond);
  border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + var(--sur)); transform: translateY(24px); opacity: 0; transition: transform .2s ease, opacity .2s;
}
.couche.visible .couche-fond { opacity: 1; }
.couche.visible .couche-boite { transform: none; opacity: 1; }
.couche.plein { align-items: stretch; }
.couche.plein .couche-boite { max-width: 640px; max-height: none; height: 100%; border-radius: 0; padding: 0; display: flex; flex-direction: column; }
.couche.plein .couche-contenu { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.carte.message-accueil { position: relative; padding-right: 44px; }
.poignee { width: 44px; height: 5px; border-radius: 3px; background: var(--bord); margin: 4px auto 12px; }
.couche-entete { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--mer-700); color: #fff; }
.couche-entete h2 { flex: 1; margin: 0; font-size: 1.2rem; text-transform: uppercase; }
.couche-entete button { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; padding: 0 10px; }
.couche-corps { flex: 1; overflow: auto; padding: 12px 16px; -webkit-overflow-scrolling: touch; }
.couche-pied { padding: 10px 16px calc(10px + var(--sur)); background: var(--carte); box-shadow: 0 -1px 0 var(--bord); }
.feuille-titre { margin: 0 0 4px; font-size: 1.1rem; }
.actions-liste { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.actions-liste .btn { justify-content: flex-start; }

#toasts { position: fixed; z-index: 80; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: 100%;
  background: #0d2438; color: #fff; border-radius: 14px; padding: 12px 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: toast-entree .22s ease;
}
.toast span { flex: 1; }
.toast.ok { border-left: 6px solid #3ddc84; }
.toast.erreur { border-left: 6px solid #ff5a4a; }
.toast.attente { border-left: 6px solid #ffb020; }
.toast button { border: 0; background: var(--soleil); color: #1b1300; border-radius: 10px; min-height: 40px; padding: 0 14px; font-weight: 800; cursor: pointer; }
.toast.sortie { opacity: 0; transform: translateY(-8px); transition: all .22s; }

/* 9. Identification ------------------------------------------------------- */
.identification { max-width: 520px; margin: 0 auto; padding: 40px 0 20px; text-align: center; }
.identification .soleil { width: 64px; height: 64px; margin: 0 auto 14px; }
.identification h1 { font-size: 2.1rem; margin: 0; text-transform: uppercase; color: var(--mer-700); line-height: 1; }
.identification h1 b { color: var(--soleil-fonce); }
@media (prefers-color-scheme: dark) { .identification h1 { color: #cfe6fb; } }
.identification p { color: var(--texte-2); }
.grille-joueurs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin: 18px 0; }
.bouton-joueur { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; min-height: 104px; border: 0; border-radius: 16px; background: var(--carte); box-shadow: var(--ombre); cursor: pointer; font-weight: 700; }
.bouton-joueur:active { transform: scale(.97); }

/* 10. Saisie d'un match --------------------------------------------------- */
.grille-epreuves { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.tuile-epreuve {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 96px; padding: 10px 6px;
  border: 0; border-radius: 16px; background: var(--carte); box-shadow: var(--ombre); cursor: pointer; font-weight: 700; font-size: .9rem; text-align: center;
}
.tuile-epreuve .emo { font-size: 2rem; line-height: 1; }
.tuile-epreuve small { font-weight: 600; color: var(--texte-3); font-size: .7rem; }
.tuile-epreuve.nouvelle { background: transparent; border: 2px dashed var(--sable-500); box-shadow: none; color: var(--texte-2); }
.tuile-epreuve:active { transform: scale(.97); }

.choix-epreuve { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.choix-epreuve .emo { font-size: 1.6rem; }
.choix-epreuve strong { flex: 1; font-size: 1.1rem; }
.formats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--sable-100); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.formats button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-size: .74rem; font-weight: 700; color: var(--texte-2); cursor: pointer; line-height: 1.1; padding: 4px; }
.formats button.actif { background: var(--carte); color: var(--accent); box-shadow: var(--ombre); }

.camps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.camps.plusieurs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.camp {
  --cc: #1f6fd1; position: relative; border-radius: 14px; background: var(--carte); border: 3px solid transparent; padding: 8px; min-height: 92px; cursor: pointer;
  box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.camp.actif { border-color: var(--cc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cc) 25%, transparent), var(--ombre); }
.camp-nom { display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--cc); letter-spacing: .04em; }
.camp-nom::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--cc); }
.camp-nom .taille { margin-left: auto; color: var(--texte-3); }
.camp-joueurs { display: flex; flex-wrap: wrap; gap: 4px; }
.camp-joueur { display: inline-flex; align-items: center; gap: 4px; background: color-mix(in srgb, var(--cc) 14%, var(--carte)); border-radius: 99px; padding: 3px 8px 3px 3px; font-size: .82rem; font-weight: 700; }
.camp-vide { font-size: .78rem; color: var(--texte-3); }
.camp .gagne { margin-top: auto; min-height: 44px; border-radius: 10px; border: 2px solid var(--cc); background: transparent; color: var(--cc); font-weight: 800; cursor: pointer; }
.camp.gagnant .gagne { background: var(--cc); color: #fff; }
.camp.gagnant { border-color: var(--cc); }
.camp.perdant { opacity: .7; }
.outils-camps { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.outils-camps .btn { flex: 1 1 auto; }
.nul-btn { display: flex; width: 100%; margin: 4px 0 12px; }
.nul-btn.actif { background: var(--texte-2); color: var(--carte); border-color: var(--texte-2); }

.pastilles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pastille {
  --pc: transparent; position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 8px; border-radius: 14px;
  border: 2px solid var(--bord); background: var(--carte); cursor: pointer; font-weight: 700; font-size: .88rem; text-align: left;
}
.pastille span.n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pastille.dans-camp { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, var(--carte)); }
.pastille .ordre-num { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--pc); color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.pastille:active { transform: scale(.96); }

.ordre { list-style: none; margin: 0; padding: 0; }
.ordre li { display: flex; align-items: center; gap: 8px; background: var(--carte); border-radius: 14px; padding: 8px; margin-bottom: 6px; box-shadow: var(--ombre); border-left: 6px solid var(--cc, var(--mer-300)); }
.ordre .pos { flex: none; width: 40px; text-align: center; font-family: var(--police-titre); font-weight: 800; font-size: 1.2rem; }
.ordre .qui { flex: 1; min-width: 0; font-weight: 700; }
.ordre .qui small { display: block; color: var(--texte-3); font-weight: 600; }
.ordre button { min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; background: var(--sable-100); cursor: pointer; font-size: 1rem; font-weight: 800; }
.ordre button.egal.actif { background: var(--soleil); }
.ordre input { width: 92px; min-height: 44px; border-radius: 10px; border: 2px solid var(--bord); padding: 6px 8px; text-align: right; font-size: 1.05rem; background: var(--carte); }

.recap-phrase { background: var(--mer-100); color: var(--mer-900); border-radius: 14px; padding: 12px 14px; font-weight: 700; margin: 12px 0 8px; font-size: 1rem; }
@media (prefers-color-scheme: dark) { .recap-phrase { color: #e3f0fb; } }
.recap-phrase.vide { background: var(--sable-100); color: var(--texte-3); font-weight: 600; }
.erreur-saisie { color: var(--rouge); font-weight: 700; font-size: .88rem; margin: 6px 0; }
.etape-titre { font-family: var(--police-titre); font-size: .95rem; text-transform: uppercase; color: var(--texte-2); margin: 14px 0 8px; letter-spacing: .03em; }

/* 11. Fiche joueur, stats, trophées ---------------------------------------- */
.fiche-tete { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.fiche-tete h2 { margin: 0; font-size: 1.7rem; text-transform: uppercase; }
.fiche-tete p { margin: 2px 0 0; color: var(--texte-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--carte); border-radius: 14px; padding: 10px 8px; text-align: center; box-shadow: var(--ombre); }
.stat strong { display: block; font-family: var(--police-titre); font-size: 1.45rem; color: var(--accent); line-height: 1.1; }
.stat span { font-size: .7rem; color: var(--texte-3); font-weight: 700; text-transform: uppercase; }
.duo-ligne { display: flex; align-items: center; gap: 10px; }
.duo-ligne .avatars { display: flex; }
.duo-ligne .avatars .avatar + .avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--carte); }
.trophees { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .trophees { grid-template-columns: 1fr 1fr; } }
.trophee { display: flex; gap: 12px; align-items: flex-start; background: var(--carte); border-radius: 16px; padding: 12px; box-shadow: var(--ombre); }
.trophee .emo { font-size: 2.2rem; line-height: 1; flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--sable-100); display: flex; align-items: center; justify-content: center; }
.trophee h3 { margin: 0; font-size: 1.05rem; }
.trophee .detenteurs { font-weight: 700; margin-top: 2px; }
.trophee small { color: var(--texte-3); display: block; margin-top: 2px; }
.face-duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; margin: 12px 0; }
.face-duel .score { font-family: var(--police-titre); font-size: 2.4rem; font-weight: 800; color: var(--accent); }
.menu-plus .btn { justify-content: flex-start; margin-bottom: 8px; }
.journal-ligne { font-size: .82rem; border-top: 1px solid var(--bord); padding: 6px 0; }
.journal-ligne small { color: var(--texte-3); }

/* 12. Admin --------------------------------------------------------------- */
.admin-section summary { cursor: pointer; font-family: var(--police-titre); font-weight: 800; font-size: 1.1rem; text-transform: uppercase; list-style: none; padding: 4px 0; }
.admin-section summary::-webkit-details-marker { display: none; }
.admin-section summary::after { content: " ▾"; color: var(--texte-3); }
.admin-section[open] summary { margin-bottom: 10px; }
.admin-ligne { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; border-top: 1px solid var(--bord); padding: 10px 0; }
.admin-ligne:first-of-type { border-top: 0; }
.bascule { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.bascule input { width: 24px; height: 24px; }

/* 13. Mode TV ------------------------------------------------------------- */
body.tv { background: radial-gradient(circle at 85% -10%, rgba(255, 198, 43, .25), transparent 35%), linear-gradient(160deg, #041f36, #0a4f8a); color: #fff; overflow: hidden; }
body.tv #app { display: none; }
#tv { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 2.2vh 3vw; font-size: 1.6vw; }
.tv-haut { display: flex; align-items: center; gap: 1.5vw; }
.tv-haut .soleil { width: 4.5vh; height: 4.5vh; }
.tv-haut h1 { margin: 0; font-size: 2.4vw; text-transform: uppercase; flex: 1; }
.tv-haut h1 b { color: var(--soleil); }
.tv-haut .horloge { font-family: var(--police-titre); font-size: 2.4vw; font-weight: 800; }
.tv-haut .url { font-size: 1.1vw; color: #cfe0ef; }
.tv-haut button { background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-radius: 1vw; padding: .6vw 1vw; font-size: 1vw; cursor: pointer; }
.tv-barre { height: .5vh; background: rgba(255, 255, 255, .15); border-radius: 1vh; margin: 1.5vh 0; overflow: hidden; }
.tv-barre div { height: 100%; background: var(--soleil); width: 0; }
.tv-diapo { flex: 1; min-height: 0; animation: tv-entree .5s ease; display: flex; flex-direction: column; }
.tv-diapo.sans-anim { animation: none; }
.tv-diapo h2 { margin: 0 0 1.5vh; font-size: 3.2vw; text-transform: uppercase; }
.tv-diapo h2 small { font-size: 1.4vw; color: #cfe0ef; font-family: var(--police); font-weight: 600; text-transform: none; margin-left: 1vw; }
.tv-colonnes { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5vw; flex: 1; min-height: 0; }
.tv-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8vh; }
.tv-liste li { display: flex; align-items: center; gap: 1.2vw; background: rgba(255, 255, 255, .08); border-radius: 1vw; padding: .9vh 1.2vw; }
.tv-liste li.nc { opacity: .5; }
.tv-liste .rang { color: #fff; font-size: 2vw; width: 3vw; }
.tv-liste .medaille { width: 3.2vw; height: 3.2vw; font-size: 1.5vw; }
.tv-liste .avatar { width: 3.4vw; height: 3.4vw; font-size: 1.3vw; }
.tv-liste .nom { flex: 1; font-size: 2vw; font-weight: 700; }
.tv-liste .nom small { display: block; font-size: 1.1vw; color: #cfe0ef; font-weight: 500; }
.tv-liste .val { font-family: var(--police-titre); font-weight: 800; font-size: 2.6vw; color: var(--soleil); }
.tv-liste.compacte li { padding: .6vh 1vw; }
.tv-liste.compacte .nom { font-size: 1.6vw; }
.tv-liste.compacte .val { font-size: 2vw; }
.tv-resultats li { font-size: 1.7vw; }
.tv-resultats .quand { color: #cfe0ef; font-size: 1.2vw; min-width: 8vw; }
.tv-trophees { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4vw; }
.tv-trophees .t { background: rgba(255, 255, 255, .08); border-radius: 1.2vw; padding: 1.6vh 1.2vw; }
.tv-trophees .emo { font-size: 3.4vw; }
.tv-trophees h3 { margin: .5vh 0; font-size: 1.8vw; }
.tv-trophees .qui { font-size: 1.6vw; font-weight: 700; color: var(--soleil); }
.tv-trophees small { font-size: 1.05vw; color: #cfe0ef; }
.tv-pied { display: flex; justify-content: space-between; font-size: 1.1vw; color: #cfe0ef; margin-top: 1vh; }
@media (orientation: portrait) {
  #tv { font-size: 3vw; }
  .tv-colonnes { grid-template-columns: 1fr; }
  .tv-trophees { grid-template-columns: 1fr 1fr; }
}

/* 14. Animations ---------------------------------------------------------- */
@keyframes toast-entree { from { opacity: 0; transform: translateY(-10px); } }
/* Pas d'animation d'opacité en mode TV : si le navigateur met les animations en pause
   (onglet en arrière-plan sur certains boîtiers), l'écran resterait vide. */
@keyframes tv-entree { from { transform: translateX(1.5vw); } }
@keyframes flash-monte { 0% { background: rgba(31, 138, 76, .25); } 100% { background: var(--carte); } }
@keyframes flash-descend { 0% { background: rgba(200, 50, 42, .18); } 100% { background: var(--carte); } }
.ligne.anim-monte { animation: flash-monte 1.6s ease; }
.ligne.anim-descend { animation: flash-descend 1.6s ease; }
.soleil-anime { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 12px; background: var(--soleil); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.8); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Tablette et plus ----------------------------------------------------------- */
@media (min-width: 720px) {
  .pastilles { grid-template-columns: repeat(4, 1fr); }
  #fab { right: max(16px, calc(50vw - 380px + 16px)); }
}
