/* police Rajdhani (Google Fonts, licence OFL) : fichiers locaux du projet, dossier fonts/ ; aucune adresse externe */
@font-face { font-family: "Rajdhani"; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/Rajdhani-Light.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Rajdhani-Regular.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/Rajdhani-Medium.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/Rajdhani-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/Rajdhani-Bold.ttf") format("truetype"); }
:root {
  --red: #c8102e;
  --header-h: var(--cfg-header-h, 100px);   /* cadre du haut (réglable dans config.json -> ui.headerHeight) */
  --footer-h: var(--cfg-footer-h, 50px);    /* cadre du bas (ui.footerHeight) */
  --toc-w: var(--cfg-toc-w, 280px);         /* largeur de la table des matières (ui.tocWidth) */
  --stage-left: var(--toc-w);   /* début de la zone d'affichage des pages (0 si la table des matières est masquée) */
  --stage-bg: #000;
  --on-red: #fff;
  /* apparence (écrasée par catalog/config.json -> "ui") */
  --header-bg: #000; --on-header: #fff;
  --footer-bg: #000; --on-footer: #fff;
  --toc-bg: rgba(0,0,0,.7); --toc-bg-solid: rgba(0,0,0,.96); --toc-fg: #fff;   /* liste */
  --toc-active-bg: rgba(255,255,255,.16); --toc-active-fg: #fff; --toc-bar: #c8102e;   /* entrée active de la liste */
  --toc-head-bg: rgba(0,0,0,.7); --toc-head-solid: rgba(0,0,0,.96);          /* bandeau « Table des matières » */
  --bg-color: #000; --bg-img-op: 1; --bg-overlay: rgba(0,0,0,0);              /* fond du cadre central */
  --search-bg: #fff; --search-fg: #222;        /* panneau de recherche */
  --pf-extra: 20px;    /* largeur ajoutée au champ de pagination */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
  height: 100dvh;
  overflow: hidden;
  background: var(--stage-bg);
  color: #111;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- cadres rouges ---------- */
#top { background: var(--header-bg); color: var(--on-header); }
#bottom { background: var(--footer-bg); color: var(--on-footer); }
#top {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px 0 0;
}
.top-left { display: flex; align-items: center; min-width: 0; }
/* le logo occupe la largeur de la table des matières ; le nom commence 10 px après */
/* logo : 90 % de la largeur / hauteur d'origine (bureau) */
#logo { width: var(--toc-w); flex: none; height: calc((var(--header-h) - 24px) * .9);
  padding: 0 calc(10px + (var(--toc-w) - 20px) * .05); object-fit: contain; object-position: center; }
#catalogName {
  margin: 0; min-width: 0; font-size: var(--title-fs, clamp(1rem, 2vw, 1.6rem)); font-weight: var(--title-fw, 650); letter-spacing: .01em;
  font-family: var(--font-title, inherit); color: var(--title-fg, inherit);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-center { display: flex; align-items: center; justify-content: center; gap: 28px; min-width: 0; }
.top-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

.page-field {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: color-mix(in srgb, currentColor 14%, transparent); border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: 8px;
  padding: 7px calc(14px + var(--pf-extra) / 2); font-size: var(--pf-fs, 1.05rem);
}
.page-field input {
  width: calc(9ch + 4px); min-width: 0; background: transparent; border: 0; border-bottom: 2px solid color-mix(in srgb, currentColor 60%, transparent);
  color: inherit; font: inherit; font-weight: 700; text-align: right; padding: 0 2px; -moz-appearance: textfield;
}
.page-field input::-webkit-outer-spin-button, .page-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.page-field input:focus { outline: none; border-bottom-color: currentColor; }
.page-field span { opacity: .85; }
.page-field .pf-label { opacity: 1; }

/* sélecteur de langue : à droite du titre, sans décaler le titre (qui reste centré) */
.title-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.title-wrap .lang { position: absolute; left: 100%; margin-left: 28px; top: 50%; transform: translateY(-50%); }
/* même fond et même contour pour la pagination et le sélecteur de langue */
.lang { display: inline-flex; background: color-mix(in srgb, currentColor 14%, transparent); border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: 8px; overflow: hidden; }
.lang button {
  background: transparent; color: inherit; border: 0; padding: 7px 11px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: currentColor; }
