/* SchoolMe Studio — design tokens + chrome, implémentation du handoff
   « SchoolMe Studio.dc.html » (claude.ai/design) : interface étudiante sans
   jargon, accents multi-teintes, technique rangée dans la modale Debug. */
:root {
  --ink: #1c1b17;
  --paper: #efece4;
  --bg: #e9e5db;
  --muted: #716c61;
  --faint: #928c80;
  --line: #d4cfc3;
  --line2: #c5bfb1;
  --blue: oklch(0.54 0.13 252);
  --bluebg: oklch(0.54 0.13 252 / 0.08);
  --amber: oklch(0.64 0.13 64);
  --green: oklch(0.56 0.11 152);
  --greenbg: oklch(0.56 0.11 152 / 0.10);
  --red: oklch(0.55 0.16 28);
  --violet: oklch(0.58 0.19 292);          /* identité « entraînement » */
  --grad: linear-gradient(100deg, oklch(0.62 0.2 292), oklch(0.6 0.21 332));
  --grad-shadow: 0 10px 26px -10px oklch(0.62 0.2 312 / 0.7);
  --fs-good: oklch(0.74 0.16 152);         /* variantes éclaircies, scène sombre */
  --fs-bad: oklch(0.64 0.2 25);
  --mono: 'IBM Plex Mono', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
body {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
/* atmosphère : trois lavis radiaux très doux (violet / corail / turquoise).
   Couche FIXE et composée une seule fois — surtout PAS background-attachment:
   fixed, qui sur Safari iOS repeint tout le viewport à chaque frame de scroll
   (scintillement puis crash de l'onglet). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(58% 48% at 10% -2%, oklch(0.72 0.13 292 / 0.16), transparent 60%),
    radial-gradient(50% 42% at 102% 6%, oklch(0.74 0.13 32 / 0.13), transparent 60%),
    radial-gradient(55% 50% at 88% 102%, oklch(0.72 0.12 172 / 0.12), transparent 62%);
}
::selection { background: oklch(0.55 0.13 250 / 0.22); }

@keyframes vkblink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes vkrise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes vkshift { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }

.mono { font-family: var(--mono); }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(233, 229, 219, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar-in {
  max-width: 1320px; margin: 0 auto; padding: 0 28px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-s {
  width: 27px; height: 27px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, oklch(0.62 0.2 292), oklch(0.6 0.21 350));
}
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 16px; }
.nav-steps { display: flex; align-items: center; gap: 6px; }
.nav-step {
  display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 9px;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted);
  text-decoration: none; transition: all .15s;
}
.nav-step .n { font-family: var(--mono); font-size: 10px; opacity: 0.8; }
.nav-step.active { background: var(--grad); color: #fff; font-weight: 600; }
/* le liséré arc-en-ciel sous la barre */
.rainbow {
  height: 3px;
  background: linear-gradient(90deg, oklch(0.66 0.2 292), oklch(0.66 0.21 350),
    oklch(0.72 0.17 30), oklch(0.72 0.16 172), oklch(0.64 0.18 250), oklch(0.66 0.2 292));
  background-size: 200% 100%;
  animation: vkshift 9s linear infinite;
}

.page { flex: 1; max-width: 1320px; width: 100%; margin: 0 auto; padding: 58px 28px 80px; animation: vkrise .3s ease; }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em;
  color: var(--violet); font-weight: 600; margin-bottom: 14px;
}
h1.hero { font-size: clamp(28px, 5vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.04; max-width: 780px; }
.lede { font-size: 16px; color: var(--muted); line-height: 1.55; max-width: 620px; margin-top: 16px; }
.lede b { color: var(--ink); font-weight: 600; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font-size: 13px; padding: 11px 20px; border-radius: 10px;
  z-index: 90; transition: all .2s; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}
.toast.show { transform: translateX(-50%); opacity: 1; }
/* le toast du plein écran : même recette, ancré DANS la scène (top layer) */
.fs-toast { position: absolute; z-index: 40; }

/* ================= IMPORTER ================= */
.src-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.15fr); gap: 26px; margin-top: 38px; align-items: start; }
.files-col, .upload-col { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.files-col .jobs-block, .upload-col .type-toggle { margin: 0; }   /* gap de colonne gère l'espacement */

.dropzone {
  border: 2px dashed var(--line2); border-radius: 20px; background: var(--paper);
  padding: 46px 40px; text-align: center; min-height: 250px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  cursor: pointer; box-shadow: 0 18px 40px -28px rgba(60, 40, 90, 0.5);
}
.dropzone.drag { border-color: var(--violet); background: oklch(0.58 0.19 292 / 0.06); }
.dz-circle {
  width: 54px; height: 54px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, oklch(0.66 0.18 292), oklch(0.64 0.2 350));
}
.dz-title { font-size: 18px; font-weight: 600; }
.dz-sub { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 8px; }

