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

body {
    background: #0f0f1a;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(29, 78, 137, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(233, 69, 96, 0.08) 0%, transparent 60%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    height: 100vh;
    padding: 24px;
}

/* Loading */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

#loading p {
    font-size: 14px;
    opacity: 0.6;
    letter-spacing: 0.5px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Book Container */
#book-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    position: relative;
}

/* Pages */
.page {
    background: #fff;
    overflow: hidden;
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Controls */
#controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 48px;
    transition: opacity 0.3s;
}

#controls button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

#controls button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#controls button:active {
    transform: scale(0.92);
}

#page-info {
    font-size: 13px;
    min-width: 64px;
    text-align: center;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}

.divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 4px;
}

/* Error */
.error-message {
    color: #e94560;
    text-align: center;
    line-height: 1.6;
    font-size: 14px;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Fullscreen adjustments */
:fullscreen #app,
:-webkit-full-screen #app {
    background: #0f0f1a;
}

/* Responsive */
@media (max-width: 768px) {
    #app {
        padding: 12px;
        gap: 16px;
    }

    #controls {
        padding: 6px 12px;
        gap: 4px;
    }

    #controls button {
        width: 36px;
        height: 36px;
    }

    #page-info {
        font-size: 12px;
        min-width: 50px;
    }
}
