/* Content/biblia.css (LIMPIO)
   - Panel izquierdo y libro ocupan TODO el alto disponible
   - Libro se adapta al tamaño de pantalla y sube (sin espacio vacío arriba)
   - Se eliminan reglas duplicadas: .topBar/.mainLayout/.navLists/min-height:100vh, etc.
*/

:root {
    --bg0: #05070c;
    --bg1: #0a1020;
    --ink: #0f172a;
    --paper: #faf7ef;
    --paper2: #f3efe5;
    --accent: #00ACC1;
    --shadow: rgba(0,0,0,.55);
    --shadow2: rgba(0,0,0,.25);
    --verseFont: 12px;
    --verseLine: 1.36;
    /* Alturas de barras superiores (solo informativas; el layout usa flex) */
    --titlebarH: 54px;
    --toolbarH: 58px;
    /* Margen de seguridad inferior dentro de cada página (evita corte de la última línea) */
    --safeBottom: 65px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  color:#e5e7eb;
  background:
    radial-gradient(1200px 600px at 50% 15%, rgba(0,172,193,.20), transparent 60%),
    radial-gradient(900px 500px at 15% 70%, rgba(255,255,255,.05), transparent 60%),
    linear-gradient(180deg,var(--bg1),var(--bg0));
  overflow:hidden; /* la app controla su propio scroll */
}

/* ===== App layout ===== */
.app{
  height: 100dvh; /* mejor que 100vh en Chrome/Windows */
  display:flex;
  flex-direction:column;
}

/* ===== Header (2 filas) ===== */
.header{
  flex: 0 0 auto;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:rgba(8,12,20,.55);
  backdrop-filter:blur(8px);
}

.titlebar{
  height: var(--titlebarH);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 16px;
}

.toolbar{
  height: var(--toolbarH);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 16px;
  border-top:1px solid rgba(255,255,255,.06);
}

.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.brandIcon{ width:34px; height:34px; object-fit:contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.brandTitle{ font-weight:900; font-size:16px; letter-spacing:.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.controls{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.ctrl{ display:flex; flex-direction:column; gap:6px; font-size:12px; opacity:.9; }

.select{
  min-width:140px;
  padding:10px;
  border-radius:10px;
  outline:none;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.25);
  color:#fff;
}

.btn{
  height:40px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.25);
  color:#fff;
  cursor:pointer;
}
.btn:hover{ border-color: rgba(0,172,193,.60); }

/* Botones de navegación (mismo look que .btn, pero compactos) */
.navToggle,
.navHide{
  height:40px;
  width:44px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.25);
  color:#fff;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.navToggle:hover,
.navHide:hover{ border-color: rgba(0,172,193,.60); }

/* Contenido (panel + libro) ocupa todo el alto restante */
.content{
  flex: 1 1 auto;
  min-height: 0; /* CLAVE para overflow en hijos */
  display:flex;
  height:auto;
}

/* ===== Left panel ===== */
.navPanel{
  width:380px;
  max-width:45vw;
  min-width:320px;
  border-right:1px solid rgba(255,255,255,.08);
  background:rgba(8,12,20,.35);
  backdrop-filter:blur(8px);
  padding:12px;

  /* full height */
  height: 100%;
  display:none; /* mobile default */
  flex-direction:column;
  min-height:0;
}

.navHeader{ display:flex; align-items:center; justify-content:end; margin-bottom:10px; }
.navHeader span{ font-weight:700; }
.btnNavHide{ height:34px; padding:0 10px; }

/* Grid 3 columnas: [LIBROS][CAP][VERS] */
.navGrid{
  display:grid;
  grid-template-columns: 1.6fr .6fr .8fr;
  gap:10px;

  /* full height */
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.navCol{ display:flex; flex-direction:column; min-height:0; }
.navLabel{ font-size:12px; opacity:.85; margin-bottom:6px; }

.listbox{
  width:100%;
  flex:1 1 auto;
  min-height:0;
  height:100%;

  border-radius:10px;
  outline:none;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.25);
  color:#fff;
  padding:8px;
}

/* Colapsado por botón */
.content.nav-collapsed .navPanel{ display:none; }

/* ===== Stage / book ===== */
.stage{
  flex: 1 1 auto;
  min-height:0;
  min-width:0;
  height:100%;

  display:flex;
  align-items:stretch;   /* en vez de center: así sube y ocupa */
  justify-content:center;
  padding:12px;          /* recupera espacio arriba */
}

.bookShell{
  position:relative;
  width: min(1100px, 100%);
  height: 100%;
  max-height: 100%;
  border-radius:22px;
  background:radial-gradient(900px 600px at 50% 40%, rgba(255,255,255,.06), rgba(0,0,0,.25));
  box-shadow:0 22px 60px var(--shadow), inset 0 0 0 1px rgba(255,255,255,.08);
  overflow:hidden;
  perspective:1600px;
}

.bookGlow{
  position:absolute;
  inset:-80px;
  background:radial-gradient(600px 260px at 50% 30%, rgba(0,172,193,.20), transparent 70%);
  filter:blur(18px);
  pointer-events:none;
}

.fxCanvas{
  position:absolute;
  inset:0;
  pointer-events:none;
  mix-blend-mode:multiply;
  opacity:.9;
}

/* Wrapper para que el JS pueda recrear #book sin romper layout */
.bookWrap{
  position:absolute;
  inset:12px;             /* antes 18px */
  border-radius:18px;
  overflow:hidden;
  transform: rotateX(2.2deg) rotateY(0deg);
  transform-origin:center;
  box-shadow:0 18px 50px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.10);
  background:rgba(0,0,0,.15);
}

