* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #c89b7e 0%, #8b5a3c 50%, #3e2723 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 235, 205, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 90, 60, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.book-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    position: relative;
    z-index: 1;
}

.book {
    width: 700px;
    height: 700px;
    background: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    transition: transform 0.6s ease, opacity 0.6s ease;
    opacity: 0;
    transform: rotateY(-180deg);
    transform-origin: left;
    backface-visibility: hidden;
}

.page.active {
    opacity: 1;
    transform: rotateY(0deg);
    z-index: 2;
}

.page.turning-out {
    animation: turnOut 0.6s ease forwards;
}

.page.turning-in {
    animation: turnIn 0.6s ease forwards;
}

@keyframes turnOut {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }
    100% {
        transform: rotateY(180deg);
        opacity: 0;
    }
}

@keyframes turnIn {
    0% {
        transform: rotateY(-180deg);
        opacity: 0;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.page-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
    background: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

button {
    padding: 12px 24px;
    font-size: 16px;
    background: linear-gradient(135deg, #d4a574 0%, #c89b7e 100%);
    color: #3e2723;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: linear-gradient(135deg, #e0b686 0%, #d4a574 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#pageNumber {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    min-width: 100px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .book {
        width: 100vw;
        height: 100vw;
        max-width: 600px;
        max-height: 600px;
        border-radius: 8px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    }
    
    .page-content {
        padding: 15px;
    }
    
    .controls {
        flex-direction: column;
        gap: 12px;
        padding: 12px 15px;
        width: 100%;
        max-width: 600px;
        border-radius: 30px;
    }
    
    button {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 20px;
    }
    
    #pageNumber {
        font-size: 16px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
        min-height: 100vh;
    }
    
    .book-container {
        gap: 15px;
        width: 100%;
    }
    
    .book {
        width: 100vw;
        height: 100vw;
        max-width: 95vw;
        max-height: 95vw;
        border-radius: 8px;
    }
    
    .page-content {
        padding: 10px;
    }
    
    .controls {
        gap: 8px;
        padding: 10px 12px;
        width: calc(100% - 16px);
        max-width: 95vw;
    }
    
    button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    #pageNumber {
        font-size: 14px;
    }
}
