:root {
    /* 品牌色系：大地色与木质调 */
    --cabinet-dark: #3e2718;  
    --cabinet-light: #8a5a3a; 
    --cabinet-inner: #2d1b12; 
    --plank-face: #6b4329;
    --plank-top: #4a2e1b;
    --wall-color: #f4f1ea;    
    --gold-accent: #cfa856;   
    --paper-color: #fdfbf7;
    
    --book-height-pc: 210px;
    --book-height-mobile: 135px;
    
    /* 木纹噪点 */
    --wood-texture: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
}

/* 隐藏滚动条但保留功能 */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(92, 58, 33, 0.2); border-radius: 2px; }

body {
    font-family: 'Noto Serif SC', serif;
    background-color: var(--wall-color);
    background-image: 
        radial-gradient(circle at 50% 30%, rgba(92, 58, 33, 0.03) 0%, rgba(92, 58, 33, 0.1) 100%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%235c3a21' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #3e2616;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 标题淡入 */
.fade-in-up { animation: fadeInUp 0.8s ease-out forwards; opacity: 0; transform: translateY(20px); }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

header { text-align: center; padding: 60px 20px 30px; z-index: 10; position: relative; }
.header-title { text-shadow: 0 2px 4px rgba(0,0,0,0.05); }

.cabinet-container {
    width: 100%; max-width: 1100px; margin: 0 auto 60px; padding: 0 15px;
    perspective: 2500px; /* 增强透视感 */
    box-sizing: border-box; flex: 1;
}

/* 筛选按钮样式优化 */
.filter-bar {
    display: flex; justify-content: center; gap: 30px; margin-bottom: 30px;
    flex-wrap: wrap; position: relative; z-index: 20;
}
.filter-btn {
    background: transparent; border: none; font-family: 'Noto Serif SC', serif;
    color: #8a5a3a; font-size: 1.05rem; cursor: pointer; padding: 6px 10px;
    position: relative; transition: all 0.3s ease; letter-spacing: 0.05em; opacity: 0.6;
}
.filter-btn:hover { opacity: 1; color: #5c3a21; transform: translateY(-1px); }
.filter-btn.active { color: #3e2718; font-weight: 700; opacity: 1; }
.filter-btn.active::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 20px; height: 2px; background-color: var(--gold-accent);
    box-shadow: 0 1px 3px rgba(207, 168, 86, 0.4);
}

/* 柜体 */
.cabinet {
    background-color: var(--cabinet-inner);
    border: 20px solid var(--cabinet-dark);
    border-top-width: 35px; border-bottom-width: 25px; border-radius: 8px 8px 0 0; 
    box-shadow: 
        0 50px 100px -20px rgba(0, 0, 0, 0.7), 
        inset 0 0 150px rgba(0,0,0,0.9), 
        0 0 0 1px rgba(255,255,255,0.1);
    position: relative; 
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 30%), var(--wood-texture);
    padding: 40px 40px 20px; display: flex; flex-direction: column; gap: 20px; z-index: 5; 
    overflow: hidden; min-height: 400px; transition: min-height 0.3s ease;
}
/* 柜顶装饰线条 */
.cabinet::before {
    content: ''; position: absolute; top: -28px; left: -18px; right: -18px; height: 6px;
    background: #5c3a21; box-shadow: 0 2px 4px rgba(0,0,0,0.5); border-radius: 2px; z-index: 10;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* 动态光照层 */
.spotlight-overlay {
    position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), transparent 10%, rgba(0,0,0,0.3) 70%);
    z-index: 6; opacity: 1; mix-blend-mode: multiply; transition: opacity 0.5s ease;
}

/* 底部底座 */
.cabinet-footer { position: relative; z-index: 4; margin-top: -1px; width: 100%; filter: drop-shadow(0 20px 20px rgba(0,0,0,0.6)); }
.footer-molding {
    height: 14px; background: var(--cabinet-light); 
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(0,0,0,0.2));
    border-top: 1px solid rgba(255,255,255,0.2); 
    width: calc(100% + 10px); margin-left: -5px; border-radius: 2px;
}
.footer-base {
    height: 55px; width: 100%; background-color: var(--cabinet-dark);
    background-image: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, transparent 10%, transparent 90%, rgba(0,0,0,0.2) 100%), var(--wood-texture);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 95% 100%, 88% 70%, 12% 70%, 5% 100%, 0% 100%);
}

