/* ============================================
   Inty News - 企业级设计系统
   现代化、高性能、可访问性优先
   ============================================ */

/* 全局重置和基础样式 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS 变量 - 设计令牌系统 */
:root {
    /* 颜色系统 - 主题色 */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* 中性色 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* 语义色 */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-warm: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-cool: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-sunset: linear-gradient(135deg, #fa709a 0%, #fee140 100%);

    /* 间距系统 (8px 基准) */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.5rem;    /* 24px */
    --space-6: 2rem;      /* 32px */
    --space-8: 3rem;      /* 48px */
    --space-10: 4rem;     /* 64px */

    /* 字体系统 */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

    /* 字体大小 */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    --text-5xl: 3rem;      /* 48px */

    /* 字重 */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-black: 900;

    /* 圆角 */
    --radius-sm: 0.25rem;   /* 4px */
    --radius-md: 0.5rem;    /* 8px */
    --radius-lg: 0.75rem;   /* 12px */
    --radius-xl: 1rem;      /* 16px */
    --radius-2xl: 1.5rem;   /* 24px */
    --radius-full: 9999px;

    /* 阴影系统 */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Breaking News Colors */
    --breaking-red: #dc2626;
    --breaking-bg: #1f2937;
    --breaking-text: #ffffff;

    /* Market Colors */
    --market-green: #10b981;
    --market-red: #ef4444;
    --market-bg: #f9fafb;

    /* 过渡 */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index 层级 */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* 亮色主题 */
    --bg-primary: #ffffff;
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --border-color: var(--gray-200);
    --divider-color: var(--gray-200);
}

/* 基础样式 */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
}

/* ============================================
   Header - 顶部导航
   ============================================ */
/* CLS 优化: 固定高度防止字体加载导致的布局偏移 */
.header {
    background: var(--gradient-primary);
    color: white;
    padding: var(--space-8) 0 var(--space-6);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: visible;
    min-height: 120px;
    z-index: 50 !important;
    overflow-anchor: none;
}

/* 背景装饰 */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo-section {
    flex: 0 0 auto;
}

.logo-emoji {
    filter: none;
    -webkit-text-fill-color: initial;
    background-clip: initial;
    -webkit-background-clip: initial;
}

/* Responsive header layout */
@media (max-width: 968px) {
    .header-content {
        justify-content: center;
        gap: 1rem;
        flex-direction: column;
        padding: 1rem 0;
    }

    .logo-section {
        text-align: center;
        flex: 1 1 100% !important;
        order: 1;
    }

    .logo-section .logo {
        font-size: 1.8rem !important;
    }

    .search-container {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        order: 2;
        flex: 1 1 100%;
        max-width: 100% !important;
        width: 100%;
        padding: 0 1rem;
    }

    .theme-toggle {
        order: 3;
    }

    .header-content .tagline {
        font-size: var(--text-sm);
        margin-top: 0.25rem;
    }
}

