/* ===== 全局重置 & 基础 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Georgia", serif;
    background: #f7f0e8;
    color: #3d2c1e;
    transition: background 0.3s, color 0.3s;
}
body.dark {
    background: #1a1612;
    color: #d4c8b8;
}

.top-bar {
    background: linear-gradient(90deg, #b87333, #d4a06a, #b87333);
    height: 4px;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f0e8e0;
}
::-webkit-scrollbar-thumb {
    background: #b87333;
    border-radius: 4px;
}
body.dark ::-webkit-scrollbar-track {
    background: #2a2420;
}
body.dark ::-webkit-scrollbar-thumb {
    background: #8a6a4a;
}

/* ===== 导航 ===== */
.nav {
    background: #fffcf9;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s;
}
body.dark .nav {
    background: #24201a;
}

.nav .logo {
    font-size: 20px;
    font-weight: 700;
    color: #3d2c1e;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
body.dark .nav .logo {
    color: #e8d5b8;
}
.nav .logo i {
    color: #b87333;
}
.nav .logo span {
    font-size: 13px;
    font-weight: 400;
    color: #a08070;
}
body.dark .nav .logo span {
    color: #6a5a4a;
}

.nav .right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.nav .right a {
    color: #5a4a3a;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    cursor: pointer;
}
body.dark .nav .right a {
    color: #b0a090;
}
.nav .right a:hover {
    color: #b87333;
}
body.dark .nav .right a:hover {
    color: #c9a87c;
}

.nav .right .btn {
    background: #b87333;
    color: #fff;
    padding: 6px 20px;
    border-radius: 30px;
    font-weight: 500;
}
.nav .right .btn:hover {
    background: #8a5a2a;
    color: #fff;
}

.nav .right .theme-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6a5a4a;
    padding: 4px 6px;
    transition: color 0.2s;
}
body.dark .nav .right .theme-btn {
    color: #b0a090;
}
.nav .right .theme-btn:hover {
    color: #3d2c1e;
}
body.dark .nav .right .theme-btn:hover {
    color: #e8d5b8;
}

.nav .right .lang {
    display: flex;
    gap: 2px;
}
.nav .right .lang button {
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: #8a7a6a;
    padding: 4px 8px;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    transition: all 0.2s;
}
body.dark .nav .right .lang button {
    color: #8a7a6a;
}
.nav .right .lang button.active {
    color: #b87333;
    border-bottom-color: #b87333;
}
body.dark .nav .right .lang button.active {
    color: #e8d5b8;
    border-bottom-color: #c9a87c;
}
.nav .right .lang button:hover {
    color: #3d2c1e;
}
body.dark .nav .right .lang button:hover {
    color: #e8d5b8;
}

/* ===== Hero 区域 ===== */
.hero {
    text-align: center;
    padding: 40px 20px 32px;
    background: #fffcf9;
    transition: background 0.3s;
}
body.dark .hero {
    background: #1e1a16;
}

.hero .badge {
    display: inline-block;
    background: #e8ddd0;
    color: #6a5a4a;
    padding: 2px 16px;
    border-radius: 20px;
    font-size: 13px;
    margin-bottom: 12px;
}
body.dark .hero .badge {
    background: #3d352e;
    color: #b0a090;
}

.hero h1 {
    font-size: 32px;
    font-weight: 700;
    color: #3d2c1e;
    letter-spacing: 2px;
}
body.dark .hero h1 {
    color: #e8d5b8;
}
.hero h1 i {
    color: #b87333;
}

.hero .subtitle {
    color: #6a5a4a;
    font-size: 15px;
    margin: 8px 0 16px;
}
body.dark .hero .subtitle {
    color: #b0a090;
}

.hero .search {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 30px;
    overflow: hidden;
    border: 2px solid #e8ddd0;
    background: #fff;
    transition: border-color 0.3s;
}
body.dark .hero .search {
    background: #1e1a16;
    border-color: #3d352e;
}
.hero .search:focus-within {
    border-color: #b87333;
}
body.dark .hero .search:focus-within {
    border-color: #c9a87c;
}

.hero .search input {
    flex: 1;
    padding: 10px 18px;
    border: none;
    font-size: 14px;
    outline: none;
    background: transparent;
    color: #3d2c1e;
}
body.dark .hero .search input {
    color: #d4c8b8;
}
.hero .search input::placeholder {
    color: #b09580;
}
body.dark .hero .search input::placeholder {
    color: #6a5a4a;
}

.hero .search button {
    padding: 10px 22px;
    border: none;
    background: #b87333;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.hero .search button:hover {
    background: #8a5a2a;
}

