:root {
  --encre: #16213A;
  --encre-douce: #3B4660;
  --papier: #F6F1E8;
  --blanc: #FFFFFF;
  --terracotta: #C4583E;
  --or: #C99A45;
  --trait: #E3DACB;
  --gris: #7A7F8C;
  --sans: "Hanken Grotesk", "Segoe UI", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--papier); color: var(--encre); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- barre -- */
.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 18px 40px; border-bottom: 1px solid var(--trait); background: var(--papier);
  position: sticky; top: 0; z-index: 5;
}
.titre { font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.titre em { font-family: var(--serif); font-weight: 400; font-style: italic; color: var(--terracotta); font-size: 1.1em; letter-spacing: 0; }
.etapes { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.etapes li {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gris); padding: 7px 12px; border-radius: 99px; border: 1px solid transparent;
  display: flex; gap: 8px; align-items: center;
}
.etapes li span { color: var(--trait); font-weight: 600; }
.etapes li.faite { color: var(--encre-douce); }
.etapes li.faite span { color: var(--or); }
.etapes li.active { color: var(--encre); border-color: var(--trait); background: var(--blanc); }
.etapes li.active span { color: var(--terracotta); }

/* ------------------------------------------------------------- écrans -- */
main { padding: 56px 40px 80px; }
.ecran { max-width: 720px; margin: 0 auto; }
.ecran-large { max-width: 1180px; }
.surtitre {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: 10px;
}
h1 { font-weight: 800; font-size: 44px; line-height: 1.04; letter-spacing: -.04em; margin: 0 0 14px; }
h1 em { font-family: var(--serif); font-weight: 400; font-style: italic; color: var(--terracotta); letter-spacing: -.01em; font-size: 1.1em; }
.chapeau { font-size: 17px; color: var(--encre-douce); margin: 0 0 32px; max-width: 560px; }
.note { font-size: 13.5px; color: var(--gris); margin: 12px 0 0; }
.alerte { background: #FBEAE5; border: 1px solid #EDC3B6; color: #8A3320; padding: 14px 16px; border-radius: 10px; margin-top: 24px; }

/* -------------------------------------------------------------- dépôt -- */
.depot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 240px; border: 1.5px dashed #CFC3AE; border-radius: 16px; background: var(--blanc);
  cursor: pointer; transition: border-color .15s, background .15s; text-align: center; padding: 24px;
}
.depot:hover, .depot.survol { border-color: var(--terracotta); background: #FFFBF6; }
.depot-icone {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--papier); color: var(--terracotta);
}
.depot-texte { font-size: 17px; }
.depot-note { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--gris); text-transform: uppercase; }

.qualite { margin-top: 32px; }
.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choix label { cursor: pointer; }
.choix input { position: absolute; opacity: 0; }
.choix span {
  display: block; padding: 16px 18px; border: 1px solid var(--trait); border-radius: 12px; background: var(--blanc);
  font-size: 14px; color: var(--gris); transition: border-color .15s;
}
.choix span b { display: block; color: var(--encre); font-size: 16px; margin-bottom: 2px; }
.choix input:checked + span { border-color: var(--encre); box-shadow: inset 0 0 0 1px var(--encre); }
.choix input:focus-visible + span { outline: 2px solid var(--terracotta); outline-offset: 2px; }