.file-card {
  border: 1.5px solid var(--ink); border-radius: 18px; background: var(--paper);
  padding: 24px 26px; animation: vkrise .25s ease;
  box-shadow: 0 18px 40px -28px rgba(60, 40, 90, 0.5);
}
.file-row { display: flex; align-items: flex-start; gap: 18px; }
.file-thumb {
  width: 96px; height: 60px; border-radius: 9px; flex-shrink: 0; color: #fff;
  background: linear-gradient(135deg, oklch(0.6 0.17 292), oklch(0.62 0.16 250));
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.file-name { font-size: 15px; font-weight: 600; word-break: break-all; }
.file-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 7px; display: flex; gap: 16px; flex-wrap: wrap; }
.bar-track { height: 6px; border-radius: 4px; background: #ded9cd; overflow: hidden; margin-top: 13px; }
.bar-fill {
  height: 100%; width: 0%; border-radius: 4px; transition: width .2s;
  background: linear-gradient(90deg, oklch(0.64 0.18 292), oklch(0.62 0.19 332));
}
.bar-fill.done { background: linear-gradient(90deg, oklch(0.66 0.16 172), oklch(0.62 0.18 250)); }
.file-status { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 7px; }
.file-status.ok { color: oklch(0.5 0.12 172); }
.file-actions { display: flex; gap: 12px; margin-top: 22px; }
.btn-primary {
  flex: 1; background: var(--grad); color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; padding: 14px 22px; border: none; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: var(--grad-shadow);
}
.btn-primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-ghost {
  padding: 14px 18px; border: 1px solid var(--line2); border-radius: 12px;
  background: none; font-family: inherit; cursor: pointer; font-size: 14px; color: var(--muted);
}
.btn-dark {
  margin-top: 4px; background: var(--grad); color: #fff; font-size: 14px; font-weight: 700;
  padding: 13px 24px; border: none; border-radius: 13px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 9px; box-shadow: var(--grad-shadow);
}

.section-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--faint); margin-bottom: 12px; }

.jobs-block { margin-top: 26px; }
.job-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--line2); border-radius: 14px;
  background: var(--paper); cursor: pointer; margin-bottom: 10px;
  box-shadow: 0 10px 26px -24px rgba(60, 40, 90, 0.5);
}
.job-row .left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.job-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.job-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 3px; }
.job-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.job-state { font-family: var(--mono); font-size: 10.5px; }
.job-action { font-family: var(--mono); font-size: 11px; color: var(--violet); font-weight: 600; }
.job-action.outline { color: var(--muted); border: 1px solid var(--line2); border-radius: 7px; padding: 4px 10px; }
.job-mini {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  border: 1px solid var(--line2); border-radius: 7px; background: none;
  padding: 6px 10px; cursor: pointer;
}
.job-mini:hover { color: var(--ink); border-color: var(--ink); }
.job-mini.del:hover { color: var(--red); border-color: var(--red); }
.job-manage {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line2); border-radius: 7px; background: none;
  padding: 4px 9px; cursor: pointer;
}
.job-manage:hover { color: var(--ink); border-color: var(--ink); }

.key-warn {
  background: #f6e8c8; color: #7a5200;
  border-bottom: 1px solid var(--amber);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.03em;
  text-align: center; padding: 8px 24px;
}

.contract-card {
  background: var(--paper); border: 1px solid var(--line2); border-radius: 18px;
  padding: 24px 26px; box-shadow: 0 18px 40px -30px rgba(60, 40, 90, 0.45);
}
.promise { display: flex; gap: 13px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.promise .mark { font-size: 15px; font-weight: 700; margin-top: 1px; font-family: var(--mono); }
.promise:nth-child(2) .mark { color: oklch(0.58 0.19 292); }
.promise:nth-child(3) .mark { color: oklch(0.58 0.2 350); }
.promise:nth-child(4) .mark { color: oklch(0.6 0.17 30); }
.promise:nth-child(5) .mark { color: oklch(0.56 0.15 172); }
.promise:nth-child(6) .mark { color: oklch(0.6 0.16 250); }
.promise .txt { font-size: 13.5px; line-height: 1.5; }

/* ================= PRÉPARATION ================= */
.proc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 30px; }
.proc-head h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 700; letter-spacing: -0.02em; }
.counters { display: flex; gap: 28px; font-family: var(--mono); }
.counter .k { font-size: 11px; color: var(--faint); margin-bottom: 5px; }
.counter .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.counter .v.green { color: oklch(0.55 0.14 172); }
#ctr-words { color: var(--ink); }
#ctr-cost { color: var(--violet); }

