:root { --fb-echelle-police: 1; --fb-taille-police-base: 16px; --fb-largeur-max: 800px; }

.fb-conteneur {
    max-width: var(--fb-largeur-max, 800px); margin: 2rem auto; padding: 0 1.5rem;
    font-size: calc(var(--fb-taille-police-base, 16px) * var(--fb-echelle-police));
}
.fb-carte {
    background: #fff; border: 1px solid #e2d5bd; border-radius: 8px;
    padding: 1.2rem 1.5rem; margin-bottom: 1rem;
}
a.fb-lien-carte { text-decoration: none; color: inherit; display: block; }
.fb-carte:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.fb-carte-outils-voix {
    display: none; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem;
}
.fb-voix-active .fb-carte-outils-voix { display: flex; }
.fb-carte-outils-voix .fb-liste-case { margin: 0; }
.fb-carte-outils-voix .fb-liste-lire {
    border: 1px solid #e2d5bd; background: #fff; border-radius: 50%; width: 1.8rem; height: 1.8rem;
    cursor: pointer; font-size: 0.9rem;
}
.fb-carte-outils-voix .fb-liste-lire:hover { background: #f6efe0; }

.fb-carte-entete { display: flex; align-items: center; gap: 0.8rem; }
.fb-carte-entete .fb-lien-carte { flex: 1; min-width: 0; }
.fb-deplier-theme {
    flex: none; display: inline-flex; align-items: center; gap: 0.3rem;
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226; border-radius: 20px;
    padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.85rem; white-space: nowrap;
}
.fb-deplier-theme:hover { background: #f6efe0; }
.fb-deplier-icone { font-size: 1em; }
.fb-theme-deplie {
    margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e2d5bd; width: 100%;
}
.fb-theme-deplie .fb-carte { box-shadow: none; }
.fb-deplier-module {
    flex: none; display: inline-flex; align-items: center; gap: 0.3rem;
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226; border-radius: 20px;
    padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.85rem; white-space: nowrap;
}
.fb-deplier-module:hover { background: #f6efe0; }
.fb-module-deplie {
    margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e2d5bd; width: 100%;
}
.fb-liste-themes-legere { list-style: none; margin: 0; padding: 0; }
.fb-liste-themes-legere li { margin-bottom: 0.5rem; }
.fb-liste-themes-legere a { color: #6b4226; text-decoration: none; border-bottom: 1px solid #b5892a; }
.fb-liste-themes-legere a:hover { border-bottom-width: 2px; }
.fb-badge {
    display: inline-block; background: #b5892a; color: #fff;
    padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.8rem; margin-bottom: 0.5rem;
}
.fb-verset { margin-bottom: 0.8rem; padding-left: 1rem; border-left: 3px solid #b5892a; font-size: 1em; }
.fb-verset .fb-ref { font-weight: bold; color: #6b4226; margin-right: 0.4rem; }
.fb-sous-titre { color: #b5892a; margin-top: 0; margin-bottom: 0.4rem; }
.fb-titre-groupe {
    margin: 2rem 0 1rem; padding-bottom: 0.4rem;
    border-bottom: 2px solid #e2d5bd; color: #6b4226;
}
.fb-texte-libre { margin: 1rem 0; line-height: 1.6; }
.fb-texte-libre a { color: #b5892a; text-decoration: underline; }

.fb-ligne-vide--petit { height: 0.75rem; }
.fb-ligne-vide--moyen { height: 1.75rem; }
.fb-ligne-vide--grand { height: 3.5rem; }

.fb-media { margin: 1.2rem 0; text-align: center; }
.fb-media img, .fb-media video { border-radius: 8px; max-width: 100%; height: auto; }
.fb-media-legende { margin-top: 0.4rem; font-size: 0.85rem; color: #886; font-style: italic; }

.fb-barre-outils {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.fb-controle-police { display: flex; gap: 0.3rem; flex: none; }
.fb-controle-police button {
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226;
    border-radius: 6px; padding: 0.25rem 0.6rem; cursor: pointer; font-weight: 600;
}
.fb-controle-police button:hover { background: #f6efe0; }

.fb-nav-sections {
    display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem;
    padding: 0.6rem 0.9rem; background: #fff; border: 1px solid #e2d5bd; border-radius: 6px;
}
.fb-nav-sections label { font-weight: 700; color: #6b4226; white-space: nowrap; }
.fb-nav-sections select {
    flex: 1; max-width: 420px; padding: 0.35rem 0.5rem; border: 1px solid #e2d5bd; border-radius: 4px;
    background: #fff; color: #2c2016; font-family: inherit;
}

.fb-lecture-audio {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.6rem 0.9rem; margin-bottom: 1rem; background: #fff; border: 1px solid #e2d5bd; border-radius: 6px;
}
.fb-lecture-audio label { font-weight: 700; color: #6b4226; }
.fb-lecture-audio select {
    padding: 0.3rem 0.4rem; border: 1px solid #e2d5bd; border-radius: 4px; background: #fff; font-family: inherit;
}
.fb-lecture-audio button {
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226; border-radius: 6px;
    padding: 0.35rem 0.7rem; cursor: pointer; font-weight: 600;
}
.fb-lecture-audio button:hover { background: #f6efe0; }
.fb-case-inline { display: inline-flex; align-items: center; gap: 0.3rem; color: #6b4226; font-weight: 600; font-size: 0.92em; }
#fb-ouvrir-reglages-audio { font-size: 1.1rem; padding: 0.3rem 0.6rem; }

.fb-menu-partage {
    display: flex; flex-direction: column; gap: 0.3rem; max-width: 260px;
    padding: 0.6rem; margin: -0.4rem 0 1rem; background: #fbf6ec;
    border: 1px solid #e2d5bd; border-top: none; border-radius: 0 0 6px 6px;
}
.fb-menu-partage a, .fb-menu-partage button {
    display: block; text-align: left; padding: 0.4rem 0.6rem; border-radius: 4px;
    border: none; background: none; color: #6b4226; font-family: inherit; font-size: 0.95em; cursor: pointer;
}
.fb-menu-partage a:hover, .fb-menu-partage button:hover { background: #f0e6d2; }

.fb-reglages-audio {
    display: flex; flex-direction: column; gap: 0.6rem; max-width: 420px;
    padding: 0.8rem 1rem; margin: -0.4rem 0 1rem; background: #fbf6ec;
    border: 1px solid #e2d5bd; border-top: none; border-radius: 0 0 6px 6px;
}
.fb-reglage-audio-ligne { display: flex; align-items: center; gap: 0.7rem; }
.fb-reglage-audio-ligne label { min-width: 130px; font-weight: 600; color: #6b4226; font-size: 0.92em; }
.fb-reglage-audio-ligne input[type="range"] { flex: 1; accent-color: #b5892a; }
.fb-reglage-audio-ligne span { min-width: 2.8em; text-align: right; color: #886; font-size: 0.9em; }
.fb-saisie-audio {
    width: 3.2em; padding: 0.15rem 0.3rem; border: 1px solid #e2d5bd; border-radius: 4px;
    text-align: right; font-family: inherit;
}

.fb-verset-case { margin-right: 0.4rem; vertical-align: middle; display: none; }
.fb-lire-verset {
    border: none; background: none; color: #b5892a; cursor: pointer; font-size: 0.85em;
    margin-left: 0.3rem; vertical-align: middle; opacity: 0.7; display: none;
}
.fb-lire-verset:hover { opacity: 1; }
.fb-voix-active .fb-verset-case, .fb-voix-active .fb-lire-verset { display: inline-block; }

/* Surbrillance de l'élément en cours de lecture vocale */
.fb-lecture-en-cours {
    background: #fff3b0 !important; transition: background 0.25s ease; border-radius: 4px;
    box-shadow: 0 0 0 3px #fff3b0;
}
body.fb-theme-nuit .fb-lecture-en-cours { background: #4a3f1a !important; box-shadow: 0 0 0 3px #4a3f1a; color: #ffe9a8 !important; }
body.fb-theme-sepia .fb-lecture-en-cours { background: #e3d29a !important; box-shadow: 0 0 0 3px #e3d29a; }
body.fb-theme-personnalise .fb-lecture-en-cours { background: color-mix(in srgb, var(--fb-perso-accent, #6b4226) 25%, transparent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fb-perso-accent, #6b4226) 25%, transparent); }
.fb-carte { position: relative; }
.fb-lire-passage {
    position: absolute; top: 0.8rem; right: 0.9rem; border: 1px solid #e2d5bd; background: #fff;
    border-radius: 50%; width: 2rem; height: 2rem; cursor: pointer; font-size: 1rem;
}
.fb-lire-passage:hover { background: #f6efe0; }

@media print {
    @page { margin: 2cm; }
    .fb-barre-outils, .fb-nav-sections, .fb-lecture-audio, .fb-reglages-audio,
    .fb-lire-passage, .fb-retour-module, .fb-menu-partage, .fb-verset-case, .fb-lire-verset,
    .fb-carte-outils-voix, .fb-panneau-couleurs-perso, .fb-selecteur-modes, .fb-deplier-theme, .fb-deplier-module { display: none !important; }
    body { background: #fff !important; }
    .fb-conteneur { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
    .fb-carte { border: none !important; box-shadow: none !important; padding: 0 0 1rem 0 !important; }
    .fb-lecture-en-cours { background: none !important; box-shadow: none !important; }
    a { color: #000 !important; text-decoration: none !important; }
}

.fb-retour-module { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e2d5bd; }
.fb-retour-module a { color: #6b4226; text-decoration: none; font-weight: 600; }
.fb-retour-module a:hover { text-decoration: underline; }

.fb-fil-ariane { color: #886; font-size: 0.9rem; margin: 0; }

.fb-lignes-defaut { margin: 0.2rem 0; }
.fb-ligne-defaut { margin: 0 0 0.2rem; font-style: italic; color: #886; font-size: 0.95em; }

/* ===== Modes d'affichage ===== */
.fb-selecteur-modes {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
    margin-bottom: 1rem; padding: 0.6rem 0.9rem; background: #fff; border: 1px solid #e2d5bd; border-radius: 6px;
}
.fb-groupe-modes { display: flex; gap: 0.3rem; }
.fb-bouton-mode {
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226; border-radius: 20px;
    padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.9em;
}
.fb-bouton-mode:hover { background: #f6efe0; }
.fb-bouton-mode--actif { background: #6b4226; color: #fff; border-color: #6b4226; }
.fb-recherche-liste {
    flex: 1; min-width: 160px; padding: 0.35rem 0.7rem; border: 1px solid #e2d5bd; border-radius: 20px;
    font-family: inherit;
}
.fb-recherche-vide { width: 100%; margin: 0.3rem 0 0; color: #886; font-style: italic; }

/* Plein écran choisi par l'internaute (bouton "Plein écran" de la barre de modes) */
.fb-conteneur.fb-affiche-plein-ecran {
    max-width: 100vw !important; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
    box-sizing: border-box;
}

.fb-panneau-couleurs-perso {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    padding: 0.7rem 0.9rem; margin: -0.4rem 0 1rem; background: #fbf6ec;
    border: 1px solid #e2d5bd; border-radius: 6px;
}
.fb-champ-couleur-perso { display: flex; align-items: center; gap: 0.4rem; }
.fb-champ-couleur-perso label { font-size: 0.85em; color: #6b4226; font-weight: 600; }
.fb-champ-couleur-perso input[type="color"] {
    width: 2.2rem; height: 2.2rem; padding: 0; border: 1px solid #e2d5bd; border-radius: 6px; cursor: pointer;
}
.fb-reinitialiser-couleurs-perso {
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226; border-radius: 6px;
    padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85em;
}
.fb-reinitialiser-couleurs-perso:hover { background: #f0e6d2; }

/* Mise en page : liste — ciblée uniquement sur les cartes module/thème (qui contiennent
   un lien .fb-lien-carte), jamais sur les cartes de référence/versets d'une page de thème. */
.fb-vue-liste .fb-carte:has(> .fb-lien-carte) {
    display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1rem;
}
.fb-vue-liste .fb-carte h2, .fb-vue-liste .fb-carte h3 { margin: 0; font-size: 1.05em; }
.fb-vue-liste .fb-badge { margin-bottom: 0; }
.fb-vue-liste .fb-carte > a.fb-lien-carte > div:last-child { display: none; } /* masque le résumé en vue liste */

/* Mise en page : magazine */
.fb-vue-magazine {
    display: grid !important; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem;
}
.fb-vue-magazine .fb-carte:has(> .fb-lien-carte) { margin-bottom: 0; height: 100%; }

/* Mode Livre : typographie de lecture, sans encarts */
.fb-mode-livre .fb-carte { border: none; box-shadow: none; background: transparent; padding: 0.4rem 0; }
.fb-mode-livre .fb-verset { border-left: none; padding-left: 0; }
.fb-mode-livre .fb-citation { font-size: 0.95em; color: #886; font-weight: normal; }
.fb-mode-livre h1 { font-family: Georgia, 'Times New Roman', serif; }

/* Mode Chapitres : navigation */
.fb-nav-chapitres {
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    margin: 1.5rem 0; padding: 0.8rem; background: #fff; border: 1px solid #e2d5bd; border-radius: 6px;
}
.fb-nav-chapitres button {
    border: 1px solid #e2d5bd; background: #fff; color: #6b4226; border-radius: 6px;
    padding: 0.4rem 0.9rem; cursor: pointer; font-weight: 600;
}
.fb-nav-chapitres button:disabled { opacity: 0.4; cursor: default; }
.fb-chapitre-position { color: #886; font-size: 0.9em; }

/* Couleurs : Nuit */
body.fb-theme-nuit { background: #1b1b1b; }
body.fb-theme-nuit .fb-conteneur { color: #e8e8e8; }
body.fb-theme-nuit .fb-carte, body.fb-theme-nuit .fb-selecteur-modes,
body.fb-theme-nuit .fb-barre-outils, body.fb-theme-nuit .fb-lecture-audio,
body.fb-theme-nuit .fb-reglages-audio, body.fb-theme-nuit .fb-nav-sections,
body.fb-theme-nuit .fb-nav-chapitres, body.fb-theme-nuit .fb-menu-partage {
    background: #2a2a2a; border-color: #444; color: #e8e8e8;
}
body.fb-theme-nuit h1, body.fb-theme-nuit h2, body.fb-theme-nuit h3, body.fb-theme-nuit h4,
body.fb-theme-nuit .fb-titre-groupe, body.fb-theme-nuit .fb-sous-titre { color: #e0c080; }
body.fb-theme-nuit .fb-bouton-mode, body.fb-theme-nuit .fb-lecture-audio button,
body.fb-theme-nuit .fb-nav-chapitres button { background: #2a2a2a; color: #e8e8e8; border-color: #555; }
body.fb-theme-nuit .fb-bouton-mode--actif { background: #e0c080; color: #1b1b1b; }
body.fb-theme-nuit a { color: #e0c080; }
body.fb-theme-nuit .fb-recherche-liste, body.fb-theme-nuit select, body.fb-theme-nuit input { background: #1b1b1b; color: #e8e8e8; border-color: #555; }

/* Couleurs : Sépia */
body.fb-theme-sepia { background: #f4ecd8; }
body.fb-theme-sepia .fb-conteneur { color: #4b3621; }
body.fb-theme-sepia .fb-carte, body.fb-theme-sepia .fb-selecteur-modes,
body.fb-theme-sepia .fb-barre-outils, body.fb-theme-sepia .fb-lecture-audio,
body.fb-theme-sepia .fb-reglages-audio, body.fb-theme-sepia .fb-nav-sections,
body.fb-theme-sepia .fb-nav-chapitres, body.fb-theme-sepia .fb-menu-partage {
    background: #efe4c8; border-color: #d8c9a3; color: #4b3621;
}
body.fb-theme-sepia h1, body.fb-theme-sepia h2, body.fb-theme-sepia h3, body.fb-theme-sepia h4,
body.fb-theme-sepia .fb-titre-groupe, body.fb-theme-sepia .fb-sous-titre { color: #7a4b23; }

/* Couleurs : Personnalisé (variables définies en JS depuis les réglages) */
body.fb-theme-personnalise { background: var(--fb-perso-fond, #fdf8f0); }
body.fb-theme-personnalise .fb-conteneur { color: var(--fb-perso-texte, #2c2016); }
body.fb-theme-personnalise .fb-carte, body.fb-theme-personnalise .fb-selecteur-modes,
body.fb-theme-personnalise .fb-barre-outils, body.fb-theme-personnalise .fb-lecture-audio,
body.fb-theme-personnalise .fb-reglages-audio, body.fb-theme-personnalise .fb-nav-sections,
body.fb-theme-personnalise .fb-nav-chapitres, body.fb-theme-personnalise .fb-menu-partage {
    background: var(--fb-perso-interface, #fff); border-color: var(--fb-perso-accent, #e2d5bd); color: var(--fb-perso-texte, #2c2016);
}
body.fb-theme-personnalise h1, body.fb-theme-personnalise h2, body.fb-theme-personnalise h3, body.fb-theme-personnalise h4,
body.fb-theme-personnalise .fb-titre-groupe, body.fb-theme-personnalise .fb-sous-titre,
body.fb-theme-personnalise a, body.fb-theme-personnalise .fb-badge { color: var(--fb-perso-accent, #6b4226); }
body.fb-theme-personnalise .fb-badge { background: var(--fb-perso-accent, #b5892a); color: var(--fb-perso-interface, #fff); }
body.fb-theme-personnalise .fb-bouton-mode--actif { background: var(--fb-perso-accent, #6b4226); color: var(--fb-perso-interface, #fff); }
body.fb-theme-personnalise .fb-verset { border-left-color: var(--fb-perso-accent, #b5892a); }
body.fb-theme-sepia a { color: #7a4b23; }