@media (min-width: 969px) {
    .logo-section .logo,
    .logo-section .tagline {
        text-align: left;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: none;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow: none;
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.theme-icon-dark {
    display: none;
}

/* Search Bar Styles */
.search-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: calc(100% - 400px);
    z-index: 100;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.25rem;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 0.75rem 6rem 0.75rem 3rem;
    font-size: 0.95rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-shortcut {
    position: absolute;
    right: 1rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

@media (max-width: 768px) {
    .search-container {
        order: 3;
        flex: 1 1 100%;
        max-width: 100% !important;
    }

    .search-shortcut {
        display: none;
    }

    .search-input {
        padding-right: 1rem;
    }
}

.logo {
    font-size: var(--text-5xl);
    font-weight: var(--font-black);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInDown 0.6s ease-out;
}

.tagline {
    font-size: var(--text-lg);
    opacity: 0.95;
    font-weight: var(--font-light);
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.stat {
    font-size: var(--text-sm);
    opacity: 0.95;
    font-weight: var(--font-medium);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================
   Unified Navigation - 统一导航栏
   页面链接 + 分类筛选合并为一行
   ============================================ */
/* CLS 优化: 固定高度防止布局偏移 */
.unified-nav {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    position: sticky;
    top: 0;
    z-index: 50 !important;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    min-height: 48px;
    overflow: visible;
}

.unified-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 1rem;
}

/* 页面链接 */
.nav-pages {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.nav-page {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.75rem 0.875rem;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

.nav-page:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.nav-page.active {
    color: #c4b5fd;
    border-bottom-color: #a78bfa;
}

/* 分类筛选按钮 */
.nav-categories {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0;
}

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

.cat-btn {
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.1);
    border-radius: 1rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    color: rgba(255,255,255,0.85);
}

.cat-btn:hover {
    border-color: #a78bfa;
    color: white;
    background: rgba(139, 92, 246, 0.25);
}

.cat-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* 旧样式 - 仅隐藏不再使用的元素 (不隐藏 shared-nav 使用的 .main-nav 和 .nav-link) */
.categories, .breadcrumb { display: none; }
.category-btn { display: none; }

/* ============================================
   Controls - 控制面板
   ============================================ */
.controls {
    background: var(--bg-primary);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    /* CLS 优化 */
    min-height: 60px;
    contain: layout style;
}

.controls .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}

.controls-left {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.btn-refresh:hover {
    background: var(--primary-700);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-refresh:active {
    transform: translateY(0);
}

.btn-refresh.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.auto-refresh-toggle input {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.limit-select {
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
}

.limit-select:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-sm);
}

.limit-select:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   Main Content - 主内容区
   ============================================ */
.main {
    padding: var(--space-8) 0 var(--space-10);
    min-height: 60vh;
    height: auto !important;
    overflow-anchor: auto;
}

/* 全宽布局 - 无侧边栏 */
.main-layout {
    display: block;
}

.content-area {
    min-width: 0;
}

/* ============================================
   News Grid - 新闻网格 (全宽)
   ============================================ */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
    /* CLS 优化 - 预留空间防止布局偏移 */
    min-height: 800px;
    contain: layout style;
}

@media (min-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    /* CLS 优化: 移动端新闻卡片固定高度 */
    .news-card {
        min-height: 380px;
    }
    .news-card-image {
        height: 180px;
    }
}

/* ============================================
   News Card - 新闻卡片
   ============================================ */
.news-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease-out both;
    position: relative;
    /* CLS 优化: 固定最小高度防止布局偏移 */
    min-height: 420px;
    contain: layout style;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-6px);
    border-color: var(--primary-300);
}

.news-card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--gradient-primary);
    transition: transform var(--transition-slow);
    /* CLS 优化 - 确保图片容器有固定尺寸 */
    aspect-ratio: 16 / 9;
    content-visibility: auto;
    contain-intrinsic-size: 100% 220px;
}

.news-card:hover .news-card-image {
    transform: scale(1.05);
}

.news-card-content {
    padding: var(--space-5);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
    gap: var(--space-3);
}

.news-card-source {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    background: var(--primary-50);
    color: var(--primary-700);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-card-category {
    padding: var(--space-1) var(--space-3);
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.news-card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    line-height: 1.4;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.news-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base);
    background: linear-gradient(to right, var(--primary-600), var(--primary-600)) no-repeat;
    background-size: 0% 2px;
    background-position: left bottom;
    transition: background-size var(--transition-base);
}

.news-card-title a:hover {
    color: var(--primary-600);
    background-size: 100% 2px;
}

.news-card-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-4);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--divider-color);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    gap: var(--space-2);
    flex-wrap: wrap;
}

.news-card-date {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: var(--font-medium);
}

.reading-time {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-medium);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.news-card-link {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: var(--font-semibold);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.news-card-link:hover {
    color: var(--primary-700);
    transform: translateX(4px);
}

/* Bookmark Button */
.bookmark-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.bookmark-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.bookmark-btn:active {
    transform: scale(0.95);
}

.bookmark-btn .bookmark-icon {
    color: #f59e0b;
    transition: all var(--transition-base);
}

.bookmark-btn.bookmarked .bookmark-icon {
    color: #f59e0b;
    animation: bookmarkPop 0.3s ease-out;
}

@keyframes bookmarkPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(15deg); }
    100% { transform: scale(1); }
}

/* ============================================
   Sidebar Ads
   ============================================ */
.sidebar-ads {
    display: none;
}

