/* Your existing CSS styles go here */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --dark-bg: #0f0f13;
    --dark-card: #1a1a24;
    --light-text: #e2e8f0;
    --light-gray: #94a3b8;
    --sidebar-text: rgba(226, 232, 240, 0.75);
    --accent: #06b6d4;
    --accent-hover: #22d3ee;
    --transition: all 0.3s ease;
    --glow: 0 0 15px rgba(99, 102, 241, 0.3);
    --content-padding: 40px;
    --header-height: 68px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', 'Roboto', sans-serif;
    background: var(--dark-bg);
    color: var(--light-text);
    line-height: 1.6;
    /*padding-top: var(--header-height);*/
    padding-top: 56px;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* 科技感背景效果 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

.grid-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--content-padding);
}

/* 头部导航 */
header {
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    height: var(--header-height);
    transition: transform 0.3s ease-in-out;
    transform: translateY(0);
}

/* header 隐藏状态 */
header.header-hidden {
    transform: translateY(-100%);
}


.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--light-text);
    text-decoration: none;
    position: relative;
}

.logo::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s ease;
}

.logo:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.logo i {
    margin-right: 10px;
    color: var(--accent);
}

/* 新增SVG样式，与原来图标大小一致 */
.logo .logo-icon {
    width: 1.8rem; /* 与原来的字体图标大小相同 */
    height: 1.8rem; /* 保持宽高一致 */
    margin-right: 10px; /* 保留原来的右边距 */
    color: var(--accent); /* 这行确保图标颜色与fa-atom一致 */
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0; /* 防止在flex布局中被压缩 */
}

.nav-menu {
    display: flex;
    gap: 35px;
}

/* 修改导航链接样式 */
.nav-menu a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.nav-item {
    position: relative;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 0;
}

.nav-item::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active::after {
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(30, 30, 40, 0.6);
    border-radius: 50px;
    padding: 6px 20px;
    width: 300px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--light-text);
    padding: 5px 10px;
    width: 100%;
    font-size: 0.91rem;
}

.search-bar input:focus {
    outline: none;
}

.search-bar button {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
}

/* 主要内容布局 */
.main-layout {
    display: grid;
    grid-template-columns: 3.5fr 1fr;
    gap: 40px;
    margin: 40px 0;
    align-items: start;
}

/*!* 右侧侧边栏容器 - 用于放置两个独立的 aside *!*/
/*.main-layout > :last-child {*/
/*    display: flex;*/
/*    flex-direction: column;*/
/*    gap: 35px;*/
/*}*/


/* 文章流区域 */
.articles-stream {
    display: flex;
    flex-direction: column;
    gap: 30px;
}



/* 主题卡片 - 75px 高度，毛玻璃质感 */
.topic-hero-card {
    height: 75px;
    background: rgba(20, 20, 28, 0.48);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 0 24px;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    position: relative;
    overflow: hidden;
}