.hero .stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.hero .stats .item {
    text-align: center;
}
.hero .stats .item .num {
    font-size: 22px;
    font-weight: 700;
    color: #3d2c1e;
}
body.dark .hero .stats .item .num {
    color: #e8d5b8;
}
.hero .stats .item .label {
    font-size: 13px;
    color: #a08070;
}
body.dark .hero .stats .item .label {
    color: #6a5a4a;
}
.hero .stats .item .label i {
    margin-right: 4px;
}

/* ===== 容器 ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* ===== 区块标题 ===== */
.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #3d2c1e;
    text-align: center;
    margin-bottom: 4px;
}
body.dark .section-title {
    color: #e8d5b8;
}
.section-title i {
    color: #b87333;
    margin-right: 6px;
}
body.dark .section-title i {
    color: #c9a87c;
}

.section-sub {
    text-align: center;
    color: #a08070;
    font-size: 14px;
    margin-bottom: 18px;
}
body.dark .section-sub {
    color: #6a5a4a;
}

/* ===== 分类网格 ===== */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}
.cat-grid a {
    background: #fffcf9;
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    text-decoration: none;
    color: #3d2c1e;
    border: 1px solid #eee8e0;
    transition: all 0.2s;
}
body.dark .cat-grid a {
    background: #24201a;
    border-color: #3d352e;
    color: #d4c8b8;
}
.cat-grid a:hover {
    transform: translateY(-3px);
    border-color: #b87333;
    box-shadow: 0 6px 20px rgba(184, 115, 51, 0.08);
}
body.dark .cat-grid a:hover {
    border-color: #c9a87c;
}
.cat-grid a .icon {
    font-size: 24px;
    color: #b87333;
    display: block;
    margin-bottom: 4px;
}
body.dark .cat-grid a .icon {
    color: #c9a87c;
}
.cat-grid a .name {
    font-size: 14px;
    font-weight: 500;
}
.cat-grid a .count {
    font-size: 12px;
    color: #a08070;
    display: block;
}
body.dark .cat-grid a .count {
    color: #6a5a4a;
}

/* ===== 功能网格 ===== */
.func-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.func-grid a {
    background: #fffcf9;
    border-radius: 10px;
    padding: 20px 14px;
    text-align: center;
    text-decoration: none;
    color: #3d2c1e;
    border: 1px solid #eee8e0;
    transition: all 0.2s;
}
body.dark .func-grid a {
    background: #24201a;
    border-color: #3d352e;
    color: #d4c8b8;
}
.func-grid a:hover {
    transform: translateY(-2px);
    border-color: #b87333;
}
body.dark .func-grid a:hover {
    border-color: #c9a87c;
}
.func-grid a i {
    font-size: 28px;
    color: #b87333;
    display: block;
    margin-bottom: 6px;
}
body.dark .func-grid a i {
    color: #c9a87c;
}
.func-grid a h3 {
    font-size: 15px;
    font-weight: 600;
}
.func-grid a p {
    font-size: 13px;
    color: #a08070;
    margin-top: 2px;
}
body.dark .func-grid a p {
    color: #6a5a4a;
}

/* ===== 双栏布局 ===== */
.dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.dual .card {
    background: #fffcf9;
    border-radius: 10px;
    padding: 16px 18px 18px;
    border: 1px solid #eee8e0;
    transition: background 0.3s, border-color 0.3s;
}
body.dark .dual .card {
    background: #24201a;
    border-color: #3d352e;
}

.dual .card .card-title {
    font-size: 15px;
    font-weight: 600;
    color: #3d2c1e;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
body.dark .dual .card .card-title {
    color: #e8d5b8;
}
.dual .card .card-title i {
    color: #b87333;
}
body.dark .dual .card .card-title i {
    color: #c9a87c;
}
.dual .card .card-title .more {
    font-size: 13px;
    font-weight: 400;
    color: #a08070;
    margin-left: auto;
    cursor: pointer;
}
body.dark .dual .card .card-title .more {
    color: #6a5a4a;
}
.dual .card .card-title .more:hover {
    color: #b87333;
}
body.dark .dual .card .card-title .more:hover {
    color: #c9a87c;
}
.dual .card .card-title .more a {
    color: #a08070;
    text-decoration: none;
}
body.dark .dual .card .card-title .more a {
    color: #6a5a4a;
}
.dual .card .card-title .more a:hover {
    color: #b87333;
}
body.dark .dual .card .card-title .more a:hover {
    color: #c9a87c;
}

/* ===== 诗词列表 ===== */
.poem-list a,
.history-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 14px;
    color: #3d2c1e;
    text-decoration: none;
    border-bottom: 1px solid #f5efe8;
    transition: color 0.2s;
}
body.dark .poem-list a,
body.dark .history-list a {
    color: #d4c8b8;
    border-bottom-color: #3d352e;
}
.poem-list a:hover,
.history-list a:hover {
    color: #b87333;
}
body.dark .poem-list a:hover,
body.dark .history-list a:hover {
    color: #c9a87c;
}

