/* RAW — style sobre. Seul « Publier » est un bouton plein. */
:root {
  --fond: #0f0f0f;
  --surface: #191919;
  --texte: #f2f2f2;
  --doux: #8a8a8a;
  --trait: #2a2a2a;
  --accent: #ffd60a;
  --sur-accent: #111;
  --erreur: #ff6b5b;
  --rayon: 6px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --fond: #fafaf8; --surface: #f0f0ec; --texte: #141414; --doux: #707070; --trait: #dedede;
    --accent: #c99a00; --sur-accent: #fff; color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fond); color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  max-width: 560px; margin: 0 auto;
  overflow-x: hidden;
}
button, select, textarea, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

.barre { display: flex; align-items: center; gap: 18px; height: 56px; }
.marque { font-weight: 900; letter-spacing: .12em; font-size: 15px; }
.icone { color: var(--doux); padding: 8px; margin: -8px; transition: color .2s var(--ease); }
.icone:hover, .icone:focus-visible { color: var(--texte); }

/* Écrans : un seul visible, entrée en fondu + glissé */
.ecran { display: none; }
.ecran.actif { display: block; animation: entree .35s var(--ease) both; }
@keyframes entree { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* 1. Filmer */
.capture { min-height: 62vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.filmer { display: flex; flex-direction: column; align-items: center; gap: 14px; cursor: pointer; }
.rond {
  width: 96px; height: 96px; border-radius: 50%;
  border: 3px solid var(--texte); position: relative;
  transition: transform .25s var(--ease);
}
.rond::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--erreur);
  transition: inset .25s var(--ease);
}
.filmer:hover .rond, .filmer:focus-within .rond { transform: scale(1.04); }
.filmer:active .rond::after { inset: 14px; }
.filmer-texte { font-weight: 600; letter-spacing: .02em; }
.lien { color: var(--doux); cursor: pointer; transition: color .2s var(--ease); }
.lien:hover { color: var(--texte); }

.choisie video {
  display: block; width: 100%; max-height: 46vh; object-fit: contain; background: #000;
  border-radius: var(--rayon);
}
.reglages { margin-top: 18px; }
.ligne {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--trait);
}
.etiquette { color: var(--doux); font-size: 14px; }
.bascule { display: flex; gap: 20px; }
.bascule button { color: var(--doux); padding: 4px 0; position: relative; transition: color .2s var(--ease); }
.bascule button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--accent);
  transform: scaleX(0); transition: transform .25s var(--ease);
}
.bascule button[aria-checked="true"], .bascule button[aria-pressed="true"] { color: var(--texte); }
.bascule button[aria-checked="true"]::after, .bascule button[aria-pressed="true"]::after { transform: scaleX(1); }
/* Formats : l'étiquette au-dessus, les choix en dessous (4 choix ne tiennent pas sur une ligne de téléphone) */
.ligne-formats { flex-wrap: wrap; row-gap: 10px; }
.ligne-formats .etiquette { flex-basis: 100%; }
.ligne-formats .bascule { flex-wrap: wrap; gap: 8px 22px; }
.champ-autre {
  flex-basis: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--trait);
  padding: 8px 0; outline: none; font-size: 15px; transition: border-color .2s var(--ease);
  animation: glisse .25s var(--ease) both;
}
.champ-autre:focus { border-bottom-color: var(--accent); }
.champ-autre::placeholder { color: var(--doux); }
.choix { display: inline-flex; align-items: center; gap: 6px; color: var(--texte); }
.choix select { appearance: none; -webkit-appearance: none; background: none; border: 0; text-align: right; padding: 4px 0; cursor: pointer; }
.choix select option { background: var(--surface); color: var(--texte); }
.choix svg { color: var(--doux); }
textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--trait);
  padding: 12px 0; resize: vertical; outline: none; transition: border-color .2s var(--ease);
}
textarea:focus { border-bottom-color: var(--accent); }
textarea::placeholder { color: var(--doux); }
.actions { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.envoyer {
  display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; font-size: 18px;
  padding: 10px 0;
}
.envoyer svg { transition: transform .25s var(--ease); }
.envoyer:hover svg, .envoyer:focus-visible svg { transform: translateX(4px); }
.envoyer:disabled { opacity: .4; cursor: default; }

.recents { margin-top: 28px; }
.recents h2 { font-size: 13px; font-weight: 600; color: var(--doux); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 6px; }
.recents ul { list-style: none; padding: 0; margin: 0; }
.recents li {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trait);
  cursor: pointer; animation: entree .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
  transition: color .2s var(--ease); position: relative;
}
.recents li:hover { color: var(--accent); }
.recents .statut { color: var(--doux); font-size: 14px; white-space: nowrap; }
.recents .statut.pret { color: var(--accent); }
.recents .statut.erreur, .recents .statut.pause { color: var(--erreur); }
.recents .statut.envoi { font-variant-numeric: tabular-nums; }
.recents .nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* avancement d'un envoi : la bordure basse de la ligne se remplit */
.recents .avance { display: none; }
.recents li.locale .avance {
  display: block; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%;
  background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0));
  transition: transform .4s var(--ease);
}