.lang button[aria-pressed="true"] span { color: var(--header-bg); }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  background: transparent; color: inherit; border: 0; border-radius: 8px; cursor: pointer; text-decoration: none;
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#stage :focus-visible, #toc :focus-visible, #search :focus-visible { outline-color: var(--red); }

#bottom {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 0; padding-bottom: env(safe-area-inset-bottom, 0);
}
#bottom .icon-btn { width: 38px; height: 38px; }
.f-left, .f-center, .f-right { display: flex; align-items: center; gap: 6px; }
/* trait vertical très léger entre les trois blocs */
.f-center::before, .f-right::before {
  content: ""; width: 1px; height: 24px; margin: 0 8px 0 14px; flex: none;
  background: color-mix(in srgb, currentColor 28%, transparent);
}
#tocBtn[aria-pressed="false"] { opacity: .6; }

/* zoom : pourcentage · - · curseur · + */
.f-right { gap: 8px; }
#zoomRange { --p: 0%; -webkit-appearance: none; appearance: none; width: 75px; height: 22px; background: transparent; cursor: pointer; margin: 0 2px; }
#zoomRange::-webkit-slider-runnable-track { height: 5px; border-radius: 3px;
  background: linear-gradient(to right, #4cc2ff var(--p), rgba(190,190,190,.55) var(--p)); }   /* partie à droite du bouton : ligne grise visible */
#zoomRange::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6.5px; border-radius: 50%;
  background: #4cc2ff; border: 2px solid var(--footer-bg); box-shadow: 0 0 0 1px #4cc2ff; transition: transform .12s; }
#zoomRange:hover::-webkit-slider-thumb { transform: scale(1.2); }
#zoomRange::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(190,190,190,.55); }
#zoomRange::-moz-range-progress { height: 5px; border-radius: 3px; background: #4cc2ff; }
#zoomRange::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #4cc2ff; border: 2px solid var(--footer-bg); }


/* ---------- centre ---------- */
#main { position: relative; min-height: 0; }

/* la table des matières est semi-transparente : le fond (image / vidéo) passe dessous */
#toc {
  transition: transform .22s ease;
  position: absolute; top: 0; bottom: 0; left: 0; width: var(--toc-w); z-index: 4;
  color: var(--toc-fg); color-scheme: dark; display: flex; flex-direction: column;
  overflow-y: auto; border-right: 1px solid color-mix(in srgb, var(--toc-fg) 18%, transparent);
}
#toc h2 { position: sticky; top: 0; z-index: 1; flex: none; margin: 0; padding: 16px 18px 12px; background: var(--toc-head-bg); backdrop-filter: blur(6px); font-family: var(--font-toc-title, inherit); font-size: var(--toc-title-fs, 1rem); font-weight: var(--toc-title-fw, 700); color: var(--toc-title-fg, inherit); border-bottom: 1px solid color-mix(in srgb, var(--toc-fg) 18%, transparent); }
#tocList { list-style: none; margin: 0; padding: 6px 0 20px; flex: 1 0 auto; background: var(--toc-bg); }
#tocList button {
  display: flex; width: 100%; gap: 12px; justify-content: space-between; align-items: baseline;
  padding: 9px 18px; border: 0; background: transparent; text-align: left; font: inherit; font-size: .92rem; cursor: pointer; color: inherit;
  font-family: var(--font-toc, inherit); font-size: var(--toc-fs, .92rem); font-weight: var(--toc-fw, 400);
}
#tocList button:hover { background: color-mix(in srgb, var(--toc-fg) 12%, transparent); }
#tocList button[aria-current="true"] { background: var(--toc-active-bg); color: var(--toc-active-fg, inherit); box-shadow: inset 4px 0 0 var(--toc-bar); font-weight: 700; }
#tocList .pg { opacity: .7; font-variant-numeric: tabular-nums; flex: none; }

