/* ===== Viewer Home ===== */
.viewer-home { min-height: 100vh; background: #f8f9fa; }
.site-header {
    background: var(--gray-900);
    color: #fff;
    padding: 0 20px;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
}
.site-logo i { color: var(--primary); }
.home-main { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }
.home-hero {
    text-align: center;
    padding: 50px 0 40px;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #fff;
    border-radius: 16px;
    margin-bottom: 40px;
}
.home-hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 10px; }
.home-hero p { font-size: 16px; opacity: 0.8; }

/* ===== Showcase ===== */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.showcase-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    display: block;
}
.showcase-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.showcase-cover {
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.showcase-cover i { font-size: 60px; color: rgba(255,255,255,0.7); }
.showcase-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}
.showcase-card:hover .showcase-overlay { opacity: 1; }
.showcase-info { padding: 16px 18px; }
.showcase-info h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.issue-num { color: var(--primary); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.issue-desc { font-size: 13px; color: var(--gray-500); line-height: 1.5; margin-bottom: 10px; }
.issue-meta { display: flex; gap: 14px; font-size: 12px; color: var(--gray-400); }
.issue-meta span { display: flex; align-items: center; gap: 4px; }
.site-footer { text-align: center; padding: 30px; color: var(--gray-500); font-size: 13px; }
.empty-home { text-align: center; padding: 80px; color: var(--gray-400); }
.empty-home i { font-size: 60px; margin-bottom: 16px; display: block; }


/* ===== Viewer Body ===== */
.viewer-body {
    background: #2d3436; /* 深灰色背景 */
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== Top Bar (样式不变) ===== */
.viewer-topbar {
    height: 52px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
/* ... .topbar-logo, .topbar-title, .topbar-actions 等样式不变 ... */

/* ===== Page Counter (样式不变) ===== */
.page-counter {
    position: fixed;
    top: 60px;
    right: 16px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    z-index: 50;
}

/* ===== 新的 Viewer Container 样式 ===== */
.viewer-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}
.book-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 隐藏原始的页面项，库会复制它们 */
.page-item {
    display: none;
}

/* 翻页库生成的页面样式 */
#book {
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-radius: 6px;
}
.st-page {
    background-color: #fff;
}

/* 页面内容样式 */
.page-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.page-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.8);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    backdrop-filter: blur(2px);
    z-index: 100; /* 确保在元素之上 */
}

/* 渲染的元素 */
.rendered-element {
    overflow: hidden;
    box-sizing: border-box;
}
.elem-text {
    box-sizing: border-box;
}

/* ===== Thumbnail Strip (样式不变) ===== */
.thumbnail-strip {
    height: 80px;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    width: 100%;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
/* ... .thumb-item 等样式不变 ... */
.thumb-item.active .thumb-preview {
    border-color: #3b82f6;
    transform: scale(1.05);
}




/* ===== Thumbnail Strip ===== */
.thumbnail-strip {
    height: 80px;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    width: 100%;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.thumb-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}
.thumb-item:hover { transform: scale(1.1); }
.thumb-item.active .thumb-preview { border-color: var(--primary); }
.thumb-preview {
    width: 44px;
    height: 54px;
    border-radius: 3px;
    border: 2px solid rgba(255,255,255,0.2);
    background: #fff;
    background-size: cover;
    background-position: center;
    transition: border-color 0.2s;
}
.thumb-item span { color: rgba(255,255,255,0.6); font-size: 10px; }

/* ===== Viewer Modal ===== */
.viewer-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.viewer-modal.active { display: flex; }
.viewer-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 460px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.viewer-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}
.viewer-modal-header h3 { font-size: 16px; font-weight: 600; }
.viewer-modal-header button { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-500); }
.viewer-modal-body { padding: 20px; }
.share-title { font-weight: 600; font-size: 15px; margin-bottom: 14px; text-align: center; }
.share-url-group { display: flex; gap: 8px; margin-bottom: 20px; }
.share-url-group input { flex: 1; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 13px; }
.share-qr { text-align: center; margin-bottom: 20px; }
.share-qr img { width: 150px; height: 150px; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.share-qr p { font-size: 12px; color: var(--gray-500); margin-top: 8px; }
.share-platform { display: flex; gap: 10px; justify-content: center; }
.share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}
.share-btn.wechat { background: #07c160; }
.share-btn.weibo { background: #e6162d; }
.share-btn.native { background: var(--primary); }

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.lightbox.active { display: flex; }
.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
}
.lightbox-page {
    background: #fff;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 4px;
}
.lightbox-close {
    position: absolute;
    top: -20px;
    right: -20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Viewer Empty ===== */
.viewer-empty {
    text-align: center;
    color: rgba(255,255,255,0.4);
    padding: 80px;
}
.viewer-empty i { font-size: 60px; display: block; margin-bottom: 16px; }

/* ===== Responsive Viewer ===== */
.hide-mobile { }
@media (max-width: 640px) {
    .hide-mobile { display: none; }
    .topbar-btn span { display: none; }
    .nav-btn { width: 36px; height: 36px; font-size: 14px; }
    .home-hero h1 { font-size: 24px; }
    .home-hero { padding: 30px 20px; }
    .viewer-container { padding: 10px 0 0; }
}

/* ===== Touch Swipe Hint ===== */
.swipe-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    animation: fadeInOut 3s forwards;
    z-index: 99;
}
@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}