/* Flipbook layout */
body { overflow-x: hidden; }

#book-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 2rem;
}

#book-container {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
}

#book-shadow {
    box-shadow: 0 8px 60px rgba(0,0,0,0.35), 0 2px 12px rgba(0,0,0,0.15);
    position: relative;
}

/* Center binding divider */
#book-shadow::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: #d1d5db;
    pointer-events: none;
    z-index: 10;
}

/* Pages rendered by StPageFlip */
.page {
    background: #fff;
    position: relative;
}

.page-content {
    overflow: hidden;
    padding: 32px 28px 48px;
    overflow-y: auto;
    font-size: 0.93rem;
    line-height: 1.75;
    color: #1e293b;
    font-family: "Georgia", "Times New Roman", serif;
}

.page-content h1, .page-content h2, .page-content h3 {
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.6rem;
    color: #1e293b;
}

.page-content img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    display: block;
    object-fit: contain;
    border-radius: 6px;
    margin: 0.5rem auto;
}

.page-content blockquote {
    border-left: 3px solid #2563eb;
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    background: #f8faff;
    color: #64748b;
    font-style: italic;
}

.page-content p:last-child { margin-bottom: 0; }

.page-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    font-size: 0.7rem;
    color: #94a3b8;
    background: #fff;
}

/* Cover page */
.page-cover {
    background: linear-gradient(160deg, #1e3a8a 0%, #1d4ed8 50%, #3b82f6 100%);
    color: white;
}

.cover-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    text-align: center;
    gap: 1rem;
}

.cover-image {
    width: 100%;
    max-height: 55%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.cover-image-placeholder {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.cover-title {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cover-subtitle {
    font-size: 0.8rem;
    opacity: 0.75;
}

/* Back cover */
.page-back-cover {
    background: #fff;
    color: #1e293b;
}

.back-cover-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    text-align: center;
    gap: 1rem;
}

/* Controls */
#book-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

#page-indicator {
    font-size: 0.82rem;
    color: #64748b;
    min-width: 120px;
    text-align: center;
}

.btn-flip {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    transition: transform 0.15s;
}

.btn-flip:hover { transform: scale(1.1); }

/* Page dots */
#page-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 600px;
}

.page-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    border: none;
    padding: 0;
}

.page-dot.active {
    background: #2563eb;
    transform: scale(1.4);
}

/* Finish banner */
#finish-banner {
    display: none;
    text-align: center;
    padding: 0.75rem 1.5rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 12px;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

/* Hide spine divider in portrait/single-page mode */
@media (max-width: 699px) {
    #book-shadow::after { display: none; }
}

/* Lesson title bar */
#lesson-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
