.pdffb-wrapper {
    width: calc(100vw - 32px);
    max-width: none;
    margin: 20px calc(50% - 50vw + 16px);
    text-align: center;
    font-family: inherit;
    position: relative;
}

.pdffb-loading {
    padding: 40px 0;
    font-style: italic;
    color: #666;
}

.pdffb-book {
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.pdffb-stage {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    width: 100%;
}

/* PageFlip controla el tamaño de sus propias imágenes. No se debe forzar
   height:auto aquí, porque recorta las páginas altas del PDF. */

.pdffb-controls {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.pdffb-controls button {
    border: none;
    background: #2c3338;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s ease;
}

.pdffb-controls button:hover {
    background: #454b52;
}

.pdffb-page-info {
    font-size: 14px;
    color: #333;
}

.pdffb-page-input {
    width: 60px;
    text-align: center;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 4px;
}

.pdffb-index {
    flex: 0 0 280px;
    width: 280px;
    max-height: 76vh;
    text-align: left;
    overflow: hidden;
    border: 1px solid #dfe3e6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.pdffb-index-title {
    padding: 15px 18px;
    background: #2c3338;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}

.pdffb-index-panel {
    max-height: calc(76vh - 54px);
    overflow-y: auto;
    overflow-x: auto;
    padding: 8px 0;
}

.pdffb-index-group {
    padding: 5px 8px 10px;
}

.pdffb-index-group h3 {
    margin: 10px 10px 5px;
    color: #2c3338;
    font-size: 15px;
    line-height: 1.25;
}

.pdffb-index-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pdffb-index-link {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    color: #222;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    align-items: flex-start;
}

.pdffb-index-link:hover {
    background: #f1f3f5;
}

.pdffb-index-link-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.pdffb-index-link-page {
    flex: 0 0 auto;
    color: #666;
    white-space: nowrap;
}

.pdffb-close-fullscreen {
    display: none;
    position: absolute;
    z-index: 20;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
}

.pdffb-close-fullscreen:hover {
    background: rgba(0, 0, 0, 0.9);
}

.pdffb-wrapper:fullscreen,
.pdffb-wrapper:-webkit-full-screen {
    width: 100vw;
    background: #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.pdffb-wrapper:fullscreen .pdffb-controls,
.pdffb-wrapper:-webkit-full-screen .pdffb-controls,
.pdffb-wrapper:fullscreen .pdffb-index,
.pdffb-wrapper:-webkit-full-screen .pdffb-index {
    display: none;
}

.pdffb-wrapper:fullscreen .pdffb-close-fullscreen,
.pdffb-wrapper:-webkit-full-screen .pdffb-close-fullscreen {
    display: block;
}

@media (max-width: 600px) {
    .pdffb-stage {
        align-items: stretch;
        flex-direction: column;
    }
    .pdffb-index {
        flex-basis: auto;
        width: 100%;
        max-height: 260px;
    }
    .pdffb-index-panel {
        max-height: 212px;
    }
    .pdffb-controls {
        gap: 8px;
    }
    .pdffb-page-info {
        font-size: 12px;
    }
}

/* En un ancho reducido, apilar el índice permite que el PDF use todo el
   ancho disponible. En pantallas amplias permanece a la izquierda. */
@media (max-width: 1279px) {
    .pdffb-stage {
        align-items: stretch;
        flex-direction: column;
    }
    .pdffb-index {
        flex-basis: auto;
        width: 100%;
        max-height: 300px;
    }
    .pdffb-index-panel {
        max-height: 246px;
    }
}
