/* Livre en main : interface iPhone (Safari). Sobre, lisible au soleil, gros boutons, une main. */
:root {
  --accent: #7B5CFA;
  --accent-fort: #6443F0;
  --accent-doux: #EEEAFE;
  --fond: #F7F6FB;
  --carte: #FFFFFF;
  --texte: #15172B;
  --texte-doux: #5A5D73;
  --bord: #E2E0EC;
  --rouge: #C62828;
  --rouge-fond: #FDECEC;
  --vert: #1B7F4B;
  --vert-fond: #E6F5EC;
  --ombre: 0 1px 3px rgba(20, 20, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #8F75FF;
    --accent-fort: #A390FF;
    --accent-doux: #2A2346;
    --fond: #0F1017;
    --carte: #1B1C27;
    --texte: #F2F2F7;
    --texte-doux: #A9ABBD;
    --bord: #2E3040;
    --rouge: #FF8A80;
    --rouge-fond: #3A1D1F;
    --vert: #7DDCA4;
    --vert-fond: #173226;
    --ombre: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #8F75FF; --accent-fort: #A390FF; --accent-doux: #2A2346; --fond: #0F1017; --carte: #1B1C27;
  --texte: #F2F2F7; --texte-doux: #A9ABBD; --bord: #2E3040; --rouge: #FF8A80; --rouge-fond: #3A1D1F;
  --vert: #7DDCA4; --vert-fond: #173226; --ombre: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
h1 { font-size: 28px; margin: 8px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 28px 0 12px; }
p { margin: 8px 0; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Boutons : zone tactile >= 48 px */
button, .bouton {
  font: inherit;
  min-height: 52px;
  border-radius: 999px;
  padding: 14px 24px;
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-weight: 650;
  -webkit-tap-highlight-color: transparent;
}
.principal { background: var(--accent); color: #fff; font-size: 18px; border: 0; }
.principal:active { background: var(--accent-fort); }
.secondaire { background: transparent; color: var(--accent); border-color: var(--accent); }
.large { width: 100%; }
.danger { background: var(--rouge); color: var(--fond); border: 0; }   /* lisible en thème clair et sombre */
.discret { background: transparent; color: var(--rouge); border-color: transparent; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }

input[type="password"], input[type="search"], textarea {
  font: inherit;
  font-size: 17px;           /* 16 px ou plus : Safari ne zoome pas */
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* Page de connexion */
.centre { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.centre form { display: flex; flex-direction: column; gap: 12px; }

/* En-tête */
.entete { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.entete h1 { margin: 0; flex: 1; }
.retour {
  min-height: 48px; min-width: 48px; display: inline-flex; align-items: center;
  color: var(--accent); font-weight: 650; text-decoration: none; font-size: 17px;
}

/* Bandeaux */
.bandeau { border-radius: 14px; padding: 14px 16px; margin: 12px 0; font-weight: 550; }
.bandeau.erreur, .erreur { background: var(--rouge-fond); color: var(--rouge); }
.bandeau.info { background: var(--accent-doux); color: var(--texte); }
.bandeau.ok { background: var(--vert-fond); color: var(--vert); }
p.erreur { border-radius: 12px; padding: 12px 14px; }
.note { color: var(--texte-doux); font-size: 15px; }

/* Liste « En cours » / « Programmées » */
.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ligne {
  display: flex; align-items: center; gap: 12px; padding: 10px; min-height: 72px;
  background: var(--carte); border-radius: 16px; box-shadow: var(--ombre);
  color: var(--texte); text-decoration: none; border: 1px solid var(--bord);
}
.ligne img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; flex: none; background: var(--bord); }
.ligne .titre { font-weight: 650; line-height: 1.25; }
.ligne .etat { color: var(--texte-doux); font-size: 15px; }
.ligne .etat.action { color: var(--accent); font-weight: 650; }
.ligne .etat.erreur { background: none; color: var(--rouge); font-weight: 650; }
.vide { color: var(--texte-doux); }

/* Grille de livres */
.grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (min-width: 520px) { .grille { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.livre {
  background: var(--carte); border-radius: 16px; border: 1px solid var(--bord); box-shadow: var(--ombre);
  padding: 8px; display: flex; flex-direction: column; gap: 6px; text-align: left;
  color: var(--texte); font: inherit; min-height: 48px; position: relative;
}
button.livre { border-radius: 16px; padding: 8px; font-weight: 400; align-items: stretch; justify-content: flex-start; }
.livre img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bord); }
.livre .titre { font-size: 15px; font-weight: 650; line-height: 1.25; }
.livre.grise img { filter: grayscale(1); opacity: .45; }
.livre.grise .titre { color: var(--texte-doux); }
.livre .raison { font-size: 13px; color: var(--texte-doux); line-height: 1.3; word-break: break-word; }
.livre .question { font-size: 15px; font-weight: 650; }
.livre .principal { min-height: 48px; padding: 10px 16px; font-size: 16px; }
.badge {
  position: absolute; top: 14px; left: 14px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}

/* Page vidéo */
.couv { display: flex; gap: 12px; align-items: center; margin: 4px 0 12px; }
.couv img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: var(--bord); }
.couv .titre { font-weight: 700; font-size: 18px; line-height: 1.25; }
.attente { text-align: center; padding: 40px 8px; }
.sablier { font-size: 56px; display: inline-block; animation: tourne 2s ease-in-out infinite; }
@keyframes tourne { 50% { transform: rotate(180deg); } 100% { transform: rotate(180deg); } }
.accroche { font-size: 20px; font-weight: 750; margin: 8px 0 16px; }
.moments { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.moment { background: var(--carte); border: 1px solid var(--bord); border-radius: 16px; padding: 12px; display: flex; gap: 12px; }
.moment img { width: 112px; flex: none; border-radius: 8px; align-self: flex-start; background: var(--bord); }
.moment .consigne-s { font-weight: 750; }
.moment .texte { margin-top: 4px; }
audio { width: 100%; margin: 12px 0; }
.lecteur { width: 100%; max-height: 70vh; background: #000; border-radius: 16px; display: block; }
.modif { display: flex; flex-direction: column; gap: 12px; }
.abandon { margin: 28px 0 12px; border-top: 1px solid var(--bord); padding-top: 12px; }
.confirmation { display: flex; flex-direction: column; gap: 12px; background: var(--rouge-fond);
  border-radius: 16px; padding: 16px; }
.confirmation .question { margin: 0; font-weight: 750; color: var(--rouge); }
.confirmation .note { margin: 0; }
.vignette { margin: 0; flex: none; width: 112px; display: flex; flex-direction: column; gap: 4px; }
.vignette img { width: 100%; }
.vignette figcaption { text-align: center; font-size: 14px; }

/* Écran de tournage (plein écran) */
#tournage { position: fixed; inset: 0; background: #000; z-index: 10; color: #fff; }
#tournage video { width: 100%; height: 100%; object-fit: cover; }
.progres {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 16px; right: 84px;
  height: 8px; background: #fff5; border-radius: 8px; overflow: hidden;
}
.progres > div { height: 100%; width: 0; background: #7B5CFA; border-radius: 8px; }
.arreter {
  position: absolute; top: calc(4px + env(safe-area-inset-top)); right: 12px;
  min-height: 48px; padding: 10px 16px; font-size: 16px; background: #000a; color: #fff; border: 2px solid #fff8;
}
.souffleur {
  position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); left: 16px; right: 16px;
  text-align: center; color: #fff;
}
.consigne { font-size: 28px; font-weight: 800; line-height: 1.2; text-shadow: 0 2px 6px #000; }
.souffleur img { max-width: 60%; max-height: 28vh; border-radius: 8px; margin-top: 8px; opacity: .9; }
.souffleur .num { font-size: 18px; font-weight: 700; text-shadow: 0 2px 6px #000; }
.decompte { font-size: 120px; font-weight: 900; text-shadow: 0 2px 10px #000; }
.souffleur .message { background: #000c; border-radius: 16px; padding: 16px; font-size: 19px; font-weight: 650; }
.souffleur .actions { margin: 12px 0 0; }
.souffleur .secondaire { color: #fff; border-color: #fff; }
.souffleur .texte { font-size: 20px; font-weight: 650; line-height: 1.3; text-shadow: 0 2px 6px #000; margin-top: 8px; }
.souffleur .lecteur { width: 100%; max-height: 55vh; border-radius: 12px; background: #000; }
.scenes .note.erreur { color: #c0392b; font-weight: 700; }
.sans-image { background: var(--bord); border-radius: 10px; flex: none; }
.ligne .sans-image { width: 52px; height: 52px; }
.livre .sans-image { width: 100%; aspect-ratio: 1; }

/* Barre de progression (script, montage) */
.progression { margin: 18px auto 6px; max-width: 420px; text-align: left; }
.barre { height: 12px; border-radius: 999px; background: var(--accent-doux); overflow: hidden; }
.barre > div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .25s linear; }
.progression .etape { margin-top: 8px; text-align: center; }
.actions.haut { margin: 4px 0 8px; }
/* Description du post, à copier */
textarea.description { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; line-height: 1.45; }
.choix { display: flex; gap: 12px; align-items: center; background: var(--carte); border: 1px solid var(--bord);
  border-radius: 14px; padding: 12px 14px; font-size: 16px; }
.choix input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); }