/* -------------------------------------------------------------- jauge -- */
.jauge { height: 10px; background: #EAE2D3; border-radius: 99px; overflow: hidden; }
.jauge div { height: 100%; width: 0; background: linear-gradient(90deg, var(--terracotta), var(--or)); border-radius: 99px; transition: width .3s; }
.jauge.indeterminee div { width: 30%; animation: aller 1.4s ease-in-out infinite; }
@keyframes aller { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

/* ---------------------------------------------------------- relecture -- */
.relecture { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 48px; align-items: start; }
.apercu { position: sticky; top: 96px; display: flex; justify-content: center; }
/* ---- lecteur : un ecrin sombre facon telephone, une barre de lecture dessous ---- */
.lecteur { display: inline-flex; flex-direction: column; gap: 14px; max-width: 100%; }
.ecrin {
  padding: 7px; border-radius: 30px;
  background: linear-gradient(160deg, #26324F 0%, #111A2E 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.08) inset,
    0 30px 60px -28px rgba(22,33,58,.55),
    0 12px 24px -16px rgba(22,33,58,.35);
}
.cadre-video { position: relative; border-radius: 23px; overflow: hidden; background: #111A2E; line-height: 0; cursor: pointer; }
/* La video remplit le cadre au pixel pres : le cadre a deja ses proportions. */
.cadre-video video { width: 100%; height: 100%; display: block; object-fit: cover; }
.gros-play {
  /* Au-dessus du milieu : les sous-titres sont a 60 % de la hauteur, le bouton ne doit pas les toucher. */
  position: absolute; left: 50%; top: 40%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(246,241,232,.92); box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transition: opacity .2s, transform .2s;
}
.gros-play::before {
  content: ""; position: absolute; left: 25px; top: 20px;
  border-left: 18px solid var(--encre); border-top: 12px solid transparent; border-bottom: 12px solid transparent;
}
.gros-play:hover { transform: scale(1.06); }
.lecteur.en-lecture .gros-play { opacity: 0; pointer-events: none; transform: scale(.85); }

.commandes { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.commandes .play {
  width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1px solid var(--trait);
  background: var(--blanc); cursor: pointer; position: relative;
}
.commandes .play::before {
  content: ""; position: absolute; left: 12px; top: 10px;
  border-left: 11px solid var(--encre); border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.lecteur.en-lecture .commandes .play::before {
  left: 11px; top: 10px; width: 3px; height: 14px; border: 0;
  background: var(--encre); box-shadow: 7px 0 0 var(--encre);
}
.piste { flex: 1; height: 5px; border-radius: 99px; background: #E6DDCC; cursor: pointer; position: relative; touch-action: none; }
.piste::after { content: ""; position: absolute; inset: -8px 0; } /* zone de clic plus haute que la piste */
.piste .rempli { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--terracotta), var(--or)); }
.temps-lecteur { font-family: var(--mono); font-size: 11.5px; color: var(--gris); min-width: 76px; text-align: right; }
.cadre-video canvas { position: absolute; left: 0; top: 0; pointer-events: none; }

/* Seule la transcription defile ; la video, le titre et l'export restent fixes.
   La page entiere prend la hauteur de l'ecran, et la liste prend le reste. */
body.mode-relecture { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.mode-relecture main { flex: 1; min-height: 0; display: flex; padding-top: 40px; padding-bottom: 32px; }
body.mode-relecture #ecran-relecture { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
body.mode-relecture .relecture { flex: 1; min-height: 0; align-items: stretch; }
body.mode-relecture .apercu { position: static; align-self: start; }
body.mode-relecture .texte { display: flex; flex-direction: column; min-height: 0; }
body.mode-relecture .blocs { flex: 1; min-height: 0; overflow-y: auto; }
body.mode-relecture .actions { flex: none; margin-top: 16px; }
body.mode-relecture .texte h1 { font-size: 38px; margin-bottom: 8px; }
body.mode-relecture .texte .chapeau { margin-bottom: 10px; font-size: 16px; }
body.mode-relecture .texte .note { margin-top: 0; }
body.mode-relecture .verifier { margin-top: 12px; }

.blocs {
  margin-top: 18px; display: flex; flex-direction: column; gap: 6px;
  padding: 2px 10px 12px 2px; margin-right: -10px; overscroll-behavior: contain;
}
@supports not selector(::-webkit-scrollbar) {
  .blocs { scrollbar-width: thin; scrollbar-color: #D6CAB4 transparent; }
}
.blocs::-webkit-scrollbar { width: 8px; }
.blocs::-webkit-scrollbar-track { background: transparent; }
.blocs::-webkit-scrollbar-thumb { background: #D6CAB4; border-radius: 99px; }
.blocs::-webkit-scrollbar-thumb:hover { background: var(--or); }
.blocs::-webkit-scrollbar-button { display: none; height: 0; }
.bloc {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start;
  background: var(--blanc); border: 1px solid var(--trait); border-radius: 10px; padding: 6px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.bloc.actif { border-color: var(--terracotta); box-shadow: 0 0 0 1px var(--terracotta); }
.bloc .temps {
  font-family: var(--mono); font-size: 11.5px; color: var(--gris); padding-top: 6px; cursor: pointer;
  background: none; border: 0; text-align: left;
}
.bloc .temps:hover { color: var(--terracotta); }
.bloc .lignes { display: flex; flex-direction: column; gap: 0; }
.bloc input {
  width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 3px 8px; background: transparent;
  font-size: 15.5px; line-height: 1.4;
}
.bloc input:hover { background: var(--papier); }
.bloc input:focus { outline: none; border-color: var(--encre); background: var(--blanc); }
.bloc input.chiffre { background: #FBF0DC; box-shadow: inset 3px 0 0 var(--or); }
.verifier {
  display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding: 10px 14px; border-radius: 10px;
  background: #FBF0DC; color: #7A5A1E; font-size: 14px;
}
.verifier::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--or); flex: none; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 99px; border: 1px solid var(--encre); background: var(--encre); color: var(--papier);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; transition: transform .1s, background .15s;
}
.bouton:hover { background: #22304F; }
.bouton:active { transform: translateY(1px); }
.bouton.secondaire { background: transparent; color: var(--encre); border-color: var(--trait); }
.bouton.secondaire:hover { border-color: var(--encre); background: var(--blanc); }
.bouton[disabled] { opacity: .5; cursor: default; }

/* ------------------------------------------------------------- export -- */
.resultat { margin-top: 32px; display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 32px; align-items: start; }
.resultat .lecteur { justify-self: start; }
.resultat .actions { margin-top: 0; flex-direction: column; align-items: flex-start; }
/* ---------------------------------------------------------- dialogue -- */
.dialogue {
  border: 0; padding: 0; border-radius: 20px; background: var(--blanc); color: var(--encre);
  width: min(540px, calc(100vw - 32px)); box-shadow: 0 40px 80px -30px rgba(22,33,58,.6);
}
.dialogue::backdrop { background: rgba(22,33,58,.42); backdrop-filter: blur(3px); }
.dialogue[open] { animation: apparaitre .18s ease-out; }
@keyframes apparaitre { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialogue form { padding: 30px 30px 26px; }
.dialogue h2 { font-weight: 800; font-size: 25px; line-height: 1.12; letter-spacing: -.03em; margin: 0 0 10px; }
.dialogue h2 em { font-family: var(--serif); font-weight: 400; font-style: italic; color: var(--terracotta); font-size: 1.1em; }
.dialogue p { color: var(--encre-douce); margin: 0 0 24px; font-size: 15.5px; }
.dialogue-boutons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.dialogue-boutons .bouton { white-space: nowrap; }

@media (max-width: 860px) { .resultat { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .relecture { grid-template-columns: 1fr; }
  body.mode-relecture { height: auto; overflow: visible; display: block; }
  body.mode-relecture main { display: block; }
  body.mode-relecture .blocs { overflow: visible; }
  .apercu { position: static; max-width: 360px; }
  main { padding: 32px 20px 64px; }
  .barre { padding: 14px 20px; }
  h1 { font-size: 34px; }
  .choix { grid-template-columns: 1fr; }
}