.book{
  position:absolute;
  inset:0;
  border-radius:0;
  overflow:hidden;
  background:transparent;
}

.hint{
  position:absolute;
  left:16px; right:16px; bottom:12px;
  text-align:center;
  font-size:12px;
  opacity:.55;
  pointer-events:none;
}

.footer{
  padding:10px 16px;
  border-top:1px solid rgba(255,255,255,.08);
  background:rgba(8,12,20,.55);
  backdrop-filter:blur(8px);
  font-size:12px;
  opacity:.85;
}

/* ====== PageFlip HTML pages (FIX corte inferior + footer siempre visible) ====== */
/* ====== PageFlip HTML pages (FOOTER FIXED BOTTOM sin overlay) ====== */



.verseRow {
    line-height: var(--verseLine);
    font-size: var(--verseFont);
    margin: 0 0 8px 0;
    display: flex;
    gap: 8px;
}

.verseNum {
    min-width: 34px;
    font-weight: 800;
    color: rgba(0,0,0,.45);
    text-align: right;
}

.verseText {
    flex: 1;
    color: #0f172a;
}


/* Si StPageFlip marca lado izquierdo/derecho */
.stf__item.--left  {
    left: 18px;
    right: 28px;
}
/* más espacio hacia el lomo */
.stf__item.--right  {
    left: 28px;
    right: 18px;
}
/* más espacio hacia el lomo */

/* Fallback si tu build no trae --left/--right (por orden de páginas) */
#book .page:nth-child(odd)  {
    left: 18px;
    right: 28px;
}

#book .page:nth-child(even) .pageFooter {
    left: 28px;
    right: 18px;
}

/* Y el body reserva igual ese gutter para que el texto y el footer alineen */
.stf__item.--left .pageBody {
    padding-left: 18px;
    padding-right: 28px;
}

.stf__item.--right .pageBody {
    padding-left: 28px;
    padding-right: 18px;
}
/* Evita gaps inesperados entre páginas */
#book, #book *{ box-sizing:border-box; }
#book{ overflow:hidden; }
#book .page{ margin:0 !important; }

/* Durante el flipping: elimina sombras/bordes para que el lomo se vea “pegado” */
body.is-flipping #book .page{
  border-radius:0 !important;
  box-shadow:none !important;
  filter:none !important;
}
body.is-flipping .stf__item,
body.is-flipping .stf__block{ box-shadow:none !important; }

/* ===== Responsive rules ===== */
@media (min-width:1024px){
  .navPanel{ display:flex; }
  .ctrlLibro, .ctrlCap{ display:block; }
}

@media (max-width:1023.98px){
  .navPanel{ display:none; }
}

@media (max-width:720px){
  .select{ min-width:120px; }
  .bookWrap{ inset:12px; }
  .page{ padding:14px; }
}
/* ===== Libro montado sobre imagen real (solo desktop landscape) ===== */

.bookBG {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    height: 100%;
}

/* Base: en móvil/tablet (o portrait) se ve como antes */
.bookShell {
    position: relative;
    width: min(1100px, 100%);
    height: 100%;
}