@media (min-width: 1024px) {
    .sidebar-ads {
        display: block;
    }

    .sticky-ad-container {
        position: sticky;
        top: 140px;
        max-height: calc(100vh - 160px);
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .sidebar-ad-unit {
        border-radius: var(--radius-lg);
        padding: 0;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .sidebar-ad-unit ins.adsbygoogle {
        min-height: 250px;
    }

    .sidebar-ad-unit + .sidebar-ad-unit {
        margin-top: var(--space-5);
    }
}

/* ============================================
   AdSense CLS 优化 - 预留广告空间
   防止广告加载时布局偏移 (Cumulative Layout Shift)
   ============================================ */

/* 🔥 核心 CLS 修复: 锚定广告必须使用 fixed 定位 */
ins.adsbygoogle[data-anchor-status],
ins.adsbygoogle[data-ad-status][style*="position: fixed"] {
    position: fixed !important;
    z-index: 2147483647 !important;
}

/* 防止锚定广告插入时推移内容 */
body > ins.adsbygoogle:first-of-type[data-anchor-status="displayed"] {
    position: fixed !important;
    top: 0 !important;
}

/* 通用广告容器 - 预留最小高度 */
.ad-container {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* 横幅广告预留空间 */
.ad-container--banner {
    min-height: 90px;
}

/* 矩形广告预留空间 */
.ad-container--rectangle {
    min-height: 250px;
}

/* 大矩形广告 */
.ad-container--large-rectangle {
    min-height: 280px;
}

/* 文章内广告 */
.ad-container--in-article {
    min-height: 120px;
    margin: var(--space-5) 0;
}

/* AdSense 自动广告 - 确保最小高度 */
ins.adsbygoogle {
    display: block;
    min-height: 90px;
}

ins.adsbygoogle[data-ad-format="auto"],
ins.adsbygoogle[data-ad-format="autorelaxed"] {
    min-height: 100px;
}

ins.adsbygoogle[data-ad-format="rectangle"] {
    min-height: 250px;
}

/* 广告加载时的骨架屏效果 */
ins.adsbygoogle:empty::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    min-height: inherit;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary, #e5e7eb) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: ad-skeleton 1.5s ease-in-out infinite;
}

@keyframes ad-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Mobile Sticky Bottom Ad
   ============================================ */
.mobile-sticky-bottom {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: var(--z-fixed);
    padding: var(--space-2);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-color);
    min-height: 60px; /* CLS 优化 - 预留空间 */
}

@media (max-width: 1023px) {
    .mobile-sticky-bottom {
        display: block;
    }
}

.close-sticky-ad {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.close-sticky-ad:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-10) var(--space-5);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-600);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-5);
}

.loading p {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-10) var(--space-5);
}

.empty-state h2 {
    font-size: var(--text-5xl);
    margin-bottom: var(--space-3);
    opacity: 0.3;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: var(--text-xl);
    font-weight: var(--font-medium);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-8) 0 var(--space-5);
    margin-top: var(--space-10);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.footer-section h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    font-weight: var(--font-bold);
}

.footer-section p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.7;
}

.footer-section a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-base);
}

.footer-section a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.footer-section .small {
    font-size: var(--text-xs);
    opacity: 0.8;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-5);
    border-top: 1px solid var(--divider-color);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

/* ============================================
   Utility Classes
   ============================================ */
.desktop-only {
    display: none;
}

@media (min-width: 1024px) {
    .desktop-only {
        display: block;
    }
}

.mobile-only {
    display: block;
}

@media (min-width: 1024px) {
    .mobile-only {
        display: none;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.updating {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .logo {
        font-size: var(--text-4xl);
    }

    .tagline {
        font-size: var(--text-base);
    }

    .header-stats {
        flex-direction: column;
        gap: var(--space-3);
    }

    .controls .container {
        flex-direction: column;
        gap: var(--space-4);
    }

    .controls-left {
        width: 100%;
        justify-content: space-between;
    }

    .controls-right {
        width: 100%;
    }

    .limit-select {
        width: 100%;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }
}

/* ============================================
   Pagination Navigation - 分页导航
   ============================================ */
.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-8);
    padding: var(--space-6) 0;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-base);
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--primary-500);
    background: var(--primary-50);
    color: var(--primary-600);
    box-shadow: var(--shadow-sm);
}

.pagination-btn:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--gray-200);
}

.pagination-arrow {
    font-size: 1.1em;
}

.pagination-info {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
}

/* Dark mode */
[data-theme="dark"] .pagination-btn {
    background: var(--bg-secondary);
}

[data-theme="dark"] .pagination-btn:hover:not(.disabled) {
    background: var(--primary-900);
    border-color: var(--primary-400);
    color: var(--primary-300);
}