/* 高级毛玻璃内发光 */
.topic-hero-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.topic-hero-card:hover {
    background: rgba(20, 20, 28, 0.64);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 左侧区域 */
.hero-left {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

/* 标题容器 */
.title-wrapper {
    position: relative;
}

/* 渐变标题 */
.hero-title {
    font-size: 1.26rem;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(120deg, #F1F5F9 0%, #A5B4FC 55%, #7DD3FC 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
    transition: all 0.5s ease;
}

.topic-hero-card:hover .hero-title {
    background: linear-gradient(120deg, #FFFFFF 0%, #C084FC 40%, #38BDF8 100%);
    background-clip: text;
    -webkit-background-clip: text;
}

/* 当 body 有 .is-category-page 类时，默认让标题变淡 */
.is-category-page .hero-title {
    /* 使用 0.2 或 0.3 的透明度，让它看起来像背景 */
    background: linear-gradient(120deg, rgba(241, 245, 249, 0.32) 0%, rgba(165, 180, 252, 0.3) 55%, rgba(125, 211, 252, 0.2) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    transition: all 0.4s ease; /* 让亮起的过程稍微平滑一点 */
}



.is-category-page .topic-hero-card:hover .hero-title {
    background: linear-gradient(120deg, #FFFFFF 0%, #C084FC 40%, #38BDF8 100%);
    background-clip: text;
    -webkit-background-clip: text;
}


.topic-hero-card:hover {
    width: 100%;
}

/* 篇数+情绪集成区域 - 横向紧凑排列 */
.stats-emotion-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

/* 篇数提示 - 极度弱化，紧凑显示 */
.stats-hint {
    display: flex;
    align-items: baseline;
    gap: 3px;
    opacity: 0.45;
    transition: opacity 0.2s ease;
    padding-right: 16px;
    position: relative;
}

.stats-hint::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.topic-hero-card:hover .stats-hint {
    opacity: 0.65;
}

.stat-number {
    font-size: 0.9rem;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
}

.stat-unit {
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
    white-space: nowrap;
}

/* 情绪徽章 - 三段式设计 */
.emotion-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 10px 2.2px 8px;
    border-radius: 40px;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.emotion-emoji {
    font-size: 1rem;
    transition: transform 0.2s ease;
    display: inline-block;
    line-height: 1;
}

.emotion-status {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ========== 三段式情绪样式 ========== */
/* 1. DEEP_THINKING (沉思中) - 冷色调 < 100篇 */
.emotion-badge.deep-thinking {
    background: rgba(59, 130, 246, 0.08);
    border: 0.5px solid rgba(59, 130, 246, 0.2);
}

.emotion-badge.deep-thinking .emotion-emoji {
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.emotion-badge.deep-thinking .emotion-status {
    color: #60a5fa;
}

/* 2. ACTIVE_FLOW (活跃中) - 中性色 100-5000篇 */
.emotion-badge.active-flow {
    background: rgba(245, 158, 11, 0.08);
    border: 0.5px solid rgba(245, 158, 11, 0.2);
}

.emotion-badge.active-flow .emotion-emoji {
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.emotion-badge.active-flow .emotion-status {
    color: #f59e0b;
}

/* 3. KNOWLEDGE_RIOT (知识狂欢) - 暖色调 > 5000篇 */
.emotion-badge.knowledge-riot {
    background: rgba(239, 68, 68, 0.08);
    border: 0.5px solid rgba(239, 68, 68, 0.25);
    animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }
}

.emotion-badge.knowledge-riot .emotion-emoji {
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    animation: emojiBounce 1.5s ease-in-out infinite;
}

@keyframes emojiBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-1px);
    }
}

.emotion-badge.knowledge-riot .emotion-status {
    color: #ef4444;
    font-weight: 600;
}

/* 悬停时情绪徽章增强互动 */
.emotion-badge:hover {
    transform: translateY(-2px);
}

.emotion-badge:hover .emotion-emoji {
    transform: scale(1.1);
}

/* 探索更多区域 */
.explore-tags {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 10px;
}

.explore-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
    letter-spacing: 0.3px;
    transition: color 0.2s;
    white-space: nowrap;
}

.topic-hero-card:hover .explore-label {
    color: #818cf8;
}

.tags-wrapper {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.explore-tag {
    font-size: 0.8rem;
    font-weight: 450;
    color: #94a3b8;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 30px;
    background: rgba(99, 102, 241, 0.08);
    transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.explore-tag:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #c7d2fe;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

/* 右侧收藏按钮 - 未悬停克制 */
.collect-btn {
    background: rgba(99, 102, 241, 0.08);
    backdrop-filter: blur(8px);
    border: 0.5px solid rgba(99, 102, 241, 0.2);
    padding: 6px 18px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.3);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.collect-btn i {
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* 悬停时夸张灵动效果 */
.collect-btn:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: #818cf8;
    box-shadow: 0 0 18px rgba(129, 140, 248, 0.6), 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #ffffff;
    transform: scale(1.05) translateY(-2px);
    gap: 10px;
}

.collect-btn:hover i {
    transform: scale(1.2) rotate(5deg);
    color: #fbbf24;
    text-shadow: 0 0 6px #fbbf24;
}

.collect-btn:active {
    transform: scale(0.96) translateY(1px);
    transition: 0.05s linear;
}

/* 收藏后的激活状态 */
.collect-btn.collected {
    background: rgba(6, 182, 212, 0.25);
    border-color: #22d3ee;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
    color: #e2e8f0;
}

.collect-btn.collected i {
    font-weight: 900;
    color: #fbbf24;
}






.article-card {
    background: var(--dark-card);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    min-height: 188px;
    will-change: transform, box-shadow;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow);
}

/* 图片优化 */
.article-img {
    width: 180px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    position: relative;
    overflow: hidden;
}

.image-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

/* 图片加载失败/无图样式 */
.image-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
}

.image-fallback .image-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* 低像素警告 */
.pixel-warning {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 3;
}


/* 2. 标签容器：控制显示数量 */
.article-tags-wrapper {
    display: inline-flex;     /* 关键：让整个包装器像文字一样行内排列 */
    align-items: baseline;    /* 关键：按文字基线对齐，保证图标和文字在一条线上 */
    vertical-align: middle;
    gap: 4px;                /* 图标和文字的间距 */
}


.tag-container {
    display: inline-flex;     /* 保持行内块属性 */
    align-items: baseline;
    overflow: hidden;
}

/* 隐藏第 3 个及以后的标签 */
.tag-container .tag:nth-child(n+3) {
    display: none !important;
}

/* 3. 逗号逻辑：只在第一个标签后显示 */
/* 仅当有至少两个标签时，给第一个标签加逗号 */
.tag-container .tag:first-child:nth-last-child(n+2)::after {
    content: ",";
    margin-right: 2px;
    margin-left: 2px;
}


/*新增tag 样式*/
.tag {
    text-decoration: none;
    color: inherit;
}



/* 响应式图片优化 */
.lazy-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.lazy-img.loaded {
    opacity: 1;
}

.low-res {
    filter: blur(3px);
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*封面明暗*/
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.21), rgba(15, 23, 42, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-icon {
    font-size: 2rem;
    color: var(--accent);
    z-index: 2;
}

.image-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--light-gray);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 3;
}

.article-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-category {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.article-category i {
    margin-right: 8px;
}

.article-category a {

    text-decoration: none;
    color: inherit;

}

/* 确保 H2 不会破坏现有的卡片设计 */
/*.card-h2-title {*/
/*    margin: 0;*/
/*    padding: 0;*/
/*    font-size: inherit; !* 继承原来 article-title 的大小 *!*/
/*    line-height: inherit;*/
/*    font-weight: inherit;*/
/*}*/

.card-h2-title a.article-title {
    display: block; /* 保持原有的点击区域 */
    /* 这里保留你原本 .article-title 的样式 */
}


.article-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.4;
    color: var(--light-text);
    transition: var(--transition);
    max-width: 95%;
    text-decoration: none;
}

.article-title:hover {
    color: var(--accent);
}

/* 修改现有的.article-excerpt样式 */
.article-excerpt {
    color: var(--light-gray);
    line-height: 1.7;
    margin-bottom: 15px;
    flex-grow: 1;
    max-width: 95%;
    font-size: 1.05rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 新增固定高度确保两行显示 */
    height: calc(1.7em * 2); /* 行高 * 行数 */
    min-height: calc(1.7em * 2); /* 确保最小高度 */
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 10px;
}

.article-meta {
    display: flex;
    align-items: center;      /* 强制所有子项居中对齐 */
    gap: 12px;
    font-size: 0.85rem;
    color: var(--light-gray);
    flex-wrap: nowrap;
}



.article-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 右侧侧边栏容器 */
.sidebar-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 新增下面这一行，确保右侧栏撑开到跟左侧一样高 */
    align-self: stretch;
}

/* 热门文章榜 - 普通侧边栏，不吸附 */
.sidebar-hot {
    display: block;
}

/* 新发布文章榜 - 独立吸附侧边栏 */
/* 1. 感应层：负责在右侧吸附，它本身不产生位移，所以鼠标判定非常稳定 */
.sidebar-sensor {
    position: sticky;
    top: 90px; /* 建议直接写死 90px 或 100px，避免变量计算失效 */
    z-index: 10;
}

/* 2. 内容层：负责在感应层内部做平移 */
.sidebar-new {
    display: block;
    /* 删掉了原来的 position: sticky 和 top */
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform;
}

/* 新增：当鼠标悬停时，我们暂时关闭过渡，让滚动同步变得即时 */
.sidebar-new.is-hovering {
    transition: none;
}

.sidebar-section {
    background: var(--dark-card);
    border-radius: 12px;
    padding: 25px;
    /*padding: 20px 20px 20px 20px;  !* 上下左右都减少5px *!*/
    box-shadow: var(--glow);
    border: 1px solid rgba(99, 102, 241, 0.2);
    overflow: visible;
}

.section-title {
    font-size: 1.4rem;
    /*font-size: 1.3rem;  !* 标题稍微缩小一点 *!*/
    font-weight: 700;
    margin-bottom: 25px;
        /*margin-bottom: 18px;  !* 减少底部间距 *!*/
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent);
}

.section-title i {
    color: var(--accent);
}

.trending-list, .new-list {
    list-style: none;
}

.trending-item, .new-item {
    padding: 15px 0;
    /*padding: 15px 0;  !* 减少上下内边距，从15px减到12px *!*/
    /*padding: 15px 0 8px 0;*/
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: visible;
    transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    position: relative;
    border-radius: 12px;
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.05);
}

