/* Liseuse des livres du projet (npolony.fr) : le PDF qui se lit comme un livre.
   Charte 2027 : crème, encre ardoise, rouge #ea504b, turquoise #009aac, Greed Condensed pour les titres.
   Mode clair seulement. Aucun style en ligne : les positions et tailles passent par le CSSOM (liseuse.js). */

@font-face { font-family: "Greed Condensed"; src: url("/fonts/greed-condensed-heavy.woff2") format("woff2"); font-style: normal; font-weight: 900; font-display: swap; }
@font-face { font-family: "Greed Condensed"; src: url("/fonts/greed-condensed-semibold.woff2") format("woff2"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: "Greed Condensed"; src: url("/fonts/greed-condensed-regular.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Greed Standard"; src: url("/fonts/greed-standard-regular.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Greed Standard"; src: url("/fonts/greed-standard-heavy.woff2") format("woff2"); font-style: normal; font-weight: 900; font-display: swap; }

:root {
  --creme: #f9f7f3;
  --creme-2: #ecebe4;
  --table: #e4dfd5;
  --encre: #424047;
  --gris: #6c6a66;
  --ligne: #dcd6cb;
  --rouge: #ea504b;
  --rouge-f: #d2403b;
  --turq: #009aac;
  --titre: "Greed Condensed", "Arial Narrow", sans-serif;
  --texte: "Greed Standard", Arial, sans-serif;
  --pw: 400px;
  --ph: 566px;
  --ox: 400px;
  --lw: 800px;
  --decal: 0px;
  --total-scale-factor: 1;
  --scale-round-x: 1px;
  --scale-round-y: 1px;
  color-scheme: only light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.ls {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--table);
  background-image: radial-gradient(ellipse at 50% 35%, #f3efe7 0%, var(--table) 70%);
  color: var(--encre);
  font: 400 15px/1.4 var(--texte);
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) 0 env(safe-area-inset-left, 0);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; }
.ls-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Barre du haut ─────────────────────────────────────────────────────────── */
.ls-barre {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--creme);
  border-bottom: 1px solid var(--ligne);
}
.ls-fermer {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--rouge); background: var(--creme); color: var(--rouge); text-decoration: none;
}
.ls-fermer:hover { background: var(--rouge); color: #fff; }
.ls-fermer svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ls-titre { min-width: 0; }
.ls-kicker { margin: 0 0 1px; font: 900 11px/1.2 var(--titre); letter-spacing: .14em; text-transform: uppercase; color: var(--rouge); }
.ls-titre h1 { margin: 0; font: 900 24px/1.05 var(--titre); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-titre h1 span { font: 400 15px/1 var(--texte); text-transform: none; color: var(--gris); margin-left: 6px; }

.ls-outils { display: flex; align-items: center; gap: 2px; }
.ls-secondaires { display: contents; }
.ls-outil {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px;
  border: 0; background: transparent; color: var(--encre); text-decoration: none; white-space: nowrap;
  font: 600 14px/1 var(--titre); letter-spacing: .02em;
}
.ls-outil:hover { background: var(--creme-2); }
.ls-outil[aria-pressed="true"], .ls-outil[aria-expanded="true"] { color: var(--rouge); }
.ls-outil svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ls-outil[data-ls-signet][aria-pressed="true"] svg { fill: currentColor; }
.ls-outil[data-ls-plus] svg { stroke-width: 3.2; }
.ls-plus { display: none; }
@media (max-width: 1380px) { .ls-secondaires .ls-outil span { display: none; } }
@media (max-width: 1100px) { .ls-outil span { display: none; } .ls-outil { padding: 0 9px; } }

/* Menu Partager */
.ls-menu {
  position: absolute; top: calc(100% + 6px); right: 16px; z-index: 40; width: 320px; max-width: calc(100vw - 32px);
  padding: 8px; background: #fff; border: 1px solid var(--ligne); box-shadow: 0 18px 40px -12px rgba(40, 34, 30, .35);
}
.ls-menu-titre { margin: 4px 8px 8px; font: 900 12px/1.2 var(--titre); letter-spacing: .12em; text-transform: uppercase; color: var(--rouge); }
.ls-menu > button { display: block; width: 100%; padding: 10px 8px; border: 0; background: none; text-align: left; }
.ls-menu > button:hover { background: var(--creme); }
.ls-reseaux { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--ligne); }
.ls-reseaux a { padding: 8px 6px; text-align: center; color: var(--encre); text-decoration: none; font: 600 13px/1.2 var(--titre); border: 1px solid var(--ligne); }
.ls-reseaux a:hover { border-color: var(--encre); }

/* ── La scène et le livre ──────────────────────────────────────────────────── */
.ls-scene {
  position: relative;
  display: flex;
  min-height: 0;
  overflow: hidden;
  padding: 24px 32px;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.ls-scene.is-zoom { overflow: auto; touch-action: pan-x pan-y; }
.ls-scene.is-defile { overflow: auto; touch-action: pan-x pan-y; padding: 0; }
.ls-livre {
  position: relative;
  flex: none;
  margin: auto;
  width: var(--lw);
  height: var(--ph);
  transform: translateX(var(--decal));
  transition: transform .5s cubic-bezier(.3, .7, .2, 1), opacity .2s;
}
.ls-livre.is-saut { opacity: .25; transition: opacity 0s; }
.ls-livre.is-prise { cursor: grab; }
.ls-livre.is-refus { animation: ls-refus .35s; }
@keyframes ls-refus { 25% { translate: -6px 0; } 60% { translate: 5px 0; } }
.ls-slot { position: absolute; top: 0; left: 0; width: var(--pw); height: var(--ph); }
.ls-slot.droite { left: var(--ox); }
.ls-slot:not(.is-vide) { box-shadow: 0 22px 44px -22px rgba(36, 30, 26, .55), 0 2px 6px rgba(36, 30, 26, .14); }
.ls-slot::after { content: ""; position: absolute; top: 0; bottom: 0; width: 14%; pointer-events: none; z-index: 3; }
.ls-livre.is-double .ls-slot.gauche::after { right: 0; background: linear-gradient(to left, rgba(36, 30, 26, .2), rgba(36, 30, 26, .05) 30%, rgba(36, 30, 26, 0)); }
.ls-livre.is-double .ls-slot.droite::after { left: 0; width: 9%; background: linear-gradient(to right, rgba(36, 30, 26, .16), rgba(255, 255, 255, .06) 35%, rgba(255, 255, 255, 0)); }
.ls-slot.is-vide::after { display: none; }

/* Une page */
.ls-pv { position: relative; width: var(--pw); height: var(--ph); background: #fff; overflow: hidden; }
.ls-pv-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.ls-pv-attente { position: absolute; inset: 0; background: linear-gradient(100deg, #fff 30%, #f4f1ea 50%, #fff 70%) 0 0 / 300% 100%; animation: ls-attente 1.6s linear infinite; }
.ls-pv.is-rendu .ls-pv-attente { display: none; }
@keyframes ls-attente { to { background-position: -150% 0; } }
.ls-ruban {
  position: absolute; top: 0; right: 16px; z-index: 4; width: 22px; height: 36px; padding: 0; border: 0;
  background: var(--rouge); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  opacity: 0; transform: translateY(-10px); transition: opacity .18s, transform .18s;
}
.ls-slot.gauche .ls-ruban { right: auto; left: 16px; }
.ls-pv:hover .ls-ruban { opacity: .35; transform: translateY(-4px); }
.ls-pv .ls-ruban:hover { opacity: .75; }
.ls-pv.is-signet .ls-ruban { opacity: 1; transform: none; }
.ls-tour .ls-ruban { display: none; }
/* Liens de la page : le sommaire cliquable, et les liens du PDF */
.ls-liens { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.ls-lien { position: absolute; display: block; pointer-events: auto; cursor: pointer; transition: background .15s, box-shadow .15s; }
.ls-lien:hover, .ls-lien:focus-visible { background: rgba(0, 154, 172, .1); box-shadow: inset 3px 0 0 var(--turq); outline: none; }
.ls-tour .ls-liens, body.is-capture .ls-liens { display: none; }

/* La page qui se tourne : coin qui se soulève, rabat, ombres (géométrie dans liseuse.js) */
.ls-tour { position: absolute; top: 0; left: var(--ox); width: var(--pw); height: var(--ph); z-index: 6; pointer-events: none; }
.ls-t-face, .ls-t-dos { position: absolute; top: 0; left: 0; width: var(--pw); height: var(--ph); transform-origin: 0 0; overflow: hidden; }
.ls-t-dos-ombre { position: absolute; inset: 0; filter: drop-shadow(0 0 14px rgba(36, 30, 26, .3)); }
.ls-t-ombre, .ls-t-reflet { position: absolute; top: 0; left: calc(-1 * var(--pw)); width: calc(2 * var(--pw)); height: var(--ph); }
.ls-papier { width: 100%; height: 100%; background: linear-gradient(90deg, #f4f1ea, #fbfaf7 60%, #f7f4ee); }
.ls-tour .textLayer { display: none; }

/* Défilement */
.ls-defile { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; padding: 24px 12px 48px; }
.ls-defile-page { position: relative; flex: none; width: var(--pw); height: var(--ph); background: #fff; box-shadow: 0 14px 30px -18px rgba(36, 30, 26, .5); }
.ls-defile .ls-ruban { right: 16px; left: auto; }

/* Couche de texte de pdf.js (sélection, recherche) : règles reprises de pdf_viewer.css */
.textLayer {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important; overflow: clip; opacity: 1; line-height: 1;
  text-align: initial; letter-spacing: normal; word-spacing: normal; text-size-adjust: none; -webkit-text-size-adjust: none;
  forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 2;
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
  -webkit-user-select: text; user-select: text;
}
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; -webkit-user-select: text; user-select: text; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) {
  z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
.textLayer .markedContent { display: contents; }
.textLayer ::selection { background: rgba(0, 154, 172, .3); color: transparent; }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; -webkit-user-select: none; user-select: none; }
.textLayer mark { color: transparent; background: rgba(234, 80, 75, .28); margin: 0; padding: 0; border-radius: 0; }
.textLayer mark.ls-surligne { background: rgba(0, 154, 172, .3); }
.textLayer mark.ls-trouve.ls-surligne { background: rgba(234, 80, 75, .4); }
.textLayer mark.is-actif { background: rgba(234, 80, 75, .55); box-shadow: 0 0 0 2px var(--rouge); }
body.is-capture .textLayer { pointer-events: none; }

/* Chargement */
.ls-chargement { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px; pointer-events: none; }
.ls-chargement p { margin: 0; font: 600 16px/1.3 var(--titre); letter-spacing: .04em; color: var(--gris); text-align: center; max-width: 340px; pointer-events: auto; }
.ls-chargement a { color: var(--rouge); }
.ls-roue { width: 34px; height: 34px; border: 3px solid var(--ligne); border-top-color: var(--rouge); border-radius: 50%; animation: ls-roue .9s linear infinite; }
.ls-chargement.is-erreur .ls-roue { display: none; }
@keyframes ls-roue { to { transform: rotate(1turn); } }

/* Flèches */
.ls-fleche {
  position: fixed; top: 50%; z-index: 20; width: 46px; height: 74px; margin-top: -37px; padding: 0;
  display: grid; place-items: center; border: 0; background: rgba(249, 247, 243, .82); color: var(--encre);
  box-shadow: 0 6px 18px -10px rgba(36, 30, 26, .5); transition: background .15s, opacity .2s;
}
.ls-fleche:hover { background: var(--rouge); color: #fff; }
.ls-fleche:disabled { opacity: 0; pointer-events: none; }
.ls-fleche svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ls-prec { left: max(8px, env(safe-area-inset-left, 0px)); }
.ls-suiv { right: max(8px, env(safe-area-inset-right, 0px)); }

/* ── Pied : chapitre, curseur, page, zoom, affichage ────────────────────────── */
.ls-pied {
  position: relative; z-index: 25;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(160px, 2fr) auto auto auto; align-items: center; gap: 18px;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--creme); border-top: 1px solid var(--ligne);
}
.ls-chapitre { margin: 0; min-width: 0; font: 600 15px/1.2 var(--titre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-chapitre b { font-weight: 900; color: var(--rouge); margin-right: 6px; }
.ls-curseur { position: relative; height: 28px; display: flex; align-items: center; }
.ls-curseur input { width: 100%; margin: 0; accent-color: var(--rouge); cursor: pointer; position: relative; z-index: 1; background: transparent; }
.ls-reperes { position: absolute; left: 8px; right: 8px; top: 50%; height: 0; }
.ls-reperes i { position: absolute; top: -9px; width: 2px; height: 7px; background: var(--gris); opacity: .55; }
.ls-curseur output {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); padding: 6px 10px; white-space: nowrap;
  background: var(--encre); color: var(--creme); font: 600 13px/1.2 var(--titre); pointer-events: none; max-width: 70vw; overflow: hidden; text-overflow: ellipsis;
}
.ls-page { display: flex; align-items: center; gap: 6px; margin: 0; font: 600 15px/1 var(--titre); }
.ls-page input { width: 64px; height: 34px; padding: 0 6px; text-align: center; border: 1px solid var(--ligne); background: #fff; font: 600 15px/1 var(--titre); }
.ls-zoom, .ls-vue { display: flex; border: 1px solid var(--ligne); background: #fff; }
.ls-zoom button, .ls-vue button { height: 34px; min-width: 34px; padding: 0 10px; border: 0; background: none; font: 600 14px/1 var(--titre); }
.ls-zoom button + button, .ls-vue button + button { border-left: 1px solid var(--ligne); }
.ls-zoom [data-ls-zoom="0"] { min-width: 64px; }
.ls-zoom button:hover, .ls-vue button:hover { background: var(--creme); }
.ls-vue [aria-pressed="true"] { background: var(--encre); color: var(--creme); }
.ls-vue [aria-pressed="true"]:hover { background: var(--encre); }

/* Lecture plein cadre : toucher le milieu de la page */
body.is-immersif .ls-barre, body.is-immersif .ls-pied { display: none; }
body.is-immersif { grid-template-rows: 0 minmax(0, 1fr) 0; }

/* ── Panneau : sommaire, pages, recherche, signets ─────────────────────────── */
.ls-panneau {
  position: fixed; z-index: 35; top: 0; right: 0; bottom: 0; width: min(400px, 100vw);
  display: flex; flex-direction: column; background: var(--creme); border-left: 1px solid var(--ligne);
  box-shadow: -24px 0 50px -30px rgba(36, 30, 26, .55); animation: ls-panneau .22s ease-out;
}
@keyframes ls-panneau { from { transform: translateX(30px); opacity: 0; } }
.ls-onglets { display: flex; align-items: stretch; border-bottom: 1px solid var(--ligne); padding: env(safe-area-inset-top, 0) 0 0; }
.ls-onglets [role="tab"] { flex: 1; padding: 16px 4px 13px; border: 0; border-bottom: 3px solid transparent; background: none; font: 600 15px/1 var(--titre); color: var(--gris); }
.ls-onglets [aria-selected="true"] { color: var(--encre); border-bottom-color: var(--rouge); }
.ls-panneau-fermer { width: 48px; border: 0; background: none; display: grid; place-items: center; }
.ls-panneau-fermer svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.ls-onglet { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 28px; -webkit-overflow-scrolling: touch; }
.ls-onglet h2 { margin: 8px 0 8px; font: 900 13px/1.2 var(--titre); letter-spacing: .12em; text-transform: uppercase; color: var(--rouge); }
.ls-onglet h2 + .ls-liste:empty::before { content: attr(data-vide); display: block; padding: 6px 0 14px; color: var(--gris); font-size: 14px; }

.ls-sommaire, .ls-resultats, .ls-liste, .ls-vignettes { list-style: none; margin: 0; padding: 0; }
.ls-sommaire button {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; width: 100%;
  padding: 11px 10px 11px 8px; border: 0; border-left: 3px solid transparent; background: none; text-align: left;
}
.ls-sommaire button:hover { background: #fff; }
.ls-sommaire .is-actif button { background: #fff; border-left-color: var(--rouge); }
.ls-som-no { font: 900 22px/1 var(--titre); color: var(--rouge); }
.ls-som-titre { font: 600 16px/1.2 var(--titre); }
.ls-som-page { font: 400 13px/1 var(--texte); color: var(--gris); }

.ls-vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 12px; }
.ls-vignette { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: center; font: 600 13px/1 var(--titre); color: var(--gris); }
.ls-vignette-image { position: relative; display: block; aspect-ratio: 595 / 842; margin-bottom: 6px; background: #fff; outline: 1px solid var(--ligne); }
.ls-vignette-image canvas { display: block; width: 100%; height: 100%; }
.ls-vignette:hover .ls-vignette-image { outline: 2px solid var(--encre); }
.is-actif > .ls-vignette .ls-vignette-image { outline: 3px solid var(--rouge); }
.is-actif > .ls-vignette { color: var(--rouge); }
.is-signet > .ls-vignette .ls-vignette-image::after { content: ""; position: absolute; top: 0; right: 8px; width: 12px; height: 18px; background: var(--rouge); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }

.ls-recherche { display: flex; gap: 4px; margin-bottom: 8px; }
.ls-recherche input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--encre); background: #fff; font-size: 16px; }
.ls-recherche button { width: 42px; border: 1px solid var(--ligne); background: #fff; display: grid; place-items: center; }
.ls-recherche button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); }
.ls-recherche-etat { margin: 0 0 10px; min-height: 1.2em; color: var(--gris); font-size: 14px; }
.ls-resultats button { display: block; width: 100%; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--ligne); background: none; text-align: left; font-size: 14px; line-height: 1.4; }
.ls-resultats button:hover, .ls-resultats [aria-current="true"] button { background: #fff; }
.ls-resultats [aria-current="true"] button { box-shadow: inset 3px 0 0 var(--rouge); }
.ls-res-page { display: block; margin-bottom: 2px; font: 900 12px/1 var(--titre); letter-spacing: .08em; text-transform: uppercase; color: var(--rouge); }
.ls-resultats mark { background: rgba(234, 80, 75, .25); color: inherit; padding: 0 1px; }

.ls-liste li { display: flex; align-items: flex-start; gap: 6px; border-bottom: 1px solid var(--ligne); }
.ls-liste .ls-aller { flex: 1; min-width: 0; padding: 10px 6px; border: 0; background: none; text-align: left; font-size: 14px; }
.ls-liste .ls-aller:hover { background: #fff; }
.ls-liste .ls-aller b { display: block; font: 900 12px/1.3 var(--titre); letter-spacing: .06em; text-transform: uppercase; color: var(--rouge); }
.ls-liste blockquote { margin: 3px 0 0; padding-left: 8px; border-left: 3px solid var(--turq); color: var(--encre); }
.ls-liste .ls-mini { flex: none; align-self: center; padding: 6px 8px; border: 1px solid var(--ligne); background: #fff; font: 600 12px/1 var(--titre); }
.ls-liste .ls-mini:hover { border-color: var(--encre); }
.ls-note { margin: 18px 0 0; color: var(--gris); font-size: 13px; }

/* ── Barre de la sélection ─────────────────────────────────────────────────── */
.ls-selection { position: fixed; z-index: 45; display: flex; background: var(--encre); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); }
.ls-selection button { padding: 10px 12px; border: 0; background: none; color: var(--creme); font: 600 14px/1 var(--titre); white-space: nowrap; }
.ls-selection button:hover { background: var(--rouge); }
.ls-selection button + button { border-left: 1px solid rgba(255, 255, 255, .15); }

/* ── Capture d'un extrait ──────────────────────────────────────────────────── */
.ls-capture-voile { position: fixed; z-index: 40; left: 50%; top: 76px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); }
.ls-capture-voile p { margin: 0; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 12px; background: var(--encre); color: var(--creme); font: 600 15px/1.3 var(--titre); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); }
.ls-capture-voile button { padding: 7px 12px; border: 1px solid var(--creme); background: none; color: var(--creme); font: 600 14px/1 var(--titre); }
body.is-capture .ls-pv { cursor: crosshair; }
body.is-capture .ls-slot:not(.is-vide), body.is-capture .ls-defile-page { outline: 2px dashed rgba(234, 80, 75, .6); outline-offset: 3px; }
.ls-cadre { position: absolute; z-index: 5; border: 2px solid var(--rouge); background: rgba(234, 80, 75, .1); box-shadow: 0 0 0 9999px rgba(36, 30, 26, .28); pointer-events: none; }

/* ── Fenêtres : image à partager, impression, raccourcis ───────────────────── */
.ls-dialogue {
  width: min(980px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0;
  background: var(--creme); color: var(--encre); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}
.ls-dialogue::backdrop { background: rgba(40, 36, 40, .55); }
.ls-impression-dlg, .ls-aide { width: min(460px, calc(100vw - 24px)); }
.ls-dlg-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--ligne); }
.ls-dlg-tete h2 { margin: 0; font: 900 22px/1.1 var(--titre); text-transform: uppercase; }
.ls-dlg-fermer { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--rouge); background: none; color: var(--rouge); }
.ls-dlg-fermer svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ls-composeur-corps { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; padding: 20px; }
.ls-apercu { display: grid; place-items: center; min-height: 240px; background: var(--creme-2); padding: 14px; }
.ls-apercu canvas { display: block; max-width: 100%; max-height: min(62dvh, 600px); width: auto; height: auto; box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .45); }
.ls-dialogue fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.ls-dialogue legend { margin-bottom: 8px; font: 900 12px/1.2 var(--titre); letter-spacing: .12em; text-transform: uppercase; color: var(--rouge); }
.ls-impression-dlg form { margin: 0; }
.ls-impression-dlg fieldset, .ls-impression-dlg .ls-dlg-actions, .ls-impression-dlg .ls-dlg-etat { margin: 16px 20px; }
.ls-choix { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.ls-choix input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--rouge); }
.ls-choix input[type="text"] { width: 48px; height: 30px; text-align: center; border: 1px solid var(--ligne); background: #fff; }
.ls-dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ls-btn { padding: 11px 16px; border: 1px solid var(--rouge); background: var(--rouge); color: #fff; font: 600 15px/1 var(--titre); letter-spacing: .02em; }
.ls-btn:hover { background: var(--rouge-f); }
.ls-btn.is-clair { background: none; color: var(--encre); border-color: var(--encre); }
.ls-btn.is-clair:hover { background: var(--encre); color: var(--creme); }
.ls-dlg-etat { min-height: 1.3em; margin: 10px 0 0; color: var(--gris); font-size: 14px; }
.ls-raccourcis { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; padding: 18px 20px 22px; }
.ls-raccourcis dt { white-space: nowrap; }
.ls-raccourcis dd { margin: 0; }
kbd { display: inline-block; min-width: 26px; padding: 3px 6px; border: 1px solid var(--ligne); border-bottom-width: 2px; background: #fff; font: 600 13px/1 var(--titre); text-align: center; }

/* Message bref */
.ls-toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px;
  background: var(--encre); color: var(--creme); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5); animation: ls-toast .2s ease-out;
}
@keyframes ls-toast { from { transform: translate(-50%, 10px); opacity: 0; } }
.ls-toast p { margin: 0; font-size: 14px; }
.ls-toast [data-ls-toast-action] { padding: 8px 12px; border: 0; background: var(--rouge); color: #fff; font: 600 14px/1 var(--titre); }
.ls-toast-fermer { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--creme); }
.ls-toast-fermer svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ls-sans-js { position: fixed; inset: auto 16px 16px; padding: 14px; background: #fff; }

/* Impression : seules les pages préparées */
.ls-impression { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  body.ls { display: block; height: auto; overflow: visible; background: #fff; padding: 0; }
  body.ls > * { display: none !important; }
  body.ls > .ls-impression { display: block !important; }
  .ls-impression img { display: block; width: 210mm; height: 296mm; object-fit: contain; break-after: page; page-break-after: always; }
  .ls-impression img:last-child { break-after: auto; page-break-after: auto; }
}

/* ── Téléphone et petites fenêtres ─────────────────────────────────────────── */
@media (max-width: 760px) {
  .ls-barre { gap: 8px; padding: 8px 10px; }
  .ls-kicker { display: none; }
  .ls-titre h1 { font-size: 20px; }
  .ls-titre h1 span { display: none; }
  .ls-outil { padding: 0 8px; }
  .ls-plus { display: inline-flex; }
  .ls-secondaires {
    display: none; position: absolute; top: calc(100% + 4px); right: 8px; z-index: 40; min-width: 230px; padding: 6px;
    background: #fff; border: 1px solid var(--ligne); box-shadow: 0 18px 40px -12px rgba(40, 34, 30, .35);
  }
  .ls-outils.is-ouvert .ls-secondaires { display: flex; flex-direction: column; align-items: stretch; }
  .ls-secondaires .ls-outil { justify-content: flex-start; height: 46px; padding: 0 12px; }
  .ls-secondaires .ls-outil span { display: inline; font-size: 16px; }
  .ls-menu { right: 8px; }
  .ls-scene { padding: 10px; }
  .ls-fleche { display: none; }
  .ls-pied { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "curseur curseur curseur" "chapitre page vue"; gap: 6px 10px; padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .ls-curseur { grid-area: curseur; }
  .ls-chapitre { grid-area: chapitre; font-size: 14px; }
  .ls-page { grid-area: page; font-size: 14px; }
  .ls-page input { width: 56px; height: 32px; }
  .ls-vue { grid-area: vue; }
  .ls-vue button { padding: 0 8px; height: 32px; }
  .ls-zoom { display: none; }
  .ls-panneau { top: auto; left: 0; width: auto; height: 82dvh; border-left: 0; border-top: 1px solid var(--ligne); box-shadow: 0 -24px 50px -30px rgba(36, 30, 26, .6); animation-name: ls-tiroir; }
  @keyframes ls-tiroir { from { transform: translateY(40px); opacity: 0; } }
  .ls-onglets { padding-top: 0; }
  .ls-composeur-corps { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .ls-apercu canvas { max-height: 40dvh; }
  .ls-dialogue fieldset { display: flex; flex-wrap: wrap; gap: 0 14px; }
  .ls-dialogue legend { width: 100%; }
  .ls-impression-dlg fieldset { display: block; }
  .ls-capture-voile { top: 64px; }
  .ls-capture-voile p { font-size: 14px; }
  .ls-toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .ls-livre { transition: none; }
  .ls-panneau, .ls-toast { animation: none; }
}
