* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

body, html {
    height: 100%;
    overflow: hidden;
    background-color: #515558;
    -webkit-overflow-scrolling: touch;
}

.flipbook-container {
    position: relative;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.flipbook {
    display: flex;
    width: 300vw;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.flipbook img {
    width: 100vw;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
    transform-origin: center center;
    cursor: grab;
    -webkit-user-drag: none;
}

.flipbook img.dragging {
    cursor: grabbing;
}

.nav-buttons {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 10;
}

.nav-buttons button {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
}

.nav-buttons button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.thumbnails-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 110px;
    background: rgba(0, 0, 0, 0.8);
    z-index: 5;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 10px;
}

.thumbnails-container::-webkit-scrollbar {
    height: 6px;
}

.thumbnails-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 0 10px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.thumbnails {
    display: flex;
    gap: 5px;
    padding: 10px 10px 0 10px;
}

.thumbnails img {
    width: 80px;
    height: 90px;
    object-fit: cover;
    opacity: 0.6;
    cursor: pointer;
}

.thumbnails img:hover {
    opacity: 1;
}

.thumbnails .active {
    opacity: 1;
    border: 2px solid #fff;
}

.page-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 3px;
    z-index: 15;
}

#zoomBtn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 15;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

#zoomBtn:hover {
    background: rgba(0, 0, 0, 0.9);
}

@media (min-width: 769px) {
    .flipbook {
        height: calc(100vh - 110px);
    }
    .flipbook img {
        height: calc(100vh - 110px);
    }
}

@media (max-width: 768px) {
    .flipbook {
        height: calc(100vh - 60px);
        position: relative;
        z-index: 5;
    }
    .flipbook img {
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
    }
    .nav-buttons {
        top: auto;
        bottom: 0;
        height: 60px;
        padding: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(0, 0, 0, 0.8);
        z-index: 10;
        position: fixed;
        width: 100vw;
        -webkit-transform: translateZ(0);
    }
    .nav-buttons button {
        width: 50%;
        height: 100%;
        border-radius: 0;
        font-size: 24px;
        margin: 0;
        background: transparent;
        -webkit-tap-highlight-color: transparent;
    }
    .nav-buttons button:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    .thumbnails-container {
        display: none;
    }
    .page-indicator {
        font-size: 12px;
        padding: 3px 8px;
        z-index: 15;
    }
    #zoomBtn {
        z-index: 15;
    }
}