
/* 全局变量 - 完全匹配原设计配色 */
:root {
    --primary-color: #00b09e;
    --nav-color: #0f8b8d;
    --banner-color: #69a9c4;
    --bg-color: #d0efef;
    --card-bg: #ffffff;
    --text-main: #222222;
    --text-secondary: #888;
    --link-color: #168C84;
    --border-color: #e5e5e5;
    --title-orange-line: #eb6100;
    --title-green-line: #c8eeeb;
    --section-gap: 10px;
    --title-bottom-margin: 1.2rem;
    --section-top-padding: 10px;
}
/* 全局重置 - 无冲突基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: #00b39e;
    transition: color 0.2s ease;
}
a:hover {
    color: #ff8018;
}
a:hover>span {
    color: #ff8018;
}

ul {
    list-style: none;
}
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}
/* 通用容器 - 固定宽度规则，避免错乱 */
.wrapper {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============== 头部基础样式（仅通用属性，无布局干扰）============== */
.header-top-wrap {
    background-color: var(--primary-color);
    width: 100%;
    padding: 1rem 0;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.logo {
    flex-shrink: 0;
    flex: 1;
}
.logo a{
    font-size: 1.5rem;
    /* font-weight: bold; */
    color: #ffffff;
    flex-shrink: 0;
    flex: 1;
}

/* 收藏/历史按钮通用样式 */
.header-btns {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
    margin-left: auto;
}

.header-btns a {
    color: #ffffff;
    font-size: 0.9rem;
    padding: 0.5rem 0.5rem;
    border-radius: 3px;
    background-color: rgba(255,255,255,0.2);
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.header-btns a:hover {
    background-color: rgba(255,255,255,0.3);
    color: #ffffff;
}
img.book-cover {
    padding: 2px;
    /* border: 1px solid #DDD; */
}
/* 搜索框通用样式 */
.search-wrap {
    display: flex;
    flex-shrink: 1;
    width: 450px;
    max-width: 450px;
}

.search-wrap input {
    width: 100%;
    padding: 0.55rem 0.8rem;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.95rem;
    outline: none;
    background-color: #c0efed;
}

.search-wrap input::placeholder {
    color: #666666;
}

.search-wrap button {
    padding: 0 1.2rem;
    border: none;
    background-color: var(--nav-color);
    color: #ffffff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.search-wrap button:hover {
    opacity: 0.9;
}

/* ============== 导航栏基础样式 ============== */
.nav-bar-wrap {
    background-color: var(--nav-color);
    padding-top: 2px;
    padding-bottom: 2px;
    width: 100%;
}

.nav-bar ul {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 0.3rem 0.2rem;
    padding: 0rem 0;
}

.nav-bar li a {
    display: block;
    padding: 0.7rem 0.3rem;
    color: #ffffff;
    font-size: 0.95rem;
    text-align: center;
    border-radius: 2px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.nav-bar li a:hover,
.nav-bar li a.active {
    background-color: var(--primary-color);
}

/* ============== 公告横幅 ============== */
.banner {
    background-color: var(--banner-color);
    color: #ffffff;
    text-align: center;
    padding: 0.8rem 5%;
    font-size: 0.95rem;
    width: 100%;
}

.banner .red {
    color: #ff0000;
    /* font-weight: bold; */
}

/* ============== 主内容容器（核心修复：背景+间距）============== */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 5px auto;
    background-color: var(--bg-color); /* 间隙背景色 #d0efef */
    border-radius: 4px;
    overflow: hidden;
    padding: 0; /* 移除内边距，由section控制 */
}

/* 每个section独立白色背景，间隙显示container的#d0efef */
.container section {
    padding: var(--section-top-padding) var(--section-gap);
    margin-bottom: 5px;
    border-bottom: 1px solid var(--title-green-line);
    width: 100%;
    background-color: var(--card-bg); /* 白色背景 */
}

.container section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: var(--section-gap);
}


.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    /* background-color: var(--title-green-line); */
    z-index: 1;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0.5px;
    background-color: var(--title-orange-line);
    z-index: 2;
}
.section-title span {
    padding: 7px;
    border-bottom: 1px solid #ffcc99;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #c6f0eb;
    width: 100%;
}
.section-header .more {
    font-size: 0.9rem;
    font-weight: normal;
}
.section-title {
    position: relative;
    display: inline-block; 
    font-size: 16px;
    color: #00b39e;
    padding-bottom: 8px;
    margin-bottom: -8px;
}
.reverse-btn {
    padding: 4px 12px;
    background-color: #e67e22;
    color: #fff;
    border: none;
    border-radius: 2px;
    font-size: 13px;
    cursor: pointer;
}
/* ============== 书籍卡片通用样式（核心修复：避免重复渲染）============== */
/* 3列网格容器 */
.book-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.2rem;
}
/* 2列网格容器 */
.book-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 2rem;
    padding-bottom: 10px;
}

