* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 40%, #8b6914 0%, #5a3e0a 40%, #2e1e05 70%, #1a0f02 100%);
    background-size: cover;
}

/* ---- Book Container ---- */

#book-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    padding: 20px;
}

#book {
    position: relative;
    cursor: grab;
    transition: margin-left 0.35s ease;
}

#book:active {
    cursor: grabbing;
}

/* ---- Pages (turn.js) ---- */

.page {
    background: #f5f0e1;
    overflow: hidden;
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.page.hard {
    background: #3a3530;
}

.blank-page {
    background: #f0ebe0;
}

.turn-page-wrapper {
    overflow: visible !important;
}

/* ---- Navigation Bar ---- */

#nav-bar {
    position: relative;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    margin-bottom: 20px;
    user-select: none;
    flex-wrap: wrap;
    flex-shrink: 0;
}

#nav-bar button {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

#nav-bar button:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

#nav-bar button:active {
    background: rgba(255, 255, 255, 0.25);
}

#btn-music.active {
    color: #f0c040;
    border-color: rgba(240, 192, 64, 0.4);
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

#page-counter {
    color: #ddd;
    font-size: 14px;
    min-width: 56px;
    text-align: center;
    letter-spacing: 1px;
}

/* ---- Mobile ---- */

@media (max-width: 768px) {
    #book-container {
        padding: 8px;
    }

    #nav-bar {
        gap: 6px;
        padding: 8px 12px;
        margin-bottom: 12px;
        border-radius: 6px;
    }

    #nav-bar button {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    #page-counter {
        font-size: 12px;
        min-width: 48px;
    }

    .nav-divider {
        height: 16px;
    }
}

@media (max-width: 480px) {
    #nav-bar {
        gap: 4px;
        padding: 6px 8px;
        margin-bottom: 8px;
    }

    #nav-bar button {
        width: 28px;
        height: 28px;
        font-size: 14px;
        border-radius: 4px;
    }
}