/* Desktop + Landscape: usa la imagen del libro como base */
/* ===== Book BG robusto contra ZOOM ===== */
.bookBG {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    height: 100%;
}

/* Desktop landscape */
@media (min-width:1024px) and (orientation:landscape) {

    .stage {
        height: 100%;
        display: flex;
        align-items: stretch;
        justify-content: center;
        padding: 8px 12px;
    }

    /* Contenedor del libro: ocupa TODO el alto disponible (evita “corte” abajo en iPad/zoom) */
    .bookShell {
        position: relative;
        height: 100%;
        max-height: 100%;
        width: min(1200px, 96vw);
        /* background-image: url("../images/bglibro.png"); */
        background-repeat: no-repeat;
        background-position: center;
        background-size: 100% 100%;
        border-radius: 18px;
        overflow: hidden;
    }

    /* El área donde va el flip: % para que escale junto al PNG */
        .bookWrap {
        position: absolute;
        left: 8.2%;
        right: 8.2%;
        top: 5.8%;
        bottom: 8.0%; /* más altura para que la página llegue más abajo */
        overflow: hidden;
        border-radius: 0 !important;
    }

    /* Anti-gaps por sub-pixel en zoom (muy común) */
    #book.stf__parent {
        width: calc(100% + 2px) !important;
        height: calc(100% + 2px) !important;
        margin-left: -1px !important;
        margin-top: -1px !important;
        transform: translateZ(0);
    }
}
/* ===== FIX: #book no llega abajo (StPageFlip wrapper con padding-bottom) ===== */
#book.stf__parent {
    height: 100% !important;
    width: 100% !important;
}

    #book.stf__parent > .stf__wrapper {
        height: 100% !important;
        width: 100% !important;
    }

        /* En landscape StPageFlip usa padding-bottom (inline) para ratio: lo anulamos */
        #book.stf__parent > .stf__wrapper.--landscape {
            height: 100% !important;
            padding-bottom: 0 !important;
        }

    /* Asegura que el bloque interno también estire */
    #book.stf__parent .stf__block {
        height: 100% !important;
    }

    /* Si hay algún contenedor extra, que herede el alto */
    #book.stf__parent .stf__item,
    #book.stf__parent .stf__container {
        height: 100% !important;
    }
/* =========================================================
   LIBRO PRO SOLO LANDSCAPE (sin PNG)
   - tapa dura negra debajo
   - cantos de hojas apiladas (líneas)
   - lomo/sombra central
   ========================================================= */
@media (min-width:1024px) and (orientation:landscape) {

    /* 1) Geometría única (TODO en %) para que el zoom no desplace nada */
    :root {
        --pgL: 8.2%;
        --pgR: 8.2%;
        --pgT: 5.8%;
        --pgB: 8.0%;
        /* Distancia del cover al borde de hojas (más cerca = menor valor) */
        --coverGap: 1.2%;
    }

    .bookShell {
        position: relative;
        border-radius: 18px;
        overflow: hidden;
        /* tu rojo, pero más elegante (puedes ajustar) */
        background: radial-gradient(900px 600px at 50% 30%, rgba(255,0,0,.35), rgba(120,0,0,.55) );
        transform: translateZ(0);
    }

        /* 2) COVER (tapa) – pegada a las hojas usando la MISMA geometría */
        .bookShell::before {
            content: "";
            position: absolute;
            /* cover = un poquito más grande que el bloque de hojas */
            left: calc(var(--pgL) - var(--coverGap));
            right: calc(var(--pgR) - var(--coverGap));
            top: calc(var(--pgT) - var(--coverGap));
            bottom: calc(var(--pgB) - var(--coverGap));
            border-radius: 16px;
            /* tapa dura roja con profundidad */
            background: radial-gradient(900px 420px at 50% 10%, rgba(255,255,255,.16), transparent 55%), linear-gradient(180deg, rgba(160,0,0,.95), rgba(70,0,0,.92));
            box-shadow: 0 26px 70px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.16), inset 0 18px 40px rgba(255,255,255,.06);
            z-index: 0;
            pointer-events: none;
        }

        /* 3) HOJAS APILADAS (más líneas, más visibles) */
        .bookShell::after {
            content: "";
            position: absolute;
            left: var(--pgL);
            right: var(--pgR);
            top: var(--pgT);
            bottom: var(--pgB);
            border-radius: 12px;
            pointer-events: none;
            /* Más hojas: paso más pequeño + un poco más de contraste */
            background: repeating-linear-gradient( 180deg, rgba(255,255,255,.22) 0px, rgba(255,255,255,.22) 1px, rgba(0,0,0,.00) 2px, rgba(0,0,0,.00) 3px ), linear-gradient(180deg, rgba(250,247,239,.96), rgba(240,235,224,.96));
            box-shadow: 0 18px 50px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.12), inset 0 10px 26px rgba(0,0,0,.10);
            z-index: 1;
        }

    /* 4) bookWrap usa EXACTAMENTE la misma geometría */
    .bookWrap {
        left: var(--pgL);
        right: var(--pgR);
        top: var(--pgT);
        bottom: var(--pgB);
        z-index: 3;
        background: transparent;
        box-shadow: 0 22px 60px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.18);
    }

    /* Lomo/sombra central (opcional, se ve más real) */
    .bookGlow {
        inset: 0;
        background: linear-gradient( 90deg, transparent 0%, rgba(0,0,0,.12) 48%, rgba(0,0,0,.35) 50%, rgba(0,0,0,.12) 52%, transparent 100% );
        filter: none;
        opacity: .85;
        z-index: 2;
        pointer-events: none;
    }
}
/* =========================================================
   NAV OFF-CANVAS SIEMPRE (sin depender de resolución)
   ========================================================= */

