/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: auto !important;
}

html, body {
    scroll-padding-top: 0;
    scroll-margin-top: 0;
}

body {
    font-family: 'Microsoft YaHei', 'SimSun', Arial, sans-serif;
    background-color: #f5f1eb;
    color: #333;
    line-height: 1.6;
}

/* 全局链接样式 */
a {
    text-decoration: none;
    color: #2c3e50;
    transition: color 0.3s ease;
}

a:hover {
    color: #34495e;
}

/* 导航链接和章节链接样式在下面定义，确保优先级 */

/* 首页布局 */
.home-body {
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.home-header {
    background: #fff;
    border-bottom: 1px solid #d4d4d4;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: none;
    position: relative;
}

.home-header .home-nav {
    display: flex;
    align-items: center;
    gap: 0;
    margin-right: 0;
    flex: 0 0 auto;
}

.home-header .home-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
}

.home-header .logo h1 {
    margin: 0;
    font-size: 22px;
    color: #333;
    line-height: 1.2;
    font-weight: 600;
}

.home-header .logo p {
    margin-top: 4px;
    color: #999;
    font-size: 12px;
    line-height: 1.2;
}

.home-nav ul {
    list-style: none;
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    align-items: center;
}

.home-nav ul li {
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
}

.home-nav ul li:not(:last-child)::after {
    content: '|';
    color: #d4d4d4;
    margin: 0 8px;
}

/* 导航链接样式 - 使用!important确保优先级 */
.home-nav a,
.category-page .home-nav a {
    color: #333 !important;
    font-weight: 400 !important;
    padding: 8px 12px !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    transition: color 0.2s ease !important;
    display: inline-block !important;
    text-decoration: none !important;
}

.home-nav a:hover,
.category-page .home-nav a:hover {
    background: transparent !important;
    color: #0066cc !important;
    text-decoration: underline !important;
}

.home-main {
    flex: 1;
    padding: 10px; /* 减少PC端与浏览器的间隔 */
}

.home-hero {
    background: #fff;
    border-radius: 24px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e0e0e0;
}

.category-hero {
    margin-bottom: 20px;
    justify-content: flex-start !important;
}

/* 章节页标题栏 - 无边框，有下划线 */
.chapter-page .category-hero {
    box-shadow: none !important;
    border: none !important;
}

.category-main {
    padding: 5px 10px 10px 10px; /* PC端顶部间距更小 */
}

.hero-text h2 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* 章节页标题栏样式 - 与文章内容一致 */
.chapter-page .category-hero .hero-text h2 {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.4;
    text-align: left;
}

/* 书籍章节列表页标题字号（与简介文字大小接近） */
.category-page .category-hero .hero-text h2 {
    font-size: 14px;
}

.hero-text p {
    color: #555;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: #e8ddd0;
    color: #6a5a4a;
    box-shadow: 0 2px 4px rgba(232, 221, 208, 0.3);
}

.btn-primary:hover {
    background: #f0e5d8;
    box-shadow: 0 4px 8px rgba(232, 221, 208, 0.4);
    color: #5a4a3a;
}

.btn-ghost {
    border: 1px solid #d0d0d0;
    color: #333;
    background: #fff;
}

.btn-ghost:hover {
    border-color: #999;
    color: #000;
    background: #f5f5f5;
}


.hero-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.hero-stats div {
    text-align: center;
}

.hero-stats strong {
    display: block;
    font-size: 20px;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 4px;
}

.hero-stats span {
    color: #7f8c8d;
    font-size: 12px;
    line-height: 1.2;
}

.home-layout {
    display: grid;
    grid-template-columns: 4fr 1fr;
    gap: 8px;
    margin-top: 20px;
}

.home-content {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e0e0e0;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title h3 {
    margin: 0;
    color: #2c3e50;
}

.section-title a {
    color: #34495e;
    font-size: 14px;
}

.featured-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.featured-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.featured-card__content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    margin-bottom: 12px;
    flex: 1;
}

.featured-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #2c3e50;
    font-weight: 600;
}

.featured-card__header h4 {
    margin: 0;
    font-size: 16px;
    color: inherit;
    transition: color 0.2s ease;
}

.featured-card__content:hover .featured-card__header h4 {
    color: #0a58ca;
}

.chapter-count {
    font-size: 13px;
    color: #7f8c8d;
}