[data-theme="dark"] .pagination-info {
    background: var(--bg-tertiary);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .pagination-nav {
        gap: var(--space-2);
    }

    .pagination-btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }

    .pagination-text {
        display: none;
    }

    .pagination-arrow {
        font-size: 1.3em;
    }

    .pagination-info {
        font-size: var(--text-xs);
    }
}

/* ============================================
   Performance Optimizations
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   🔒 无障碍性改进 (Accessibility)
   ============================================ */

/* 跳过链接 - 键盘用户快速跳转到主内容 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-600);
    color: white;
    padding: var(--space-3) var(--space-4);
    z-index: 10000;
    text-decoration: none;
    font-weight: var(--font-semibold);
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
    top: 0;
}

/* 改进的焦点样式 - 更明显的焦点指示器 */
*:focus-visible {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
}

/* 按钮和链接的焦点样式 */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-secondary: #333;
    }

    .news-card {
        border: 2px solid var(--border-color);
    }

    a {
        text-decoration: underline;
    }
}

/* 屏幕阅读器专用文本 */
.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;
}

/* 交互元素的最小触摸目标尺寸 (44x44px) */
.news-card-link,
.category-btn,
.cat-btn,
.reaction-btn,
button {
    min-height: 44px;
    min-width: 44px;
}

/* 打印样式 */
@media print {
    .header,
    .main-nav,
    .categories,
    .controls,
    .sidebar-ads,
    .mobile-sticky-bottom,
    .footer {
        display: none;
    }

    .news-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ============================================
   BREAKING NEWS FLASH BAR (U.S. Style)
   ============================================ */
.breaking-news-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--breaking-bg);
    color: var(--breaking-text);
    z-index: 10000;
    padding: 0.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: var(--font-sans);
}

.breaking-news-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.breaking-badge {
    background: var(--breaking-red);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.breaking-ticker {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 24px;
}

.breaking-ticker-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    animation: ticker-scroll 30s linear infinite;
    white-space: nowrap;
}

.breaking-ticker-content:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.breaking-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.breaking-item a {
    color: var(--breaking-text);
    text-decoration: none;
    transition: color 0.2s;
}

.breaking-item a:hover {
    color: #60a5fa;
}

.breaking-separator {
    color: var(--breaking-red);
    font-weight: 700;
}

/* Adjust body to account for fixed breaking bar */
body.has-breaking-bar {
    padding-top: 40px;
}

/* ============================================
   TRENDING NOW SIDEBAR WIDGET
   ============================================ */
.trending-widget {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    color: white;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.trending-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.trending-icon {
    font-size: 1.5rem;
    animation: flame-flicker 1.5s infinite;
}

@keyframes flame-flicker {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* Sidebar Widget - 简洁版 */
.sidebar-widget {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-500);
}

.widget-loading {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    padding: 1rem 0;
    text-align: center;
}

.trending-list {
    list-style: none;
}

.trending-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.trending-item:last-child {
    border-bottom: none;
}

.trending-rank {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-500);
    min-width: 1.25rem;
    flex-shrink: 0;
}

.trending-content {
    flex: 1;
    min-width: 0;
}

.trending-title {
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.35;
    margin: 0;
}

.trending-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trending-title a:hover {
    color: var(--primary-600);
}

.trending-stats {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   60-SECOND NEWS BRIEF
   ============================================ */
.news-brief-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 2rem;
    color: white;
    box-shadow: var(--shadow-xl);
}

.news-brief-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.news-brief-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-brief-time {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

.news-brief-list {
    list-style: none;
}

.news-brief-item {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: all 0.2s;
}

.news-brief-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(5px);
}

.news-brief-bullet {
    font-size: 1.25rem;
    min-width: 1.5rem;
}

.news-brief-text {
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .breaking-news-content {
        gap: 0.5rem;
    }

    .breaking-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .breaking-item {
        font-size: 0.85rem;
    }

    .markets-content {
        gap: 1rem;
    }

    .market-item {
        font-size: 0.8rem;
    }

    .market-label {
        display: none;
    }

    .trending-widget {
        padding: 1rem;
    }

    .news-brief-section {
        padding: 1rem;
    }

    .news-brief-title {
        font-size: 1.25rem;
    }
}

/* ============================================
   UPDATE NOTIFICATION BANNER
   ============================================ */
.update-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    animation: slideUpBanner 0.3s ease-out;
    max-width: 90%;
}