.content {
    position: relative;
}

/* Backdrop SIN capa visual (no oscurece ni desenfoca) */
.navBackdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    z-index: 80;
}

/* Panel flotante SIEMPRE */
.navPanel {
    opacity: 0.99;
    background: radial-gradient(1200px 600px at 50% 15%, rgba(0, 172, 193, .20), transparent 60%), radial-gradient(900px 500px at 15% 70%, rgba(255, 255, 255, .05), transparent 60%), linear-gradient(180deg, var(--bg1), var(--bg0));
    position: fixed;
    top: calc(var(--titlebarH) + var(--toolbarH));
    left: 0;
    height: calc(100dvh - (var(--titlebarH) + var(--toolbarH)));
    width: min(420px, 92vw);
    display: flex;
    flex-direction: column;
    min-height: 0;
    transform: translateX(-105%);
    transition: transform .26s ease;
    border-right: 1px solid rgba(255,255,255,.10);
    box-shadow: 20px 0px 12px 1px rgba(0, 0, 0, .55);
    z-index: 90;
}

/* Estado abierto */
.app.nav-open .navPanel {
    transform: translateX(0);
}

/* Importante: aunque no tenga “capa visual”, sí debe poder capturar click para cerrar */
.app.nav-open .navBackdrop {
    pointer-events: auto; /* SOLO cuando está abierto */
}

/* (Opcional) bloquear scroll del body cuando está abierto */
body.nav-lock {
    overflow: hidden;
}

/* NUEVO BOTON PIN PARA ANCLAR MENU FLOTANTE */
/* Botón pin: mismo look que navHide */
.navPin {
    height: 40px;
    width: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(0,0,0,.25);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .navPin:hover {
        border-color: rgba(0,172,193,.60);
    }

/* Estado visual cuando está anclado */
.app.nav-pinned .navPin {
    border-color: rgba(0,172,193,.75);
    box-shadow: 0 0 0 2px rgba(0,172,193,.20) inset;
}

/* Si está anclado: el menú queda siempre abierto */
.app.nav-pinned .navPanel {
    transform: translateX(0) !important;
}

/* Si está anclado: NO uses backdrop para no “tapar” el libro */
.app.nav-pinned .navBackdrop {
    pointer-events: none !important;
}

/* Si quieres que al anclar el contenido se corra a la derecha (recomendado) */
.app.nav-pinned .content {
    padding-left: min(420px, 92vw);
}

/* RESALTANDO VERSICULO CLICKEADO  */
/* Resaltado del versículo seleccionado (cyan claro casi transparente, sin afectar el layout) */
.verseRow.is-selected {
    position: relative;
}

    .verseRow.is-selected::before {
        content: "";
        position: absolute;
        left: -6px;
        right: -6px;
        top: -2px;
        bottom: -2px;
        background: rgba(0, 172, 193, .18);
        border-radius: 10px;
        pointer-events: none;
    }

    .verseRow.is-selected > * {
        position: relative;
        z-index: 1;
    }
/* =========================================================
   FIX DEFINITIVO: footer SIEMPRE visible (sin position:absolute)
   Pegar al FINAL del biblia.css
   ========================================================= */

/* ====== PageFlip HTML pages (SIN footer + sin corte abajo) ====== */
.page {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,var(--paper),var(--paper2));
    color: var(--ink);
    border-radius: 0;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.07), inset 0 18px 24px rgba(0,0,0,.04);
    padding: 18px 18px 22px 18px; /* más aire abajo */
    display: flex;
    flex-direction: column;
}

