/* Interface athlète et admin. Palette inspirée des disques de compétition sur un fond craie. */
:root {
  --craie: #ecece7;
  --surface: #ffffff;
  --graphite: #1e2227;
  --acier: #5e646b;
  --trait: #d3d4ce;
  --rouge: #c8202a;
  --bleu: #1b4c9c;
  --jaune: #e9b800;
  --vert: #2c7a3b;
  --condense: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, system-ui, sans-serif;
  --texte: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rayon: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--craie); color: var(--graphite);
  font: 16px/1.5 var(--texte);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--bleu); }
h1, h2, h3 { font-family: var(--condense); font-weight: 700; line-height: 1.1; margin: 0 0 .5rem; }
h1 { font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }

.entete {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.25rem; background: var(--graphite); color: #fff;
}
.entete a { color: #fff; text-decoration: none; }
.entete .marque { font-family: var(--condense); font-weight: 700; font-size: 1.2rem; }
.entete nav { display: flex; gap: 1rem; align-items: center; font-size: .95rem; }
.entete form { margin: 0; }
.entete button { background: none; border: 0; color: #c9ccd0; font: inherit; cursor: pointer; padding: 0; }

main { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
main.large { max-width: 60rem; }

.carte { background: var(--surface); border-radius: var(--rayon); padding: 1.25rem; margin-bottom: 1rem; }
.discret { color: var(--acier); font-size: .92rem; }

/* Sections du formulaire : une bande de couleur par mouvement, comme un disque sur la barre */
.section { background: var(--surface); border-radius: var(--rayon); padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1rem; border-left: 6px solid var(--trait); }
.section[data-couleur="rouge"] { border-left-color: var(--rouge); }
.section[data-couleur="bleu"] { border-left-color: var(--bleu); }
.section[data-couleur="jaune"] { border-left-color: var(--jaune); }
.section[data-couleur="vert"] { border-left-color: var(--vert); }

label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.champ { margin-bottom: 1rem; }
.champ:last-child { margin-bottom: 0; }
.aide { font-weight: 400; color: var(--acier); font-size: .85rem; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; font: inherit; font-size: 16px; /* 16px évite le zoom automatique sur iPhone */
  padding: .65rem .75rem; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: #fbfbf9; color: var(--graphite);
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--bleu); outline-offset: 1px; border-color: transparent; }
input.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; font-size: 1.2rem; text-align: center; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 1rem var(--texte); padding: .75rem 1.2rem; border-radius: var(--rayon);
  border: 2px solid var(--graphite); background: var(--graphite); color: #fff;
  cursor: pointer; text-decoration: none; min-height: 48px;
}
.bouton:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; }
.bouton.secondaire { background: transparent; color: var(--graphite); }
.bouton.danger { background: transparent; color: var(--rouge); border-color: var(--rouge); }
.bouton.whatsapp { background: #1f7a4d; border-color: #1f7a4d; }
.bouton.plein { width: 100%; }
.bouton[disabled] { opacity: .45; cursor: not-allowed; }
.bouton.petit { padding: .4rem .75rem; min-height: 36px; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
form.en-ligne { display: inline; margin: 0; }

.alerte { padding: .8rem 1rem; border-radius: var(--rayon); margin-bottom: 1rem; background: #e2ecdf; color: #1d4d27; }
.alerte.erreur { background: #f6dcdc; color: #7c1219; }
.alerte.info { background: #dfe6f2; color: #173a73; }

/* Liste des retours */
.retour { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface); border-radius: var(--rayon); padding: 1rem 1.25rem; margin-bottom: .6rem; }
.retour h3 { margin: 0 0 .15rem; }
.retour .actions { flex-shrink: 0; }
.vide { text-align: center; padding: 2.5rem 1rem; }

.pastille { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 99px; background: var(--craie); color: var(--acier); }
.pastille.attente { background: #fff3c4; color: #6b5400; }
.pastille.erreur { background: #f6dcdc; color: #7c1219; }

/* Zone d'envoi vidéo */
.envoi { margin-top: 1rem; border-top: 1px dashed var(--trait); padding-top: 1rem; }
.envoi-entete { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .6rem; }
.envoi-entete strong { font-size: .95rem; }
.envoi-liste { list-style: none; margin: 0 0 .75rem; padding: 0; }
.envoi-liste li { display: grid; grid-template-columns: 56px 1fr auto; gap: .75rem; align-items: center;
  padding: .5rem 0; border-bottom: 1px solid var(--craie); }
.envoi-liste .vignette { width: 56px; height: 56px; border-radius: 4px; background: var(--craie) center/cover; }
.envoi-liste .nom { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.envoi-liste .etat { font-size: .82rem; color: var(--acier); }
.envoi-liste li.a-supprimer .nom { text-decoration: line-through; color: var(--acier); }
.barre { height: 5px; background: var(--craie); border-radius: 3px; overflow: hidden; margin-top: .3rem; }
.barre > span { display: block; height: 100%; width: 0; background: var(--bleu); transition: width .2s; }
li.termine .barre > span { background: var(--vert); }
li.echec .barre > span { background: var(--rouge); }
.bouton-fichier { position: relative; overflow: hidden; }
.bouton-fichier input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.pied-formulaire { position: sticky; bottom: 0; background: var(--craie); padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom)); }
.pied-formulaire .discret { margin: .5rem 0 0; text-align: center; }

/* Partage */
.lien { display: block; word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: .9rem;
  background: var(--craie); padding: .75rem; border-radius: var(--rayon); margin-bottom: 1rem; }
.message { white-space: pre-wrap; background: #e7f3ec; border-radius: var(--rayon); padding: .9rem; margin-bottom: 1rem; }

/* Admin */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--craie); vertical-align: middle; }
th { font-size: .85rem; color: var(--acier); font-weight: 600; }
.tableau-defilant { overflow-x: auto; margin-bottom: 1.5rem; }
.jauge { height: 10px; background: var(--craie); border-radius: 5px; overflow: hidden; margin: .5rem 0; }
.jauge > span { display: block; height: 100%; background: var(--graphite); }
.jauge.pleine > span { background: var(--rouge); }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.code-affiche { font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; letter-spacing: .1em; margin: .3rem 0 .6rem; }
.limites { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }
.titre-page { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

@media (max-width: 520px) {
  .retour { flex-direction: column; align-items: stretch; }
  h1 { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
video.vignette { object-fit: cover; display: block; }
[hidden] { display: none !important; }
