/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --font-display: 'ZCOOL KuaiLe', cursive;
    --font-body: 'Noto Sans SC', sans-serif;
    --color-page: #fefaf2;
    --color-accent: #ff8f00;
    --text-area-height: 130px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background:
        radial-gradient(ellipse at 50% 80%, #4a3728 0%, transparent 60%),
        linear-gradient(180deg, #2c1e10 0%, #3e2b18 40%, #2c1e10 100%);
    background-color: #3e2b18;
}

/* ========================================================
   左侧书籍信息面板（仅封面关闭时可见）
   ======================================================== */
.book-info-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.5s ease;
}
.book-info-panel.hidden {
    opacity: 0;
}

.info-inner {
    text-align: center;
    color: #c4b89a;
    padding: 40px 48px;
    max-width: 440px;
}

.badge {
    display: inline-block;
    background: rgba(255,143,0,0.18);
    border: 1px solid rgba(255,143,0,0.35);
    color: #ffb74d;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 18px;
}

.info-inner h1 {
    font-family: var(--font-display);
    font-size: 2.6rem;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 18px;
    text-shadow: 0 2px 20px rgba(255,143,0,0.25);
}

.synopsis {
    font-size: 1rem;
    line-height: 1.85;
    color: #b8a98a;
    margin-bottom: 18px;
}

.meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
    font-size: 0.9rem;
    color: #a09078;
}

.hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--color-accent);
    margin-bottom: 32px;
}
.hint-arrow {
    animation: nudge-right 1.5s ease-in-out infinite;
}
@keyframes nudge-right {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

.series-label {
    font-size: 0.78rem;
    letter-spacing: 4px;
    color: #5c5040;
}

/* ========================================================
   翻页书本容器 — 上下等距居中
   ======================================================== */
#flipbook-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    /* 上下对称留白 */
    padding: 28px 20px;
}

/* ===== Page Styles ===== */
.page {
    background-color: var(--color-page);
    overflow: hidden;
}

/* --- 中缝书脊阴影 ---
 * 展开跨页时显示；翻页动画进行时淡出，翻完后淡入。
 */
#flipbook.spread-open::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    z-index: 100;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
    background:
        linear-gradient(90deg,
            transparent            0%,
            rgba(0,0,0,0.02)      22%,
            rgba(0,0,0,0.05)      38%,
            rgba(0,0,0,0.09)      47%,
            rgba(0,0,0,0.12)      50%,
            rgba(0,0,0,0.09)      53%,
            rgba(0,0,0,0.05)      62%,
            rgba(0,0,0,0.02)      78%,
            transparent           100%
        );
}
/* 翻页进行中：隐藏书脊 */
#flipbook.spread-open.flipping::after {
    opacity: 0;
}

/*
 * 书脊阴影：使用页面自身的 inset box-shadow 模拟中缝折痕。
 * 这样翻页时，阴影随页面一起移动/被遮挡，完全符合物理逻辑。
 */
.page.--left {
    border-right: 0;
    box-shadow:
        inset -12px 0 18px -6px rgba(0,0,0,0.15),
        inset -3px  0  5px -1px rgba(0,0,0,0.10);
}
.page.--right {
    border-left: 0;
    box-shadow:
        inset 12px 0 18px -6px rgba(0,0,0,0.15),
        inset 3px  0  5px -1px rgba(0,0,0,0.10);
}

.page.hard {
    background-color: #d8b55a;
}

.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* --- Cover front --- */
.cover-front {
    background: #c9a34a;
}
.cover-front .page-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Title page (back of cover) --- */
.title-page {
    background: var(--color-page);
    display: flex;
    align-items: center;
    justify-content: center;
}
.title-page-inner {
    text-align: center;
    padding: 30px;
}
.tp-series {
    font-size: 0.9rem;
    color: #a08a6c;
    letter-spacing: 3px;
    margin-bottom: 22px;
}
.tp-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: #5d4037;
    margin-bottom: 18px;
}
.tp-deco {
    font-size: 2rem;
    margin-bottom: 18px;
    letter-spacing: 8px;
}
.tp-desc {
    font-size: 1rem;
    color: #8d6e63;
}

/* --- Story pages --- */
.story-page {
    display: flex;
    flex-direction: column;
}
.story-page .page-img {
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    object-fit: cover;
}

/* 统一固定高度的文字区 */
.text-area {
    flex: 0 0 var(--text-area-height);
    height: var(--text-area-height);
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid #e8dcc8;
    background: var(--color-page);
}
.text-area h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #5d4037;
    margin-bottom: 5px;
    line-height: 1.3;
}
.text-area p {
    font-size: 0.92rem;
    line-height: 1.7;
    color: #4e342e;
}

.page-num {
    position: absolute;
    bottom: 6px;
    font-size: 0.75rem;
    color: #c0b0a0;
}
.--left .page-num { left: 16px; }
.--right .page-num { right: 16px; }

/* --- Back cover --- */
.cover-back {
    background: linear-gradient(145deg, #c9a84c, #a67c30);
    display: flex;
    align-items: center;
    justify-content: center;
}
.back-cover-inner {
    text-align: center;
    color: #fff;
    padding: 30px;
}
.back-end {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: 14px;
}
.back-deco {
    font-size: 3rem;
    margin-bottom: 14px;
}
.back-msg {
    font-size: 0.95rem;
    line-height: 1.8;
    color: rgba(255,255,255,0.85);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .book-info-panel { display: none; }
    .info-inner h1   { font-size: 2rem; }
    .text-area h3    { font-size: 0.95rem; }
    .text-area p     { font-size: 0.82rem; }
    :root { --text-area-height: 110px; }
}
