/* ==========================================================================
   1. 全局变量与基础重置
   ========================================================================== */
:root {
    --primary: #1f2937;
    --accent: #c81d25;
    --accent-strong: #a31217;
    --bg: #fdf7f2;
    --surface: #fffaf5;
    --border: #f2e6db;
    --muted: #8b6f5a;
    --shadow-sm: 0 1px 2px rgba(31, 41, 55, 0.06);
    --shadow-md: 0 8px 24px rgba(31, 41, 55, 0.1);
}

* { box-sizing: border-box; }

body {
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    margin: 0;
    color: var(--primary);
    letter-spacing: 0.2px;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }

/* ==========================================================================
   2. 头部、导航与公共组件 (Hero Header)
   ========================================================================== */
.top-bar {
    background: #f4f4f5;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--muted);
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar .top-bar-brand-mobile {
    display: none;
}

.top-bar-login-text {
    display: none;
}


.top-bar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: #fff;
    text-decoration: none;
    transition: 0.2s;
}

img.top-bar-avatar {
    object-fit: cover;
    background: #fff;
}

.top-bar-avatar:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.top-bar-user {
    color: var(--primary);
    font-weight: 600;
}

.top-user-menu {
    position: relative;
}

.top-user-menu__trigger {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.top-user-menu__trigger::-webkit-details-marker {
    display: none;
}

.top-user-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 170px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 200;
}

.top-user-menu__item {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
}

.top-user-menu__item:hover {
    background: #f3f4f6;
    color: var(--accent);
}

.top-user-menu__item--danger {
    color: #b42318;
}

.top-bar-user-link {
    text-decoration: none;
}