/* 书架层板 */
.shelf-row { position: relative; width: 100%; margin-bottom: 5px; display: flex; flex-direction: column; justify-content: flex-end; z-index: 2; }
.books-container { display: flex; justify-content: center; align-items: flex-end; padding: 0 10px; gap: 15px; z-index: 5; margin-bottom: -4px; perspective: 1000px; min-height: var(--book-height-pc); }
.shelf-plank {
    height: 18px; width: 100%; background: var(--plank-face);
    background-image: linear-gradient(to right, rgba(0,0,0,0.4), transparent 5%, transparent 95%, rgba(0,0,0,0.4));
    border-top: 6px solid var(--plank-top); 
    box-shadow: 0 20px 30px -5px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.15);
    border-radius: 2px; position: relative; z-index: 4;
}

@keyframes bookEnter {
    0% { opacity: 0; transform: translateY(-30px) rotateX(10deg); }
    100% { opacity: 1; transform: translateY(0) rotateX(0); }
}

/* 书籍本体 */
.book-cover {
    height: var(--book-height-pc); width: auto; aspect-ratio: 0.66; 
    position: relative; background: var(--book-color);
    border-radius: 2px 5px 5px 2px;
    /* 增强阴影 */
    box-shadow: 
        3px 0 5px rgba(0,0,0,0.3), /* 右侧阴影 */
        inset 3px 0 5px rgba(255,255,255,0.1), /* 左侧高光 */
        inset -1px 0 2px rgba(0,0,0,0.3), /* 右侧内阴影 */
        5px 10px 15px rgba(0,0,0,0.35); /* 投射阴影 */
    cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center bottom; display: flex; flex-direction: column; overflow: hidden;
    color: rgba(255,255,255,0.95); font-family: 'Noto Serif SC', serif; padding: 14px 10px;
    opacity: 0; animation: bookEnter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; animation-delay: var(--delay);
    backface-visibility: hidden;
}
.book-cover:hover {
    transform: translateY(-15px) scale(1.05) rotateY(-5deg);
    box-shadow: 10px 25px 30px rgba(0,0,0,0.4), inset 1px 0 2px rgba(255,255,255,0.3); 
    z-index: 50;
    filter: brightness(1.1);
}
/* 纸质纹理 */
.book-cover::before {
    content: ''; position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
    mix-blend-mode: overlay; pointer-events: none; z-index: 1;
}
/* 书脊压痕 */
.book-spine-groove {
    position: absolute; left: 8px; top: 0; bottom: 0; width: 1px;
    background: rgba(0,0,0,0.3); border-left: 1px solid rgba(255,255,255,0.1); z-index: 2;
}

.cover-title { 
    font-weight: 700; line-height: 1.35; margin-top: 15%; 
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4); font-size: 0.95rem;
    letter-spacing: 0.02em; padding-left: 6px;
}
.cover-author { 
    font-size: 0.65rem; opacity: 0.85; margin-top: auto; margin-bottom: 5px; 
    text-transform: uppercase; letter-spacing: 1px;
    border-top: 1px solid rgba(255,255,255,0.3); padding-top: 6px; display: block;
    text-align: center;
}

/* 模态框 - 沉浸式阅读 - 修复闪动问题 */
.modal-overlay {
    position: fixed; inset: 0; width: 100%; height: 100%;
    background: rgba(30, 18, 10, 0.9); backdrop-filter: blur(12px);
    z-index: 100;
    
    /* 关键修复：增加 visibility 过渡，防止 ghosting 闪烁 */
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.4s;
    
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { 
    opacity: 1; 
    visibility: visible; 
    pointer-events: all; 
}

.book-detail {
    width: 100%; max-width: 960px; height: 85vh; max-height: 700px;
    background: var(--paper-color);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.9);
    display: flex; overflow: hidden; border-radius: 4px; position: relative;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    
    /* 动画属性 */
    transform: translateY(30px) scale(0.95); opacity: 0;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s ease;
    
    /* 性能优化：防止动画过程中的像素抖动 */
    backface-visibility: hidden;
    will-change: transform, opacity;
}
.modal-overlay.active .book-detail { transform: translateY(0) scale(1); opacity: 1; }

/* 左侧视觉区 */
.detail-visual {
    width: 35%; min-width: 300px; background: #f0ede6;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px; border-right: 1px solid rgba(0,0,0,0.06); position: relative;
    box-shadow: inset -10px 0 20px rgba(0,0,0,0.03);
}

.real-cover {
    width: 180px; height: 270px; object-fit: cover;
    border-radius: 2px;
    box-shadow: 
        -5px 0 10px rgba(255,255,255,0.4),
        15px 15px 30px rgba(0,0,0,0.25);
    background-color: #e0dcd0;
}

/* 右侧内容区 */
.detail-content { flex: 1; padding: 50px 60px; overflow-y: auto; scroll-behavior: smooth; position: relative; }