.pageHeader {
    font-weight: 800;
    font-size: 14px;
    color: #0b1324;
    letter-spacing: .2px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

:root {
    /* ...tus variables... */
    /* Margen de seguridad inferior dentro de cada página (evita corte de la última línea) */
    --safeBottom: 64px;
}

/* ... */

.pageBody {
    flex: 1;
    padding-top: 12px;
    overflow: hidden;
    padding-bottom: var(--safeBottom); /* 👈 margen real abajo */
    box-sizing: border-box;
}

/* ✅ ELIMINAR footer definitivamente */
.pageFooter {
    display: none !important;
}

/* Botón comparar versiones (al lado del pin) */
.btnCompare {
    height: 40px;
    width: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(0,0,0,.25);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

    .btnCompare:hover {
        border-color: rgba(0,172,193,.60);
    }

    .btnCompare:active {
        transform: translateY(1px);
    }

/* Estilos del modo comparación dentro de páginas */
.cmpWrap,
.cmpWrap * {
    color: #111 !important;
    text-shadow: none !important;
}

/* Título */
.cmpTitle {
    color: #0b0b0b !important;
    font-weight: 800;
}

/* Tarjetas */
.cmpItem {
    background: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(0,0,0,.18) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    padding: 14px 16px !important; /* padding general */
    border-radius: 14px !important;
    margin-bottom: 5px;
}

/* Etiqueta versión */
.cmpVersion {
    font-size: small;
    color: #0022a7 !important;
    font-weight: 500;
    margin: 0 0 10px 0 !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(0,0,0,.10) !important;
}

/* Texto del versículo */
.cmpText {
    color: #111 !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    padding: 2px 4px !important;
    margin: 0 !important;
}

/* Hint */
.cmpHint {
    color: #222 !important;
    opacity: .85 !important;
    font-weight: 600;
    margin-top: 16px !important;
    padding-top: 10px !important;
    border-top: 1px dashed rgba(0,0,0,.18) !important;
}
/* separación entre tarjetas */
.cmpList {
    gap: 16px !important;
}

/* Si algún estilo global te baja la opacidad, lo anulamos */
.cmpWrap {
    position: relative;
    opacity: 1 !important;
    filter: none !important;
    padding: 18px 20px !important;
}
/* Botón Volver (arriba a la derecha) */
.cmpBackBtn {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 5;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.18);
    background: rgba(255,255,255,.92);
    color: #111;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.10);
}

    .cmpBackBtn:hover {
        border-color: rgba(0,0,0,.35);
        transform: translateY(-1px);
    }

    .cmpBackBtn:active {
        transform: translateY(0);
    }

/* Para que el título no choque con el botón */
.cmpTitle {
    padding-right: 110px; /* reserva espacio a la derecha */
}
/* =========================================================
   RESTORE: Versiones rápidas (pills) al lado del dropdown
   (Tu CSS actual no las incluía; esto NO rompe nada existente)
   ========================================================= */
.versionPills{
  display:flex;
  align-items:stretch;
  border-radius:999px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.25);
}

.verPill{
  height:40px;
  min-width:70px;
  padding:0 18px;
  border:0;
  cursor:pointer;
  color:#fff;
  font-weight:800;
  letter-spacing:.6px;
  background:transparent;
}

.verPill:not(:first-child){
  border-left:1px solid rgba(255,255,255,.10);
}

.verPill:hover{ background:rgba(255,255,255,.06); }
.verPill:active{ transform:translateY(1px); }

    .verPill.active {
        background: rgb(0 172 193 / 30%);
        box-shadow: inset 0 0 0 1px rgb(0 172 193 / 26%);
    }

.verPill:focus-visible{
  outline:2px solid rgba(0,172,193,.95);
  outline-offset:2px;
}