.top-bar-user-link:hover {
    color: var(--accent);
}
.top-bar-link {
    color: var(--primary);
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.top-bar-link:hover {
    border-color: var(--border);
    color: var(--accent);
    background: #fff;
}

.top-bar-link--accent {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.top-bar-icon-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: #fff;
    transition: 0.2s;
}

.top-bar-icon-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.top-bar-icon-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.hero-header {
    background: var(--surface);
    color: var(--primary);
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   3. 登录注册页
   ========================================================================== */
.auth-page {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.auth-card {
    width: min(460px, 100%);
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 32px;
    border: 1px solid var(--border);
}

.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.auth-tab {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: 0.2s;
    position: relative;
}

.auth-tab svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.auth-tab.is-active {
    color: var(--accent);
    border-color: rgba(200, 29, 37, 0.4);
    box-shadow: var(--shadow-sm);
    background: #fff5f5;
}

.auth-panel {
    display: none;
}

.auth-panel.is-active {
    display: block;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    background: #fff;
}

.auth-field--password {
    position: relative;
}

.auth-field--password input {
    padding-right: 46px;
}

.auth-password-toggle,
.auth-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
}

.auth-password-toggle svg,
.auth-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.auth-password-toggle .auth-password-icon--visible,
.auth-toggle .icon-eye-open {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-icon--hidden,
.auth-toggle.is-visible .icon-eye-closed {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-icon--visible,
.auth-toggle.is-visible .icon-eye-open {
    display: inline;
}

.auth-password-toggle:focus-visible,
.auth-toggle:focus-visible {
    outline: 2px solid rgba(200, 29, 37, 0.4);
    outline-offset: 2px;
    border-radius: 6px;
}

.auth-field input:focus {
    outline: none;
    border-color: rgba(200, 29, 37, 0.5);
    box-shadow: 0 0 0 3px rgba(200, 29, 37, 0.12);
}

.auth-submit {
    width: 100%;
    padding: 12px 16px;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.auth-submit:hover {
    background: var(--accent-strong);
}

.auth-message {
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.auth-message--error {
    background: #fff1f1;
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.2);
}

.auth-message--success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid rgba(21, 128, 61, 0.2);
}

.auth-title {
    margin: 0 0 10px;
}

.auth-title--center {
    text-align: center;
}

.auth-title--spaced {
    margin-bottom: 20px;
}

.auth-action {
    margin-top: 14px;
}

.auth-redirect-hint {
    color: #666;
    font-size: 12px;
    margin-top: 10px;
}

.auth-links {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-links a {
    color: inherit;
    text-decoration: none;
}

.auth-links a:hover {
    color: var(--accent);
}
.hero-inner, .container-wrapper {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
}

.hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: block;
    object-fit: contain;
}

.brand-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    color: var(--primary);
    background: var(--surface);
}

.badge-accent {
    border-color: rgba(37, 99, 235, 0.3);
    color: var(--accent);
    background: rgba(37, 99, 235, 0.12);
}

.nav-container {
    position: sticky;
    top: 0;
    z-index: 99;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.user-menu { justify-self: end; grid-column: 3; }
.nav-link { padding: 10px 12px; font-weight: 600; border-radius: 8px; color: var(--primary); }
.nav-link:hover { background: #f3f4f6; color: var(--accent); }
.nav-link.is-active {
    color: var(--accent);
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(37, 99, 235, 0.3);
}


.nav-link:focus-visible,
.top-bar-link:focus-visible,
.top-bar-user-link:focus-visible,
.top-user-menu__trigger:focus-visible,
.top-user-menu__item:focus-visible,
.top-bar-icon-link:focus-visible,
.nav-search button:focus-visible,
.nav-search input:focus-visible,
.pagination a:focus-visible,
.auth-submit:focus-visible,
.auth-links a:focus-visible {
    outline: 2px solid rgba(200, 29, 37, 0.55);
    outline-offset: 2px;
}
.btn-solid {
    background: var(--accent);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
}

/* ==========================================================================
   3. 首页/分类页网格布局 (修复变窄核心)
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 36px auto 48px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.container.portal {
    display: block;
}

.portal-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.portal-main {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.portal-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.portal-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 0.4px;
}

.section-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.portal-grid {
    display: grid;
    gap: 24px;
}

.portal-top-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.portal-sidebar .portal-top-grid {
    grid-template-columns: 1fr;
}

.portal-sidebar .portal-top-grid .portal-card--compact,
.portal-sidebar .portal-top-grid .portal-card--hero {
    grid-column: auto;
}

.portal-top-grid .portal-card--compact {
    grid-column: span 2;
}
.portal-top-grid .portal-card--hero {
    grid-column: span 2;
}

.portal-secondary-grid,
.portal-hot-grid,
.portal-latest-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.portal-latest-grid {
    grid-template-columns: 1fr;
    gap: 18px;
}

.portal-card--hero .card-content h3 {
    font-size: 1.5rem;
}

.portal-card--compact .card-content {
    padding: 16px;
}

.portal-card--compact .card-content h3 {
    font-size: 1rem;
}

.portal-card--compact .meta {
    padding: 10px 16px;
}

.portal .pagination {
    grid-column: auto;
    margin-top: 10px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 28px;
    color: #94a3b8;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-image img { width: 100%; height: 200px; object-fit: cover; display: block; }
.card-content { padding: 20px; flex-grow: 1; }
.card-content h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    line-height: 1.55;
}
.card-content p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.7;
}
.meta { font-size: 0.85rem; color: var(--muted); padding: 12px 20px; border-top: 1px solid var(--border); }

/* 首页/列表：来源作者链接（可点击但尽量融入 meta 文本） */
.source-link {
    color: inherit;
    font-weight: 600;
    opacity: 0.92;
    text-decoration-line: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    border-radius: 6px;
    transition: color 0.15s ease, opacity 0.15s ease, text-decoration-color 0.15s ease, background-color 0.15s ease;
}

.source-link:hover {
    opacity: 1;
    color: var(--primary);
    text-decoration-color: currentColor;
}

.source-link:visited {
    color: inherit;
}

.source-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
    outline-offset: 2px;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.latest-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.latest-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.latest-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.latest-body {
    flex: 1;
    min-width: 0;
}

.latest-body h3 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    line-height: 1.6;
}

.latest-summary {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.latest-body h3 a {
    color: var(--primary);
    text-decoration: none;
}

.latest-body h3 a:hover {
    color: var(--accent);
}

.latest-body h3 a:focus-visible,
.news-item h3 a:focus-visible,
.card-content h3 a:focus-visible {
    outline: 2px solid rgba(200, 29, 37, 0.55);
    outline-offset: 2px;
    border-radius: 6px;
}


.latest-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--muted);
}

.latest-meta span {
    padding: 4px 10px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.latest-thumb {
    width: 160px;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
}

.latest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.latest-thumb--empty {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

/* ==========================================================================
   4. tag.php 列表美化
   ========================================================================== */
.tag-container { max-width: 1000px; margin: 30px auto; padding: 0 20px; }
.tag-header { border-bottom: 2px solid var(--accent); padding-bottom: 15px; margin-bottom: 30px; }
.news-item { display: flex; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.news-item .thumb { width: 200px; aspect-ratio: 20 / 13; overflow: hidden; border-radius: 8px; flex-shrink: 0; }
.news-item .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   5. 通用分页组件 (最关键：解决所有冲突)
   ========================================================================== */
.pagination {
    grid-column: 1 / -1; /* 👈 强制在首页 Grid 布局中占满整行，解决变窄问题 */
    display: flex; 
    justify-content: center; 
    align-items: center;
    padding: 40px 0; 
    gap: 8px; 
    width: 100%; 
    margin-top: 20px;
    clear: both;
    flex-wrap: wrap;
}

.pagination a, .pagination span, .pagination button {
    padding: 8px 16px; border: 1px solid var(--border);
    text-decoration: none; color: var(--muted); border-radius: 6px;
    transition: all 0.2s; background: var(--surface);
    font-size: 0.95rem;
    line-height: 1.2;
}

/* 统一前台选中状态颜色（红色） */
.pagination a.active, .pagination span.active {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
}

.pagination a:hover:not(.active) { background-color: #f3f4f6; color: var(--accent); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.pagination .disabled {
    color: #9ca3af;
    border-color: var(--border);
    background: #f3f4f6;
    cursor: not-allowed;
}

.pagination .pagination__ellipsis {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    padding: 8px 6px;
}

.pagination__meta {
    color: var(--muted);
    padding: 8px 12px;
}

.pagination__jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pagination__jump input {
    width: 70px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.pagination__jump button {
    cursor: pointer;
}

.pagination a:focus-visible,
.pagination button:focus-visible,
.pagination__jump input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==========================================================================
   6. 文章详情、点赞与评论
   ========================================================================== */
.article-container { max-width: 800px; margin: 40px auto; padding: 24px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.article-body { line-height: 1.9; font-size: 1.05rem; }
.article-body img { max-width: 100% !important; height: auto !important; border-radius: 5px; margin-bottom: 20px; }
.article-tag-box { margin-top: 20px; font-size: 0.95rem; color: var(--muted); }
.article-tag-box .tag-link {
    color: var(--accent);
    text-decoration: underline;
    margin-right: 8px;
    font-weight: 600;
}
.article-tag-box .tag-link:hover {
    color: var(--primary);
    text-decoration-thickness: 2px;
}
.like-section { text-align: center; margin: 40px 0; border-top: 1px dashed var(--border); padding-top: 30px; }
.like-btn { padding: 12px 30px; background: var(--accent); color: white; border: none; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-sm); }

.comment-section { max-width: 800px; margin: 40px auto; padding: 20px; border-top: 1px solid var(--border); }
.comment-form textarea { width: 100%; height: 100px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }

/* ==========================================================================
   8. 底部与响应式
   ========================================================================== */
.footer {
    text-align: center !important;
    padding: 40px 20px !important;
    color: var(--muted) !important;
    font-size: 0.9rem !important;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .container { grid-template-columns: 1fr; }
    .top-bar {
        position: relative;
        z-index: 100;
    }
    .top-bar-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 8px 12px;
    }
    .top-bar-date {
        display: none;
    }
    .top-bar .top-bar-brand-mobile {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
        justify-content: flex-start;
    }
    .top-bar-brand-mobile .brand-logo {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }
    .top-bar-brand-mobile .brand-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .top-user-menu__trigger .top-bar-user {
        display: none;
    }
    .top-bar-actions {
        flex: 0 0 auto;
        width: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        white-space: nowrap;
        gap: 8px;
    }
    .top-bar-icon-link {
        width: auto;
        min-width: 64px;
        height: 32px;
        padding: 0 10px;
        gap: 6px;
        border-radius: 999px;
        font-size: 0.85rem;
        font-weight: 600;
    }
    .top-bar-icon-link svg {
        width: 16px;
        height: 16px;
    }
    .top-bar-login-text {
        display: inline;
        line-height: 1;
    }
    .top-user-menu__panel {
        right: 0;
        left: auto;
        min-width: 160px;
    }
    .hero-header {
        display: none;
    }
    .hero-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .nav-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        background: #e95a16;
        backdrop-filter: none;
        border-bottom: none;
        padding: 10px 12px;
    }
    .nav-links {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px 6px;
    }
    .nav-link {
        width: 100%;
        min-height: 38px;
        padding: 6px 0;
        font-size: 0.82rem;
        line-height: 1.2;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
        border: 1px solid #ececec;
        background: #fff;
        color: var(--primary);
        border-radius: 10px;
    }
    .nav-link.is-active {
        background: #1f2a44;
        color: #fff;
        border-color: #1f2a44;
        box-shadow: 0 2px 8px rgba(31, 42, 68, 0.32);
    }
    .news-item { flex-direction: column; }
    .news-item .thumb { width: 100%; }
    .portal-top-grid { grid-template-columns: 1fr; }
    .portal-top-grid .portal-card--hero { grid-column: span 1; }
    .portal-layout { grid-template-columns: 1fr; }
    .nav-links .nav-category { display: inline-flex; }
    .pagination {
        padding: 24px 0;
        gap: 6px;
    }
    .pagination .pagination__first,
    .pagination .pagination__last,
    .pagination .pagination__ellipsis {
        display: none;
    }
    .card-content h3,
    .news-item h3 {
        font-size: 1rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (min-width: 769px) {
    .nav-links {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .nav-links .nav-category { display: inline-flex; }
}
/* 追加到 CSS 第 4 部分末尾 */
.news-item .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* 使文字垂直居中对齐图片 */
}

.news-item h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.4;
}

.news-item h3 a {
    color: var(--primary);
    text-decoration: none;
}

.news-item h3 a:hover {
    color: var(--accent);
}

/* 响应式：手机端图片变小或切换为上下布局 */
@media (max-width: 600px) {
    .news-item {
        flex-direction: column;
    }
    .news-item .thumb {
        width: 100%;
        height: auto;
    }
}
/* --- 文章导航优化 (修复重叠) --- */
.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    gap: 20px; /* 增加间距防止挤压 */
}

.nav-item {
    flex: 1; /* 平分空间 */
    min-width: 0; /* 允许文字截断 */
}

.nav-item small {
    display: block;
    color: #999;
    margin-bottom: 5px;
    font-size: 12px;
}

.nav-item a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 超出显示省略号 */
    transition: color 0.2s;
}

.nav-item a:hover {
    color: var(--accent);
}
/* --- 文章导航：左对齐与右对齐，防止重叠 --- */
.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 40px 0;
    padding: 25px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    gap: 20px;
}

.nav-item {
    flex: 1; /* 平分宽度 */
    min-width: 0; /* 允许截断 */
}

.nav-item.next {
    text-align: right; /* 下一篇文字右对齐 */
}

.nav-item a {
    display: block;
    color: #333;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 标题太长自动变... */
    font-size: 15px;
}

/* --- 点赞按钮：精美大气的居中样式 --- */
.action-bar {
    display: flex;
    justify-content: center; /* 确保真正居中 */
    margin: 50px 0;
}

.like-btn {
    padding: 12px 35px;
    border-radius: 50px; /* 圆角胶囊形状 */
    border: 2px solid var(--accent);
    background: #fff;
    color: var(--accent);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.like-btn:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

.like-btn:disabled {
    background: #f1f2f6;
    border-color: #dfe4ea;
    color: #a4b0be;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* --- 评论表单：对齐与间距 --- */
.comment-form-container {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
}

#commentForm textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box; /* 关键：防止撑破容器 */
    font-size: 14px;
    margin-bottom: 15px;
    display: block;
}

.btn-submit {
    padding: 10px 30px;
    background: #2f3542;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
/* --- 点赞按钮区域居中 --- */
.action-bar {
    display: flex;
    justify-content: center; /* 强制水平居中 */
    margin: 40px 0;
    width: 100%;
}

.like-btn {
    padding: 10px 25px;
    background-color: var(--accent);
    color: #fff;
    border: none;
    border-radius: 30px; /* 圆角胶囊形状 */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(249, 115, 22, 0.2);
}

.like-btn:hover {
    background-color: var(--accent-strong);
    transform: translateY(-2px);
}

.like-btn:disabled, .like-btn.voted {
    background-color: #f1f2f6 !important; /* 变成淡灰色 */
    color: #a4b0be !important;
    cursor: default;
    box-shadow: none;
    transform: none;
}

/* 导航样式（上一篇/下一篇） */
.article-nav { 
    display: flex; 
    justify-content: space-between; 
    margin: 40px 0; 
    padding: 20px 0; 
    border-top: 1px solid #eee; 
    border-bottom: 1px solid #eee; 
}

.nav-item { flex: 1; min-width: 0; }
.nav-item.next { text-align: right; }
.nav-item small { color: #999; display: block; margin-bottom: 5px; }
.nav-item a { 
    color: #2c3e50; 
    font-weight: bold; 
    text-decoration: none; 
    display: block; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}
.nav-item a:hover { color: var(--accent); }

/* 点赞及分享操作栏 */
.action-bar { 
    text-align: center; 
    margin: 40px 0; 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    align-items: center; 
}

.like-btn, .share-btn { 
    padding: 12px 30px; 
    border-radius: 25px; 
    border: none; 
    cursor: pointer; 
    font-weight: bold; 
    text-decoration: none; 
    font-size: 14px; 
    transition: transform 0.2s;
}

.like-btn:active, .share-btn:active { transform: scale(0.95); }

.like-btn { background: var(--accent); color: #fff; }
.like-btn:disabled { background: #dfe4ea; color: #a4b0be; cursor: default; }
.share-btn { background: #2f3542; color: #fff; 
 }

/* =========================
   ✅ 全站：灭横向溢出兜底（加到 style.css 最底部）
   ========================= */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* 常见元凶：100vw 会导致手机出现横向滚动 */
body, header, main, footer,
.top-bar, .hero-header, .nav-container {
  max-width: 100%;
}

/* 所有 img/iframe 等媒体元素不要撑破 */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   搜索页 UX 优化
   ========================================================================== */
.search-page-container {
    display: block;
}

.search-shell {
    max-width: 900px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.search-title {
    margin: 0 0 14px;
    font-size: 1.5rem;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.search-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.95rem;
}

.search-form input:focus {
    outline: none;
    border-color: rgba(200, 29, 37, 0.5);
    box-shadow: 0 0 0 3px rgba(200, 29, 37, 0.12);
}

.search-form button {
    border: none;
    border-radius: 10px;
    padding: 0 18px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.search-form button:hover {
    background: var(--accent-strong);
}

.search-form--filters {
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #fff;
}

.search-form--filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
    color: var(--muted);
    font-size: 0.85rem;
}

.search-form--filters select {
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: var(--primary);
}

.search-meta {
    margin: 8px 0 16px;
    color: var(--muted);
}

.search-message {
    margin: 14px 0 2px;
    color: var(--muted);
}

.search-empty-state {
    margin-top: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.search-empty-state__hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.search-suggest-list {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-suggest-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fffaf5;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.search-suggest-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.search-suggest-item:focus-visible {
    outline: 3px solid rgba(200, 29, 37, 0.2);
    outline-offset: 2px;
}

.search-message--error {
    color: #b91c1c;
}

.search-news-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-news-item {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.search-item-meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .search-shell {
        padding: 16px;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form button {
        height: 42px;
    }
}

.nav-inner {
    width: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
}

.nav-search input {
    width: 220px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 0.9rem;
    background: #fff;
}

.nav-search input:focus {
    outline: none;
    border-color: rgba(200, 29, 37, 0.5);
    box-shadow: 0 0 0 3px rgba(200, 29, 37, 0.12);
}

.nav-search button {
    border: none;
    border-radius: 999px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.nav-search button:hover {
    background: var(--accent-strong);
}

.nav-search__icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 768px) {
    .nav-inner {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .nav-search {
        display: none;
    }
}


.auth-field-note {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.auth-field-note.is-error {
    color: #b91c1c;
}

.auth-field-note.is-warning {
    color: #b45309;
}

.auth-field input.is-invalid {
    border-color: rgba(185, 28, 28, 0.55);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

/* 作者页 + 关注流 */
.author-page,
.follow-feed {
    padding: 24px 12px 40px;
}

.author-card,
.author-posts,
.follow-feed__header,
.follow-feed__empty,
.follow-feed__list {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.author-card__head {
    display: flex;
    gap: 16px;
}

.author-card__avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.author-card__summary h1,
.follow-feed__header h1 {
    margin: 0;
}

.author-card__stats {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    color: var(--muted);
}

.author-card__actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 600;
    border: 1px solid transparent;
}

.btn-primary {
    color: #fff;
    background: var(--accent);
}

.btn-secondary {
    color: var(--primary);
    background: #fff;
    border-color: var(--border);
}

.btn.is-disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.author-card__hint {
    color: var(--muted);
    font-size: 13px;
}

.author-posts__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.author-posts__list li,
.follow-feed__item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.author-posts__list li:last-child,
.follow-feed__item:last-child {
    border-bottom: 0;
}

.author-posts__list time,
.follow-feed__meta {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.follow-feed__meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pwa-install-btn {
    position: fixed;
    right: 16px;
    bottom: 18px;
    z-index: 99;
    border: none;
    border-radius: 999px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #2c3e50;
    box-shadow: 0 8px 20px rgba(44, 62, 80, 0.3);
}

.pwa-install-btn[hidden] {
    display: none;
}

.wechat-source-note {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

.wechat-source-note__link {
    color: inherit;
}