.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
/* cycle de teintes du handoff : 292 → 350 → 30 → 172 → 250 → 95 → 320 → 150 */
.stage-card:nth-child(8n+1) { --h: 292; }
.stage-card:nth-child(8n+2) { --h: 350; }
.stage-card:nth-child(8n+3) { --h: 30; }
.stage-card:nth-child(8n+4) { --h: 172; }
.stage-card:nth-child(8n+5) { --h: 250; }
.stage-card:nth-child(8n+6) { --h: 95; }
.stage-card:nth-child(8n+7) { --h: 320; }
.stage-card:nth-child(8n+8) { --h: 150; }
.stage-card {
  --hc: oklch(0.6 0.18 var(--h));
  --hsoft: oklch(0.6 0.18 var(--h) / 0.13);
  background: var(--paper); border: 1px solid var(--line2); border-radius: 14px;
  padding: 20px 22px; transition: all .2s;
  box-shadow: 0 10px 26px -22px rgba(60, 40, 90, 0.5);
}
.stage-card.active { border-color: var(--hc); box-shadow: 0 12px 30px -14px var(--hc); }
.stage-card.done { border-color: var(--hc); }
.stage-card.failed { border-color: var(--red); }
.stage-top { display: flex; align-items: center; gap: 13px; margin-bottom: 13px; }
.stage-glyph {
  width: 38px; height: 38px; border-radius: 12px; background: #e7e2d6; color: var(--faint);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 16px; flex-shrink: 0; transition: all .2s;
}
.stage-card.active .stage-glyph { background: var(--hsoft); color: var(--hc); box-shadow: 0 0 0 4px var(--hsoft); }
.stage-card.done .stage-glyph { background: var(--hc); color: #fff; }
.stage-card.failed .stage-glyph { background: oklch(0.55 0.16 28 / 0.12); color: var(--red); }
.stage-name { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; }
.stage-status { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.stage-card.active .stage-status, .stage-card.done .stage-status { color: var(--hc); }
.stage-card.failed .stage-status { color: var(--red); }
.stage-bar { height: 6px; border-radius: 4px; background: #ded9cd; overflow: hidden; }
.stage-bar div { height: 100%; width: 0%; background: var(--hc); border-radius: 4px; transition: width .2s linear; }
.stage-card.done .stage-bar div { width: 100%; }
.stage-card.failed .stage-bar div { background: var(--red); }
.stage-detail { font-size: 12px; color: var(--muted); margin-top: 11px; line-height: 1.45; min-height: 34px; }

.proc-foot { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.proc-note { font-size: 13px; color: var(--muted); }
.btn-resume { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 13px; cursor: pointer; background: none; }

/* ================= RÉVISER ================= */
.viewer-page { flex: 1; width: 100%; animation: vkrise .3s ease; padding-bottom: 56px; }
.viewer-head { max-width: 1320px; margin: 0 auto; padding: 38px 28px 0; }
.viewer-head-in {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 20px;
}
.viewer-head h1 { font-size: clamp(22px, 3.5vw, 30px); font-weight: 700; letter-spacing: -0.02em; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-new { padding: 10px 16px; border: 1px solid var(--line2); border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--muted); background: none; font-family: inherit; text-decoration: none; }
.btn-new-ic { display: none; }   /* texte sur desktop ; bascule en icône sur XS */
.btn-fs-open {
  padding: 10px 16px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--grad);
  font-family: inherit; box-shadow: var(--grad-shadow);
}
.btn-fs-open:hover { filter: brightness(1.08); }

.transport { max-width: 1320px; margin: 0 auto; padding: 16px 28px 0; display: flex; align-items: center; gap: 16px; }
.transport[hidden] { display: none; }   /* photos : pas de barre de lecture */
.play-main {
  width: 44px; height: 44px; border-radius: 50%; color: #fff; border: none;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; flex-shrink: 0;
}
.transport-label { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 96px; }
.scrub { position: relative; flex: 1; min-width: 160px; height: 8px; background: #ded9cd; border-radius: 4px; cursor: pointer; }
.scrub-fill {
  position: absolute; left: 0; top: 0; height: 100%; width: 0%; border-radius: 4px;
  background: linear-gradient(90deg, oklch(0.64 0.18 292), oklch(0.62 0.19 332));
}
.scrub-dot {
  position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%);
  width: 13px; height: 13px; border-radius: 50%; background: oklch(0.62 0.19 312);
  border: 2px solid var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* ---- l'invite permanente d'entraînement (bordure dégradée animée) ---- */
.practice-wrap { max-width: 1320px; margin: 18px auto 0; padding: 0 28px; }
.practice-dock {
  border-radius: 18px; padding: 2px;
  background: linear-gradient(100deg, oklch(0.7 0.18 292), oklch(0.7 0.19 350), oklch(0.74 0.16 40), oklch(0.74 0.15 172));
  background-size: 200% 100%;
  animation: vkshift 10s linear infinite;
}
.practice-in {
  border-radius: 16px; background: var(--paper); padding: 15px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.practice-lead { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 240px; }
.practice-star { font-size: 22px; flex-shrink: 0; }
.practice-field { flex: 1; min-width: 160px; }
.practice-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--faint); margin-bottom: 4px; }
.practice-input {
  /* 16px minimum : sous ce seuil, iOS Safari zoome la page au focus */
  width: 100%; border: none; background: transparent; font-family: inherit;
  font-size: 16px; font-weight: 500; color: var(--ink); outline: none;
}
.practice-input:disabled { opacity: 0.55; }
.practice-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.practice-chip {
  padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .18s; border: 1.5px solid var(--line2);
  background: none; color: var(--muted); font-family: inherit;
}
.practice-chip.on { border-color: transparent; background: var(--grad); color: #fff; }
.practice-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.quiz-history {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted); max-width: 220px;
  background: var(--paper); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; cursor: pointer;
}
.practice-badge { font-size: 12px; color: var(--muted); white-space: nowrap; }
.practice-badge.loading { animation: vkblink 1s steps(1) infinite; color: var(--violet); }
.practice-go {
  background: var(--grad); color: #fff; font-size: 14px; font-weight: 700;
  padding: 12px 20px; border-radius: 12px; cursor: pointer; border: none;
  display: flex; align-items: center; gap: 9px; font-family: inherit;
  box-shadow: 0 8px 24px -8px oklch(0.62 0.2 312 / 0.7); white-space: nowrap;
  min-height: 44px;
}
.practice-go:hover { filter: brightness(1.08); }
.practice-go:disabled { opacity: 0.5; cursor: default; filter: none; }

/* ================= LECTEUR — carousel un chapitre à la fois =================
   UN SEUL chapitre est rendu à la fois. L'ancienne pellicule posait les 77
   cellules côte à côte (~50 000 px de large) : Safari iOS devait composer une
   surface énorme et tuait l'onglet (« un problème s'est produit à plusieurs
   reprises »). Ici la scène n'affiche qu'une carte ; les vignettes restent
   petites et se chargent à la demande (content-visibility + lazy-load). */
/* en-tête du lecteur : métadonnées (pleine largeur) + bouton plein écran */
.reader-bar {
  max-width: 1320px; margin: 10px auto 0; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.reader-fs-btn {
  flex: 0 0 auto; font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: var(--paper); border: 1px solid var(--line2);
  border-radius: 9px; padding: 8px 14px; white-space: nowrap;
}
.reader-fs-btn:hover { color: var(--ink); border-color: var(--ink); }
.reader-meta { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; min-width: 0; }
.reader-chno {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--acc);
  background: var(--accsoft); border-radius: 6px; padding: 3px 9px;
}
.reader-kind {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 600; color: var(--muted);
}
.reader-flags { display: flex; gap: 5px; }

/* trois colonnes : image | texte | quiz */
.reader-col { --ch: 292; --acc: oklch(0.56 0.16 var(--ch)); --accsoft: oklch(0.56 0.16 var(--ch) / 0.13); min-width: 0; }
.reader-img-col, .reader-text {
  background: var(--paper); border: 1px solid var(--line2); border-radius: 16px;
  box-shadow: 0 18px 44px -30px rgba(60, 40, 90, 0.5);
}
.reader-img-col { overflow: hidden; }
.reader-slide {
  position: relative;                 /* ancre les flèches superposées + la boîte réponse */
  display: flex; align-items: center; justify-content: center;
  background: #f1ede4; border-radius: 16px; padding: 14px;
}
.reader-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line2); background: rgba(247, 244, 236, 0.86); color: var(--ink);
  font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.45);
  transition: background .15s, opacity .15s;
}
.reader-arrow.prev { left: 12px; }
.reader-arrow.next { right: 12px; }
.reader-arrow:hover { background: var(--paper); }
.reader-arrow:disabled { opacity: 0; pointer-events: none; }
/* surlignage CLAIR de la réponse sur l'image (boîte Gemini /locate), pulsée */
.ans-box {
  position: absolute; z-index: 2; pointer-events: none; border-radius: 4px;
  border: 3px solid oklch(0.62 0.2 312); background: oklch(0.62 0.2 312 / 0.18);
  animation: ansPulse 1.4s ease-in-out infinite;
}
@keyframes ansPulse {
  0%, 100% { box-shadow: 0 0 0 3px oklch(0.62 0.2 312 / 0.25), 0 0 16px oklch(0.62 0.2 312 / 0.4); }
  50% { box-shadow: 0 0 0 7px oklch(0.62 0.2 312 / 0.35), 0 0 34px oklch(0.62 0.2 312 / 0.7); }
}
.reader-img {
  width: 100%; height: auto; max-height: 64vh;
  object-fit: contain; border-radius: 8px; background: #fff; cursor: zoom-in;
  box-shadow: 0 10px 28px -16px rgba(0, 0, 0, 0.4);
  transition: filter .3s ease;
}
/* question en cours (sans réponse) : on floute la diapo ET le texte transcrit
   pour ne pas y lire la réponse pendant qu'on répond. */
