/* ClipApp : styles de l'interface.
   Les tokens ci-dessous sont copiés tels quels de la charte UX/UI (section 08).
   Aucune autre couleur, taille ou durée n'est autorisée. */

:root {
  /* Couleurs - thème sombre (défaut) */
  --bg: #000000; --surface: #1C1C1E; --surface-2: #2C2C2E;
  --line: #3A3A3C; --text: #FFFFFF; --text-muted: #8E8E93;
  --positive: #00C46A; --negative: #FF453A; --warning: #FFB020;
  /* Typographie */
  --font: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-display: 48px; --fs-h1: 32px; --fs-h2: 22px; --fs-body: 16px; --fs-caption: 13px;
  --fw-regular: 400; --fw-semibold: 600; --fw-bold: 700;
  /* Espacements (base 4 px) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-6: 24px; --s-8: 32px; --s-12: 48px; --s-16: 64px;
  /* Formes et mouvement */
  --r-pill: 999px; --r-card: 16px; --r-field: 12px;
  --h-button: 52px; --h-touch: 44px; --content-max: 720px;
  --t-fast: 150ms ease-out; --t-base: 250ms ease-out;
}

/* Thème clair : suit le système, sauf si l'utilisateur a forcé le sombre. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #FFFFFF; --surface: #F5F5F7; --surface-2: #E8E8ED; --line: #E5E5EA;
    --text: #0A0A0A; --text-muted: #6E6E73;
    --positive: #00A85A; --negative: #E5372C; --warning: #C98500;
  }
}

/* Thème clair forcé depuis les Réglages. */
:root[data-theme="light"] {
  --bg: #FFFFFF; --surface: #F5F5F7; --surface-2: #E8E8ED; --line: #E5E5EA;
  --text: #0A0A0A; --text-muted: #6E6E73;
  --positive: #00A85A; --negative: #E5372C; --warning: #C98500;
}

/* ---------------------------------------------------------------------------
   Valeurs dérivées des tokens (aucune nouvelle couleur : seulement des mélanges).
   --------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  /* Voile derrière une feuille du bas */
  --voile: color-mix(in srgb, var(--bg) 72%, transparent);
  /* Ombre très douce, tolérée en thème clair seulement */
  --ombre-claire: none;
  --h-navigation: var(--s-16);
  --l-navigation: calc(var(--s-16) + var(--s-8));
  /* Marge latérale mobile : 16 px, puis 20 px dès 390 px (charte, section 03) */
  --marge: var(--s-4);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --voile: color-mix(in srgb, var(--text) 40%, transparent);
    --ombre-claire: 0 0 var(--s-6) color-mix(in srgb, var(--text) 12%, transparent);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --voile: color-mix(in srgb, var(--text) 40%, transparent);
  --ombre-claire: 0 0 var(--s-6) color-mix(in srgb, var(--text) 12%, transparent);
}
@media (min-width: 390px) {
  :root { --marge: 20px; }
}

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: var(--fs-body); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Focus toujours visible au clavier (contour 2 px --text, charte section 04). */
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* Titres qui reçoivent le focus après un changement d'écran : pas de contour. */
[tabindex="-1"]:focus { outline: none; }

.num { font-variant-numeric: tabular-nums; }

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Lien « Aller au contenu », visible seulement au clavier. */
.lien-evitement {
  position: absolute; z-index: 30; top: var(--s-2); left: var(--marge);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-pill);
  background: var(--text); color: var(--bg); font-weight: var(--fw-semibold);
  transform: translateY(calc(-100% - var(--s-4)));
}
.lien-evitement:focus { transform: none; }

