/* ============================================================
   云展电子书 - turn.js 双页翻书（对齐官方 double-page 示例）
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: #1c1c28; color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ---- turn.js 核心结构（必须与官方一致） ---- */
.flipbook-viewport {
    position: fixed; inset: 0; z-index: 10;
    overflow: hidden; width: 100%; height: 100%;
    /* flexbox 居中替代 autoCenter，避免 page-stage 高度为 0 时偏移错误 */
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
}
/* container 不需要 absolute/left/top，flexbox 已接管居中 */
.flipbook-viewport .container {
    position: relative;
}
/* flipbook 自身无 left/top 定位，由 turn.js 管理 */
.flipbook-viewport .flipbook {
    position: absolute;
}
/* 默认单页尺寸（会被 JS 通过 .turn('size',w,h) 覆盖） */
.flipbook-viewport .page,
.flipbook-viewport .double {
    width: 460px;
    height: 600px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    -webkit-box-shadow: 0 0 20px rgba(0,0,0,.22);
    box-shadow: 0 0 20px rgba(0,0,0,.22);
}
/* 封底 */
.flipbook-viewport .page.back-cover {
    background: linear-gradient(135deg, #0a1a3a, #1a3a6c);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; color: #fff;
}
.back-cover .bc-icon { font-size: 52px; margin-bottom: 14px; }
.back-cover .bc-name { font-size: 13px; letter-spacing: .2em; opacity: .85; }
.back-cover .bc-msg  { font-size: 12px; margin-top: 8px; opacity: .6; }

/* ---- 顶部工具栏 ---- */
.fb-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    height: 48px; display: flex; align-items: center;
    justify-content: space-between; padding: 0 10px;
    background: rgba(20,20,30,.88);
    backdrop-filter: blur(12px);
}
.tool-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; border-radius: 8px;
    background: rgba(58,58,66,.9); color: #fff; font-size: 16px;
    cursor: pointer; outline: none; transition: background .15s;
}
.tool-btn:hover { background: rgba(80,80,90,.95); }
.tool-btn:active { background: #1890ff; }
.topbar-title {
    flex: 1; text-align: center; font-size: 14px;
    color: rgba(255,255,255,.85);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 8px;
}

/* ---- 底部工具栏 ---- */
.fb-toolbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    height: 56px; display: flex; align-items: center;
    justify-content: center; gap: 8px; padding: 0 12px;
    background: rgba(20,20,30,.88);
    backdrop-filter: blur(12px);
}
.page-input {
    width: 48px; height: 30px;
    background: rgba(50,50,60,.9); border: 1px solid rgba(80,80,100,.5);
    border-radius: 6px; color: #fff; font-size: 13px;
    text-align: center; outline: none;
}
.page-total {
    color: rgba(255,255,255,.6); font-size: 13px;
    min-width: 24px; text-align: center;
}

/* ---- 加载遮罩 ---- */
#loading-mask {
    position: fixed; inset: 0; z-index: 50;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #1c1c28; color: rgba(255,255,255,.55);
    font-size: 14px; gap: 12px;
}
.spinner {
    width: 30px; height: 30px;
    border: 3px solid rgba(255,255,255,.1); border-top-color: #1890ff;
    border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 响应式：手机单页 ---- */
@media (max-width: 767px) {
    .flipbook-viewport .page,
    .flipbook-viewport .double {
        width: 360px; height: 508px;
    }
    .fb-topbar { height: 40px; }
    .tool-btn { width: 32px; height: 32px; font-size: 14px; }
    .fb-toolbar { height: 48px; gap: 6px; }
    .page-total, .page-input { font-size: 12px; }
    .page-input { width: 40px; height: 26px; }
}
@media (max-width: 400px) {
    .flipbook-viewport .page,
    .flipbook-viewport .double {
        width: 300px; height: 423px;
    }
}