/* 悬停时变成卡片效果 */
.trending-item:hover, .new-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    transform: translateX(4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-bottom-color: transparent;
    margin-bottom: 4px;
    margin-top: 4px;
}

.trending-item:last-child, .new-item:last-child {
    border-bottom: none;
}

.trending-number {
    font-weight: 700;
    /*font-weight: 600;  !* 字重稍微减轻 *!*/
    font-size: 1.5rem;
    /*font-size: 1.3rem;  !* 数字稍微缩小，从1.5rem减到1.3rem *!*/
    width: 40px;
    color: var(--light-gray);
    /*width: 36px;  !* 宽度减少4px *!*/
    display: inline-block;
    vertical-align: top;
}

.trending-content, .new-content {
    display: inline-block;
    width: calc(100% - 50px);
        /*width: calc(100% - 42px);  !* 适应缩小的数字宽度 *!*/
    vertical-align: top;
    overflow: visible;
    transition: all 0.3s ease;
}

.trending-title, .new-title {
    font-weight: 600;
    margin-bottom: 8px;
    /*font-weight: 500;  !* 字重稍微减轻，视觉上更清爽 *!*/
    /*margin-bottom: 6px;  !* 减少底部间距 *!*/
    text-decoration: none;
    color: var(--sidebar-text, rgba(226, 232, 240, 0.75));  /*侧边栏专用颜色*/
    /*color: var(--sidebar-text, #cbd5e1);  !* 侧边栏专用颜色 *!*/
    /*color: var(--light-text); !*   颜色有点亮*! */
    font-size: 1.05rem;
    line-height: 1.4;
    /*font-size: 1.05rem;  !* 字体稍微缩小，从1.05rem减到0.95rem *!*/
    /*line-height: 1.35;  !* 行高略微收紧 *!*/
    word-break: break-word;
    position: relative;
    cursor: pointer;
    display: block;

    /* 实际高度限制 - 只显示2行 */
    max-height: calc(1.4em * 2);
    overflow: hidden;

    /* 底部淡出效果 */
    mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);

    /* 关键修改：收回动画更快 (0.3s)，展开动画慢 (0.65s) */
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                mask-image 0.2s ease,
                -webkit-mask-image 0.2s ease,
                color 0.2s ease;
}