/* Icônes : trait de 1,5 px, linéaires, 24 px. */
.icone {
  width: var(--s-6); height: var(--s-6); flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.sprite { display: none; }

/* ---------------------------------------------------------------------------
   Typographie (charte section 02)
   --------------------------------------------------------------------------- */
.display {
  font-size: var(--fs-display); line-height: 52px;
  font-weight: var(--fw-bold); letter-spacing: -0.02em;
}
h1 {
  font-size: var(--fs-h1); line-height: 36px;
  font-weight: var(--fw-bold); letter-spacing: -0.01em;
}
h2 {
  font-size: var(--fs-h2); line-height: 28px;
  font-weight: var(--fw-semibold);
}
.legende {
  font-size: var(--fs-caption); line-height: 18px;
  color: var(--text-muted);
}
/* Libellé en petites capitales grises (au-dessus d'un chiffre ou d'une liste). */
.petites-capitales {
  font-size: var(--fs-caption); line-height: 18px; font-weight: var(--fw-semibold);
  color: var(--text-muted); text-transform: uppercase;
}
.texte-muet { color: var(--text-muted); }

/* Couleurs réservées aux états */
.positif { color: var(--positive); }
.negatif { color: var(--negative); }
.avertissement { color: var(--warning); }

/* ---------------------------------------------------------------------------
   Mise en page
   --------------------------------------------------------------------------- */
.page {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  max-width: var(--content-max); margin: 0 auto;
  padding: var(--s-8) var(--marge)
           calc(var(--h-navigation) + var(--s-8) + env(safe-area-inset-bottom));
}

.entete { display: grid; gap: var(--s-2); margin-bottom: var(--s-8); }

.section { margin-top: var(--s-8); }
.section > h2 { margin-bottom: var(--s-2); }
.zone > .section:first-child { margin-top: 0; }

/* Le bouton principal reste en bas de l'écran quand il y a peu de contenu. */
.action-principale { margin-top: auto; padding-top: var(--s-8); }

/* Lien de retour (Vidéos, Statistiques) */
.retour {
  display: inline-flex; align-items: center; gap: var(--s-1);
  width: fit-content; min-height: var(--h-touch);
  margin-left: calc(-1 * var(--s-2)); padding-right: var(--s-2);
  color: var(--text-muted); transition: color var(--t-fast);
}
@media (hover: hover) {
  .retour:hover { color: var(--text); }
}

/* ---------------------------------------------------------------------------
   Navigation : barre du bas (téléphone), barre latérale fine (900 px et plus)
   --------------------------------------------------------------------------- */
.navigation {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--h-navigation) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--line);
}
.navigation a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-1); min-height: var(--h-touch);
  font-size: var(--fs-caption); line-height: 18px;
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.navigation a[aria-current="page"] { color: var(--text); font-weight: var(--fw-semibold); }
/* Survol seulement avec une souris (sur téléphone, il resterait collé après un toucher). */
@media (hover: hover) {
  .navigation a:hover { color: var(--text); }
}
/* Contour de focus arrondi et à l'intérieur (sinon coupé par le bord de l'écran). */
.navigation a:focus-visible { outline-offset: calc(-1 * var(--s-1)); border-radius: var(--r-field); }

.avec-pastille { position: relative; display: inline-flex; }
.pastille {
  position: absolute; top: calc(-1 * var(--s-1)); left: calc(100% - var(--s-2));
  min-width: var(--s-4); height: var(--s-4); padding: 0 var(--s-1);
  border-radius: var(--r-pill);
  background: var(--text); color: var(--bg);
  font-size: var(--fs-caption); line-height: var(--s-4); font-weight: var(--fw-semibold);
  text-align: center;
}