@media (max-width: 560px){
  .versionPills{ transform:scale(.95); transform-origin:right center; }
  .verPill{ min-width:62px; padding:0 14px; font-size:13px; }
}

/* =========================================================
   TABLET PORTRAIT: aprovechar ancho útil del papel
   - Quita "gutter" izquierdo/derecho (lomo) pensado para 2 páginas
   - Mantiene un margen limpio para verse profesional
   ========================================================= */
@media (min-width: 700px) and (orientation: portrait){

  /* Asegura que el wrapper portrait no use padding-bottom para ratio */
  #book.stf__parent > .stf__wrapper.--portrait{
    height: 100% !important;
    width: 100% !important;
    padding-bottom: 0 !important;
  }

  /* En portrait queremos el contenido centrado y sin lomo exagerado */
  #book.stf__parent > .stf__wrapper.--portrait .stf__item.--left,
  #book.stf__parent > .stf__wrapper.--portrait .stf__item.--right{
    left: 12px !important;
    right: 12px !important;
  }

  /* El body de la página usa padding simétrico */
  #book.stf__parent > .stf__wrapper.--portrait .pageBody{
    padding-left: 18px !important;
    padding-right: 18px !important;
  }
}
/* ======================================
   SCROLL VERTICAL SOLO EN MODO COMPARAR
   (compatible con iOS/Safari)
   ====================================== */

/* Cuando el pageContent está en modo comparar */
.pageBody.isCompareScroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: 100% !important;
}

/* Importante: permitir que el contenido pueda scrollear (sin esto a veces no funciona) */
.pageContent.isCompareScroll {
    max-height: 100% !important;
}
/* =========================
   MODO COMPARAR: OCULTAR PÁGINA DERECHA Y USAR ANCHO COMPLETO
   ========================= */

/* Ajusta el selector #book si tu contenedor se llama distinto */
#book.compareModeOn .stf__page,
#book.compareModeOn .stf__item {
    /* no tocamos todas, solo actuamos sobre las visibles con :nth */
}

    /* Ocultar la "página derecha" visible */
    #book.compareModeOn .stf__item:nth-child(2),
    #book.compareModeOn .stf__page:nth-child(2) {
        display: none !important;
    }

    /* Estirar la página izquierda a ancho completo */
    #book.compareModeOn .stf__item:nth-child(1),
    #book.compareModeOn .stf__page:nth-child(1) {
        width: 100% !important;
        left: 0 !important;
    }

        /* Asegurar que el body de la página use todo */
        #book.compareModeOn .stf__item:nth-child(1) .pageBody,
        #book.compareModeOn .stf__page:nth-child(1) .pageBody {
            width: 100% !important;
        }
/* Asegura que el libro pueda contener un overlay absoluto */
#book {
    position: relative;
}

/* Capa que cubre el libro completo */
#compareOverlay {
    position: absolute;
    inset: 0;
    z-index: 9999;
    display: none;
    pointer-events: auto;
}

/* Visible */
#book.compareOverlayOn #compareOverlay {
    display: block;
}

/* Fondo tipo página */
#compareOverlay .cmpOverlayInner {
    background-color: white;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* ✅ scroll vertical */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 18px;
    box-sizing: border-box;
}