.poem-list a .author,
.history-list a .cat {
    font-size: 12px;
    color: #a08070;
    background: #f5efe8;
    padding: 0 10px;
    border-radius: 10px;
    flex-shrink: 0;
}
body.dark .poem-list a .author,
body.dark .history-list a .cat {
    color: #6a5a4a;
    background: #2a2420;
}

.poem-list .empty,
.history-list .empty {
    text-align: center;
    color: #b09580;
    font-size: 14px;
    padding: 12px 0;
}
body.dark .poem-list .empty,
body.dark .history-list .empty {
    color: #6a5a4a;
}

.history-clear {
    font-size: 12px;
    color: #a08070;
    cursor: pointer;
}
.history-clear:hover {
    color: #b87333;
}
body.dark .history-clear {
    color: #6a5a4a;
}
body.dark .history-clear:hover {
    color: #c9a87c;
}

/* ===== 经典推荐 ===== */
.recommend-links {
    max-width: 1100px;
    margin: 0 auto 16px;
    padding: 16px 24px;
    background: #fffcf9;
    border-radius: 12px;
    border: 1px solid #eee8e0;
    transition: background 0.3s, border-color 0.3s;
}
body.dark .recommend-links {
    background: #24201a;
    border-color: #3d352e;
}

.recommend-links-title {
    font-size: 15px;
    font-weight: 600;
    color: #3d2c1e;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee8e0;
    display: flex;
    align-items: center;
    gap: 6px;
}
body.dark .recommend-links-title {
    color: #e8d5b8;
    border-bottom-color: #3d352e;
}
.recommend-links-title i {
    color: #b87333;
}
body.dark .recommend-links-title i {
    color: #c9a87c;
}

.recommend-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}
.recommend-links-list a {
    font-size: 14px;
    color: #6a5a4a;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
body.dark .recommend-links-list a {
    color: #b0a090;
}
.recommend-links-list a:hover {
    color: #b87333;
}
body.dark .recommend-links-list a:hover {
    color: #c9a87c;
}
.recommend-links-list a i {
    font-size: 11px;
    opacity: 0.6;
}

/* ===== Footer ===== */
.footer {
    max-width: 1100px;
    margin: 0 auto 16px;
    padding: 20px 24px 16px;
    background: #fffcf9;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #eee8e0;
    transition: background 0.3s, border-color 0.3s;
}
body.dark .footer {
    background: #24201a;
    border-color: #3d352e;
}

.footer .links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.footer .links a {
    color: #6a5a4a;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
body.dark .footer .links a {
    color: #8a7a6a;
}
.footer .links a:hover {
    color: #b87333;
}
body.dark .footer .links a:hover {
    color: #c9a87c;
}
.footer .links a i {
    margin-right: 4px;
}

.footer .copy {
    font-size: 13px;
    color: #a08070;
}
body.dark .footer .copy {
    color: #6a5a4a;
}
.footer .copy .sutra {
    font-size: 13px;
    color: #b09580;
    margin-top: 4px;
    letter-spacing: 1px;
}
body.dark .footer .copy .sutra {
    color: #5a4a3a;
}

/* ===== 返回顶部 ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: #b87333;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(184, 115, 51, 0.3);
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    background: #8a5a2a;
    transform: translateY(-2px);
}
body.dark .back-to-top {
    background: #8a6a4a;
}
body.dark .back-to-top:hover {
    background: #6a4a2a;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .nav {
        padding: 10px 16px;
    }
    .nav .logo {
        font-size: 17px;
    }
    .nav .right a {
        font-size: 13px;
    }
    .nav .right .btn {
        padding: 5px 14px;
        font-size: 13px;
    }

    .hero {
        padding: 28px 16px 24px;
    }
    .hero h1 {
        font-size: 26px;
    }
    .hero .stats {
        gap: 20px;
    }
    .hero .stats .item .num {
        font-size: 18px;
    }

    .cat-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    .func-grid {
        grid-template-columns: 1fr 1fr;
    }
    .dual {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .container {
        padding: 16px 12px 28px;
    }

    .recommend-links {
        padding: 12px 16px;
        margin: 0 12px 14px;
    }
    .recommend-links-list {
        gap: 6px 14px;
    }
    .recommend-links-list a {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .func-grid {
        grid-template-columns: 1fr;
    }
    .cat-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .hero h1 {
        font-size: 22px;
    }
    .hero .search {
        border-radius: 20px;
    }
    .hero .search input {
        padding: 8px 14px;
        font-size: 13px;
    }
    .hero .search button {
        padding: 8px 14px;
        font-size: 13px;
    }
    .nav .right .lang button {
        font-size: 11px;
        padding: 3px 6px;
    }
    .nav .right a {
        font-size: 12px;
    }
}