.featured-card__description {
    color: #555;
    font-size: 14px;
    line-height: 1.7;
    min-height: 60px;
    margin: 0;
}

.featured-card .book-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 12px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.featured-card .book-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.featured-card__actions {
    margin-top: auto;
}

.featured-card__actions .btn-primary {
    padding: 8px 18px;
}

.home-sidebar {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e0e0e0;
}

.home-footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

/* 分类页布局 */
.category-page {
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.category-main {
    flex: 1;
    padding: 5px 10px 10px 10px; /* PC端顶部间距更小 */
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.category-layout {
    display: grid !important;
    grid-template-columns: 4fr 1fr !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.category-content {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    width: 100% !important;
    grid-column: 1 / 2 !important;
    display: block !important;
    overflow: visible;
    margin: 0;
}

.category-sidebar {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e0e0e0;
    width: 100% !important;
    grid-column: 2 / 3 !important;
    display: block !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
.featured-books--stacked {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.no-data {
    padding: 40px;
    text-align: center;
    color: #888;
}

/* 顶部菜单栏样式 */
.top-menu-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

.top-menu-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 100%;
}

.logo h1 {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.book-menu {
    flex: 1;
    margin-left: 40px;
}

.book-list {
    list-style: none;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.book-list li {
    margin: 0;
}

.book-list a {
    color: #fff;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 4px;
    display: block;
    transition: background-color 0.3s ease;
}

.book-list a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 主内容区域样式 */
.main-content-body {
    background-color: #fff;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
}

.welcome-container {
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-container h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 32px;
}

.welcome-container > p {
    font-size: 18px;
    color: #666;
    margin-bottom: 40px;
}

.featured-books {
    margin-top: 40px;
}

.featured-books h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.book-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.book-card h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 20px;
}

.book-card p {
    color: #666;
    font-size: 14px;
}

.book-summary {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    min-height: 56px;
}

/* 侧边栏样式 */
.sidebar-body {
    background-color: #f9f9f9;
    padding: 20px;
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid #e0e0e0;
}

.sidebar-container {
    max-width: 100%;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h3,
.sidebar-section h4 {
    color: #6a5a4a;
    font-size: 18px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8ddd0;
}

.history-list,
.ranking-list,
.nav-list {
    list-style: none;
}

.history-list li,
.nav-list li {
    padding: 8px 0;
    color: #666;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.history-list li:last-child,
.nav-list li:last-child {
    border-bottom: none;
}

.ranking-list {
    counter-reset: ranking;
}

.ranking-list li {
    padding: 8px 0;
    color: #6a5a4a;
    font-size: 14px;
    counter-increment: ranking;
    position: relative;
    padding-left: 25px;
}

.ranking-list li::before {
    content: counter(ranking);
    position: absolute;
    left: 0;
    color: #d4c5a9;
    font-weight: bold;
}

.ranking-list li a {
    color: #6a5a4a;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ranking-list li a:hover {
    color: #5a4a3a;
    text-decoration: underline;
}

.nav-list a {
    color: #0066cc;
    display: block;
}

/* 推荐书籍卡片样式 - 使用featured-card */
.recommended-books {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 侧边栏中的featured-card样式调整 */
.sidebar-section .featured-card {
    margin-bottom: 0;
    border-color: #e8ddd0;
}

.sidebar-section .featured-card__header h4 {
    font-size: 16px;
    color: #6a5a4a;
}

.sidebar-section .featured-card p {
    font-size: 13px;
    line-height: 1.6;
    min-height: 50px;
    margin-bottom: 12px;
    color: #6a5a4a;
}

.sidebar-section .featured-card__actions .btn-primary {
    padding: 6px 14px;
    font-size: 13px;
    background: #e8ddd0;
    color: #6a5a4a;
    border-color: #d4c5a9;
}

.sidebar-section .featured-card__actions .btn-primary:hover {
    background: #f0e5d8;
    color: #5a4a3a;
    box-shadow: 0 2px 8px rgba(232, 221, 208, 0.3);
}

.nav-list a {
    color: #0066cc;
    display: block;
    padding: 8px 0;
}

.nav-list a:hover {
    color: #004499;
}

/* 类型书籍列表页样式 */
.category-list-body {
    background-color: #fff;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
}

.category-list-container {
    max-width: 1200px;
    margin: 0 auto;
}

.category-header {
    background: #fff;
    color: #2c3e50;
    padding: 5px 15px 5px 15px;
    border-radius: 12px;
    margin-bottom: 8px;
    margin-left: 0;
    margin-right: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: nowrap;
}

.category-header h1,
#bookTitle {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.4;
    margin: 0;
    color: #333;
}

.category-header .chapter-nav-header {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.category-header .chapter-nav-title {
    font-size: 16px;
    line-height: 1.3;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.category-header .chapter-nav {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.category-description {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.books-grid-container {
    padding: 10px 10px 10px 10px;
}

.books-grid-container h2 {
    color: #2b2f55;
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(103, 126, 234, 0.15);
    font-weight: 600;
}

.books-grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.books-grid-toolbar .summary-count {
    font-size: 14px;
    color: #8d9ab8;
}
.summary-count {
    font-size: 12px;
    color: #7f8c8d;
}

.books-grid-toolbar .search-input {
    border: 1px solid rgba(143, 160, 227, 0.5);
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 14px;
    background-color: rgba(247, 249, 255, 0.9);
    color: #9aa7c7;
    box-shadow: inset 0 2px 4px rgba(103, 126, 234, 0.08);
    cursor: not-allowed;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 5px;
    padding: 0 0 5px 5px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 25px;
    padding: 15px 0;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    color: #6a5a4a;
    background: #fff;
    border: 1px solid rgba(232, 221, 208, 0.5);
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.pagination-link:hover {
    background: #f0e5d8;
    border-color: #e8ddd0;
    color: #5a4a3a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(232, 221, 208, 0.3);
}

.pagination-link.active {
    background: #e8ddd0;
    color: #6a5a4a;
    border-color: #d4c5a9;
    box-shadow: 0 4px 12px rgba(232, 221, 208, 0.4);
    font-weight: 600;
}

.pagination-link.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(232, 221, 208, 0.5);
    background: #f0e5d8;
}

.pagination-link.pagination-prev,
.pagination-link.pagination-next {
    font-weight: 600;
    padding: 0 16px;
}

.pagination-link.pagination-prev:hover,
.pagination-link.pagination-next:hover {
    background: #f0e5d8;
    box-shadow: 0 2px 8px rgba(232, 221, 208, 0.3);
}

.book-card {
    position: relative;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-card::after {
    display: none;
}

.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 221, 208, 0.4);
    border-color: #e8ddd0;
}

.book-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #7f8c8d;
    background: #ecf0f1;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.book-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex: 1;
    margin-bottom: 8px;
}

.book-card-link:hover {
    text-decoration: none;
}

.book-card h4 {
    position: relative;
    z-index: 1;
    color: #2c3e50;
    margin-bottom: 6px;
    font-size: 18px;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.book-card-link:hover h4 {
    color: #5a4a3a;
}

.book-summary {
    position: relative;
    z-index: 1;
    color: #555;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
    min-height: 60px;
    flex: 1;
    transition: color 0.3s ease;
}

.book-card-link:hover .book-summary {
    color: #5a4a3a;
}

.book-meta {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #9aa2c7;
    margin-bottom: 6px;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.book-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.book-meta span::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #bdc3c7;
}

.book-meta span:first-child::before {
    display: none;
}

.book-actions {
    position: relative;
    z-index: 1;
    margin-top: 0;
}

.btn-read {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e8ddd0;
    color: #6a5a4a;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    font-weight: 500;
}

.btn-read::after {
    content: "→";
    font-size: 12px;
}

.btn-read:hover {
    box-shadow: 0 4px 8px rgba(232, 221, 208, 0.4);
    color: #5a4a3a;
    background: #f0e5d8;
}

/* 书籍列表页样式 */
.book-list-body {
    background-color: #fff;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
}

.book-list-container {
    max-width: 1000px;
    margin: 0 auto;
}

.book-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.book-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.book-author {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 15px;
}

.book-description {
    font-size: 16px;
    line-height: 1.8;
    opacity: 0.95;
}

.chapter-list-container h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.book-description {
    padding: 18px;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    color: #555;
    font-size: 14px;
    line-height: 1.7;
}

/* 章节列表样式 - 确保优先级 */
.chapter-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
}

.volume-section {
    display: block !important;
    width: 100% !important;
    margin-bottom: 2rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 1px solid #e0e0e0 !important;
    grid-column: 1 / -1 !important;
}

.volume-title {
    display: block !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    color: #333 !important;
    margin: 0 0 1rem 0 !important;
    padding: 0 !important;
}

.chapter-group {
    margin-bottom: 1rem;
}

.chapter-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    margin: 0 0 0.5rem 0;
}

.volume-chapters {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    align-items: center !important;
}

/* 简洁的章节列表样式 - 按行展示 */
.chapter-list-simple {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.chapter-row {
    display: block !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #f0f0f0 !important;
    transition: background-color 0.2s !important;
}

.chapter-row:hover {
    background-color: #f8f8f8 !important;
}

.chapter-row:last-child {
    border-bottom: none !important;
}

.chapter-row a {
    display: block !important;
    text-decoration: none !important;
    color: #333 !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
}

.chapter-row a:hover {
    color: #0066cc !important;
}

.chapter-item {
    background: #fff !important;
    border: 1px solid rgba(232, 221, 208, 0.5) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(232, 221, 208, 0.2) !important;
}

.chapter-item:hover {
    background: #f0e5d8 !important;
    color: #5a4a3a !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(232, 221, 208, 0.4) !important;
    border-color: #e8ddd0 !important;
}

/* 章节链接样式 - 使用!important确保优先级最高 */
.chapter-item a {
    color: #6a5a4a !important;
    font-size: 14px !important;
    display: block !important;
    width: 100% !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
    word-break: break-all !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
}

.chapter-item:hover a {
    color: #5a4a3a !important;
}

/* 按卷分组的章节样式 - 允许换行 */
.volume-chapters .chapter-item a {
    word-wrap: break-word !important;
    word-break: break-all !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
}

/* 章节内容页样式 */
.chapter-body {
    background-color: #fff;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
}

.chapter-container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #fff;
}

.chapter-title-header {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e0e0e0;
}

.chapter-title-header h1 {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 0;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chapter-nav-top {
    margin-bottom: 8px;
    padding-bottom: 6px;
}

.chapter-nav-top .chapter-nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.chapter-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.chapter-header h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.chapter-nav {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-btn {
    background-color: #e8ddd0;
    color: #6a5a4a;
    border: 1px solid rgba(232, 221, 208, 0.5);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

.nav-btn:hover {
    background-color: #f0e5d8;
    border-color: #e8ddd0;
    color: #5a4a3a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(232, 221, 208, 0.3);
}

.nav-btn.disabled {
    background-color: #f5f0e8 !important;
    cursor: not-allowed !important;
    color: #b0a89a !important;
    border-color: #e8ddd0 !important;
    opacity: 0.6;
}

.nav-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.chapter-content {
    font-size: 18px;
    line-height: 2;
    color: #333;
    padding: 15px 15px;
    text-align: justify;
    text-indent: 2em;
}

.chapter-content p {
    margin-bottom: 20px;
    text-indent: 2em;
}

.chapter-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* 错误页面样式 */
.error-body {
    background-color: #fff;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
}

.error-container {
    max-width: 600px;
    margin: 100px auto;
    text-align: center;
}

.error-container h1 {
    color: #e74c3c;
    font-size: 48px;
    margin-bottom: 20px;
}

.error-container p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    /* 移动端整体背景与文字颜色（仅在暗色模式下生效） */
    body.dark-mode {
        background-color: #000;
        color: #666;
    }

    body.dark-mode .category-page {
        background-color: #000;
    }

    /* 主要内容容器在移动端使用深色背景，仅暗色模式 */
    body.dark-mode .home-content,
    body.dark-mode .category-content,
    body.dark-mode .book-content,
    body.dark-mode .chapter-content-wrapper,
    body.dark-mode .zhuzibaijia-content {
        background-color: #000 !important;
        color: #666 !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* 作者介绍 / 简介 / 章节内容等卡片改为黑底亮灰字，提升对比度，仅暗色模式 */
    body.dark-mode .book-author,
    body.dark-mode .book-description,
    body.dark-mode .book-intro,
    body.dark-mode .chapter-content,
    body.dark-mode .zhuzibaijia-content .book-intro,
    body.dark-mode .zhuzibaijia-content .chapter-table-container {
        background-color: #000 !important;
        color: #f5f5f5 !important;
    }

    body.dark-mode .chapter-content p {
        color: #f0f0f0 !important;
    }

    /* 移动端作者介绍/简介内部文字（标题和段落），覆盖模板中的内联颜色，仅暗色模式 */
    body.dark-mode .book-author h3,
    body.dark-mode .book-author div,
    body.dark-mode .book-description *,
    body.dark-mode .book-intro * {
        color: #f5f5f5 !important;
    }

    /* 首页头部 */
    .home-header {
        padding: 10px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .home-header .logo h1 {
        font-size: 18px;
    }
    
    .home-header .logo p {
        font-size: 11px;
    }
    
    .home-nav {
        width: 100%;
    }
    
    .home-nav ul {
        flex-wrap: wrap;
        gap: 0;
        padding-bottom: 5px;
        justify-content: flex-start;
    }
    
    .home-nav ul li:not(:last-child)::after {
        margin: 0 6px;
    }
    
    .home-nav a {
        font-size: 13px !important;
        padding: 6px 10px !important;
        white-space: nowrap;
    }
    
    /* 首页主内容 */
    .home-main {
        padding: 15px;
    }
    
    .category-main {
        padding: 15px 15px 15px 15px; /* 增加右侧padding，与浏览器右侧保持间隔 */
    }
    
    /* Hero区域 */
    .home-hero {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
    
    /* 分类页和章节页的 Hero 区域，右侧增加间隔 */
    .category-hero {
        padding: 15px 15px 15px 15px !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        border-radius: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .hero-text h2 {
        font-size: 22px;
    }
    
    .hero-text p {
        font-size: 13px;
    }
    
    .hero-actions {
        gap: 8px;
    }
    
    .btn-primary,
    .btn-ghost {
        padding: 7px 14px;
        font-size: 13px;
    }
    
    .hero-stats {
        gap: 20px;
        width: 100%;
        justify-content: space-around;
    }
    
    .hero-stats strong {
        font-size: 18px;
    }
    
    .hero-stats span {
        font-size: 11px;
    }
    
    /* 布局改为单列 */
    .home-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-layout {
        grid-template-columns: 1fr !important;
        gap: 15px;
        margin-top: 0 !important;
    }
    
    .book-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chapter-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* 内容区域 - 确保在主内容区域 */
    .home-content {
        padding: 15px 15px 15px 15px; /* 增加右侧padding，与浏览器右侧保持间隔 */
        border-radius: 16px;
        order: 1;
    }
    
    .category-content {
        order: 1;
        grid-column: 1 / -1 !important; /* 重置 grid-column，让内容占据整行 */
    }
    
    .book-content {
        order: 1;
    }
    
    .chapter-content-wrapper {
        order: 1;
    }
    
    .home-sidebar,
    .category-sidebar,
    .book-content,
    .book-sidebar,
    .chapter-content-wrapper,
    .chapter-sidebar {
        padding: 15px;
        border-radius: 16px;
    }
    
    /* 侧边栏 - 确保在底部显示 */
    .home-sidebar,
    .category-sidebar,
    .book-sidebar,
    .chapter-sidebar {
        order: 2;
        display: block !important;
        grid-column: 1 / -1 !important; /* 重置 grid-column，让侧边栏占据整行并显示在底部 */
    }
    
    .category-content {
        padding: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        border: none;
    }
    
    .books-grid-container {
        padding: 10px 15px 10px 10px; /* 增加右侧padding，与div保持间隔 */
    }
    
    /* 书籍描述 - 移动端增加右侧间隔 */
    .book-description {
        padding-right: 15px !important;
    }
    
    .section-title h3 {
        font-size: 18px;
    }
    
    /* 卡片网格 */
    .featured-books {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* 卷和章节列表 */
    .volume-section {
        margin-bottom: 1.5rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .volume-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .volume-chapters {
        gap: 0.4rem !important;
    }
    
    .volume-chapters .chapter-item a {
        padding: 0.4rem 0.8rem !important;
        font-size: 13px !important;
    }
    
    .featured-card {
        padding: 15px;
    }
    
    .featured-card__header h4 {
        font-size: 16px;
    }
    
    .featured-card p {
        font-size: 13px;
        min-height: auto;
    }
    
    /* 书籍列表 */
    .book-list {
        gap: 12px;
    }
    
    .book-card {
        padding: 15px;
    }
    
    .book-card h4 {
        font-size: 16px;
    }
    
    .book-summary {
        font-size: 13px;
    }
    
    /* 章节列表 */
    .chapter-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .chapter-item {
        padding: 10px 12px;
    }
    
    .chapter-item a {
        font-size: 14px;
    }
    
    /* 章节内容 */
    .chapter-content {
        font-size: 16px;
        line-height: 1.8;
        padding: 15px 15px 15px 15px; /* 增加右侧padding，与div保持间隔 */
    }
    
    .chapter-content p {
        margin-bottom: 1em;
    }
    
    /* 章节导航 */
    .chapter-nav {
        flex-direction: column;
        gap: 8px;
    }
    
    .chapter-nav-top {
        padding: 10px 0 10px 15px;
    }
    
    .chapter-nav-top .chapter-nav {
        flex-direction: row;
        gap: 8px;
    }
    
    .chapter-footer {
        padding: 20px 0 0 15px;
        margin-top: 30px;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 14px;
        flex: 1;
        text-align: center;
    }
    
    .chapter-title-header {
        padding: 10px 0 10px 15px;
    }
    
    .chapter-title-header h1 {
        font-size: 18px;
        line-height: 1.4;
    }
    
    /* 分类页标题 */
    .category-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .category-header h1 {
        font-size: 20px;
    }
    
    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }
    
    .pagination-link {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 36px;
    }
    
    /* 侧边栏在移动端已通过上面的 order: 2 设置显示在底部 */
    
    .sidebar-section {
        margin-bottom: 15px;
    }
    
    .sidebar-section h3,
    .sidebar-section h4 {
        font-size: 16px;
    }
    
    .ranking-list li {
        padding: 8px 0 8px 25px; /* 保留左侧padding，避免编号和文本重合 */
        font-size: 14px;
    }
    
    /* 顶部菜单 */
    .top-menu-container {
        flex-direction: column;
        padding: 10px;
    }
    
    .book-list a {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    /* 主题切换按钮 */
    .theme-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        font-size: 20px;
    }
}

/* 隐私政策页面 */
.policy-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(232, 221, 208, 0.6);
    line-height: 1.8;
    color: #4a3c2f;
}

.policy-card h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: #6a5a4a;
    font-size: 20px;
}

.policy-card h3:first-child {
    margin-top: 0;
}

.policy-card p {
    margin-bottom: 12px;
}

.policy-card ul {
    margin: 0 0 16px 20px;
    padding: 0;
    list-style: disc;
}

.policy-card li {
    margin-bottom: 6px;
}

.faq-list {
    list-style: disc;
    padding-left: 20px;
    color: #6a5a4a;
    line-height: 1.6;
}

.faq-list li {
    margin-bottom: 6px;
}

/* 诸子百家章节列表专用样式 */
.zhuzibaijia-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.zhuzibaijia-content {
    flex: 1;
    min-width: 0;
}

.zhuzibaijia-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.zhuzibaijia-content .book-intro,
.zhuzibaijia-content .chapter-table-container {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    border: 1px solid rgba(232, 221, 208, 0.8);
    box-shadow: 0 6px 14px rgba(232, 221, 208, 0.35);
    margin-bottom: 20px;
}

.zhuzibaijia-content .chapter-table-container h3,
.zhuzibaijia-content .book-intro h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #6a5a4a;
    font-size: 18px;
    border-bottom: 2px solid rgba(232, 221, 208, 0.9);
    padding-bottom: 10px;
}

.zhuzibaijia-content .chapter-table,
.zhuzibaijia-content .volume-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
}

.zhuzibaijia-content .chapter-table thead,
.zhuzibaijia-content .volume-table thead {
    background: #fffefc;
}

.zhuzibaijia-content .chapter-table th,
.zhuzibaijia-content .volume-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #7c6a59;
    border-bottom: 2px solid rgba(232, 221, 208, 0.5);
}

.zhuzibaijia-content .chapter-table td,
.zhuzibaijia-content .volume-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(232, 221, 208, 0.6);
    color: #4a3c2f;
}

.zhuzibaijia-content .chapter-table tbody tr:hover,
.zhuzibaijia-content .volume-table tbody tr:hover {
    background: #f0e5d8;
}

.zhuzibaijia-content .chapter-table tbody tr:last-child td {
    border-bottom: none;
}

.zhuzibaijia-content .chapter-number {
    width: 80px;
    color: #b38c5a;
    font-weight: 500;
}

.zhuzibaijia-content .chapter-title {
    flex: 1;
}

.zhuzibaijia-content .chapter-title a {
    color: #6a5a4a;
    text-decoration: none;
    transition: color 0.2s;
}

.zhuzibaijia-content .chapter-title a:hover {
    color: #5a4a3a;
}

.zhuzibaijia-content .volume-section-table {
    margin-bottom: 30px;
    border: 1px solid rgba(232, 221, 208, 0.8);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 14px rgba(232, 221, 208, 0.35);
}

.zhuzibaijia-content .volume-header {
    background: #fffefc;
    color: #897664;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(232, 221, 208, 0.45);
    font-size: 16px;
    font-weight: 600;
}

.zhuzibaijia-content .chapter-group-table {
    margin-bottom: 20px;
}

.zhuzibaijia-content .chapter-group-header {
    background: #f4ebdf;
    padding: 10px 15px;
    font-weight: 600;
    color: #5a4a3a;
    border-left: 4px solid #d4c5a9;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .zhuzibaijia-layout {
        flex-direction: column;
        gap: 15px;
    }

    .zhuzibaijia-sidebar {
        width: 100%;
        order: 2;
    }

    .zhuzibaijia-content {
        order: 1;
    }

    .zhuzibaijia-content .chapter-table,
    .zhuzibaijia-content .volume-table {
        font-size: 14px;
    }

    .zhuzibaijia-content .chapter-table th,
    .zhuzibaijia-content .chapter-table td,
    .zhuzibaijia-content .volume-table th,
    .zhuzibaijia-content .volume-table td {
        padding: 8px;
    }

    .zhuzibaijia-content .book-intro,
    .zhuzibaijia-content .chapter-table-container {
        padding: 15px;
    }
}

/* 小屏幕手机 (最大宽度 480px) */
@media (max-width: 480px) {
    .home-main {
        padding: 10px;
    }
    
    .category-main {
        padding: 10px 12px 10px 10px; /* 增加右侧padding，与浏览器右侧保持间隔 */
    }
    
    .home-hero {
        padding: 12px;
    }
    
    /* 分类页和章节页的 Hero 区域，右侧增加间隔 */
    .category-hero {
        padding: 12px 12px 12px 12px !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        border-radius: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .hero-text h2 {
        font-size: 20px;
    }
    
    /* 卷和章节列表 - 小屏幕 */
    .volume-section {
        margin-bottom: 1rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    .volume-title {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .volume-chapters {
        gap: 0.3rem !important;
    }
    
    .volume-chapters .chapter-item a {
        padding: 0.35rem 0.7rem !important;
        font-size: 12px !important;
    }
    
    .hero-stats {
        gap: 15px;
    }
    
    .hero-stats strong {
        font-size: 16px;
    }
    
    .home-content {
        padding: 12px 12px 12px 12px; /* 增加右侧padding，与浏览器右侧保持间隔 */
        border-radius: 12px;
    }
    
    .home-sidebar,
    .category-sidebar,
    .book-content,
    .book-sidebar,
    .chapter-content-wrapper,
    .chapter-sidebar {
        padding: 12px;
        border-radius: 12px;
    }
    
    .category-content {
        padding: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        border: none;
    }
    
    .books-grid-container {
        padding: 10px 12px 10px 10px; /* 增加右侧padding，与div保持间隔 */
    }
    
    /* 书籍描述 - 小屏幕增加右侧间隔 */
    .book-description {
        padding-right: 12px !important;
    }
    
    .featured-card,
    .book-card {
        padding: 12px;
    }
    
    .chapter-content {
        font-size: 15px;
        padding: 12px 12px 12px 12px; /* 增加右侧padding，与div保持间隔 */
    }
    
    .chapter-footer {
        padding: 15px 0 0 12px;
        margin-top: 25px;
    }
    
    .chapter-title-header h1 {
        font-size: 16px;
    }
    
    .category-header h1 {
        font-size: 18px;
    }
    
    .pagination-link {
        padding: 5px 10px;
        font-size: 12px;
        min-width: 32px;
    }
}

