body {
    background-color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: sans-serif;
    overflow: hidden;
}

.flip-book {
    box-shadow: 0 0 20px 0 rgba(0,0,0,0.5);
    display: none; /* Hidden until loaded */
    background-size: cover;
}

.page {
    padding: 0;
    background-color: white;
    overflow: hidden;
    position: relative;
    box-shadow: inset -1px 0 20px rgba(0, 0, 0, 0.1);
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* or cover if you want full bleed */
    pointer-events: none; /* Prevent image dragging interfering with flip */
}

/* Loader */
.loader {
    border: 5px solid #f3f3f3;
    border-radius: 50%;
    border-top: 5px solid #3498db;
    width: 50px;
    height: 50px;
    -webkit-animation: spin 2s linear infinite; /* Safari */
    animation: spin 2s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 20px;
}

.controls button {
    background: white;
    border: none;
    padding: 5px 15px;
    margin: 0 5px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.controls button:hover {
    background: #eee;
}