@media (min-width: 900px) {
  .avec-navigation { padding-left: var(--l-navigation); }
  .navigation {
    top: 0; right: auto; width: var(--l-navigation); height: auto;
    display: flex; flex-direction: column; gap: var(--s-2);
    padding: var(--s-6) 0;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .navigation a { height: var(--s-16); }
  .page { padding-top: var(--s-12); padding-bottom: var(--s-12); }
}

/* ---------------------------------------------------------------------------
   Boutons : 52 px, pilule, pleine largeur sur mobile
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  width: 100%; height: var(--h-button); padding: 0 var(--s-6);
  border: 0; border-radius: var(--r-pill);
  font-size: var(--fs-body); font-weight: var(--fw-semibold);
  transition: transform var(--t-fast);
}
.btn:active { transform: scale(0.97); }
.btn-primary { height: var(--h-button); border-radius: var(--r-pill);
               background: var(--text); color: var(--bg); font-weight: var(--fw-semibold); }
.btn-secondaire { background: var(--surface-2); color: var(--text); }
.btn-destructif { background: transparent; color: var(--negative); }
@media (min-width: 900px) {
  .btn { width: auto; min-width: calc(var(--s-16) * 4); }
}
.boutons { display: grid; gap: var(--s-3); }

/* ---------------------------------------------------------------------------
   Listes : lignes de 64 px séparées par une ligne fine
   --------------------------------------------------------------------------- */
.liste > li + li { border-top: 1px solid var(--line); }

.ligne {
  display: flex; align-items: center; gap: var(--s-3);
  width: calc(100% + 2 * var(--s-3)); min-height: var(--s-16);
  margin: 0 calc(-1 * var(--s-3)); padding: var(--s-2) var(--s-3);
  border: 0; border-radius: var(--r-field);
  background: none; text-align: left;
}
a.ligne, button.ligne { transition: background var(--t-fast); }
@media (hover: hover) {
  a.ligne:hover, button.ligne:hover { background: var(--surface); }
}
.ligne > .icone { color: var(--text-muted); }

.ligne-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ligne-titre, .ligne-sous-titre {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ligne-titre { font-weight: var(--fw-semibold); }
.ligne-sous-titre { font-size: var(--fs-caption); line-height: 18px; color: var(--text-muted); }
.ligne-valeur {
  flex: none; font-size: var(--fs-caption); line-height: 18px;
  font-weight: var(--fw-semibold); color: var(--text-muted);
}
.ligne-valeur.positif { color: var(--positive); }
.ligne-valeur.negatif { color: var(--negative); }
.ligne-valeur.avertissement { color: var(--warning); }

.vignette {
  flex: none; width: var(--s-12); height: var(--s-12);
  border-radius: var(--r-field); background: var(--surface-2);
  object-fit: cover;
}

/* Vignettes des clips d'une vidéo (format 9:16) */
.vignettes {
  display: grid; gap: var(--s-2); margin-top: var(--s-2);
  grid-template-columns: repeat(auto-fill, minmax(var(--s-16), 1fr));
}
.vignettes button { display: block; width: 100%; padding: 0; border: 0; border-radius: var(--r-field); background: none; }
.vignettes img {
  display: block; width: 100%; aspect-ratio: 9 / 16;
  border-radius: var(--r-field); background: var(--surface-2); object-fit: cover;
}

/* Avertissements d'une vidéo (orange = avertissement) */
.avertissements { display: grid; gap: var(--s-2); color: var(--warning); }
.erreur-video { display: grid; gap: var(--s-2); }
.erreur-video summary {
  display: flex; align-items: center; min-height: var(--h-touch);
  color: var(--text-muted); cursor: pointer;
}
.erreur-video details p { overflow-wrap: anywhere; white-space: pre-wrap; }

/* Barre de progression (vidéos en cours) */
.progression {
  height: var(--s-1); margin-top: var(--s-2);
  border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden;
}
.progression > span {
  display: block; width: 0; height: 100%;
  background: var(--text); transition: width var(--t-base);
}

/* ---------------------------------------------------------------------------
   Chiffre clé
   --------------------------------------------------------------------------- */
.chiffre-cle { display: grid; gap: var(--s-1); }

/* Alertes de surveillance en haut de l'Accueil : texte court coloré, sans gros badge. */
.alertes { display: grid; gap: var(--s-2); margin-bottom: var(--s-8); }

/* ---------------------------------------------------------------------------
   Onglets : contrôle segmenté en pilule
   --------------------------------------------------------------------------- */
.onglets {
  display: flex; gap: var(--s-1); padding: var(--s-1);
  border-radius: var(--r-pill); background: var(--surface);
}
.onglet {
  position: relative; flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: var(--h-touch); padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text-muted);
  font-weight: var(--fw-semibold); cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
}
.onglet[aria-selected="true"],
.onglet:has(input:checked) { background: var(--surface-2); color: var(--text); }
/* Onglets faits de boutons radio (Réglages) : le rond est caché. */
.onglet input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.onglet:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }

/* Groupe de choix (fieldset) sans cadre */
.groupe { margin: 0; padding: 0; border: 0; min-width: 0; }
.groupe > legend { float: left; width: 100%; padding: 0; margin: 0 0 var(--s-2); }
.groupe > legend + * { clear: both; }
.groupe > .legende { margin-top: var(--s-2); }

/* Zone d'onglets suivie de son contenu */
.onglets + .zone { margin-top: var(--s-6); }

/* ---------------------------------------------------------------------------
   Champs
   --------------------------------------------------------------------------- */
.formulaire { display: grid; gap: var(--s-6); }
.champ { display: grid; gap: var(--s-2); }
.champ label { font-size: var(--fs-caption); line-height: 18px; color: var(--text-muted); }
.champ input {
  width: 100%; height: var(--h-button); padding: 0 var(--s-4);
  border: 0; border-radius: var(--r-field);
  background: var(--surface); color: var(--text);
}
.champ input:focus { outline: 2px solid var(--text); outline-offset: 0; }
.champ-erreur { font-size: var(--fs-caption); line-height: 18px; color: var(--negative); }

