/* VOICE: outil de vestiaire, simple et rapide au doigt
   IDEA: une app mobile de club — gazon, maillots, feuille de match
   PICTURE: le terrain et la feuille d'équipes « soir de match »
   COLOUR and TYPE: vert gazon profond, encre presque noire, blanc ; police système
   LAYOUT: une colonne, cartes arrondies, barre d'onglets en bas */
:root {
  color-scheme: light dark;
  --bg: #f3f5f4; --card: #ffffff; --ink: #0f1a14; --muted: #5b6b62; --line: #e2e8e4; --soft: #eef3f0;
  /* Contraste AA (4,5:1) : --green sur blanc 5,4:1 (texte, liens) ; --green-ink sur --green 5,4:1 (boutons) */
  --green: #147a3b; --green-d: #0d3b23; --green-ink: #ffffff; --red: #c62828; --amber: #b45309;
  --team-a: #1d4ed8; --team-b: #dc2626; --radius: 18px;
  --shadow: 0 1px 2px rgb(15 26 20 / .04), 0 3px 12px -8px rgb(15 26 20 / .12);
  --shadow-lift: 0 2px 4px rgb(15 26 20 / .05), 0 10px 24px -14px rgb(15 26 20 / .24);
  --s1: #2a78d6; --s2: #eb6834; --grid: #e6ebe8;
  /* Mouvement : sortie douce, et un léger rebond pour ce qui « arrive » */
  --ease: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1210; --card: #161d19; --ink: #edf3ef; --muted: #9aaba1; --line: #26302a; --soft: #1d2621;
    --green: #22c55e; --green-d: #08261a; --green-ink: #052e16; /* texte foncé sur le vert vif : 6,5:1 (le blanc n'avait que 2,3:1) */ --red: #f87171; --amber: #fbbf24;
    --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lift: 0 14px 34px -12px rgb(0 0 0 / .75); --s1: #3987e5; --s2: #d95926; --grid: #26302a;
  }
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-tap-highlight-color: transparent; }
::selection { background: color-mix(in srgb, var(--green) 24%, var(--card)); color: var(--ink); }
input, textarea { caret-color: var(--green); }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; overflow-x: clip; }
a { color: var(--green); }
.plain { color: inherit; text-decoration: none; }

/* Barre du haut */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); color: #fff;
  background: linear-gradient(120deg, #0b3320 0%, #0d3b23 45%, #14532d 100%); box-shadow: 0 8px 24px -14px rgb(0 0 0 / .6); }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.brand img { transition: transform .6s var(--spring); }
#nav { display: flex; gap: 6px; }
.rolechip { color: #fff; text-decoration: none; font-size: 14px; font-weight: 700; padding: 7px 12px; border-radius: 999px; background: #2f5642; white-space: nowrap;
  border: 1px solid rgb(255 255 255 / .12); transition: background .2s, transform .2s var(--ease); }

/* Barre d'onglets du bas */
.tabbar[hidden], [hidden] { display: none !important; }
.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: var(--card);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; min-height: 48px; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; border-radius: 12px; transition: color .2s; }
.tabbar svg { box-sizing: content-box; padding: 3px 16px; border-radius: 999px; transition: background-color .25s, transform .25s var(--spring); }
.tabbar a.active { color: var(--green); }
.tabbar .dot { position: absolute; top: 2px; inset-inline-start: calc(50% + 10px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.tabbar a.active svg { stroke-width: 2.4; background: color-mix(in srgb, var(--green) 15%, transparent); }
.tabbar a:active svg { transform: scale(.9); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 10px 0 16px; }
h2 { font-size: 1.08rem; margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s; }
details.card > summary { list-style: none; } details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '›'; float: inline-end; transform: rotate(90deg); color: var(--muted); font-size: 20px; line-height: 1; transition: transform .25s var(--ease), color .2s; }
details.card[open] > summary::after { transform: rotate(-90deg); }
summary { cursor: pointer; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 13.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }
.grow { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
a.grow:hover strong { text-decoration: underline; }

/* Boutons et champs : cibles de 44 px */
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; padding: 10px 16px; border-radius: 12px;
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  transition: transform .18s var(--ease), background-color .2s, border-color .2s, box-shadow .2s, filter .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 55%, transparent); outline-offset: 2px; }
input, select, textarea { font: inherit; font-size: 16px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); width: 100%;
  transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; min-height: 96px; }