/* Envois en cours : barre de 2 px tout en haut, une ligne discrète sous la marque */
.fil { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 10; background: transparent; }
.fil-plein { height: 100%; width: 0; background: var(--accent); transition: width .4s var(--ease), background-color .3s var(--ease); }
.fil.pause .fil-plein { background: var(--erreur); }
.bandeau {
  margin: -10px 0 8px; font-size: 13px; color: var(--doux); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: glisse .3s var(--ease) both;
}
.bandeau.pause { color: var(--erreur); }
.bandeau.fini { color: var(--texte); }
@keyframes glisse { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.champ {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--trait);
  padding: 12px 0; outline: none; font-size: 20px; letter-spacing: .06em; transition: border-color .2s var(--ease);
}
.champ:focus { border-bottom-color: var(--accent); }
.champ::placeholder { color: var(--doux); font-size: 15px; letter-spacing: 0; }
.attente .message { color: var(--erreur); }

/* 2. Montage */
.attente { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; }
.etape { font-size: 22px; font-weight: 600; margin: 0 0 18px; min-height: 1.4em; }
.jauge { height: 3px; background: var(--trait); overflow: hidden; border-radius: 2px; }
.jauge-plein { height: 100%; width: 0; background: var(--accent); transition: width .4s var(--ease); }
.jauge.indeterminee .jauge-plein { width: 30%; animation: va-et-vient 1.4s var(--ease) infinite; }
@keyframes va-et-vient { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.aide { color: var(--doux); font-size: 14px; margin-top: 18px; }

/* 2. Les sorties d'une vidéo, l'une sous l'autre */
.titre-groupe { color: var(--doux); font-size: 14px; margin: 0 0 4px; }
.sortie { padding: 18px 0 8px; border-bottom: 1px solid var(--trait); animation: entree .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.sortie:last-child { border-bottom: 0; }
.sortie-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.sortie-nom { min-width: 0; overflow-wrap: anywhere; }
.sortie-etat { color: var(--doux); font-size: 14px; font-weight: 400; white-space: nowrap; }
.sortie-etat.pret { color: var(--accent); }
.sortie-etat.erreur { color: var(--erreur); }
.sortie-attente .aide { margin: 12px 0 10px; }
.sortie-attente .jauge { margin-top: 4px; }
.sortie.a_preparer .sortie-attente .jauge { display: none; }
.sortie video {
  display: block; width: 100%; max-height: 60vh; aspect-ratio: 9 / 16; object-fit: contain; background: #000;
  border-radius: var(--rayon);
}
.infos { color: var(--doux); font-size: 14px; margin: 12px 0 18px; }
.infos .avert { display: block; margin-top: 4px; }
.sortie .etiquette { display: block; }
.sortie .etiquette textarea { display: block; color: var(--texte); font-size: 16px; }
.sortie .message { margin-bottom: 12px; }
.collab { display: flex; align-items: center; gap: 10px; padding: 14px 0; color: var(--doux); font-size: 15px; cursor: pointer; }
.collab input { accent-color: var(--accent); width: 18px; height: 18px; }
.collab strong { color: var(--texte); font-weight: 600; }
.publier {
  width: 100%; margin-top: 18px; padding: 16px; border-radius: var(--rayon);
  background: var(--accent); color: var(--sur-accent); font-weight: 800; font-size: 17px; letter-spacing: .02em;
  transition: transform .15s var(--ease), filter .2s var(--ease);
}
.publier:hover { filter: brightness(1.06); }
.publier:active { transform: scale(.985); }
.publier:disabled { filter: grayscale(.8) brightness(.7); cursor: default; }
.message { min-height: 1.4em; margin: 14px 0 32px; color: var(--doux); }
.message.ok { color: var(--texte); }
.message.ko { color: var(--erreur); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
