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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    backdrop-filter: blur(10px);
}

.header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 2rem;
    color: #333;
    font-weight: 700;
}

.page-counter {
    font-size: 1.2rem;
    color: #666;
    font-weight: 600;
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
}

.flipbook-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    position: relative;
}

.flipbook {
    position: relative;
    width: 100%;
    max-width: 700px;
    aspect-ratio: 9/16;
    perspective: 1500px;
    overflow: hidden;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    transform: rotateY(-90deg);
    transform-origin: left center;
    transition: all 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    backface-visibility: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

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

.page.flipping-out {
    animation: flipOut 0.8s cubic-bezier(0.645, 0.045, 0.355, 1) forwards;
}

.page.flipping-in {
    animation: flipIn 0.8s cubic-bezier(0.645, 0.045, 0.355, 1) forwards;
}

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

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

.page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.nav-button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: #667eea;
}

.nav-button:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(1);
}

.controls {
    margin-top: 30px;
}

.thumbnails {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 120px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.thumbnail:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.thumbnail.active {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail span {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.instructions {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .flipbook-container {
        flex-direction: column;
    }
    
    .nav-button {
        width: 40px;
        height: 40px;
    }
    
    .thumbnail {
        width: 60px;
        height: 90px;
    }
}