.trending-title:hover, .new-title:hover {
    color: var(--accent);
    max-height: 300px;
    mask-image: none;
    -webkit-mask-image: none;
    /* 悬停时展开用慢速 */
    transition: max-height 0.85s cubic-bezier(0.4, 0, 0.2, 1),
                mask-image 0.2s ease,
                -webkit-mask-image 0.2s ease,
                color 0.2s ease;
}

.trending-meta, .new-meta {
    font-size: 0.85rem;
        /*font-size: 0.75rem;  !* 元数据字体缩小，节省空间 *!*/
    color: var(--light-gray);
    display: flex;
    gap: 15px;
    transition: all 0.3s ease;
}

/* 悬停时元数据轻微变化 */
.trending-item:hover .trending-meta,
.new-item:hover .new-meta {
    color: var(--accent-hover);
}

.new-number {
    font-weight: 700;
    font-size: 1.2rem;
    width: 40px;
        /*font-weight: 600;*/
        /*font-size: 1.1rem;*/
    /*width: 36px;  !* 宽度减少4px，和热门榜保持一致 *!*/
    color: var(--accent);
    display: inline-block;
    vertical-align: top;
    text-align: center;
}

/* 页脚 */
footer {
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    padding: 60px 0 30px;
    margin-top: 50px;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}