body.quiz-asking .reader-img, body.quiz-asking .lightbox-img { filter: blur(14px) brightness(0.94); }
body.quiz-asking .reader-text { filter: blur(6px); user-select: none; }
.reader-text { padding: 18px 20px; overflow-y: auto; max-height: 72vh; transition: filter .3s ease; }
.reader-text::-webkit-scrollbar { width: 7px; }
.reader-text::-webkit-scrollbar-thumb { background: #cdc7b8; border-radius: 5px; }

.flag-chip {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.05em;
  border-radius: 3px; padding: 1px 4px; border: 1px solid currentColor; background: var(--paper);
}
.flag-truncated { color: var(--amber); }
.flag-low_align_confidence { color: var(--red); }
.flag-silent { color: var(--faint); }

.cite-chip { display: inline-flex; align-items: center; gap: 7px; cursor: copy; margin-bottom: 11px; }
.cite-time { font-family: var(--mono); font-size: 10px; color: var(--acc); font-weight: 600; }
.cite-copy { font-family: var(--mono); font-size: 9px; color: var(--faint); }
.cell-body { font-size: 15px; line-height: 1.7; }
.cell-body .sn { transition: background .15s; border-radius: 3px; padding: 0 2px; }
.cell-body .sn.on { background: oklch(0.56 0.16 var(--ch, 292) / 0.24); }
.cell-body .silent-note { color: var(--faint); font-style: italic; }

/* markdown transcrit (photos) : titres, listes, tableaux, + ajouts manuscrits */
.md-legend { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-bottom: 10px; }
.cell-body.md { font-size: 14px; line-height: 1.6; }
.cell-body.md h1 { font-size: 18px; font-weight: 700; margin: 14px 0 6px; }
.cell-body.md h2 { font-size: 16px; font-weight: 700; margin: 12px 0 5px; }
.cell-body.md h3 { font-size: 14.5px; font-weight: 600; margin: 11px 0 4px; color: var(--acc); }
.cell-body.md h4, .cell-body.md h5, .cell-body.md h6 { font-size: 13.5px; font-weight: 600; margin: 9px 0 3px; }
.cell-body.md p { margin: 6px 0; }
.cell-body.md ul, .cell-body.md ol { margin: 5px 0; padding-left: 20px; }
.cell-body.md li { margin: 2px 0; }
.cell-body.md strong { font-weight: 700; }
.cell-body.md code { font-family: var(--mono); font-size: 12.5px; background: var(--line2); border-radius: 4px; padding: 1px 4px; }
.cell-body.md pre { background: #f1ede4; border-radius: 8px; padding: 12px; overflow-x: auto; }
.cell-body.md pre code { background: none; padding: 0; }
.cell-body.md table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.cell-body.md th, .cell-body.md td { border: 1px solid var(--line2); padding: 5px 9px; text-align: left; }
.cell-body.md th { background: var(--accsoft); font-weight: 600; }
.cell-body.md blockquote { border-left: 3px solid var(--line2); margin: 6px 0; padding-left: 12px; color: var(--muted); }
/* formules KaTeX : une formule large défile au lieu de déborder la colonne/cellule */
.cell-body.md .katex-display { overflow-x: auto; overflow-y: hidden; margin: 8px 0; padding-bottom: 2px; }
.cell-body.md td .katex-display, .cell-body.md th .katex-display { margin: 4px 0; text-align: left; }
.cell-body.md .katex { font-size: 1.05em; }
/* contenu MANUSCRIT / ajouté à la main → encre distincte de l'imprimé */
.ms { color: oklch(0.52 0.2 264); background: oklch(0.52 0.2 264 / 0.1); border-radius: 3px; padding: 0 2px; font-style: italic; }

/* loader pendant la localisation (bbox Gemini) + agrandissement plein écran */
.slide-loader {
  position: absolute; z-index: 4; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  background: rgba(20, 19, 15, 0.82); color: #fff; font-size: 13px; white-space: nowrap;
}
.slide-loader[hidden] { display: none; }
.slide-loader .spin {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* zoom image seule (au-dessus du lecteur plein écran) */
.lightbox { position: fixed; inset: 0; z-index: 210; background: rgba(12, 11, 9, 0.96); }
.lightbox[hidden] { display: none; }
.lb-imgwrap {
  position: absolute; inset: 0; overflow: auto;
  display: flex; align-items: center; justify-content: center; padding: 2vh;
}
.lightbox-img { max-width: 100%; max-height: 96vh; object-fit: contain; cursor: zoom-in; user-select: none; }
.lightbox.zoom .lb-imgwrap { align-items: flex-start; justify-content: flex-start; }
.lightbox.zoom .lightbox-img { max-width: none; max-height: none; width: 170%; cursor: zoom-out; }
#lb-box { position: fixed; }                       /* coordonnées viewport */
.answer-hl { background: oklch(0.86 0.17 95); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.lightbox-close {
  position: fixed; top: 16px; right: 18px; z-index: 2; width: 40px; height: 40px;
  border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.16); color: #fff;
  font-size: 18px; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* lecteur PLEIN ÉCRAN : même disposition 3 colonnes, qui remplit la fenêtre */
#reader.reader-fs {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; flex-direction: column; gap: 12px; padding: 14px 18px; overflow: hidden;
}
#reader.reader-fs .reader-bar, #reader.reader-fs .read-cols, #reader.reader-fs .thumbs-wrap {
  max-width: none; margin: 0; padding: 0;
}
#reader.reader-fs .read-cols { flex: 1 1 auto; min-height: 0; align-items: stretch; }
#reader.reader-fs .reader-col { display: flex; flex-direction: column; }
#reader.reader-fs .reader-img-col, #reader.reader-fs .reader-text, #reader.reader-fs .quiz-panel { max-height: none; overflow: auto; }
#reader.reader-fs .reader-slide { flex: 1 1 auto; min-height: 0; }
#reader.reader-fs .reader-img { max-height: 100%; height: 100%; }
#reader.reader-fs .thumbs-wrap { flex: 0 0 auto; }

/* rail de vignettes : petite diapo + numéro de chapitre + premiers mots */
.thumbs-wrap { max-width: 1320px; margin: 16px auto 0; padding: 0 28px 8px; overflow-x: auto; overflow-y: hidden; }
.thumbs-wrap::-webkit-scrollbar { height: 9px; }
.thumbs-wrap::-webkit-scrollbar-track { background: #ded9cd; }
.thumbs-wrap::-webkit-scrollbar-thumb { background: #b8b2a4; border-radius: 6px; }
.thumbs-row { display: flex; gap: 11px; min-width: min-content; }
.thumb {
  --acc: oklch(0.56 0.16 var(--ch, 292));
  flex: 0 0 auto; width: 108px;
  content-visibility: auto; contain-intrinsic-size: 108px 96px;
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
}
.thumb-img {
  width: 108px; height: 61px; object-fit: cover; border-radius: 7px;
  border: 2px solid var(--line2); background: #fff; transition: border-color .15s;
}
.thumb.active .thumb-img, .thumb.playing .thumb-img { border-color: var(--acc); }
.thumb-cap { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.thumb-n { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--acc); }
.thumb-words {
  font-size: 10.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 108px;
}
.thumb.active .thumb-words { color: var(--ink); }

.center-note { margin: auto; color: var(--faint); font-family: var(--mono); font-size: 12px; padding: 60px; text-align: center; }

/* ============ EN PAGE : carousel + panneau de quiz côte à côte ============ */
.read-cols { display: flex; align-items: flex-start; gap: 16px; max-width: 1320px; margin: 10px auto 0; padding: 0 28px; }
.reader-img-col { flex: 1.1 1 0; }
.read-cols .reader-text { flex: 1 1 0; }
.quiz-panel { flex: 0 0 330px; }
/* bascule En page | Plein écran dans l'entête */
.mode-toggle { display: inline-flex; gap: 3px; padding: 3px; background: var(--paper); border: 1px solid var(--line2); border-radius: 10px; }
.mode-btn { border: none; background: none; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 7px 13px; border-radius: 8px; transition: all .15s; }
.mode-btn.on { background: var(--grad); color: #fff; box-shadow: var(--grad-shadow); }

.quiz-empty {
  border: 1px dashed var(--line2); border-radius: 16px; padding: 28px 22px;
  color: var(--muted); font-size: 13.5px; line-height: 1.6; text-align: center; background: var(--paper);
}
.quiz-card {
  --ch: 292; --acc: oklch(0.56 0.16 var(--ch)); --accsoft: oklch(0.56 0.16 var(--ch) / 0.13);
  background: var(--paper); border: 1px solid var(--line2); border-radius: 16px;
  box-shadow: 0 18px 44px -30px rgba(60, 40, 90, 0.5); padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.quiz-kicker { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--acc); }
.quiz-fb { font-size: 14px; font-weight: 700; }
.quiz-fb.good { color: oklch(0.55 0.14 150); }
.quiz-fb.bad { color: var(--red); }
.quiz-q { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.quiz-choices { display: grid; gap: 9px; }
.quiz-choice {
  text-align: left; font-family: inherit; font-size: 14px; cursor: pointer;
  padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line2);
  background: var(--paper); color: var(--ink); transition: border-color .15s, background .15s;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--acc); }
.quiz-choice:disabled { cursor: default; }
.quiz-choice.good { border-color: oklch(0.55 0.14 150); background: oklch(0.55 0.14 150 / 0.12); font-weight: 600; }
.quiz-choice.bad { border-color: var(--red); background: oklch(0.55 0.16 28 / 0.1); }
.quiz-expl { font-size: 13px; line-height: 1.55; color: var(--muted); background: var(--accsoft); border-radius: 10px; padding: 12px 14px; }
.quiz-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz-src, .quiz-next {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--paper); color: var(--ink);
}
.quiz-src:hover { border-color: var(--acc); }
.quiz-next { border: none; background: var(--grad); color: #fff; box-shadow: var(--grad-shadow); margin-left: auto; }

@media (max-width: 900px) {
  .read-cols { flex-direction: column; }
  .reader-img-col, .read-cols .reader-text, .quiz-panel { flex: none; width: 100%; }
}

/* ================= PLEIN ÉCRAN (entraînement) ================= */
.fs-stage {
  --acc: oklch(0.76 0.16 var(--ch, 292));
  --accsoft: oklch(0.76 0.16 var(--ch, 292) / 0.18);
  position: fixed; inset: 0; z-index: 100; background: #100f0c; cursor: none;
  overflow: hidden;
}
.fs-stage[hidden] { display: none; }
.fs-stage.show-cursor, .fs-stage.quiz, .fs-stage.reveal { cursor: auto; }
/* DEUX ZONES. La diapo (haut) est toujours visible EN ENTIER — object-fit
   contain, jamais rognée ni mise à l'échelle du viewport, jamais masquée. Le
   texte et le quiz vivent SOUS elle, jamais par-dessus. La diapo ne fait que
   se flouter pendant le choix de réponse, puis redevient nette. */
.fs-body {
  position: absolute; left: 0; right: 0;
  top: 58px; bottom: 86px;            /* dégage l'entête et les commandes */
  display: flex; flex-direction: column; gap: 1.6vh; padding: 0 4vw;
}
.fs-slide-zone {
  flex: 1 1 52%; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  transition: flex-basis .35s ease;
}
/* question ouverte : la diapo rétrécit un peu (reste entière) pour laisser
   la place aux choix — elle ne disparaît jamais */
.fs-stage.quiz .fs-slide-zone, .fs-stage.reveal .fs-slide-zone { flex-basis: 40%; }
.fs-img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: 12px; background: #000;
  box-shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.85);
  transition: filter .35s ease;
}
.fs-stage.quiz .fs-img { filter: blur(16px) brightness(0.82); }  /* flou PENDANT le choix */
/* révélé / en pause / écoute : net (aucune classe → aucun filtre) */
.fs-content {
  flex: 1 1 48%; min-height: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.6vh; overflow-y: auto; text-align: center;
}

/* stories : une barre par question */
.fs-stories {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 5px;
  padding: 14px 16px; z-index: 5; pointer-events: none;
}
.fs-story { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.22); overflow: hidden; }
.fs-story div { height: 100%; width: 0%; background: #fff; border-radius: 2px; transition: width .25s linear; }

/* entête : marque + type ✦ · score ★ + fermer */
.fs-head {
  position: absolute; top: 26px; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.fs-head-left { display: flex; align-items: center; gap: 10px; color: #fff; flex-wrap: wrap; min-width: 0; }
.fs-head-left .brand-s { width: 26px; height: 26px; border-radius: 7px; font-size: 12px; }
.fs-head-left .nm { font-weight: 700; }
.fs-pill {
  font-family: var(--mono); font-size: 11px; color: #fff;
  background: rgba(255,255,255,0.16); border-radius: 999px; padding: 3px 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.fs-head-right { display: flex; align-items: center; gap: 12px; color: #fff; }
.fs-score { font-family: var(--mono); font-size: 13px; background: rgba(255,255,255,0.16); border-radius: 999px; padding: 5px 13px; }
.fs-score .ok { color: var(--fs-good); }
.fs-close {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.16);
  color: #fff; border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px;
}

/* sous-titres : SOUS la diapo (jamais par-dessus), dévoilés au fil de la voix */
.fs-caption {
  width: 100%; max-width: 1000px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3em;
  font-size: clamp(20px, 3.4vh, 42px); line-height: 1.3; font-weight: 600; color: #fff;
  transition: opacity .12s linear; pointer-events: none;
}
.fs-caption.off { opacity: 0; }
/* question ouverte : la phrase à trou se compacte au-dessus des choix */
.fs-stage.quiz .fs-caption, .fs-stage.reveal .fs-caption {
  font-size: clamp(17px, 2.4vh, 30px);
}
.cap-word { display: inline-block; opacity: 0.32; transition: opacity .25s, text-shadow .25s; will-change: opacity; }
.cap-word.seen { opacity: 1; }
.cap-word.on { opacity: 1; text-shadow: 0 0 22px var(--acc); }
/* le trou : UNE pastille de largeur FIXE — ni la longueur du mot ni le nombre
   de mots n'indicent la réponse (mots masqués consécutifs regroupés) */
.fs-caption .cap-word.cap-mask {
  width: 2.6em; min-width: 2.6em; opacity: 1; text-align: center;
  color: var(--acc); background: var(--accsoft);
  border: 2px dashed var(--acc); border-radius: 0.42em; font-weight: 800;
  text-shadow: none;
}
.fs-stage.quiz .cap-word.cap-mask { animation: vkblink 1s steps(1) infinite; }
/* réponse révélée : pastille pleine à l'accent, texte sombre */
.fs-caption .cap-word.cap-reveal {
  opacity: 1; padding: 0.04em 0.4em; border-radius: 0.4em;
  background: var(--acc); color: #15140f; font-weight: 800;
  box-shadow: 0 8px 26px -8px var(--acc); text-shadow: none;
  animation: capReveal .55s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes capReveal {
  0% { transform: scale(.5); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* le panneau de question : dans la zone de contenu, SOUS la diapo */
.fs-quiz {
  width: 100%; display: flex; justify-content: center;
}
.fs-quiz[hidden] { display: none; }
.fs-quiz-card {
  width: min(100%, 680px);
  display: flex; flex-direction: column; align-items: center; gap: 1.6vh;
  background: rgba(16, 15, 12, .5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px;
  padding: clamp(14px, 2.2vh, 22px) clamp(16px, 3vw, 28px);
  box-shadow: 0 20px 60px -24px rgba(0, 0, 0, .6);
  animation: vkrise .3s ease;
}
.fs-quiz-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.85);
}
.fs-quiz-fb { font-size: clamp(22px, 3.6vw, 32px); font-weight: 800; animation: vkrise .3s ease; }
.fs-quiz-fb.good { color: oklch(0.78 0.15 152); }
.fs-quiz-fb.bad { color: oklch(0.78 0.16 70); }
.fs-quiz-q { font-weight: 700; font-size: clamp(18px, 2.6vh, 26px); line-height: 1.25; color: #fff; }
.fs-quiz-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; width: 100%; }
.fs-choice {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 60px; padding: 15px 20px; border-radius: 16px;
  font-family: inherit; font-size: clamp(15px, 2.1vw, 19px); font-weight: 600; text-align: left;
  color: #fff; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .28);
  cursor: pointer; touch-action: manipulation; transition: all .2s;
}
.fs-choice:hover, .fs-choice:focus-visible { border-color: var(--acc); transform: translateY(-1px); outline: none; }
.fs-choice:disabled { cursor: default; transform: none; }
.fs-choice .mk { font-weight: 800; font-size: 18px; }
.fs-choice.good {
  border-color: var(--fs-good); background: oklch(0.74 0.16 152 / .28); font-weight: 700;
  box-shadow: 0 10px 30px -10px var(--fs-good);
}
.fs-choice.bad { border-color: var(--fs-bad); background: oklch(0.64 0.2 25 / .24); animation: quizShake .3s; }
.fs-choice.off { opacity: .4; }
@keyframes quizShake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.fs-quiz-expl {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: vkrise .3s ease;
}
.fs-quiz-expl[hidden] { display: none; }
.fs-quiz-expl .row {
  width: 100%; display: flex; gap: 13px; align-items: flex-start; text-align: left;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 15px; padding: 16px 18px;
}
.fs-quiz-expl .bulb { font-size: 20px; flex-shrink: 0; }
.fs-quiz-expl .txt { color: rgba(255,255,255,0.95); font-size: clamp(14px, 1.9vw, 16px); line-height: 1.55; flex: 1; }
.fs-quiz-expl .verdict { font-weight: 700; margin-bottom: 4px; display: block; }
.fs-quiz-expl .verdict.good { color: var(--fs-good); }
.fs-quiz-expl .verdict.bad { color: var(--fs-bad); }
.fs-continue {
  font-family: inherit; font-size: 15px; font-weight: 700; min-height: 44px;
  background: #fff; color: #15140f; border: none; border-radius: 13px;
  padding: 13px 30px; cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}
.fs-continue:hover { filter: brightness(1.05); }
.fs-continue.ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.4); box-shadow: none; }
.fs-done-title { font-size: clamp(34px, 7vw, 64px); font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.fs-done-score { font-size: clamp(17px, 2.6vw, 24px); color: rgba(255,255,255,0.85); }

/* commandes du bas : citation · ↑ ⏯ ↓ */
.fs-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  color: #fff;
}
.fs-cite { font-family: var(--mono); font-size: 12px; opacity: 0.8; }
.fs-flag { font-family: var(--mono); font-size: 11px; color: var(--amber); margin-left: 14px; }
.fs-nav { display: flex; align-items: center; gap: 14px; }
.fs-nav button {
  border: none; border-radius: 50%; cursor: pointer; color: #fff;
  background: rgba(255,255,255,0.16); width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  touch-action: manipulation;
}
.fs-nav button.big { width: 50px; height: 50px; background: #fff; color: #15140f; font-size: 15px; }

/* points des questions, à droite — peut être long (« toutes les dates ») :
   plafonné en hauteur et défilable pour ne jamais déborder de l'écran */
.fs-dots {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 6;
  display: flex; flex-direction: column; gap: 9px; align-items: center;
  max-height: 78vh; overflow-y: auto; padding: 4px 0;
  scrollbar-width: none;
}
.fs-dots::-webkit-scrollbar { display: none; }
.fs-dot {
  width: 7px; height: 7px; border-radius: 50%; cursor: pointer; border: none; padding: 0;
  background: rgba(255,255,255,0.45); transition: all .2s;
}
.fs-dot.cur { width: 11px; height: 11px; background: var(--acc); }
.fs-dot.done { background: rgba(255,255,255,0.85); }

.fs-hint {
  /* au-dessus des commandes, pas par-dessus la diapo */
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 13px; color: rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .55); padding: 12px 20px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5;
}
.fs-stage.paused .fs-hint, .fs-stage.ended .fs-hint { opacity: 1; }

/* ============ DÉTAILS PAR ÉTAPE — dépliant « debug » sous chaque carte ======
   Remplace l'ancienne modale Debug : chaque étape du pipeline porte son propre
   panneau entrée/sortie + journal, dépliable en place. */
.stage-toggle {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 2px 0;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.stage-toggle:hover { color: var(--ink); }
.stage-toggle .chev { display: inline-block; transition: transform .15s; }
.stage-card.open .stage-toggle .chev { transform: rotate(90deg); }
.stage-card:not(.open) .stage-debug { display: none; }
.stage-debug {
  margin-top: 11px; background: #1c1b17; border: 1px solid #34322b; border-radius: 10px;
  padding: 13px 15px; font-family: var(--mono); color: #cfc9bb;
  max-height: 270px; overflow-y: auto; overflow-x: hidden;
}
.stage-debug::-webkit-scrollbar { width: 8px; }
.stage-debug::-webkit-scrollbar-thumb { background: #48443b; border-radius: 5px; }
.dbg-io { display: flex; gap: 10px; font-size: 11.5px; line-height: 1.65; }
.dbg-io .k { color: oklch(0.7 0.15 172); min-width: 56px; flex-shrink: 0; }
.dbg-io .v { color: #ded8ca; word-break: break-word; }
.dbg-tech { font-size: 11.5px; color: #8a8576; line-height: 1.6; margin: 9px 0 0; }
.dbg-journal { margin-top: 11px; border-top: 1px solid #2c2a23; padding-top: 10px; font-size: 12px; line-height: 1.85; }
.dbg-journal .ln .t { color: #6f6a5c; }
.dbg-journal .ev { color: #d9d4c6; word-break: break-word; overflow-wrap: anywhere; }
.dbg-journal .ev.ok { color: #a9c08a; }
.dbg-journal .ev.warn { color: #d9a45f; }
.dbg-journal .empty { color: #6f6a5c; font-style: italic; font-size: 11.5px; }
.proc-cost { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ============ IMPORT : sélecteur Vidéo|Photos + file d'attente photos ======= */
.type-toggle {
  display: inline-flex; gap: 4px; margin: 4px 0 22px; padding: 4px;
  background: var(--paper); border: 1px solid var(--line2); border-radius: 12px;
}
.type-btn {
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 9px 18px; border-radius: 9px; transition: all .15s;
}
.type-btn.on { background: var(--grad); color: #fff; box-shadow: var(--grad-shadow); }

.folder-row { display: flex; gap: 10px; margin-bottom: 16px; }
.folder-select {
  flex: 1; min-width: 0; font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line2); border-radius: 10px; padding: 11px 14px;
}
.photo-queue {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px; margin-top: 16px;
}
.qthumb { position: relative; aspect-ratio: 4/3; }
.qthumb img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line2); background: #fff;
}
.qthumb .qext {
  display: none; position: absolute; inset: 0; border-radius: 8px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line2); background: var(--paper);
  font: 600 12px/1 var(--mono); letter-spacing: 0.06em; color: var(--muted);
}
.qthumb.noimg img { display: none; }
.qthumb.noimg .qext { display: flex; }
.qx {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 12px; line-height: 1;
  background: var(--ink); color: var(--paper); box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.qthumb.busy .qx { display: none; }
.qthumb.busy::after {
  content: ""; position: absolute; inset: 0; border-radius: 8px;
  background: rgba(255,255,255,0.45);
}

/* ================= GALERIE ================= */
.gal-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 26px;
}
.gal-head h1 { font-size: 30px; font-weight: 600; margin-top: 6px; }
.gal-sub { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.gal-sub.err { color: var(--red); font-weight: 600; }
.gal-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-line {
  font-family: var(--mono); font-size: 12px; color: var(--ink); text-decoration: none;
  border: 1px solid var(--line2); border-radius: 10px; padding: 10px 16px; cursor: pointer;
}
.btn-line:hover { border-color: var(--ink); }
.btn-danger {
  font-family: inherit; font-size: 13px; font-weight: 600; color: #fff; cursor: pointer;
  background: var(--red); border: none; border-radius: 10px; padding: 11px 18px;
}
.btn-danger:hover { filter: brightness(0.95); }
.gal-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px;
}
.gthumb {
  position: relative; margin: 0; aspect-ratio: 3/4; border: 1px solid var(--line2);
  border-radius: 12px; overflow: hidden; background: var(--paper);
}
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gthumb.bad { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.gthumb.bad figcaption { background: var(--red); }
.gthumb-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.gthumb figcaption {
  position: absolute; left: 8px; bottom: 8px; font-size: 10.5px; color: #fff;
  background: rgba(0,0,0,0.55); border-radius: 6px; padding: 2px 7px;
}
.gx {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 13px; line-height: 1;
  background: var(--ink); color: var(--paper); box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.gx:hover { background: var(--red); }
.gx:disabled { opacity: 0.4; cursor: default; }
.gal-empty { color: var(--muted); font-size: 14px; padding: 40px 4px; }

/* ================= RESPONSIVE ================= */
@media (max-width: 760px) {
  .topbar-in { padding: 0 16px; gap: 10px; height: 54px; }
  .nav-step { padding: 7px 10px; }
  .nav-step span:not(.n) { display: none; }   /* numéros seuls sur téléphone */
  .topbar .btn-new { padding: 7px 11px; font-size: 16px; }
  .btn-new-tx { display: none; }              /* « Nouvelle vidéo » → ＋ seul sur XS */
  .btn-new-ic { display: inline; }
  .page { padding: 36px 18px 64px; }
  .src-grid { grid-template-columns: 1fr; }   /* empile fichiers / import sur mobile */
  .counters { gap: 18px; }
  .counter .v { font-size: 19px; }
  .viewer-head { padding: 24px 18px 0; }
  .transport, .practice-wrap, .reader-stage, .thumbs-wrap { padding-left: 18px; padding-right: 18px; }
  .transport-label { min-width: 0; }
  .practice-in { gap: 12px; }
  .practice-star { display: none; }
  .reader-arrow { width: 38px; height: 38px; font-size: 20px; }
  .reader-arrow.prev { left: 8px; }
  .reader-arrow.next { right: 8px; }
  .reader-img { max-height: 38vh; }
  .reader-text { max-height: 30vh; }
  .fs-body { padding: 0 12px; gap: 1vh; }
  .fs-caption { font-size: clamp(20px, 5.4vw, 30px); }
  .fs-quiz-card { gap: 1.2vh; }
  .fs-quiz-choices { grid-template-columns: 1fr; gap: 10px; }
  .fs-choice { min-height: 54px; }
  .fs-pill { max-width: 34vw; }
  .fs-dots { right: 8px; }
}