/* Si quieres que el flip NO responda a clics mientras comparas */
#book.compareOverlayOn {
    /* no hace falta, pero ayuda */
}
/* ============================= */
/* 📱 DISEÑO OPTIMIZADO MÓVIL */
/* ============================= */
@media (max-width: 768px) {

    .top-bar {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    /* Versiones en scroll horizontal */
    .version-tabs {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

        .version-tabs button {
            flex: 0 0 auto;
            padding: 6px 12px;
            font-size: 14px;
            border-radius: 10px;
        }

    /* Selectores Libro y Capítulo */
    .selector-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

        .selector-row select {
            width: 100%;
            font-size: 16px;
            padding: 8px;
            border-radius: 10px;
        }

    /* Controles inferiores */
    .control-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

        .control-row button {
            flex: 1;
            padding: 10px;
            font-size: 16px;
            border-radius: 12px;
        }

    /* Botones A- A+ */
    .font-controls {
        display: flex;
        gap: 8px;
        justify-content: center;
    }

        .font-controls button {
            padding: 8px 12px;
            font-size: 15px;
            border-radius: 10px;
        }
}
/* ================================
   📱 TOPBAR: 2 filas limpias en móvil
   (no rompe desktop)
   ================================= */
@media (max-width: 600px) {

    /* Evita que los contenedores flex se “rompan” por overflow */
    .topbar, .header, .titlebar, .toolbar {
        min-width: 0;
    }

    /* ===== FILA 1 (titlebar): Logo + Pills ===== */
    .titlebar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 10px 6px;
    }

        .titlebar .brand {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex: 0 0 auto;
        }

        .titlebar .brandTitle {
            font-size: 14px;
            line-height: 1.1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 120px; /* ajusta si deseas */
        }

        /* Pills en scroll horizontal (para que no se amontonen) */
        .titlebar .controls {
            min-width: 0;
            flex: 1 1 auto;
            display: flex;
            justify-content: flex-end;
            align-items: center;
        }

    #versionPills.versionPills {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 2px 0;
        min-width: 0;
        max-width: 100%;
    }

        #versionPills.versionPills::-webkit-scrollbar {
            display: none;
        }

    /* Si tus pills son buttons/divs, esto ayuda a compactar */
    #versionPills .pill,
    #versionPills button {
        flex: 0 0 auto;
        padding: 6px 10px;
        font-size: 13px;
        border-radius: 10px;
        white-space: nowrap;
    }

    /* ===== FILA 2 (toolbar): Libro/Cap + Botones ===== */
    .toolbar {
        display: grid;
        grid-template-columns: 1fr auto; /* izquierda selects, derecha botones */
        gap: 10px;
        align-items: center;
        padding: 6px 10px 10px;
    }

        /* Columna izquierda: nav + selects */
        .toolbar > .controls:first-child {
            display: grid;
            grid-template-columns: 42px 1fr 110px; /* menú / libro / cap */
            gap: 8px;
            align-items: center;
            min-width: 0;
        }

    /* nav button compacto */
    #btnNavToggle.navToggle {
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    /* Labels: en móvil, que el texto no quite espacio */
    .toolbar label.ctrl span {
        display: none; /* oculta "Libro" y "Cap." en móvil */
    }

    /* selects full width */
    .toolbar .select {
        width: 100%;
        padding: 10px 10px;
        font-size: 15px;
        border-radius: 12px;
    }

    /* Columna derecha: botones */
    .toolbar > .controls:last-child {
        display: flex;
        gap: 6px;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

        .toolbar > .controls:last-child .btn {
            padding: 10px 10px;
            font-size: 14px;
            border-radius: 12px;
            min-width: 42px;
            height: 42px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

    /* ===== Breakpoint extra pequeño: apila botones debajo ===== */
    @media (max-width: 380px) {
        .toolbar {
            grid-template-columns: 1fr; /* una sola columna */
        }

            .toolbar > .controls:first-child {
                grid-template-columns: 42px 1fr 1fr; /* menú / libro / cap */
            }

            .toolbar > .controls:last-child {
                justify-content: space-between;
            }
    }
}
/* =========================================================
   ✅ MÓVIL: Toolbar en UNA SOLA FILA (carrusel horizontal)
   Objetivo: que NO se vaya a 2 líneas.
   Igual que la fila del título: el usuario desliza a la derecha.
   ========================================================= */
@media (max-width: 420px) {

    /* La toolbar completa se vuelve “carrusel” */
    .toolbar {
        display: flex !important;
        flex-wrap: nowrap !important; /* 👈 NO permitir salto */
        align-items: center;
        gap: 10px;
        padding: 6px 10px 10px;
        overflow-x: auto; /* 👈 scroll horizontal */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
    }

        .toolbar::-webkit-scrollbar {
            display: none;
        }

        /* Cada bloque .controls se mantiene en una sola línea */
        .toolbar > .controls {
            display: inline-flex !important;
            flex: 0 0 auto !important; /* 👈 no estirar, no encoger */
            flex-wrap: nowrap !important; /* 👈 no permitir salto */
            align-items: center;
            gap: 8px;
            white-space: nowrap;
        }

            /* Si hay estilos previos que fuerzan width:100% en .controls, lo anulamos */
            .toolbar > .controls:first-child,
            .toolbar > .controls:last-child {
                width: auto !important;
                min-width: 0 !important;
            }

        /* Oculta labels “Libro/Cap.” para ganar espacio */
        .toolbar label.ctrl span {
            display: none;
        }

    /* Botón menú */
    #btnNavToggle.navToggle {
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    /* Selects con ancho fijo (para que el carrusel funcione) */
    .ctrlLibro select.select {
        width: 170px;
    }
    /* ajusta */
    .ctrlCap select.select {
        width: 78px;
    }
    /* ajusta */

    .toolbar .select {
        height: 40px;
        padding: 6px 10px;
        font-size: 14px;
        border-radius: 12px;
        box-sizing: border-box;
        flex: 0 0 auto; /* 👈 clave */
    }

    /* Botones */
    .toolbar .btn {
        height: 40px;
        min-width: 44px;
        padding: 0 10px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        flex: 0 0 auto; /* 👈 clave */
    }
}
/* =========================================================
   ✅ Quitar el espacio vacío arriba del libro en móvil
   Causa típica: el contenedor “stage/bookWrap” está centrando verticalmente
   (align-items:center) o tiene padding-top/margin-top.
   Solución: en móvil, alinear arriba (flex-start) y resetear paddings/margins.
   ========================================================= */
@media (max-width: 600px) {

    /* 1) El área donde vive el flipbook NO debe centrar vertical */
    .stage, main.stage, #stage, #bookStage, .bookStage {
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important; /* 👈 clave */
        padding-top: 0 !important; /* 👈 elimina el hueco */
        margin-top: 0 !important;
    }

    /* 2) Si tienes un wrapper alrededor del book con padding/margen, se lo quitamos */
    #bookWrap, .bookWrap, .flipContainer, .bookFrame, .frame {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* 3) Asegura que el libro ocupe todo el alto disponible desde arriba */
    #book, .book, #flipbook, .flipbook, .stf__wrapper, .stf__parent {
        margin-top: 0 !important;
        top: 0 !important;
    }
}
@media (max-width: 600px) {
    :root {
        --topbarH: 124px;
        --safeBottom: 10px;
    }

    .stage, main.stage {
        height: calc(100dvh - var(--topbarH) - var(--safeBottom)) !important;
        min-height: calc(100dvh - var(--topbarH) - var(--safeBottom)) !important;
        overflow: hidden;
    }
}
/* =========================================================
   ✅ ELIMINAR el espacio vacío arriba del libro (MÓVIL)
   Causa: el contenedor del book (o el wrapper de PageFlip)
          está centrando verticalmente o tiene padding-top.
   Fix: forzar “pegado arriba” + que el wrapper ocupe 100% del alto.
   ========================================================= */