:is(input:not([type=range], [type=radio], [type=checkbox], [type=color]), select, textarea):focus-visible {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 20%, transparent); }
select.compact { width: auto; min-height: 38px; padding: 6px 8px; }
label { font-size: 14px; font-weight: 650; display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.open { background: #dbeafe; color: #1e40af; } .badge.voting { background: #fef3c7; color: #92400e; }
.badge.validated, .badge.played { background: #dcfce7; color: #166534; } .badge.pending { background: #fef3c7; color: #92400e; }
.badge.blocked { background: #fee2e2; color: #991b1b; } .badge.admin, .badge.super_admin { background: #ede9fe; color: #5b21b6; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
/* Prochains matchs : le titre garde sa largeur, les boutons de présence passent à la ligne sur mobile */
.upcoming li > a.grow { flex: 1 1 210px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--green) 18%, var(--card)); display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: color-mix(in srgb, var(--green) 70%, var(--ink)); flex: none; object-fit: cover; }
.avatar-image { overflow: hidden; background: transparent; }
.avatar-svg { display: block; flex: none; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.avatar-choice { min-block-size: 112px; display: grid; place-items: center; gap: 6px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-align: center; }
.avatar-choice:has(input:checked) { border-color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--card)); }
.avatar-choice input { position: absolute; opacity: 0; }
.avatar-choice:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.level-choice { min-block-size: 64px; display: grid; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-align: center; }
.level-choice:has(input:checked) { border-color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--card)); }
.level-choice input { position: absolute; opacity: 0; }
.level-choice:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; }
.rating { display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; align-items: center; gap: 8px; padding: 6px 0; }
.rating input[type=range] { padding: 0; min-height: 0; border: 0; background: none; accent-color: var(--green); }
.rating output { font-weight: 800; text-align: end; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.tab { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { font: inherit; font-weight: 650; font-size: 14px; border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 9px; cursor: pointer; min-height: 38px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.pitch-wrap { border-radius: 14px; overflow: hidden; background: #2f7d3a; }
.pitch { display: block; width: 100%; height: auto; }
.teams-sum { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 10px 0; }
.team-box { border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.team-box strong { display: block; }
.warn, .ok { --tone: var(--amber); background: color-mix(in srgb, var(--tone) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--line)); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.warn { text-decoration: none; } .ok { --tone: var(--green); }
.provider { gap: 10px; } .provider svg { width: 20px; height: 20px; }
/* Connexion : bouton visiblement inactif tant que les conditions ne sont pas acceptées (cliquable pour expliquer pourquoi) */
.is-off { opacity: .5; cursor: not-allowed; filter: grayscale(.6); }
.check.remember { align-items: flex-start; } .check.remember input { flex: none; width: 18px; height: 18px; padding: 0; margin: 2px 0 0; }
.tourlink { background: none; border-style: dashed; color: var(--green); font-weight: 650; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 18px) scale(.96); background: rgb(17 17 17 / .92); color: #fff;
  padding: 11px 18px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; max-width: 90vw; z-index: 30;
  box-shadow: 0 14px 30px -12px rgb(0 0 0 / .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity .25s var(--ease), transform .4s var(--spring); }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.share { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.linkbox { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; background: var(--soft); padding: 10px; border-radius: 10px; }
.vote-bar { height: 6px; background: var(--soft); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.vote-bar span { display: block; height: 100%; background: var(--green); }
.order li { padding: 8px 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .2s, background-color .2s; }
.choice input { width: auto; min-height: 0; margin-top: 4px; accent-color: var(--green); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
/* État vide : message, puis l'action directe */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 4px 0; } .empty p { margin: 0; }
/* Nombre suivi de son unité (« 12 joueurs », « 12 heures ») */
.unit { display: flex; align-items: center; gap: 8px; } .unit input { flex: 1; min-width: 0; } .unit span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.check { display: flex; gap: 6px; align-items: center; font-weight: 400; font-size: 14px; margin: 0; }
.check input { width: auto; min-height: 0; accent-color: var(--green); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: end; white-space: nowrap; }
.table th { font-size: 13px; color: var(--muted); font-weight: 650; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; text-align: center; font-weight: 750; }
.scoreboard strong { display: inline-block; font-size: 34px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rolecard { display: flex; gap: 14px; align-items: center; width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.rolecard.current { border-color: var(--green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 30%, transparent); }
.roleicon { font-size: 30px; }
.pospick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.posopt { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 650; font-size: 14px; }
.posopt span { min-width: 34px; } .posopt select { padding: 8px 4px; }
.chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.chip { margin: 0; } .chip input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.chip span { display: flex; align-items: center; justify-content: center; height: 44px; border: 1px solid var(--line); border-radius: 12px; font-weight: 800; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--spring); }
.chip input:checked + span { background: var(--green); border-color: var(--green); color: var(--green-ink); transform: scale(1.05); }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--green) 55%, transparent); }
.install { display: flex; align-items: center; gap: 12px; background: linear-gradient(120deg, color-mix(in srgb, var(--green) 14%, var(--card)), var(--card)); }
.install-ico { font-size: 26px; }

/* Statistiques */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 650; }
.tile-val { font-size: 30px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-val.small-val { font-size: 17px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { font-size: 13px; color: var(--muted); }
.chart { position: relative; height: 220px; }
.chart svg { display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-dasharray: 1; } /* pathLength=1 : tracé animable */
.chart .dot1 { fill: var(--s1); stroke: var(--card); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; top: 4px; width: 170px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); pointer-events: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mk { width: 3px; height: 14px; border-radius: 2px; display: inline-block; }
.sw.s1, .hbar-fill.s1 { background: var(--s1); } .mk.s2, .hbar-mark.s2 { background: var(--s2); }
.hbar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px; gap: 10px; align-items: center; padding: 6px 0; }
.hbar-label { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.hbar:has(.hbar-label.wide) { grid-template-columns: 110px minmax(0, 1fr) 56px; }
.hbar-track { position: relative; height: 14px; background: var(--soft); border-radius: 4px; }
.hbar-fill { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.hbar-mark { position: absolute; top: -3px; bottom: -3px; width: 4px; border-radius: 2px; box-shadow: 0 0 0 2px var(--card); }
.hbar-val { text-align: end; font-weight: 750; font-size: 14px; white-space: nowrap; }

/* Arbitre */
.referee-card .whistle { display: inline-flex; width: 40px; height: 40px; border-radius: 12px; align-items: center; justify-content: center; background: #111827; color: #facc15; }

/* Feuille d'équipes « soir de match » */
.board { position: relative; border-radius: 18px; padding: 14px 10px 12px; color: #f8fafc; overflow: hidden; margin-bottom: 10px;
  background: radial-gradient(120% 60% at 50% -10%, rgb(125 175 255 / .35), transparent 60%), radial-gradient(60% 40% at 0% 0%, rgb(255 255 255 / .15), transparent 70%),
    radial-gradient(60% 40% at 100% 0%, rgb(255 255 255 / .15), transparent 70%), linear-gradient(180deg, #0b1733 0%, #0a1430 55%, #0c3a1f 100%); }
.board::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: repeating-linear-gradient(90deg, #14532d 0 18px, #166534 18px 36px); opacity: .6; }
.ref-banner { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; justify-content: center; margin: 0 auto 12px; padding: 8px 14px;
  width: fit-content; max-width: 100%; background: #0b0f1a; border: 1px solid #e8c15a; border-radius: 12px; box-shadow: 0 0 18px rgb(232 193 90 / .25); }
.ref-banner .whistle { color: #facc15; display: inline-flex; }
.ref-banner small { display: block; font-size: 11px; letter-spacing: .04em; color: #e8c15a; font-weight: 700; }
.ref-banner strong { font-size: 15px; }
.panels { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding-bottom: 18px; }
.panel { background: linear-gradient(180deg, rgb(15 23 42 / .92), rgb(15 23 42 / .82)); border: 1px solid rgb(232 193 90 / .55); border-top: 4px solid var(--team); border-radius: 12px; padding: 8px 8px 10px; }
.panel h3 { margin: 2px 2px 6px; font-size: 16px; font-weight: 900; letter-spacing: .01em; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.panel h3 span { font-size: 11px; font-weight: 700; color: #cbd5e1; }
.line-label { color: #e8c15a; font-size: 11px; font-weight: 800; letter-spacing: .06em; margin: 8px 2px 2px; padding-bottom: 2px; border-bottom: 1px solid rgb(232 193 90 / .45); }
.pl { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid rgb(148 163 184 / .15); }
.pl:last-child { border-bottom: 0; }
.jn { flex: none; width: 30px; } .jersey { width: 30px; height: 27px; display: block; }
.pn { font-size: 13.5px; font-weight: 700; line-height: 1.15; overflow: hidden; }
.pn small { display: block; font-size: 10.5px; font-weight: 600; color: #94a3b8; }
.pl.sub .pn { color: #cbd5e1; font-weight: 600; }
.cap { display: inline-block; background: #facc15; color: #111; border-radius: 50%; width: 16px; height: 16px; font-size: 10px; line-height: 16px; text-align: center; }
@media (min-width: 640px) { .pn { font-size: 15px; } .jn, .jersey { width: 36px; } .jersey { height: 32px; } }

/* ======================================================================
   Animations et finitions
   - Entrée de page en cascade : seulement quand on change de page (#app.enter, posée puis retirée par app.js),
     jamais après une simple action, pour ne pas rejouer les animations à chaque clic.
   - Feuille de match et terrain : joueurs qui entrent en place (.swap = changement de proposition ou de vue).
   - Tout est désactivé si le système demande de réduire les animations.
   ====================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.99); } }
@keyframes fade { from { opacity: 0; } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.3); } 70% { opacity: 1; transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(var(--from, -14px)); } }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes glow { 50% { box-shadow: 0 0 34px rgb(232 193 90 / .6); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(16deg); } 40% { transform: rotate(-8deg); } 80% { transform: rotate(-4deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes field { to { background-position: 0 0, -56px 0; } }
@keyframes bounce { from { transform: translateY(0) scaleY(.94); } 12% { transform: translateY(-4px) scaleY(1); } to { transform: translateY(-52px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shadow { to { transform: scale(.5); opacity: .35; } }

/* Survol : seulement sur les appareils qui en ont un (pas d'effet « collé » au doigt) */
@media (hover: hover) {
  .btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
  .btn.primary:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), 0 10px 20px -8px color-mix(in srgb, var(--green) 75%, transparent); }
  .rolecard:hover, a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
  .list li:has(> a.grow):hover { background: var(--soft); border-bottom-color: transparent; border-radius: 12px; }
  .tab:hover:not(.active) { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
  .rolechip:hover { background: #426653; }
  .brand:hover img { transform: rotate(-20deg) scale(1.08); }
  details.card > summary:hover::after { color: var(--green); }
}
.list li:has(> a.grow) { margin-inline: -10px; padding-inline: 10px; transition: background-color .2s; }
.tab, .seg button { transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s; }
.choice:has(input:checked) { border-color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--card)); }
details.card[open] > :not(summary) { animation: rise .3s var(--ease) both; }
/* Ouverture en douceur des volets, là où le navigateur sait animer la hauteur */
@supports (interpolate-size: allow-keywords) and selector(::details-content) {
  :root { interpolate-size: allow-keywords; }
  details.card::details-content { block-size: 0; overflow: clip; transition: block-size .3s var(--ease), content-visibility .3s allow-discrete; }
  details.card[open]::details-content { block-size: auto; }
}

/* Badges lisibles en mode sombre ; point qui pulse pendant un vote */
@media (prefers-color-scheme: dark) {
  .badge.open { background: #1d2f41; color: #93c5fd; }
  .badge.voting, .badge.pending { background: #3e3417; color: #fcd34d; }
  .badge.validated, .badge.played { background: #183b25; color: #86efac; }
  .badge.blocked { background: #3d2421; color: #fca5a5; }
  .badge.admin, .badge.super_admin { background: #2d2a45; color: #c4b5fd; }
}
.badge.voting::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-inline-end: 5px; vertical-align: 1px; border-radius: 50%;
  background: currentColor; }
@media (prefers-reduced-motion: no-preference) { .badge.voting::before { animation: pulse 1.6s ease-in-out infinite; } }

/* Chargement : barre fine en haut, page atténuée ; squelette au premier affichage */
#progress { position: fixed; top: env(safe-area-inset-top, 0); left: 0; right: 0; height: 3px; z-index: 40; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s; }
#progress::before { content: ''; position: absolute; inset: 0; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #4ade80, #facc15, transparent); animation: progress 1.1s var(--ease) infinite paused; }
body.busy #progress { opacity: 1; }
body.busy #progress::before { animation-play-state: running; }
#app { transition: opacity .2s; }
body.busy #app { opacity: .6; }
.sk { border-radius: var(--radius); margin-bottom: 12px; background: linear-gradient(90deg, var(--soft) 25%, color-mix(in srgb, var(--soft) 35%, var(--card)) 50%, var(--soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk-title { height: 30px; width: 55%; border-radius: 10px; margin: 8px 0 16px; } .sk-card { height: 120px; } .sk-card.short { height: 76px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Entrée de page : les blocs arrivent en cascade, puis les lignes des listes */
#app.enter > * { animation: rise .45s var(--ease) both; }
#app.enter > :nth-child(2) { animation-delay: 40ms; } #app.enter > :nth-child(3) { animation-delay: 80ms; }
#app.enter > :nth-child(4) { animation-delay: 120ms; } #app.enter > :nth-child(5) { animation-delay: 160ms; }
#app.enter > :nth-child(6) { animation-delay: 200ms; } #app.enter > :nth-child(7) { animation-delay: 240ms; }
#app.enter > :nth-child(n+8) { animation-delay: 280ms; }
#app.enter .list > li { animation: rise .4s var(--ease) both; animation-delay: 140ms; }
#app.enter .list > li:nth-child(2) { animation-delay: 170ms; } #app.enter .list > li:nth-child(3) { animation-delay: 200ms; }
#app.enter .list > li:nth-child(4) { animation-delay: 230ms; } #app.enter .list > li:nth-child(n+5) { animation-delay: 260ms; }
#app.enter .wave { display: inline-block; transform-origin: 70% 80%; animation: wave 1.4s ease-in-out .35s 1; }

/* Barres (votes, statistiques) qui se remplissent ; courbe qui se trace ; points qui apparaissent */
#app.enter :is(.vote-bar span, .hbar-fill) { transform-origin: left; animation: grow-x .9s var(--ease) .25s both; }
#app.enter .hbar-mark { animation: fade .4s ease .85s both; }
#app.enter .chart .line { animation: draw 1.2s var(--ease) .15s both; }
#app.enter .chart .dot1 { animation: pop .45s var(--spring) both; animation-delay: calc(250ms + var(--d, 0) * 70ms); }
#app.enter .tile { animation: rise .45s var(--ease) both; }
#app.enter .tile:nth-child(2) { animation-delay: 70ms; } #app.enter .tile:nth-child(3) { animation-delay: 140ms; }

/* Score final */
#app.enter .scoreboard strong { animation: pop .6s var(--spring) .1s both; }

/* Feuille de match : les joueurs entrent par leur côté ; terrain : chaque joueur arrive à sa place */
:is(#app.enter, .swap) .panel .pl { animation: slide-in .42s var(--ease) both; animation-delay: calc(90ms + var(--d, 0) * 35ms); }
:is(#app.enter, .swap) .panel + .panel .pl { --from: 14px; }
:is(#app.enter, .swap) .ref-banner { animation: rise .4s var(--ease) both, glow 1.6s ease-in-out .4s 2; }
.pitch .pm { transform-box: fill-box; transform-origin: 50% 30%; }
:is(#app.enter, .swap) .pitch .pm { animation: pop .5s var(--spring) both; animation-delay: calc(120ms + var(--d, 0) * 45ms); }
.swap + .teams-sum { animation: rise .4s var(--ease) .2s both; }

/* Connexion : un ballon qui rebondit sur un gazon qui défile */
.login { max-width: 420px; margin: 18px auto 30px; }
@media (max-width: 480px) { .login { margin-top: 6px; } .login .hero { height: 122px; } .login .ball { bottom: 16px; width: 46px; height: 46px; margin-left: -23px; } .login .ball-shadow { bottom: 12px; } }
.login .card { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; margin: 0; }
.hero { position: relative; height: 150px; overflow: hidden; border-radius: 22px 22px 0 0;
  background: radial-gradient(90% 70% at 50% 0%, rgb(255 255 255 / .18), transparent 70%), repeating-linear-gradient(90deg, #1d6b31 0 28px, #22783a 28px 56px);
  animation: field 1.4s linear infinite; }
.hero::after { content: ''; position: absolute; inset: auto 0 0; height: 40px; background: linear-gradient(0deg, rgb(0 0 0 / .18), transparent); }
.ball { position: absolute; left: 50%; bottom: 30px; width: 54px; height: 54px; margin-left: -27px; z-index: 1;
  animation: bounce .8s cubic-bezier(.2, .65, .35, 1) infinite alternate; }
.ball svg { display: block; width: 100%; height: 100%; animation: spin 1.4s linear infinite; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .25)); }
.ball-shadow { position: absolute; left: 50%; bottom: 24px; width: 46px; height: 10px; margin-left: -23px; border-radius: 50%;
  background: rgb(0 0 0 / .35); filter: blur(2px); animation: shadow .8s cubic-bezier(.2, .65, .35, 1) infinite alternate; }

/* Réduire les animations (réglage du système) : tout devient instantané, le ballon s'arrête */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Votes personnalisés : résultats (admins seulement) */
.pollres { display: grid; gap: 8px; margin: 8px 0; }
.pollopt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.pollbar { flex: 1 0 100%; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pollbar > span { display: block; height: 100%; border-radius: 4px; background: var(--green); }

/* Langue (fr / en / ar) : sélecteur dans la barre du haut ; arabe de droite à gauche (dir="rtl" sur <html>, core/i18n.js) */
.lang { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; border-radius: 10px; background: rgb(255 255 255 / .12); color: #fff; border: 1px solid rgb(255 255 255 / .25); margin-inline-start: auto; }
.lang option { color: var(--ink); background: var(--card); }
[dir=rtl] body { font-family: system-ui, 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'Geeza Pro', sans-serif; }
[dir=rtl] .flip, [dir=rtl] details.card > summary::after { display: inline-block; }
[dir=rtl] .flip { transform: scaleX(-1); }
[dir=rtl] :is(#app.enter, .swap) .panel .pl { --from: 14px; }
[dir=rtl] :is(#app.enter, .swap) .panel + .panel .pl { --from: -14px; }
[dir=rtl] #progress { transform: scaleX(-1); }
[dir=rtl] #app.enter :is(.vote-bar span, .hbar-fill) { transform-origin: right; }

/* Admin plateforme : portée des drapeaux et modifications groupées, mobile et RTL */
.platform-scope-label { display: block; margin-block: 10px 4px; font-weight: 700; }
.platform-feature-scope { display: block; width: 100%; min-height: 44px; padding: 8px 10px; }
.platform-select-all { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-block: 10px; }
.platform-feature-list li { justify-content: flex-start; }
.platform-feature-option { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 44px; padding-block: 7px; }
.platform-feature-option input, .platform-select-all input { flex: none; }
.platform-features [data-feature-dirty-status] { margin-block: 12px; }
.platform-features [data-feature-dirty-status][data-dirty="true"] { font-weight: 700; color: var(--warning, #a16207); }
@media (max-width: 390px) {
  .platform-features .btn { width: 100%; }
  .platform-feature-scope { font-size: 16px; }
}