/* PC端完整卡片（默认显示） */
.book-card-full {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.book-card-full .book-cover {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid #eee;
}
.book-card-full .book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.book-card-full .book-name {
    font-size: 0.9rem;
}
.book-card-full .book-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.book-card-full .book-meta a {
    color: var(--text-secondary);
}
.book-meta span {
    color: #00b39e;
}
.book-card-full .book-latest {
    font-size: 0.85rem;
    color: var(--link-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移动端简易卡片（默认隐藏） */
.book-card-simple {
    display: none;
    flex-direction: column;
    align-items: center;
    /* gap: 0.5rem; */
}
.book-card-simple .book-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid #eee;
}
.book-card-simple .book-name {
    font-size: 1.1rem;
    /* font-weight: bold; */
    text-align: center;
    color: var(--link-color);
}

/* 热门小说卡片 */
.book-hot-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}
.book-hot-card:last-child {
    padding-bottom: 0;
}
.book-hot-card .book-cover {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid #eee;
}
.book-hot-card .book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}
.book-hot-card .book-name {
    font-size: 0.9rem;
}
.book-hot-card .book-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.book-hot-card .book-latest {
    font-size: 0.85rem;
    color: var(--link-color);
}
.book-latest span {
    color: #666666;
}
/* ============== 小说表格样式 ============== */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}
.book-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: fixed;
}
.book-table th,
.book-table td {
    padding: 0.6rem 0.3rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 1px;
}
.book-table th:nth-child(1),
.book-table td:nth-child(1) { width: 80px; }
.book-table th:nth-child(2),
.book-table td:nth-child(2) { width: 20%; }
.book-table th:nth-child(3),
.book-table td:nth-child(3) { width: 35%; }
.book-table th:nth-child(4),
.book-table td:nth-child(4) { width: 15%;}.book-table .cate
.book-table th:nth-child(5),
.book-table td:nth-child(5) { width: 130px; }
.book-table td:nth-child(4) a { color: #999; }
.book-table th {
    /* font-weight: bold; */
    color: var(--text-secondary);
    background-color: #f8f8f8;
}
.book-table tr:hover {
    background-color: #f5f5f5;
}
.book-table .cate {
    color: #999;
    font-size: 0.8rem;
}
.book-table .update-time {
    color: var(--text-secondary);
}
.book-table tbody tr:nth-child(even) {
    background-color: #f6f6f6;
}
/* 新书推荐 */
.new-book {
    font-size: 0.85rem;
    line-height: 1.7;
    color: red;
}
/* 分页组件 - PC端 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    /* margin: 0 0 25px 0; */
    width: 100%;
    flex-wrap: wrap;
}
.page-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #00b39e;
    border-radius: 2px;
    font-size: 14px;
    cursor: pointer;
}
.page-item.active {
    background-color: #00b39e;
    color: #fff;
}
.page-item.jump-input {
    width: auto;
    padding: 0 10px;
    border: 1px solid #ccc;
    cursor: default;
}
.jump-input input {
    width: 40px;
    height: 22px;
    border: 1px solid #ccc;
    border-radius: 2px;
    text-align: center;
    margin: 0 5px;
}
/* ============== 页脚 ============== */
.footer {
    background-color: var(--primary-color);
    color: #ffffff;
    text-align: center;
    padding: 0.5rem 5%;
    /* margin-top: 1.5rem; */
    font-size: 0.85rem;
}
.footer a {
    color: #ffffff;
    margin: 0 0.5rem;
}
.footer a:hover {
    text-decoration: underline;
}
.footer p {
    margin: 0.5rem 0;
}
.friend-link .nav-bar{
    width: auto !important;
    max-width: auto !important;
    margin: 0 auto !important;
}
.friend-link .section-header {
    margin-bottom: 0 !important;
}
.friend-link .nav-bar li a {
    padding: 0.4rem 0.2rem !important;
}
.friend-link a {
    color: #00b39e !important;
}
.friend-link a:hover {
    background-color: transparent !important;
    color: #ff8018 !important;
}
.friend-link ul {
    grid-template-columns: repeat(12, 1fr) !important;
}
/* ============================================== */
/* ============== 移动端专属样式 =============== */
/* ============================================== */
@media (max-width: 768px) {
    .wrapper, .container {
        width: 100%;
    }

    /* 头部布局适配 */
    .header-top-wrap {
        padding: 0.5rem 5%;
    }
    .header-top {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0;
    }
    .logo a{
        order: 1;
        font-size: 1.4rem;
    }
    .header-btns {
        order: 2;
        gap: 0.8rem;
        margin-left: 0;
    }
    .header-btns a {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }
    .search-wrap {
        order: 3;
        width: 100%;
        max-width: none;
        margin-top: 0.8rem;
    }

    /* 导航栏移动端适配 */
    .nav-bar ul {
        grid-template-columns: repeat(12, 1fr);
        gap: 0.2rem;
        padding: 0.5rem 5%;
    }
    .nav-bar li a {
        font-size: 0.9rem;
        padding: 0.5rem 0.2rem;
    }

    /* 横幅适配 */
    .banner {
        font-size: 0.9rem;
        padding: 0.8rem 3%;
    }
    .section-title {
        font-size: 1.1rem;
    }

    /* 书籍卡片移动端切换 */
    .book-card-full {
        display: none !important;
    }
    .book-card-simple {
        display: flex !important;
    }

    .book-grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .book-hot-card {
        padding: 0.8rem 0;
    }
    .book-hot-card .book-cover {
        width: 90px;
        height: 130px;
    }
    .book-hot-card .book-name {
        font-size: 1.25rem;
    }
    .book-hot-card .book-meta {
        font-size: 1rem;
    }

    /* 表格移动端适配 */
    .book-table th:nth-child(3),
    .book-table td:nth-child(3),
    .book-table th:nth-child(4),
    .book-table td:nth-child(4),    
    .book-table th:nth-child(5),
    .book-table td:nth-child(5) {
        display: none;
    }
    .book-table th:nth-child(1),
    .book-table td:nth-child(1) { width: 7%; }
    .book-table th:nth-child(2),
    .book-table td:nth-child(2) { width: 38%; }
    .book-table th:nth-child(3),
    .book-table td:nth-child(3) { width: 40%; }
    .book-table {
        font-size: 1rem;
    }

    .new-book {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    .reverse-btn {
        padding: 3px 8px;
        font-size: 14px;
    }
    /* 分页组件 - 移动端适配 */
    .pagination {
        gap: 5px;
        margin-bottom: 15px;
        padding: 0 5px;
    }
    .page-item {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .page-item.jump-input {
        padding: 0 5px;
        font-size: 12px;
    }
    .jump-input input {
        width: 35px;
        height: 20px;
        font-size: 12px;
    }
    .footer {
        font-size: 0.8rem;
        padding: 1.5rem 3%;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .container section:nth-child(5) {
        display: none;
    }
    .nav-bar ul {
        grid-template-columns: repeat(8, 1fr);
        padding: 0.2rem;
    }
    .book-grid-3 {
        gap: 0.5rem;
    }
    .book-hot-card {
        padding: 0.3rem 0;
    }
    .book-hot-card {
        min-width: 0;  /* 允许 Grid 项目收缩 */
    }
    .book-hot-card .book-name {
        font-size: 1rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .book-hot-card .book-meta {
        font-size: 0.9rem;
    }

    .book-hot-card .book-latest {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        width: 100%;
        overflow: hidden;
    }
    .book-hot-card .book-latest a {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .book-card-simple .book-name {
        font-size: 0.9rem;
        line-height: 0.9rem;
        display: -webkit-box;
        line-clamp: 1;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: clip;
    }
    .logo a{
        font-size: 1.3rem;
    }
    .header-btns a {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    .book-table {
        font-size: 0.8rem;
    }
    .footer {
        padding: 0.8rem 3%;
    }

    .friend-link ul {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    .friend-link .nav-bar li a {
        padding: 0.3rem 0.2rem;
    }
}