.copyright {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    color: var(--light-gray);
}

.copyright a {
    color: inherit;
    text-decoration: none;
}


/* 加载更多 */
.load-more {
    text-align: center;
    margin: 40px 0;
}

.load-btn {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.load-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow);
}

/* 性能优化提示 */
.performance-info {
    background: rgba(6, 182, 212, 0.1);
    border-left: 3px solid var(--accent);
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-top: 20px;
    font-size: 0.9rem;
}


.desktop-search {
    display: flex;
}


/* 动画效果 */
.article-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.article-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 加载动画 */
@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

.loading {
    animation: pulse 1.5s infinite;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

/* 沉浸感增强 */
.articles-stream {
    perspective: 1000px;
}

.article-card {
    transform-style: preserve-3d;
    transform: translateZ(0);
}

/* 骨架屏加载效果 */
.skeleton {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.4));
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 阅读进度条 */
.reading-progress {
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    z-index: 999;
    transform-origin: 0 0;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.8);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary);
    transform: translateY(-5px) scale(1.05);
}

/* 主题切换 */
.theme-switch {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.8);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 99;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* 亮色主题 */
body.light-theme {
    --dark-bg: #f0f2f5;
    --dark-card: #ffffff;
    --light-text: #1e293b;
    --light-gray: #64748b;
    --sidebar-text: rgba(30, 41, 59, 0.7);;  /* 新增：亮色主题侧边栏文字颜色，使用主文字颜色 70% 不透明度 */
    --accent: #0ea5e9;
    --accent-hover: #38bdf8;
}

body.light-theme::before {
    background: radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 40%);
}

