.wppf-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
}

.wppf-open-button {
    appearance: none;
    border: none;
    cursor: pointer;
    font: inherit;
    padding: .8rem 1.6rem;
    border-radius: .5rem;
    background: #1d2327;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
    transition: background-color .15s ease, transform .15s ease;
}

.wppf-open-button:hover {
    background: #2f363b;
    transform: translateY(-1px);
}

.wppf-modal {
    display: none;
    position: fixed;
    z-index: 2147483647;
    inset: 0;
    max-width: none;
    margin: 0;
}

.wppf-modal.wppf-is-open {
    display: block;
}

.wppf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .75);
}

.wppf-modal-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1800px, 98vw);
    height: min(1300px, 96vh);
    box-sizing: border-box;
    overflow: hidden;
    background: #fff;
    border-radius: .6rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    transform: translate(-50%, -50%);
}

.wppf-modal .wppf-stage {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    padding-top: 1rem;
    box-sizing: border-box;
}

.wppf-modal .wppf-book {
    height: 100%;
}

.wppf-modal .wppf-book-viewport {
    height: 100%;
}

.wppf-modal .wppf-controls {
    flex: 0 0 auto;
    margin: 0;
    padding: .75rem 1rem;
    border-top: 1px solid #e2e2e2;
}

.wppf-close {
    appearance: none;
    border: none;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
    font: inherit;
    position: absolute;
    top: .6rem;
    right: .6rem;
    z-index: 2;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wppf-stage {
    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: var(--wppf-height, 760px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.wppf-stage.wppf-is-zoomed {
    justify-content: flex-start;
    align-items: flex-start;
}

.wppf-book-viewport {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    height: var(--wppf-height, 760px);
}

.wppf-pan-surface {
    display: none;
}

.wppf-stage.wppf-is-zoomed .wppf-pan-surface {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: block;
    cursor: move;
    touch-action: none;
}

.wppf-stage.wppf-is-zoomed .wppf-pan-surface.wppf-is-panning {
    cursor: grabbing;
}

.wppf-book {
    width: 100%;
    height: var(--wppf-height, 760px);
}

.wppf-book > .stf__wrapper {
    height: 100%;
    /* PageFlip's inline ratio padding duplicates the book's explicit height. */
    padding-bottom: 0 !important;
}

.wppf-page {
    background: #fff;
    overflow: hidden;
}

.wppf-page canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.wppf-loading {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    z-index: 2;
}

.wppf-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
}

.wppf-controls button,
.wppf-download {
    appearance: none;
    border: 1px solid currentColor;
    background: transparent;
    padding: .7rem 1rem;
    border-radius: .4rem;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
}

.wppf-controls button:disabled {
    opacity: .4;
    cursor: default;
}

.wppf-zoom-level {
    min-width: 3.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.wppf-page-indicator {
    min-width: 4.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.wppf-has-error .wppf-book {
    display: none;
}

@media (max-width: 768px) {
    .wppf-wrapper {
        margin: 1rem auto;
    }

    .wppf-stage {
        min-height: 520px;
    }

    .wppf-book {
        height: 520px;
    }

    .wppf-book-viewport {
        height: 520px;
    }

    .wppf-controls {
        gap: .5rem;
    }

    .wppf-download {
        flex-basis: 100%;
        text-align: center;
    }
}
