body {
    margin: 0;
    background: #2e2e2e;
    display: flex;
    flex-direction: column;
    /*justify-content: center;*/
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: "Inter", sans-serif;
    color: #fff;
}

.container {
    position: relative; 
    top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #3a3a3a;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 95vw;
}

.book {
    width: 90%;
    max-width: 1000px;
    display: flex;
    position: relative;
    perspective: 2000px;
    /*height: 70vh;*/
    margin-top: 1rem;
    overflow: hidden;
}

.page {
    /*height: 100%;*/
    background: white;
    overflow: hidden;
    transition: transform 0.2s ease-in-out;
    backface-visibility: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
    touch-action: pan-y;
}

.page canvas {
    width: 100%;
    height: 100%;
    display: block;
    
}

/* --- Default (Desktop/Dual-Page) Styles --- */
#left-page {
    width: 50%;
    transform-origin: right center;
    z-index: 1;
    display: block;
}

#right-page {
    width: 50%;
    transform-origin: left center;
    z-index: 2;
    display: block;
}

.page.flip {
    transform: rotateY(-180deg);
}

.page.flip_mirrored {
    transform: rotateY(180deg);
}

.nav-btn {
    font-size: 2rem; /* Adjusted for better fit with new layout */
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    z-index: 10;
    border-radius: 0.75rem;
    transition: background 0.3s ease;
    opacity: 0.8;
    margin: 0 0.5rem; /* Space between buttons */
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

/* New container for buttons at the bottom */
.button-container {
    background-color: #3a3a3a;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    position: fixed;
    bottom: 50px; /* adjust to your liking */
    display: flex;
    justify-content: center; /* Center buttons horizontally */
    align-items: center;
    /*margin-top: 1rem; /* Space below the book */
    width: 90%; /* Take full width of parent container */
    max-width: 1000px; /* Align with book max-width */
}

.hidden {
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.5s, opacity 0.5s linear;
}

.visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.5s linear;
}

#loading-message {
    font-size: 1.5rem;
    color: #ccc;
    margin-top: 2rem;
}

/* --- Mobile/Single-Page Styles --- */
@media (max-width: 768px) {
    .book {
        width: 100%;
        max-width: 500px;
        /*height: 75vh;*/
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #left-page {
        display: none;
    }

    #right-page {
        width: 100%;
        transform-origin: center center;
    }

    .page.flip {
        transform: rotateY(-180deg);
    }
    .page.flip_mirrored {
        transform: rotateY(180deg);
    }

    .nav-btn {
        font-size: 1.8rem;
        padding: 0.4rem 0.6rem;
        /* No absolute positioning needed here, handled by button-container */
    }

    #loading-message {
        font-size: 1.2rem;
    }
}