#stageWrap { position: absolute; inset: 0; min-width: 0; min-height: 0; background: transparent; overflow: hidden; }
/* le fond couvre toute la fenêtre : visible à travers les cadres haut / bas / table des matières quand leur opacité est réduite */
#bgLayer { position: fixed; inset: 0; z-index: 0; background: var(--bg-color); overflow: hidden; pointer-events: none; }
#top, #main, #bottom { z-index: 1; }
#top { z-index: 3; box-shadow: var(--head-shadow, none); }   /* ombre du cadre du haut (réglable) : elle tombe sur la table des matières et sur le fond */
#bgVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; opacity: var(--bg-img-op); }
#bgImage { position: absolute; inset: 0; background: center / cover no-repeat; pointer-events: none; opacity: var(--bg-img-op); }
#bgOverlay { position: absolute; inset: 0; pointer-events: none; background: var(--bg-overlay); }
#stage { position: absolute; inset: 0 0 0 var(--stage-left); overflow: hidden; display: flex; padding: 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
#book { margin: auto; flex: none; will-change: transform; }
#book.shift { transition: transform var(--flip-ms, 520ms) cubic-bezier(.3,0,.25,1); }
@media (prefers-reduced-motion: reduce) { #book.shift { transition: none; } }
.stage-msg { margin: auto; color: #ddd; max-width: 40ch; text-align: center; line-height: 1.5; }

.page { background: #fff; overflow: hidden; }
.stf__item { will-change: transform; }
.page img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.page img:not([src]) { visibility: hidden; }
.page .hl { position: absolute; display: block; }
.page .hl:hover { background: rgba(200,16,46,.14); outline: 1px solid rgba(200,16,46,.55); }
/* rectangle sur le terme trouvé par la recherche */
.page .found {
  position: absolute; pointer-events: none; z-index: 3; border-radius: 3px;
  border: 2px solid #e60023; background: rgba(255, 222, 0, .38);
  box-shadow: 0 0 0 3px rgba(255,255,255,.7), 0 0 14px rgba(230,0,35,.55);
  animation: foundPulse 1s ease-out 3;
}
@keyframes foundPulse { 0% { transform: scale(1.4); opacity: .25; } 100% { transform: scale(1); opacity: 1; } }
/* numéro surligné à l'ouverture d'un lien (réglable : couleurs, épaisseur, durée, pulsation) */
.page .found.found-link {
  border: var(--lk-bw, 4px) solid var(--lk-border, #e60023); background: var(--lk-fill, rgba(255,222,0,.45));
  box-shadow: var(--lk-shadow, 0 0 0 4px rgba(255,255,255,.85), 0 0 20px 4px #e60023);
  animation: var(--lk-anim, linkPulse 1.1s ease-in-out infinite);
}
@keyframes linkPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .page .found, .page .found.found-link { animation: none; } }

/* ---------- recherche ---------- */
#search {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%);
  background: var(--search-bg); color: var(--search-fg); box-shadow: -8px 0 24px rgba(0,0,0,.35); display: flex; flex-direction: column; z-index: 5;
}
.search-head { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid rgba(128,128,128,.35); }
.search-head input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border: 1px solid #bbb; border-radius: 8px; }
.search-head .icon-btn { color: var(--search-fg); }
.search-head .icon-btn:hover { background: rgba(128,128,128,.22); }
#searchStatus { margin: 0; padding: 10px 14px 4px; color: var(--search-fg); font-size: .85rem; }
#results { list-style: none; margin: 0; padding: 0 0 16px; overflow-y: auto; }
#results button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid rgba(128,128,128,.25); background: transparent; font: inherit; font-size: .88rem; line-height: 1.4; cursor: pointer; color: var(--search-fg); }
#results button:hover { background: rgba(128,128,128,.2); }
#results .rp { display: block; font-weight: 700; color: var(--red); margin-bottom: 2px; }
#results mark { background: #ffe58a; color: #111; padding: 0 1px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--footer-h) + 18px); transform: translateX(-50%);
  background: #111; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: .9rem; z-index: 20;
}

/* ---------- responsive (téléphones / tablettes) ---------- */
.only-mobile { display: none; }
.only-desktop { display: inline-grid; }
/* table des matières masquée sur ordinateur */
@media (min-width: 861px) {
  body.toc-hidden { --stage-left: 0px; }
  body.toc-hidden #toc { transform: translateX(-100%); }
  #top { display: block; position: relative; padding: 0; }
  .lang button { padding-top: 9.5px; padding-bottom: 9.5px; }   /* même hauteur que le champ de pagination */
  .top-left { position: absolute; left: 0; top: 0; bottom: 0; }
  .top-center { position: absolute; top: 0; bottom: 0; left: var(--stage-left); right: 0; padding: 0 250px; pointer-events: none; }
  .top-center > * { pointer-events: auto; }
  .top-right { position: absolute; right: 20px; top: 0; bottom: 0; }
  #bottom { margin-left: var(--stage-left); }   /* la table des matières descend jusqu'en bas de la fenêtre : le cadre du bas commence à sa droite */
  #toc { position: fixed; top: var(--header-h); bottom: 0; }
}
@media (max-width: 860px) {
  :root { --header-h: 100px; --toc-w: 280px; }
  .only-mobile { display: inline-grid; }
  .only-desktop { display: none; }
  :root { --stage-left: 0px; }
  #bottom { padding: 0 6px; }
  .f-center::before, .f-right::before { margin: 0 2px 0 8px; }
  .top-center, .title-wrap { display: contents; }
  .title-wrap .lang { position: static; transform: none; margin: 0; grid-column: 2; grid-row: 1; justify-self: end; z-index: 2; }
  /* mobile : ligne 1 = menu + logo ; ligne 2 = titre du catalogue à gauche, pagination + recherche à droite */
  #top { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 1fr 1fr; gap: 0 8px; padding: 0 10px; align-items: center; }
  .top-left { grid-column: 1 / -1; grid-row: 1; position: static; }
  #catalogName { grid-column: 1; grid-row: 2; margin: 0; white-space: normal; line-height: 1.15; max-height: 2.4em; }
  .top-right { grid-column: 2; grid-row: 2; position: static; gap: 6px; }
  .zoom-extra { display: none; }
  #catalogName { font-size: min(var(--title-fs, 1.1rem), 1.1rem); }
  .page-field { padding: 5px 9px; font-size: .9rem; }
  #logo { width: auto; max-width: 150px; padding: 0 6px; height: 42px; }
  #stage { inset: 0; }
  #toc {
    width: min(320px, 86%); z-index: 6;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 8px 0 24px rgba(0,0,0,.4);
  }
  body.toc-open #toc { transform: none; }
  #toc h2 { background: var(--toc-head-solid); }
  #tocList { background: var(--toc-bg-solid); }
}
@media (max-width: 480px) { .f-left, .f-center, .f-right { gap: 2px; } }
@media (prefers-reduced-motion: reduce) { #toc { transition: none; } }

#logoLink { display: flex; align-items: center; flex: none; }

/* écran d'accueil */
#splash { position: fixed; inset: 0; z-index: 1000; background: var(--stage-bg, #000); display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease; }
#splash.done { opacity: 0; pointer-events: none; }
.splash-in { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 20px; text-align: center; animation: splash-in .5s ease both; }
#splashImg { width: min(400px, 80vw); height: auto; display: block; box-shadow: 0 10px 40px rgba(0,0,0,.6); background: #222; }
#splashName { margin: 0; color: #fff; font-size: 1.6rem; font-weight: 700; }
@keyframes splash-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ligne (couleur ou dégradé) tout en bas du cadre du haut */
#top::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--hl-h, 0px); background: var(--hl-bg, none); pointer-events: none; }

/* ligne (couleur ou dégradé) tout en haut du cadre du bas */
#bottom::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: var(--fl-h, 0px); background: var(--fl-bg, none); pointer-events: none; }

/* fenêtre d'impression */
#printDlg, #dlDlg { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.print-box { width: min(420px, 100%); background: #fff; color: #222; border-radius: 12px; padding: 20px 22px; box-shadow: 0 16px 50px rgba(0,0,0,.5); }
.print-box h3 { margin: 0 0 6px; font-size: 1.1rem; }
.print-help { margin: 0 0 12px; font-size: .85rem; color: #555; }
#printInput { width: 100%; font: inherit; font-size: 1.05rem; padding: 10px 12px; border: 1px solid #bbb; border-radius: 8px; }
#printInput:focus { outline: 2px solid #4cc2ff; border-color: transparent; }
.print-err { min-height: 1.2em; margin: 8px 0 0; color: #b00020; font-size: .85rem; }
.print-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.print-actions button { font: inherit; padding: 8px 16px; border-radius: 8px; border: 1px solid #bbb; background: #f2f2f2; color: #222; cursor: pointer; }
.print-actions button.primary { background: #0b3d91; border-color: #0b3d91; color: #fff; }
.print-actions button:disabled { opacity: .6; cursor: wait; }

/* flèches latérales (bureau) : placées par le JS contre les bords des pages */
.nav-side { position: absolute; top: 0; z-index: 4; display: grid; align-items: center; padding: 0 8px; left: 4px;
  width: var(--nav-w, 115px); height: 300px; border: 0; border-radius: 0; cursor: pointer;
  background: transparent; color: var(--nav-fg, #fff); -webkit-tap-highlight-color: transparent; }   /* la zone est invisible : seul le rond avec la flèche se voit */
.nav-dot { display: grid; place-items: center; width: var(--nav-d, 52px); height: var(--nav-d, 52px); border-radius: 50%; background: var(--nav-bg, rgba(0,0,0,.55)); box-shadow: 0 2px 10px rgba(0,0,0,.3); transition: transform .12s ease; }
.nav-side:not(:disabled):hover .nav-dot { transform: scale(1.08); }
#navPrev { justify-items: start; }
#navNext { justify-items: end; }
.nav-side:focus { outline: none; }
.nav-side:focus-visible .nav-dot { outline: 2px solid var(--nav-fg, #fff); outline-offset: 2px; }
.nav-side:disabled { cursor: default; pointer-events: none; }
.nav-side:disabled .nav-dot { opacity: .3; }
.nav-side svg { width: var(--nav-s, 26px); height: var(--nav-s, 26px); fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 861px) { .f-center { display: none; } }
@media (max-width: 860px) { .nav-side { display: none; } }

/* texte sélectionnable (couche invisible sur l'image) */
.page .tl { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.page .tl .ln { position: absolute; white-space: nowrap; color: transparent; font-family: Arial, Helvetica, sans-serif; pointer-events: none; }
.page .tl .wd { display: inline-block; vertical-align: top; white-space: pre; pointer-events: auto; cursor: text; overflow: visible; }
.page .tl .wd > span { display: inline-block; transform-origin: 0 0; }
.page .tl ::selection { background: rgba(60, 130, 255, .35); color: transparent; }
.page .hl { z-index: 2; }

/* loupe unique : + (vue normale) / − (zoomée) */
#zoomBtn .ic-minus { display: none; }
#zoomBtn.on .ic-plus { display: none; }
#zoomBtn.on .ic-minus { display: block; }

/* fenêtre de téléchargement */
.dl-opt { display: flex; align-items: center; gap: 8px; padding: 8px 2px; cursor: pointer; font-size: 1rem; }
.dl-pages { display: flex; gap: 18px; padding: 0 0 6px 28px; }
.dl-pages label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* boutons du cadre du bas : survol immédiat + info-bulle instantanée */
#bottom .icon-btn { transition: none; position: relative; }
#bottom .icon-btn:hover { background: color-mix(in srgb, currentColor 22%, transparent); }
#bottom .icon-btn[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: rgba(20,20,20,.95); color: #fff; font-size: .78rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 20; border: 1px solid rgba(255,255,255,.15);
}

/* curseurs : loupe + sur la page (zoom avant), loupe − quand on est zoomé, texte (I) sur le texte, main sur les zones de changement de page */
.page { cursor: zoom-in; }
body.is-zoomed .page { cursor: zoom-out; }
.page .tl .wd { cursor: text; }
.nav-side:not(:disabled) { cursor: pointer; }

/* effet « livre ouvert » : ombre dégradée au milieu des deux pages (couleur, opacité, largeur et niveau réglés dans config.json / convertisseur) */
#spine {
  position: absolute; z-index: 2; pointer-events: none; transition: opacity .15s ease;
  background: var(--spine-bg, linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,.14) 34%, rgba(0,0,0,.4) 49.5%, rgba(0,0,0,.52) 50%, rgba(0,0,0,.4) 50.5%, rgba(0,0,0,.09) 72%, rgba(0,0,0,0)));
}
#spine[hidden] { display: none; }
#spine.flipping { opacity: 0; }

/* bouton plein écran */
#fsBtn .ic-compress { display: none; }
#fsBtn.on .ic-expand { display: none; }
#fsBtn.on .ic-compress { display: block; }
#fsBtn[hidden] { display: none; }

/* pendant que la page tourne : la couche de texte (des centaines d'éléments) est masquée pour garder l'animation fluide */
body.is-flipping .page .tl { display: none; }

/* menu du clic droit sur une image */
#imgMenu { position: fixed; z-index: 60; min-width: 190px; padding: 4px; background: #fff; color: #111; border: 1px solid rgba(0,0,0,.18); border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.28); }
#imgMenu[hidden] { display: none; }
#imgMenu button { display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 5px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
#imgMenu button:hover, #imgMenu button:focus-visible { background: #e8eefc; outline: none; }

/* bouton « Télécharger » au survol d'une photo (taille, couleurs, opacité et texte : réglages de l'onglet Images) */
#imgBadge { position: fixed; z-index: 55; display: inline-flex; align-items: center; gap: .5em; padding: .45em .8em .45em .65em; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; background: var(--imgb-bg, rgba(0,0,0,.72)); color: var(--imgb-fg, #fff); font-family: inherit; font-weight: 600; font-size: var(--imgb-fs, 12px); line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35); white-space: nowrap; }
#imgBadge[hidden] { display: none; }
#imgBadge:hover { transform: scale(1.05); }
body.is-flipping #imgBadge, body.is-zoomed #imgBadge { display: none; }

/* ---------- cadre du bas : pastille arrondie (boutons seulement) ou barre pleine largeur (ui.footMode = 'bar') ---------- */
.f-pill { display: flex; align-items: center; justify-content: center; max-width: 100%; }
body.foot-pill #bottom { background: transparent; }
body.foot-pill #bottom::before { display: none; }
body.foot-pill .f-pill {
  height: calc(var(--footer-h) - 10px); padding: 0 16px; border-radius: 999px;
  background: var(--footer-bg); color: var(--on-footer);
  border: 1px solid color-mix(in srgb, var(--on-footer) 18%, transparent); box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
body.foot-pill #bottom .icon-btn { border-radius: 999px; }

/* ---------- bords arrondis du livre + ombre portée sur le fond (ui.bookRadius, ui.bookShadow*) ---------- */
.stf__item.--left { border-radius: var(--book-r, 0px) 0 0 var(--book-r, 0px); }
.stf__item.--right { border-radius: 0 var(--book-r, 0px) var(--book-r, 0px) 0; }
body.book-single .stf__item { border-radius: var(--book-r, 0px); }      /* couverture / dernière page seule : les quatre coins */
#bookFrame { position: absolute; z-index: 0; pointer-events: none; border-radius: var(--book-r, 0px); box-shadow: var(--book-shadow, none); }
#bookFrame.anim { transition: left .45s ease, width .45s ease; }      /* suit le décalage de la couverture */
body.is-zoomed #bookFrame { display: none; }

/* table des matières à sous-dossiers (niveaux 1 à 3) */
#tocList li[hidden] { display: none; }
#tocList .arw { flex: none; width: 1em; text-align: center; color: var(--toc-arw-fg, inherit); opacity: var(--toc-arw-op, .75); font-size: var(--toc-arw-fs, 14px); line-height: 1; transition: transform .15s; margin-right: -4px; }
#tocList li.kids .tt { font-weight: var(--toc-kids-fw, inherit); }
#tocList li.open > button .arw { transform: rotate(90deg); }
#tocList .tt { flex: 1; min-width: 0; }
#tocList li.lv2 > button { padding-left: calc(18px + var(--toc-indent, 16px)); }
#tocList li.lv3 > button { padding-left: calc(18px + 2 * var(--toc-indent, 16px)); }
#tocList li.lv2 > button, #tocList li.lv3 > button { font-size: calc(var(--toc-fs, .92rem) * .95); }
#tocList:not(.tree) .arw { display: none; }