.champ select {
  width: 100%; height: var(--h-button); padding: 0 var(--s-4);
  border: 0; border-radius: var(--r-field);
  background: var(--surface); color: var(--text);
  font: inherit;
}
.champ select:focus { outline: 2px solid var(--text); outline-offset: 0; }

/* Dans une feuille (fond --surface), les champs passent sur --surface-2. */
.feuille .champ input,
.feuille .champ select { background: var(--surface-2); }

/* Zone de dépôt du fichier vidéo */
.depot {
  display: grid; gap: var(--s-1); justify-items: center; text-align: center;
  padding: var(--s-8) var(--s-4);
  border: 1px dashed var(--line); border-radius: var(--r-card);
  cursor: pointer; transition: background var(--t-fast);
}
.champ .depot { font-size: var(--fs-body); line-height: 1.5; color: var(--text); }
.depot.survol { background: var(--surface-2); }
@media (hover: hover) {
  .depot:hover { background: var(--surface-2); }
}
.depot-titre { font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
/* Le vrai champ fichier est caché : son focus clavier se voit sur la zone de dépôt. */
.champ:has(input[type="file"]:focus-visible) .depot { outline: 2px solid var(--text); outline-offset: 2px; }

/* Case à cocher (droits) */
.champ .case {
  display: flex; align-items: flex-start; gap: var(--s-3);
  min-height: var(--h-touch); font-size: var(--fs-body); line-height: 1.5; color: var(--text);
  cursor: pointer;
}
.case input {
  flex: none; width: var(--s-6); height: var(--s-6); margin: 0;
  accent-color: var(--text);
}

/* ---------------------------------------------------------------------------
   États : vide, erreur, squelettes
   --------------------------------------------------------------------------- */
.vide { display: grid; gap: var(--s-4); padding: var(--s-8) 0; }
.vide .btn { margin-top: var(--s-2); }
.vide-court { padding: var(--s-4) 0; color: var(--text-muted); }

.erreur { display: grid; gap: var(--s-4); padding: var(--s-8) 0; }
.erreur summary {
  display: flex; align-items: center; min-height: var(--h-touch);
  color: var(--text-muted); cursor: pointer;
}
.erreur details p { overflow-wrap: anywhere; }
/* Sur ordinateur, les boutons gardent leur largeur (comme sur l'Accueil). */
@media (min-width: 900px) {
  .vide, .erreur { justify-items: start; }
}

/* Squelettes : rectangles --surface qui pulsent doucement.
   La pulsation est volontairement lente (« doucement », charte section 04) :
   c'est la seule durée hors tokens, car 250 ms ferait clignoter. */
.squelette {
  display: block; border-radius: var(--r-field); background: var(--surface);
  animation: pulser 1.6s ease-in-out infinite;
}
.squelette-texte { width: 40%; height: var(--s-3); }
.squelette-texte.court { width: 25%; }
.squelette-chiffre { width: var(--s-16); height: var(--s-12); margin: var(--s-1) 0; }
.ligne .squelette-texte + .squelette-texte { margin-top: var(--s-2); }
@keyframes pulser { 50% { opacity: 0.5; } }

/* ---------------------------------------------------------------------------
   Feuille du bas
   --------------------------------------------------------------------------- */
.feuille {
  position: fixed; inset: auto 0 0 0;
  width: 100%; max-width: min(100%, var(--content-max));
  max-height: calc(100dvh - var(--s-12));
  margin: 0 auto; padding: 0; border: 0;
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: var(--surface); color: var(--text);
  box-shadow: var(--ombre-claire);
  overflow: auto;
}
.feuille::backdrop { background: var(--voile); }
.feuille[open] { animation: monter var(--t-base); }
.feuille[open]::backdrop { animation: apparaitre var(--t-base); }
.feuille-interieur {
  display: grid; gap: var(--s-6);
  padding: var(--s-2) var(--marge) calc(var(--s-6) + env(safe-area-inset-bottom));
}
.poignee {
  justify-self: center; width: var(--s-8); height: var(--s-1);
  border-radius: var(--r-pill); background: var(--line);
}
.feuille-contenu { display: grid; gap: var(--s-6); }
.feuille-contenu > p { color: var(--text-muted); }

@keyframes monter { from { transform: translateY(100%); } }
@keyframes apparaitre { from { opacity: 0; } }

/* ---------------------------------------------------------------------------
   Toast : message en bas, 3 s
   --------------------------------------------------------------------------- */
.toast {
  position: fixed; z-index: 20;
  left: var(--marge); right: var(--marge);
  bottom: calc(var(--h-navigation) + var(--s-4) + env(safe-area-inset-bottom));
  max-width: var(--content-max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: var(--h-button); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  border-radius: var(--r-card); background: var(--surface-2); color: var(--text);
  box-shadow: var(--ombre-claire);
  animation: apparaitre var(--t-base);
}
.toast-action {
  flex: none; min-height: var(--h-touch); padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-pill); background: none;
  font-weight: var(--fw-semibold);
}
@media (min-width: 900px) {
  .toast { left: calc(var(--l-navigation) + var(--marge)); bottom: var(--s-6); }
}

/* ---------------------------------------------------------------------------
   Écran de connexion
   --------------------------------------------------------------------------- */
.connexion {
  justify-content: center; gap: var(--s-8);
  max-width: calc(var(--s-16) * 6);
  padding-bottom: var(--s-12);
}
.connexion .entete { margin-bottom: 0; }
.connexion .btn { width: 100%; }

/* ---------------------------------------------------------------------------
   Valider : pile de clips (F7)
   --------------------------------------------------------------------------- */
:root {
  /* Fond des éléments posés sur une vidéo (bouton lecture, messages) */
  --fond-sur-video: color-mix(in srgb, var(--bg) 80%, transparent);
  /* Ronds ✕ / ✓ : en thème clair, fond blanc pour garder le contraste du vert et du rouge */
  --fond-rond: var(--surface-2);
  --bord-rond: transparent;
  /* Hauteur du bas de la pile (ronds + aide), pour placer le toast juste au-dessus */
  --h-pied-pile: calc(var(--s-16) + var(--s-3) + 18px);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --fond-rond: var(--bg); --bord-rond: var(--line); }
}
:root[data-theme="light"] { --fond-rond: var(--bg); --bord-rond: var(--line); }