@media (max-width: 900px) {

    /* 1) El contenedor principal donde vive el libro: pegado arriba */
    .stage, main.stage, #stage, #viewer, #bookStage, .bookStage, .flipHost, .viewer {
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important; /* 👈 clave */
        align-items: center !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        overflow: hidden;
    }

    /* 2) Los wrappers típicos de StPageFlip / PageFlip: que NO centren */
    .stf__wrapper,
    .stf__parent,
    .stf__block,
    .stf__container {
        display: flex !important;
        justify-content: flex-start !important; /* 👈 clave */
        align-items: flex-start !important; /* 👈 clave */
        padding-top: 0 !important;
        margin-top: 0 !important;
        height: 100% !important;
        min-height: 100% !important;
    }

    /* 3) El elemento book: sin offset vertical */
    #book, .book, #flipbook, .flipbook {
        margin-top: 0 !important;
        top: 0 !important;
        transform: none !important; /* por si hay translateY(...) */
    }

    /* 4) Si el hueco viene de un “padding-top” que pusimos antes para el header,
        aquí lo anulamos (porque ya estás usando carrusel y no se monta). */
    .stage, main.stage, #stage, #viewer, #bookStage, .bookStage {
        padding-top: 0 !important;
    }
}
/* ✅ 2) Estilo del botón (no interfiere con tus estilos actuales) */
.btnFullscreen {
    flex: 0 0 auto;
    height: 40px;
    min-width: 44px;
    padding: 0 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

    .btnFullscreen:active {
        transform: scale(0.98);
    }

/* En móvil, que no rompa el carrusel de versiones */
@media (max-width: 600px) {
    .titlebar .controls {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    #versionPills {
        min-width: 0;
        flex: 1 1 auto;
    }

    .btnFullscreen {
        height: 38px;
        min-width: 42px;
    }
}
