/* ===== 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: #fdfaf3;
    --color-accent: #e04332; /* 朱砂红 */
    --text-area-height: 155px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    /* 宣纸淡雅色背景 */
    background:
        radial-gradient(ellipse at 50% 80%, #f3ede2 0%, transparent 60%),
        linear-gradient(180deg, #d4c4b0 0%, #e8decb 40%, #d4c4b0 100%);
    background-color: #e8decb;
}

/* ========================================================
   左侧书籍信息面板（仅封面关闭时可见）
   ======================================================== */
.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: #4a3a2d;
    padding: 40px 48px;
    max-width: 440px;
}

.badge {
    display: inline-block;
    background: rgba(224, 67, 50, 0.12);
    border: 1px solid rgba(224, 67, 50, 0.25);
    color: #e04332;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 18px;
}

.info-inner h1 {
    font-family: var(--font-display);
    font-size: 2.8rem;
    color: #2c1e10;
    line-height: 1.25;
    margin-bottom: 18px;
    text-shadow: 0 2px 10px rgba(255,255,255,0.8);
}

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

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

.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: #8c7e6d;
}

/* ========================================================
   翻页书本容器 — 上下等距居中
   ======================================================== */
#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;
}

.page.--left {
    border-right: 0;
    box-shadow:
        inset -12px 0 18px -6px rgba(0,0,0,0.12),
        inset -3px  0  5px -1px rgba(0,0,0,0.08);
}
.page.--right {
    border-left: 0;
    box-shadow:
        inset 12px 0 18px -6px rgba(0,0,0,0.12),
        inset 3px  0  5px -1px rgba(0,0,0,0.08);
}

.page.hard {
    background-color: #d15141; /* 朱砂色基底 */
}

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

/* --- Cover front --- */
.cover-front {
    background: #d15141;
}
.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: #9a8570;
    letter-spacing: 3px;
    margin-bottom: 22px;
}
.tp-title {
    font-family: var(--font-display);
    font-size: 2.6rem;
    color: #3b2818;
    margin-bottom: 18px;
}
.tp-deco {
    font-size: 2rem;
    margin-bottom: 18px;
    letter-spacing: 8px;
}
.tp-desc {
    font-size: 1rem;
    color: #7b6550;
}

/* --- 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 #e2d5c3;
    background: var(--color-page);
    position: relative;
}
.text-area h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: #b73a2b; /* 朱砂暗红 */
    margin-bottom: 6px;
    line-height: 1.3;
}
.text-area p {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #4a3a2d;
}

.knowledge-tip {
    margin-top: 6px;
    background: #fdf5e6;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px dashed #f3a83b;
    font-size: 0.85rem !important;
    color: #a86c12 !important;
}

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

/* --- Back cover --- */
.cover-back {
    background: #e8b031; /* 藤黄底色 */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.back-cover-inner {
    text-align: center;
    color: #fff;
    padding: 30px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.back-end {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-bottom: 14px;
}
.back-deco {
    font-size: 3rem;
    margin-bottom: 14px;
}
.back-msg {
    font-size: 1rem;
    line-height: 1.8;
    color: rgba(255,255,255,0.95);
}

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