body.light-theme .grid-lines {
    background-image: linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

body.light-theme header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

body.light-theme header.header-hidden {
    /* 隐藏时保持亮色主题背景 */
    background: rgba(255, 255, 255, 0.8);
}


body.light-theme .search-bar {
    background: rgba(240, 240, 245, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

body.light-theme .article-card,
body.light-theme .sidebar-section {
    background: var(--dark-card);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* 亮色主题 */
body.light-theme .trending-item:hover,
body.light-theme .new-item:hover {
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

body.light-theme footer {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

body.light-theme .copyright {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* 桌面端默认样式 - 移动端按钮默认隐藏 */
.mobile-menu-btn,
.mobile-search-btn,
.header-right {
    display: none;
}


/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--light-text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* 移动端搜索优化 */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-search-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--light-text);
    font-size: 1.2rem;
    cursor: pointer;
}


.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1001;
    padding: 15px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-search-overlay.active {
    transform: translateY(0);
}

.mobile-search-container {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(30, 30, 40, 0.9);
    border-radius: 50px;
    padding: 8px 15px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.mobile-search-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--light-text);
    font-size: 1rem;
    padding: 10px 0;
}

.mobile-search-container input:focus {
    outline: none;
}

.mobile-search-container button {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

.mobile-search-close {
    color: var(--light-gray) !important;
}


/* 响应式设计 */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    /* 移动端时取消吸附效果，让侧边栏正常排列 */
    .sidebar-new {
        position: static;
    }

    /* 侧边栏容器在移动端正常显示 */
    .sidebar-right {
        margin-top: 30px;
    }

    /*分类和标签页的主题卡*/
    .hero-left {
        gap: 20px;
    }

    .stats-emotion-wrapper {
        gap: 12px;
    }

    .explore-tag {
        font-size: 0.7rem;
        padding: 2px 6px;
    }



}

@media (max-width: 992px) {
    /* 1. 压缩容器顶部的巨大空隙 */
    .container {
        padding-top: 0 !important; /* 如果原有的是 padding */
        margin-top: 0 !important;      /* 如果原有的是 margin */
        overflow-x: hidden; /* 关键：防止被子元素的 100vw 撑出滚动条 */
    }

    /* --- 1. 大框架调整：让侧边栏排到文章流上方 --- */
    .main-layout {
        flex-direction: column;
        margin-top: 5px;
        gap: 20px; /* 减小流式布局内部的间距 */
    }

    .sidebar-right {
        order: -1; /* 关键：把右侧栏提到最前面显示 */
        display: flex !important;
        flex-direction: row !important; /* 让里面的榜单横向排队 */
        overflow-x: auto; /* 开启横向滚动 */
        overflow-y: hidden;
        /* 这里的第一个值 0px 代表上内边距，根据需要微调 */
        padding: 0px 15px 15px 15px;
        /*padding: 10px 15px 25px 15px;*/
        gap: 15px; /* 卡片间距 */
        -webkit-overflow-scrolling: touch; /* 丝滑滚动 */
        /* 修改这里：不要使用 100vw，改用 calc */
        width: calc(100% + 30px); /* 100% 是父容器宽，30px 是补偿左右负边距 */
        /*width: 100vw;*/
        margin-left: -15px;       /* 向左移动抵消 padding */
        margin-right: -15px;      /* 关键：向右也移动抵消，防止撑开父元素 */
        /* 移除可能存在的顶部外边距 */
        margin-top: 5px !important;
        /*控制下边缘和文章卡片的距离并且不影响边缘阴影*/
        margin-bottom: -6px !important;
    }

    /* --- 2. 榜单卡片样式调整 --- */
    .sidebar-hot, .sidebar-sensor {
        flex: 0 0 85%; /* 每个卡片占屏幕宽度的 85% */
        min-width: 300px;
    }

    /* 手机端关掉所有吸附效果，否则会乱跳 */
    .sticky-sidebar {
        position: static !important;
        margin-top: 10px;
        /*控制热门和新发布文章的下边缘空间和阴影的完整性*/
        margin-bottom: -5px;
    }

    /* 隐藏手机端难看的滚动条 */
    .sidebar-right::-webkit-scrollbar {
        display: none;
    }

    /* 4. 减小卡片内部标题上方的间距 */
    .sidebar-section {
        /*减少与文章卡片的顶部空隙*/
        margin-bottom: 0;
        padding: 15px; /* 适当减小榜单内部的留白 */
    }

    .section-title {
        margin-bottom: 10px;
        font-size: 1.1rem; /* 稍微缩小标题，省出垂直空间 */
    }


    /*分类和标签页主题卡片*/
    .hero-left {
        gap: 16px;
    }

    .explore-label {
        display: none;
    }

    .stats-hint::after {
        display: none;
    }








    /* --- 3. 原有的卡片样式（保持不变） --- */
    .article-card {
        flex-direction: column;
        min-height: auto;
        width: 100%; /* 确保它占满父容器，而父容器现在受 container 约束 */
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box; /* 确保 padding 不撑大卡片 */
    }

    .article-card.visible {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        /* 这里的 padding 为 0 是因为父级 .container 已经有边距了 */
    }


    .article-img {
        width: 100%;
        height: 200px;
    }

    .image-fallback .image-icon {
        font-size: 2rem;
    }

    .article-title {
        font-size: 1.5rem;
    }

    .article-content {
        padding: 20px;
    }

    .article-excerpt {
        -webkit-line-clamp: 2;
        height: calc(1.7em * 2);
        min-height: calc(1.7em * 2);
    }

    .article-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-top: 0px;
    }
}

@media (max-width: 768px) {
    :root {
        --content-padding: 25px;
        --header-height: 60px;
    }

    /* 移动端缩小按钮尺寸 */
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
        font-size: 1rem;
    }

    .theme-switch {
        width: 40px;
        height: 40px;
        bottom: 20px;
        left: 20px;
        font-size: 1rem;
    }


    /* 头部布局 */
    .header-container {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        position: relative;
    }

    .logo {
        font-size: 1.3rem;
        flex-shrink: 0;
    }

    .logo span {
        display: inline-block;
    }

    /* 右侧按钮组 - 移动端显示 */
    .header-right {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-shrink: 0;
        z-index: 100;
    }

    /* 移动端按钮显示 */
    .mobile-menu-btn {
        display: block;
        position: relative;
        z-index: 1001;
    }

    .mobile-search-btn {
        display: block;
        position: relative;
        z-index: 1001;
    }

    /* 隐藏桌面搜索框 */
    .desktop-search {
        display: none;
    }

    .search-bar {
        display: none;
    }

    /* 移动端菜单 */
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.4s ease;
        z-index: 999;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
        pointer-events: none;
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* 侧边栏调整 */
    .trending-content, .new-content {
        width: calc(100% - 40px);
    }


    .topic-hero-card {
        height: auto;
        min-height: 75px;
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 12px;
    }

    /*分类和标签主题卡*/
    .hero-title {
        font-size: 1.45rem;
    }

    .explore-tag {
        font-size: 0.65rem;
    }

    .emotion-status {
        display: none;
    }

    .emotion-badge {
        padding: 3px 8px;
    }



}


@media (max-width: 480px) {
    :root {
        --content-padding: 15px;
    }

    /* 超小屏进一步缩小按钮 */
    .back-to-top {
        width: 36px;
        height: 36px;
        bottom: 15px;
        right: 15px;
        font-size: 0.9rem;
    }

    .theme-switch {
        width: 36px;
        height: 36px;
        bottom: 15px;
        left: 15px;
        font-size: 0.9rem;
    }

    .nav-menu {
        gap: 10px;
        flex-wrap: wrap;
    }

    .nav-item {
        font-size: 0.9rem;
        padding: 5px;
    }

    .trending-item, .new-item {
        padding: 12px;
    }




    .article-meta {
        flex-direction: row;       /* 恢复水平排列 */
        flex-wrap: wrap;         /* 关键：如果屏幕实在太窄，允许自动折行而不会超出边界 */
        align-items: center;
        gap: 15px;                /* 适当减小间距 */
        font-size: 0.75rem;      /* 稍微调小字体，确保一行能塞下更多内容 */
        margin-top: 1.5px;
    }

    .article-excerpt {
        font-size: 1rem; /* 稍微减小字体大小 */
        line-height: 1.6; /* 调整行高 */
        height: calc(1.6em * 2); /* 重新计算高度 */
        min-height: calc(1.6em * 2);
    }

    .article-stats {
        flex-wrap: wrap;
    }

    .trending-number, .new-number {
        width: 30px;
        font-size: 1.2rem;
    }

    .article-content {
        padding: 15px;
    }

    .article-img {
        height: 180px;
    }

    .pixel-warning {
        bottom: 5px;
        right: 5px;
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    .article-title {
        font-size: 1.4rem;
    }
}

