:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #f59e0b;
    --text: #1e293b;
    --text-light: #64748b;
    --bg: #f8fafc;
    --card: #fff;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color .2s;
}

a:hover { color: var(--primary-dark); }

/* ===== Header ===== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    /* 以下三行已移除，导航栏不再固定，随页面正常滚动 */
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,.95);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.site-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.site-logo i { color: var(--primary); font-size: 1.5rem; }
.site-logo:hover { color: var(--primary); }

.tag-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tag-nav::-webkit-scrollbar { display: none; }

.tag-nav a {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-light);
    background: var(--bg);
    border: 1px solid var(--border);
    white-space: nowrap;
    transition: all .2s;
}

.tag-nav a:hover,
.tag-nav a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.search-box { position: relative; flex-shrink: 0; }

.search-box input {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 36px 6px 14px;
    font-size: 13px;
    width: 180px;
    transition: all .3s;
    background: var(--bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    width: 240px;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.search-box button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
}

.search-box button:hover { color: var(--primary); }

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

/* ===== Layout ===== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

.layout-flex {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.content-area { min-width: 0; flex: 1; }
.sidebar { width: 300px; flex-shrink: 0; }

/* ===== Components ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow .3s, transform .3s;
}

.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.widget {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.widget-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.widget-title i { color: var(--primary); }

.article-item { padding: 20px; border-bottom: 1px solid var(--border); }
.article-item:last-child { border-bottom: none; }

.article-item h2,
.article-item h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.5;
}

.article-item h2 a,
.article-item h3 a { color: var(--text); }
.article-item h2 a:hover,
.article-item h3 a:hover { color: var(--primary); }

.article-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.article-meta i { margin-right: 3px; }

.article-summary {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Article Content ===== */
.article-content { line-height: 1.9; font-size: 16px; color: var(--text); }
.article-content h2 { margin-top: 28px; margin-bottom: 14px; font-size: 1.35em; color: var(--text); padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.article-content h3 { margin-top: 22px; margin-bottom: 10px; font-size: 1.15em; color: var(--text); }
.article-content p { margin-bottom: 1em; }
.article-content ul, .article-content ol { padding-left: 2em; margin-bottom: 1em; }
.article-content a { color: var(--primary); text-decoration: underline; text-decoration-color: rgba(37,99,235,.3); }
.article-content a:hover { text-decoration-color: var(--primary); }
.article-content a.auto-link { color: var(--primary); text-decoration: none; border-bottom: 1px dashed var(--primary); padding: 0 2px; }
.article-content a.auto-link:hover { background: var(--primary-light); border-bottom-style: solid; }

/* 图片与表格响应式 */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1em 0;
}

.article-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.article-content th, .article-content td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.article-content th { background: var(--bg); }

/* ===== Tags & Categories ===== */
.tag-cloud a {
    display: inline-block;
    margin: 3px;
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 15px;
    color: var(--text-light);
    font-size: 12px;
    border: 1px solid var(--border);
    transition: all .2s;
}

.tag-cloud a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.footer-tags a { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.15); }
.footer-tags a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.cat-list a {
    display: block;
    padding: 8px 12px;
    color: var(--text-light);
    font-size: 14px;
    border-radius: 6px;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.cat-list a:hover, .cat-list a.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); }

/* ===== Breadcrumb ===== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 16px;
    font-size: 13px;
}

.breadcrumb-item a { color: var(--text-light); }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text); }

/* ===== Pagination ===== */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 3px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-item.disabled .page-link { color: var(--text-light); cursor: default; background: transparent; }

/* ===== Footer ===== */
.site-footer {
    background: var(--text);
    color: rgba(255,255,255,.7);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.site-footer h6 { color: #fff; font-weight: 600; margin-bottom: 12px; }
.site-footer a { color: rgba(255,255,255,.7); }
.site-footer a:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 16px;
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
}

/* ===== Hot List ===== */
.hot-list { counter-reset: hot; }
.hot-list li {
    counter-increment: hot;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.hot-list li:last-child { border-bottom: none; }

.hot-list li::before {
    content: counter(hot);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg);
    color: var(--text-light);
}

.hot-list li:nth-child(-n+3)::before { background: var(--primary); color: #fff; }
.hot-list li a { color: var(--text); line-height: 1.5; }
.hot-list li a:hover { color: var(--primary); }

/* ===== Section Title ===== */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.section-title i { color: var(--primary); }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); margin-left: 12px; }

.badge-cat {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* ===== Home Hero ===== */
.home-hero {
    text-align: center;
    padding: 32px 16px;
    margin-bottom: 16px;
}

.home-hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.home-hero p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* ===== Mobile Nav Overlay ===== */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-nav-overlay.show {
    display: block;
    opacity: 1;
}

/* ===== Touch Target Optimization ===== */
a, button, .page-link, .tag-nav a, .cat-list a, .tag-cloud a {
    min-height: 24px;
}

/* ===== 响应式断点 ===== */
@media (max-width: 992px) {
    .sidebar { width: 260px; }
}

@media (max-width: 768px) {
    .site-header .container { padding: 10px 16px; }

    .mobile-toggle { display: flex; }

    .tag-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
        gap: 8px;
        max-height: 60vh;
        overflow-y: auto;
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
        z-index: 1001;
    }

    .tag-nav.show { display: flex; flex-wrap: wrap; }
    .tag-nav a { display: inline-flex; }

    .search-box {
        width: 100%;
        order: 3;
        margin-top: 4px;
    }

    .search-box input { width: 100%; }
    .search-box input:focus { width: 100%; }

    .main-container { padding: 16px 12px; }

    .layout-flex {
        flex-direction: column;
        gap: 16px;
    }

    .sidebar { width: 100%; }

    .article-content { font-size: 15px; }
    .article-item { padding: 16px; }
    .section-title { font-size: 16px; }
    .home-hero { padding: 24px 12px; }
    .home-hero h1 { font-size: 1.4rem; }

    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pagination .page-link {
        min-width: 36px;
        min-height: 36px;
        font-size: 13px;
        padding: 4px 10px;
    }

    .card-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .site-logo { font-size: 1.15rem; }
    .site-logo i { font-size: 1.2rem; }

    .main-container { padding: 12px 10px; }
    .article-item { padding: 14px 12px; }
    .article-item h2, .article-item h3 { font-size: 15px; }
    .article-content { font-size: 14.5px; line-height: 1.8; }
    .section-title { font-size: 15px; }
    .widget { padding: 16px; }
    .home-hero h1 { font-size: 1.25rem; }

    .pagination .page-link {
        min-width: 32px;
        min-height: 32px;
        font-size: 12px;
        padding: 2px 6px;
        margin: 0 2px;
    }
}