@keyframes slideUpBanner {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.update-content {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.update-content span {
    font-weight: 600;
}

@media (max-width: 768px) {
    .update-banner {
        bottom: 10px;
        padding: 0.75rem 1rem;
    }

    .update-content {
        font-size: 0.9rem;
        gap: 0.5rem;
    }

    .update-content button {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.8rem !important;
    }
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.back-to-top:active {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .back-to-top {
        width: 44px;
        height: 44px;
        bottom: 20px;
        right: 20px;
        font-size: 1.25rem;
    }
}

/* ============================================
   BREADCRUMB NAVIGATION
   ============================================ */
.breadcrumb {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    font-size: var(--text-sm);
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-link:hover {
    color: var(--primary-600);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: var(--font-semibold);
}

.breadcrumb-separator {
    color: var(--text-tertiary);
    margin: 0 0.25rem;
}

@media (max-width: 768px) {
    .breadcrumb {
        padding: 0.5rem 0;
        font-size: var(--text-xs);
    }

    .breadcrumb-list {
        gap: 0.25rem;
    }
}


/* ============================================
   REACTION BUTTONS
   ============================================ */
.reaction-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--divider-color);
    margin-top: 0.75rem;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.9rem;
}

.reaction-btn:hover {
    transform: scale(1.05);
    border-color: var(--primary-400);
    background: var(--primary-50);
}

.reaction-btn:active {
    transform: scale(0.95);
}

.reaction-btn.reacted {
    background: var(--primary-100);
    border-color: var(--primary-500);
    font-weight: var(--font-semibold);
}

.reaction-emoji {
    font-size: 1.1rem;
    line-height: 1;
}

.reaction-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: var(--font-semibold);
    min-width: 1rem;
    text-align: center;
}

.reaction-btn.reacted .reaction-count {
    color: var(--primary-700);
}

@media (max-width: 768px) {
    .reaction-bar {
        gap: 0.375rem;
    }

    .reaction-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }

    .reaction-emoji {
        font-size: 1rem;
    }
}


/* ============================================
   READING HISTORY - READ STATE
   ============================================ */
.news-card.read {
    opacity: 0.75;
}

.news-card.read .news-card-title a {
    color: var(--text-tertiary);
}

.news-card.read .news-card-image {
    opacity: 0.6;
    filter: grayscale(30%);
}

.news-card.read:hover {
    opacity: 0.9;
}

.news-card.read:hover .news-card-image {
    opacity: 0.8;
    filter: grayscale(10%);
}

/* ============================================
   VIEW TOGGLE BUTTONS
   ============================================ */
.view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}

.view-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-base);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.view-btn:last-child {
    border-right: none;
}

.view-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--primary-600);
    color: white;
}

@media (max-width: 768px) {
    .view-toggle {
        display: none;
    }
}

/* ============================================
   LIST VIEW MODE
   ============================================ */
.news-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.news-grid.view-list .news-card {
    flex-direction: row;
    max-width: 100%;
}

.news-grid.view-list .news-card-image {
    width: 250px;
    height: 180px;
    object-fit: cover;
    flex-shrink: 0;
}

.news-grid.view-list .news-card-content {
    flex: 1;
    padding: var(--space-4);
}

.news-grid.view-list .news-card-description {
    display: block;
}

@media (max-width: 768px) {
    .news-grid.view-list .news-card {
        flex-direction: column;
    }

    .news-grid.view-list .news-card-image {
        width: 100%;
        height: 200px;
    }
}

/* ============================================
   COMPACT VIEW MODE
   ============================================ */
.news-grid.view-compact {
    display: block;
}

.news-grid.view-compact .news-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    border-radius: var(--radius-md);
}

.news-grid.view-compact .news-card-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.news-grid.view-compact .news-card-content {
    flex: 1;
    padding: 0;
}

.news-grid.view-compact .news-card-header {
    margin-bottom: var(--space-1);
}

.news-grid.view-compact .news-card-title {
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
}

.news-grid.view-compact .news-card-description {
    display: none;
}

.news-grid.view-compact .reaction-bar {
    display: none;
}

.news-grid.view-compact .news-card-footer {
    padding-top: 0;
    border-top: none;
    font-size: var(--text-xs);
}

.news-grid.view-compact .bookmark-btn {
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
}

@media (max-width: 768px) {
    .news-grid.view-compact .news-card-image {
        width: 80px;
        height: 80px;
    }
}