.detail-title { 
    font-family: 'Noto Serif SC', serif; font-size: 2.4rem; font-weight: 900; 
    color: #2c1e16; margin-bottom: 0.5rem; line-height: 1.1; letter-spacing: -0.02em;
}
.detail-author {
    font-size: 1rem; color: #8a6a50; text-transform: uppercase; 
    letter-spacing: 0.15em; font-weight: 600; padding-bottom: 20px;
    border-bottom: 1px solid #e5e2d9; margin-bottom: 30px;
}

/* 首字下沉修改：使用粗宋体 */
.drop-cap::first-letter {
    font-family: 'Noto Serif SC', serif;
    font-weight: 900; /* 特粗 */
    font-size: 3.8em; 
    float: left; 
    line-height: 0.85; 
    margin-right: 0.15em; 
    margin-top: 0.02em;
    color: #3e2718;
}

.quote-box {
    margin: 30px 0; padding: 25px 30px;
    background: rgba(92, 58, 33, 0.03);
    border-left: 4px solid #5c3a21;
    font-family: 'KaiTi', serif; font-size: 1.2em; color: #5c3a21;
    line-height: 1.6;
    position: relative;
}
.quote-box::before {
    content: '“'; position: absolute; top: 10px; left: 10px; font-size: 3rem; 
    color: rgba(92, 58, 33, 0.1); font-family: serif; line-height: 1;
}

/* 播客播放器 */
.podcast-player {
    margin: 25px 0; background: #fff; border: 1px solid #e5e2d9; border-radius: 6px;
    padding: 16px 20px; display: flex; align-items: center; gap: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); transition: border-color 0.3s;
    cursor: pointer;
}
.podcast-player:hover { border-color: #cfa856; }
.play-btn {
    width: 44px; height: 44px; background: #5c3a21; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
    cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(92, 58, 33, 0.3);
}
.play-btn:hover { transform: scale(1.05); background: #754d2e; }
.waveform { flex: 1; height: 24px; display: flex; align-items: center; gap: 3px; }
.bar { width: 3px; background: #e0dcd0; border-radius: 2px; animation: wave 1.2s ease-in-out infinite paused; }
.podcast-player.playing .bar { animation-play-state: running; background: #cfa856; }
@keyframes wave { 0%, 100% { height: 20%; } 50% { height: 100%; } }

/* 移动端适配 */
@media (max-width: 768px) {
    header { padding: 40px 20px 20px; }
    .cabinet-container { padding: 0 10px; margin-bottom: 40px; }
    .cabinet { padding: 30px 10px 15px; border-width: 12px; border-top-width: 25px; min-height: 300px; }
    .books-container { min-height: var(--book-height-mobile); } /* 修复移动端空架子高度 */
    .filter-bar { gap: 10px; margin-bottom: 20px; }
    .filter-btn { font-size: 0.9rem; padding: 5px 8px; }
    
    .book-cover { height: var(--book-height-mobile); border-radius: 2px; }
    .cover-title { font-size: 0.65rem; padding-left: 4px; padding-right: 4px; -webkit-line-clamp: 2; margin-top: 20%; line-height: 1.4; }
    .cover-author { font-size: 0.5rem; transform: scale(0.9); margin-bottom: 4px; }
    .shelf-plank { height: 12px; border-top-width: 4px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5); }

    /* 移动端模态框重构 */
    .modal-overlay { padding: 0; align-items: flex-end; background: rgba(0,0,0,0.8); }
    .book-detail { 
        flex-direction: column; height: 90vh; max-height: 90vh; width: 100%; 
        border-radius: 16px 16px 0 0; transform: translateY(100%); 
    }
    .modal-overlay.active .book-detail { transform: translateY(0); }
    
    .detail-visual { 
        width: 100%; height: auto; min-height: auto; padding: 20px 24px; 
        flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; 
        border-right: none; border-bottom: 1px solid rgba(0,0,0,0.06); background: #f8f6f1;
    }
    .real-cover { width: 70px; height: 105px; flex-shrink: 0; box-shadow: 2px 4px 8px rgba(0,0,0,0.15); border-radius: 2px; }
    
    .mobile-header-info { flex: 1; }
    .mobile-title { 
        font-family: 'Noto Serif SC', serif; font-size: 1.4rem; font-weight: 800; 
        line-height: 1.2; margin-bottom: 4px; color: #2c1e16;
    }
    
    .detail-content { padding: 24px 20px 100px; /* 底部留白给按钮 */ }
    .detail-header { display: none; }
    .detail-body { font-size: 1rem; line-height: 1.7; text-align: justify; }
    /* 修正移动端引号重叠问题：增加 padding-top 让文字下移 */
    .quote-box { margin: 20px 0; padding: 35px 20px 20px 20px; font-size: 1.05em; border-left-width: 3px; }
    
    /* 关闭按钮位置调整 */
    .close-btn { top: 16px; right: 16px; background: rgba(0,0,0,0.05); }
}