/* Pendant la validation, l'écran ne défile pas : la carte prend toute la place libre. */
.page:has(.pile:not(.terminee)) {
  height: 100dvh; min-height: 0; padding-top: var(--s-4);
  padding-bottom: calc(var(--h-navigation) + var(--s-4) + env(safe-area-inset-bottom));
}
.page:has(.pile:not(.terminee)) > .zone {
  flex: 1; min-height: 0; margin-top: var(--s-4);
  display: flex; flex-direction: column;
}
.pile:not(.terminee) {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: var(--s-3);
}
.pile.terminee > :not(.pile-fin) { display: none; }

/* Compteur et son : une barre posée sur le haut de la carte, qui ne bouge pas pendant le glisser. */
.pile-haut {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  width: min(100cqw, 100cqh * 9 / 16); margin: 0 auto; padding: var(--s-2);
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.pile-compteur {
  padding: var(--s-1) var(--s-3); border-radius: var(--r-pill);
  background: var(--fond-sur-video); font-weight: var(--fw-semibold);
}
.bouton-icone {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--h-touch); height: var(--h-touch);
  border: 0; border-radius: var(--r-pill);
  background: var(--fond-sur-video); color: var(--text);
  pointer-events: auto;
}

/* La scène mesure la place libre ; la carte y tient en 9:16, centrée. */
.pile-scene { position: relative; flex: 1; min-height: 0; container-type: size; }

.carte-clip {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  width: min(100cqw, 100cqh * 9 / 16); aspect-ratio: 9 / 16; margin: 0 auto;
  border-radius: var(--r-card); overflow: hidden;
  background: var(--surface);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  cursor: grab;
  transition: transform var(--t-base), opacity var(--t-base);
}
.carte-clip.en-glisse { transition: none; cursor: grabbing; }
/* La carte suivante attend juste derrière (effet de pile). */
.carte-clip.carte-suivante {
  z-index: 1; pointer-events: none;
  transform: translateY(var(--s-3)) scale(0.96);
}
.carte-clip.partie { z-index: 3; pointer-events: none; }

.carte-video {
  display: block; width: 100%; height: 100%;
  object-fit: cover; background: var(--surface);
  pointer-events: none;
}