/* ============================================
   HAMBURGER MENU (MOBILE)
   ============================================ */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-icon {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-icon:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.hamburger-btn.active .hamburger-icon:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-icon:nth-child(3) {
    transform: translateY(-13px) rotate(-45deg);
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    /* 只对首页的侧边栏导航应用滑出样式，不影响 shared-nav.js 注入的导航 */
    /* shared-nav.js 注入的 .main-nav 有内联样式 (style="background: white;...") */
    /* 这里使用 :not([style]) 来排除它，或者更好的方案是让 shared-nav 使用横向滚动 */

    /* 保留滑出菜单样式，但只在有 hamburger 按钮的页面生效 */
    .header ~ .main-nav:not([style*="background"]) {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-primary);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }

    .header ~ .main-nav:not([style*="background"]).mobile-nav-open {
        right: 0;
    }

    .header ~ .main-nav:not([style*="background"]) .nav-container {
        flex-direction: column;
        padding: 2rem 1.5rem;
        gap: 0;
    }

    .header ~ .main-nav:not([style*="background"]) .nav-link {
        width: 100%;
        padding: 1rem;
        border-bottom: 1px solid var(--divider-color);
        justify-content: flex-start;
    }

    /* shared-nav.js 注入的导航 - 横向滚动布局 */
    .main-nav[style*="background"] {
        position: sticky !important;
        top: 0 !important;
        right: auto !important;
        width: 100% !important;
        height: auto !important;
    }

    .main-nav[style*="background"] .nav-container {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 8px 10px !important;
        gap: 4px !important;
    }

    .main-nav[style*="background"] .nav-link {
        width: auto !important;
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-bottom: none !important;
    }
}

/* ============================================
   UNIFIED-NAV 移动端优化
   紧凑的单行横向滚动，不占据大半个屏幕
   ============================================ */
@media (max-width: 768px) {
    /* 移动端紧凑布局 - 两行固定高度 */
    .unified-nav {
        min-height: auto;
        padding: 0;
    }

    .unified-nav .container {
        flex-direction: column;
        padding: 0 0.5rem;
        gap: 0;
    }

    /* 页面链接 - 单行横向滚动 */
    .unified-nav .nav-pages {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0.25rem 0;
        gap: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .unified-nav .nav-pages::-webkit-scrollbar {
        display: none;
    }

    .unified-nav .nav-page {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    /* 分类按钮 - 单行横向滚动 */
    .unified-nav .nav-categories {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 0.25rem 0;
        gap: 0.35rem;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .unified-nav .nav-categories::-webkit-scrollbar {
        display: none;
    }

    .unified-nav .cat-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        flex-shrink: 0;
    }

    /* 隐藏 hamburger 按钮，因为导航已经紧凑显示 */
    .hamburger-btn {
        display: none !important;
    }
}

/* ============================================
   Mobile Optimizations - 移动端优化增强
   ============================================ */

/* 触摸友好的最小点击区域 (iOS 推荐 44px) */
@media (max-width: 768px) {
    .nav-page,
    .cat-btn,
    .btn,
    button,
    a.btn,
    .news-card {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-page {
        padding: 0.875rem 0.75rem;
        display: flex;
        align-items: center;
    }

    .cat-btn {
        padding: 0.5rem 0.875rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 移动端导航横向滚动优化 */
    .nav-pages {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        padding-bottom: 2px;
    }

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

    .nav-page {
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    /* 滚动指示器渐变 */
    .unified-nav .container::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, rgba(30, 27, 75, 1), transparent);
        pointer-events: none;
    }

    .unified-nav .container {
        position: relative;
    }
}

/* 图片懒加载占位符 */
.news-card-image[loading="lazy"],
.news-image[loading="lazy"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
}

/* 图片加载中动画 */
.news-card-image:not([src]),
.news-image:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* 触摸反馈 - 点击时视觉响应 */
@media (hover: none) and (pointer: coarse) {
    .nav-page:active,
    .cat-btn:active,
    .news-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .btn:active {
        transform: scale(0.95);
    }
}

/* 防止双击缩放 */
* {
    touch-action: manipulation;
}

/* 安全区域适配 (iPhone X+) */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-sticky-bottom {
        padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
    }

    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 0.75rem 0;
        min-height: auto;
    }

    .logo {
        font-size: 1.5rem;
    }

    .tagline {
        display: none;
    }

    .unified-nav {
        min-height: 40px;
    }

    .nav-page {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }
}
