* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: #ffffff; color: #333; overflow-x: hidden; }

/* 页面切换控制 */
.view-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; display: none; background: #fff; overflow-y: auto; }
.view-layer.active { display: block; }
#detail-view, #reader-view { transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 200; }
#detail-view.active, #reader-view.active { transform: translateX(0); }

/* 首页顶部 */
.top-header { padding: 10px 15px 0; position: sticky; top: 0; background: #fff; z-index: 50; }
.search-bar { background: #f5f6f8; border-radius: 20px; padding: 8px 15px; border: 1px solid #ebebeb; color: #999; font-size: 14px; margin-bottom: 12px; }
.nav-tabs { display: flex; overflow-x: auto; font-size: 16px; color: #888; padding-bottom: 5px; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab { margin-right: 22px; white-space: nowrap; transition: 0.2s; }
.nav-tab.active { font-size: 18px; color: #222; font-weight: 800; position: relative; }
.nav-tab.active::after { content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); width: 14px; height: 3px; background: #222; border-radius: 2px; }

/* 首页模块 */
.main-content { padding: 15px 15px 80px; background: #f8f9fa; min-height: 100vh;}
.card-module { background: #fff; border-radius: 16px; padding: 18px; margin-bottom: 15px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.card-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; }
.card-title .sub-title { font-size: 13px; color: #bbb; font-weight: normal; margin-left: 10px; }
.card-title .arrow { margin-left: auto; color: #ccc; font-size: 20px; font-weight: normal; }

/* 1:1 夸克网格排版 (前4名放左边，后4名放右边) */
.book-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 1fr); grid-auto-flow: column; gap: 16px 12px; }
.book-item { display: flex; gap: 10px; align-items: center; }
.book-cover { width: 48px; height: 64px; border-radius: 4px; object-fit: cover; background: #eee; border: 1px solid #f0f0f0; }
.book-info { flex: 1; overflow: hidden; }
.book-name { font-size: 14px; font-weight: bold; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.book-rank { font-size: 14px; font-weight: 900; color: #d0d0d0; margin-right: 6px; }
.book-rank.top3 { color: #ff5050; }
.tag { font-size: 10px; background: #f5f5f5; color: #888; padding: 2px 5px; border-radius: 4px; margin-right: 4px; }

.book-grid-vertical { display: flex; flex-direction: column; gap: 20px; }
.book-item-large { display: flex; gap: 15px; }
.book-item-large .book-cover { width: 75px; height: 100px; border-radius: 6px; }
.book-item-large .book-name { font-size: 16px; margin-bottom: 6px; }
.book-item-large .book-desc { font-size: 13px; color: #888; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; margin-bottom: 6px; }

/* 底部导航 */
.bottom-nav { position: fixed; bottom: 0; width: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); display: flex; justify-content: space-around; padding: 8px 0 25px; border-top: 1px solid #f0f0f0; z-index: 90; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; color: #999; font-size: 10px; gap: 4px; }
.bottom-nav-item.active { color: #222; font-weight: 800; }
.bottom-nav-item .icon { font-size: 22px; }

/* 详情页 (仿夸克) */
#detail-view { background: #f4eee6; }
.detail-bg { position: absolute; top: 0; width: 100%; height: 350px; background: inherit; filter: blur(30px); z-index: 1; opacity: 0.5; }
.detail-content { position: relative; z-index: 2; }
.header-bar.transparent { background: transparent; padding: 15px 20px; }
.header-actions { display: flex; gap: 15px; font-size: 14px; font-weight: normal; color: #333; }
.detail-top { display: flex; flex-direction: column; align-items: center; padding: 20px 0; }
.detail-cover { width: 120px; height: 160px; border-radius: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); margin-bottom: 20px; }
.detail-title { font-size: 24px; font-weight: 900; color: #222; margin-bottom: 8px; }
.detail-author { font-size: 14px; color: #666; }
.detail-main-card { background: #fff; border-radius: 20px 20px 0 0; min-height: 50vh; padding: 20px; margin-top: 10px; padding-bottom: 100px;}
.detail-stats { display: flex; justify-content: space-around; margin-bottom: 20px; border-bottom: 1px solid #f5f5f5; padding-bottom: 20px;}
.stat-item { text-align: center; }
.stat-num { font-size: 20px; font-weight: 900; color: #222; }
.stat-num small { font-size: 12px; font-weight: normal; margin-left: 2px;}
.stat-desc { font-size: 12px; color: #999; margin-top: 4px; }
.detail-tags { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; }
.detail-tags .tag { background: #f5f4f0; padding: 4px 12px; border-radius: 12px; font-size: 12px; color: #666;}
.detail-intro { font-size: 15px; color: #444; line-height: 1.8; }

.detail-bottom-bar { position: fixed; bottom: 0; width: 100%; background: #fdfdfd; display: flex; justify-content: space-around; padding: 12px 0 25px; border-top: 1px solid #eee; z-index: 200; }
.bottom-action { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: #333; font-weight: bold; }
.bottom-action.disabled { color: #ccc; }
.float-listen-btn { position: fixed; right: 20px; bottom: 100px; width: 56px; height: 56px; background: #5c554b; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 200; }

/* 纯净阅读页 */
#reader-view { background: #f2ead8; }
.reader-header { background: #e8ddc7; padding: 15px; display: flex; align-items: center; border-bottom: 1px solid #d5c8ae; position: sticky; top: 0;}
.chapter-title { flex: 1; text-align: center; font-size: 16px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px;}
.reader-content { padding: 25px 20px; font-size: 20px; color: #2c2c2c; line-height: 1.9; min-height: 80vh;}
/* 洗稿排版核心：强制段落首行缩进，段落间距 */
.reader-content p { text-indent: 2em; margin-bottom: 1em; text-align: justify; }

.reader-footer { background: #e8ddc7; padding: 15px 20px 30px; display: flex; justify-content: space-between; align-items: center; }
.reader-btn { background: rgba(0,0,0,0.06); padding: 10px 25px; border-radius: 20px; font-size: 15px; font-weight: bold; color: #444; cursor: pointer; }

/* 目录弹窗 */
#catalog-modal { position: fixed; bottom: 0; width: 100%; height: 75vh; background: #fff; z-index: 300; border-radius: 16px 16px 0 0; transform: translateY(100%); transition: transform 0.3s; display: flex; flex-direction: column; box-shadow: 0 -4px 20px rgba(0,0,0,0.15);}
#catalog-modal.active { transform: translateY(0); }
.catalog-header { padding: 18px; display: flex; justify-content: space-between; border-bottom: 1px solid #f0f0f0; }
.catalog-list { flex: 1; overflow-y: auto; padding: 0 20px; }
.catalog-item { padding: 16px 0; border-bottom: 1px solid #f5f5f5; font-size: 15px; color: #333; }