/* « Valider » ou « Rejeter » apparaît pendant le glisser. */
.tampon {
  position: absolute; top: var(--s-6);
  padding: var(--s-1) var(--s-4);
  border: 2px solid currentColor; border-radius: var(--r-pill);
  background: var(--bg);
  font-size: var(--fs-h2); line-height: 28px; font-weight: var(--fw-bold);
  opacity: 0; pointer-events: none;
}
.tampon-valider { left: var(--s-4); color: var(--positive); }
.tampon-rejeter { right: var(--s-4); color: var(--negative); }

.carte-pause {
  position: absolute; inset: 0; margin: auto;
  display: flex; align-items: center; justify-content: center;
  width: var(--s-16); height: var(--s-16);
  border-radius: var(--r-pill); background: var(--fond-sur-video); color: var(--text);
  pointer-events: none;
}

.carte-remontage {
  position: absolute; inset: 0;
  display: grid; align-content: center; justify-items: center; gap: var(--s-4);
  padding: var(--s-6); text-align: center;
  background: var(--fond-sur-video);
}
.carte-remontage .btn { width: auto; min-width: 0; }
.carte-remontage.en-cours p { animation: pulser 1.6s ease-in-out infinite; }

.pile-actions {
  display: flex; align-items: center; justify-content: center; gap: var(--s-6);
  height: var(--s-16);
}
.pile-actions .btn { width: auto; min-width: 0; }
.pile-aide { text-align: center; }
.aide-clavier { display: none; }
@media (hover: hover) and (pointer: fine) {
  .aide-tactile { display: none; }
  .aide-clavier { display: inline; }
}
.pile-fin-titre { font-weight: var(--fw-semibold); }

/* Ronds ✕ et ✓ : fond neutre, la couleur dit l'état (rouge = rejeter, vert = valider). */
.rond {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--s-16); height: var(--s-16); padding: 0;
  border: 1px solid var(--bord-rond); border-radius: var(--r-pill);
  background: var(--fond-rond); color: var(--text);
  box-shadow: var(--ombre-claire);
  transition: transform var(--t-fast);
}
.rond:active { transform: scale(0.97); }
.rond-rejeter { color: var(--negative); }
.rond-valider { color: var(--positive); }
.rond.squelette { border: 0; box-shadow: none; }
.rond-petit {
  width: var(--h-touch); height: var(--h-touch);
  border: 0; background: var(--surface-2); box-shadow: none;
}
.rond-petit[aria-disabled="true"] { color: var(--text-muted); cursor: default; }
.rond-petit[aria-disabled="true"]:active { transform: none; }

/* Le toast se pose au-dessus des ronds, pour ne jamais les cacher. */
.page:has(.pile:not(.terminee)) ~ #zone-toast .toast {
  bottom: calc(var(--h-navigation) + env(safe-area-inset-bottom) + var(--s-4) + var(--h-pied-pile) + var(--s-3));
}
@media (min-width: 900px) {
  .page:has(.pile:not(.terminee)) { padding-top: var(--s-6); padding-bottom: var(--s-6); }
  .page:has(.pile:not(.terminee)) ~ #zone-toast .toast {
    bottom: calc(var(--s-6) + var(--h-pied-pile) + var(--s-3));
  }
}

/* ---------------------------------------------------------------------------
   Feuilles d'un clip : lecteur, détail, modification
   --------------------------------------------------------------------------- */
.lecteur-clip {
  display: block; justify-self: center;
  height: min(60dvh, calc(var(--s-16) * 8)); max-width: 100%; aspect-ratio: 9 / 16;
  border-radius: var(--r-card); background: var(--bg);
}
.feuille-texte { display: grid; gap: var(--s-1); }
.feuille-texte .texte-muet { overflow-wrap: anywhere; }
.titre-clip { font-weight: var(--fw-semibold); }

.champ textarea {
  width: 100%; min-height: calc(var(--s-16) * 2); padding: var(--s-3) var(--s-4);
  border: 0; border-radius: var(--r-field);
  background: var(--surface-2); color: var(--text);
  font: inherit; resize: vertical;
}
.champ textarea:focus { outline: 2px solid var(--text); outline-offset: 0; }

.reglages-bornes { display: grid; gap: var(--s-2); }
.reglage {
  display: grid; grid-template-columns: 1fr auto minmax(calc(var(--s-16) * 2), auto) auto;
  align-items: center; gap: var(--s-2);
}
.reglage-valeur { text-align: center; font-weight: var(--fw-semibold); }

/* ---------------------------------------------------------------------------
   Réduire les animations : tout est coupé
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop {
    animation: none !important; transition: none !important;
  }
  .btn:active, .rond:active { transform: none; }
}
