:root {
  --fond: #f6f4ef;
  --carte: #ffffff;
  --texte: #1f1d1a;
  --doux: #6b665e;
  --trait: #e4e0d7;
  --accent: #2f5d50;
  --accent-texte: #ffffff;
  --alerte: #a3442f;
  --rayon: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #1b1a18;
    --carte: #252421;
    --texte: #ece8e1;
    --doux: #a39d93;
    --trait: #38352f;
    --accent: #7fb3a3;
    --accent-texte: #10201b;
    --alerte: #e08a74;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 680px; margin: 0 auto; padding: 0 16px 40px; }

.entete {
  max-width: 680px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: calc(18px + env(safe-area-inset-top)) 16px 14px;
}
.marque { font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; color: var(--texte); text-decoration: none; }
.entete nav a { color: var(--doux); text-decoration: none; font-size: .95rem; }

.carte {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 18px;
  margin-bottom: 16px;
}
.carte.etroite { max-width: 440px; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: .9rem; color: var(--doux); font-weight: 600; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .04em; }

.titre-section { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.compteur {
  font-size: .85rem; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.compteur.epuise { background: color-mix(in srgb, var(--alerte) 14%, transparent); color: var(--alerte); }

input[type=url], input[type=password], input[type=text] {
  width: 100%; font: inherit; font-size: 16px;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--trait); background: var(--fond); color: var(--texte);
}
label { display: block; margin-bottom: 6px; color: var(--doux); font-size: .9rem; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

button, .bouton {
  display: inline-block; font: inherit; font-weight: 600; text-align: center; text-decoration: none;
  border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer;
  background: var(--accent); color: var(--accent-texte);
}
button.secondaire, .bouton.secondaire {
  background: transparent; color: var(--texte); border: 1px solid var(--trait);
}
.lien-bouton {
  background: none; border: 0; padding: 4px 0; color: var(--doux);
  font-weight: 400; font-size: .85rem; text-decoration: underline;
}
.boutons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.boutons > form { margin: 0; }
.boutons.colonne { flex-direction: column; }
.boutons.colonne button { width: 100%; }
form.lien .boutons button { flex: 1 1 200px; }
.carte.etroite form button[type=submit] { width: 100%; margin-top: 12px; }

.videos { list-style: none; margin: 14px 0 0; padding: 0; }
.videos li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--trait);
}
.videos li:first-child { border-top: 0; }
.video { display: flex; align-items: center; gap: 12px; color: var(--texte); text-decoration: none; min-width: 0; flex: 1; }
.video span { min-width: 0; overflow-wrap: anywhere; }
.video small { display: block; color: var(--doux); font-size: .8rem; margin-top: 2px; }
.vignette { width: 112px; height: 63px; object-fit: cover; border-radius: 8px; flex: none; background: var(--trait); }
.grande-vignette { width: 100%; height: auto; border-radius: 10px; margin-bottom: 12px; background: var(--trait); }
.vignette.verrouillee { filter: grayscale(1) blur(2px); opacity: .45; }
.videos.attente li { flex-wrap: wrap; }
.actions { display: flex; gap: 16px; justify-content: flex-end; width: 100%; }
.actions form { margin: 0; }

details { margin-top: 14px; }
summary { cursor: pointer; color: var(--doux); }
ol { padding-left: 1.3em; }
ol li { margin: 4px 0; }
code { font-size: .85em; overflow-wrap: anywhere; }

.message {
  background: var(--carte); border: 1px solid var(--trait); border-left: 4px solid var(--accent);
  padding: 12px 14px; border-radius: 10px; margin: 0 0 16px;
}
.note { color: var(--doux); font-size: .85rem; }
.vide { color: var(--doux); margin: 4px 0 0; }
.ouvert { font-size: 1.05rem; margin: 0 0 6px; }
.ouvert strong { font-variant-numeric: tabular-nums; }
.retour a { color: var(--doux); }

.lecteur { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--rayon); overflow: hidden; }
.lecteur iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.journal { width: 100%; border-collapse: collapse; font-size: .85rem; }
.journal th, .journal td { text-align: left; padding: 5px 6px; border-top: 1px solid var(--trait); overflow-wrap: anywhere; }
.journal small { color: var(--doux); }

/* Ajouts : résumé, alertes, sas, règles, graphiques ---------------------- */
:root { --serie: #21825f; }
@media (prefers-color-scheme: dark) { :root { --serie: #3fae86; } }

.entete nav { display: flex; gap: 16px; }
.resume { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pastille {
  display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: .9rem;
  background: var(--carte); border: 1px solid var(--trait); color: var(--texte); text-decoration: none;
}
.pastille strong { font-variant-numeric: tabular-nums; }
.pastille small, .pastille.neutre { color: var(--doux); }
.alerte {
  background: color-mix(in srgb, var(--alerte) 12%, var(--carte));
  border: 1px solid color-mix(in srgb, var(--alerte) 40%, transparent);
  color: var(--texte); padding: 12px 14px; border-radius: 10px; margin: 0 0 16px;
}

.sas { text-align: center; }
.sas-compte { font-size: 3.2rem; font-weight: 700; margin: 8px 0; font-variant-numeric: tabular-nums; color: var(--accent); }
.sas form { margin-top: 10px; }
.sas button { width: 100%; }
button:disabled { opacity: .45; cursor: default; }
.pleine-largeur { width: 100%; }

.regles { margin-top: 12px; }
.regle {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--trait); margin: 0; color: var(--texte); font-size: 1rem;
}
.regle input { width: 90px; text-align: right; padding: 8px 10px; }
.champ-unite { display: flex; align-items: center; gap: 6px; }
.champ-unite small { color: var(--doux); width: 2.5em; }
input[type=number] {
  font: inherit; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--trait); background: var(--fond); color: var(--texte);
}
.interrupteur { display: flex; align-items: center; gap: 10px; color: var(--texte); font-size: 1rem; padding: 6px 0; }
.interrupteur input { width: 20px; height: 20px; accent-color: var(--accent); }
.interrupteur small { display: block; color: var(--doux); font-size: .78rem; }
.regles button[type=submit] { margin-top: 14px; width: 100%; }
.attente-regles ul { list-style: none; padding: 0; margin: 0; }
.attente-regles li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; }
.attente-regles small { display: block; color: var(--doux); }

.heros { text-align: center; }
.heros .chiffre { font-size: 3rem; font-weight: 700; margin: 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.heros p { margin: 4px 0; }
.heros small { color: var(--doux); }

.graphique { margin: 18px 0 0; }
.graphique figcaption { margin-bottom: 4px; }
.graphique svg { width: 100%; height: auto; display: block; overflow: visible; }
.graphique .barre { fill: var(--serie); }
.graphique .zone { fill: transparent; }
.graphique .colonne:hover .zone { fill: color-mix(in srgb, var(--texte) 6%, transparent); }
.graphique .base { stroke: var(--doux); stroke-width: 1; }
.graphique .grille { stroke: var(--trait); stroke-width: 1; stroke-dasharray: 2 3; }
.graphique .axe { fill: var(--doux); font-size: 11px; font-variant-numeric: tabular-nums; }
.tableau-defile { overflow-x: auto; }
.tableau-defile table { min-width: 460px; }
.tableau-defile th, .tableau-defile td { overflow-wrap: normal; white-space: nowrap; }
.videos li > span small { display: block; }
