* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1890ff;
    --secondary-color: #52c41a;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #e8e8e8;
    --hot-color: #ff4d4f;
    --hover-color: #40a9ff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    --primary-color: #40a9ff;
    --secondary-color: #73d13d;
    --text-color: #e8e8e8;
    --text-light: #b0b0b0;
    --bg-color: #1a1a1a;
    --card-bg: #2a2a2a;
    --border-color: #3a3a3a;
    --hot-color: #ff7875;
    --hover-color: #69c0ff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="image"] {
    --primary-color: #1890ff;
    --secondary-color: #52c41a;
    --text-color: #333333;
    --text-light: #666666;
    --bg-color: transparent;
    --card-bg: rgba(255, 255, 255, 0.45);
    --border-color: rgba(0, 0, 0, 0.1);
    --hot-color: #ff4d4f;
    --hover-color: #40a9ff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

html[data-theme="image"] {
    background-image: url('https://xxq.dpdns.org/');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100%;
}

html[data-theme="image"] body {
    background-image: url('https://xxq.dpdns.org/');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

[data-theme="image"] .news-card {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(1px); /* 毛玻璃效果保留1px */
    -webkit-backdrop-filter: blur(1px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="image"] .header {
    background: rgba(255, 255, 255, 0.48);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="image"] .footer {
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

[data-theme="image"] .news-link {
    color: var(--text-color);
}

[data-theme="image"] .news-link:hover {
    background-color: rgba(240, 240, 240, 0.5);
}

[data-theme="image"] .news-link.hot {
    background: linear-gradient(90deg, rgba(255, 245, 245, 0.45) 0%, rgba(255, 255, 255, 0.45) 100%);
}

[data-theme="image"] .news-link.hot:hover {
    background: linear-gradient(90deg, rgba(255, 230, 230, 0.45) 0%, rgba(255, 245, 245, 0.45) 100%);
}

/* 图片模式下前三名不同的背景色 */
[data-theme="image"] .news-link.hot.rank-1 {
    background: linear-gradient(90deg, rgba(255, 245, 245, 0.45) 0%, rgba(255, 255, 255, 0.45) 100%);
}

[data-theme="image"] .news-link.hot.rank-1:hover {
    background: linear-gradient(90deg, rgba(255, 230, 230, 0.45) 0%, rgba(255, 245, 245, 0.45) 100%);
}

[data-theme="image"] .news-link.hot.rank-2 {
    background: linear-gradient(90deg, rgba(255, 248, 240, 0.45) 0%, rgba(255, 255, 255, 0.45) 100%);
}

[data-theme="image"] .news-link.hot.rank-2:hover {
    background: linear-gradient(90deg, rgba(255, 232, 208, 0.45) 0%, rgba(255, 248, 240, 0.45) 100%);
}

[data-theme="image"] .news-link.hot.rank-3 {
    background: linear-gradient(90deg, rgba(240, 248, 255, 0.45) 0%, rgba(255, 255, 255, 0.45) 100%);
}

[data-theme="image"] .news-link.hot.rank-3:hover {
    background: linear-gradient(90deg, rgba(224, 240, 255, 0.45) 0%, rgba(240, 248, 255, 0.45) 100%);
}

[data-theme="image"] .news-card-header {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="image"] .about-card {
    background: rgba(255, 255, 255, 0.48);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 30px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.refresh-btn {
    color: var(--primary-color);
    font-weight: 500;
}

.refresh-btn:hover {
    color: var(--hover-color);
    animation: rotate 0.5s ease;
}

.theme-toggle-btn {
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.theme-toggle-btn:hover {
    color: var(--primary-color);
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Main Content */
.main {
    min-height: calc(100vh - 200px);
    padding-bottom: 40px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* News Card */
.news-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 450px;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.news-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

[data-theme="dark"] .news-card-header {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
}

.news-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.news-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    min-width: 0;
    margin: 0;
}

.card-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    cursor: pointer;
    margin-left: auto;
    background: transparent;
    border: none;
    flex-shrink: 0;
}

.card-refresh-btn:hover {
    color: var(--primary-color);
    background-color: rgba(24, 144, 255, 0.1);
    transform: rotate(180deg);
}

.card-refresh-btn:active {
    transform: rotate(360deg);
}

/* News List */
.news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* 自定义滚动条样式 */
.news-list::-webkit-scrollbar {
    width: 6px;
}

.news-list::-webkit-scrollbar-track {
    background: transparent;
}

.news-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.news-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

[data-theme="dark"] .news-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

[data-theme="dark"] .news-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.news-item {
    border-bottom: 1px solid var(--border-color);
}

.news-item:last-child {
    border-bottom: none;
}

.news-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.3s;
    position: relative;
}

.news-link:hover {
    background-color: #f8f9fa;
}

[data-theme="dark"] .news-link:hover {
    background-color: #2a2a2a;
}

.news-link.hot {
    background: linear-gradient(90deg, #fff5f5 0%, #ffffff 100%);
}

.news-link.hot:hover {
    background: linear-gradient(90deg, #ffe5e5 0%, #fff5f5 100%);
}

/* 前三名不同的背景色 */
.news-link.hot.rank-1 {
    background: linear-gradient(90deg, #fff5f5 0%, #ffffff 100%);
}

.news-link.hot.rank-1:hover {
    background: linear-gradient(90deg, #ffe5e5 0%, #fff5f5 100%);
}

.news-link.hot.rank-2 {
    background: linear-gradient(90deg, #fff8f0 0%, #ffffff 100%);
}

.news-link.hot.rank-2:hover {
    background: linear-gradient(90deg, #ffe8d0 0%, #fff8f0 100%);
}

.news-link.hot.rank-3 {
    background: linear-gradient(90deg, #f0f8ff 0%, #ffffff 100%);
}

.news-link.hot.rank-3:hover {
    background: linear-gradient(90deg, #e0f0ff 0%, #f0f8ff 100%);
}

[data-theme="dark"] .news-link.hot {
    background: linear-gradient(90deg, #3a1f1f 0%, #2a2a2a 100%);
}

[data-theme="dark"] .news-link.hot:hover {
    background: linear-gradient(90deg, #4a2f2f 0%, #3a1f1f 100%);
}

/* 暗黑模式下前三名不同的背景色 */
[data-theme="dark"] .news-link.hot.rank-1 {
    background: linear-gradient(90deg, #3a1f1f 0%, #2a2a2a 100%);
}

[data-theme="dark"] .news-link.hot.rank-1:hover {
    background: linear-gradient(90deg, #4a2f2f 0%, #3a1f1f 100%);
}

[data-theme="dark"] .news-link.hot.rank-2 {
    background: linear-gradient(90deg, #3a2a1f 0%, #2a2a2a 100%);
}

[data-theme="dark"] .news-link.hot.rank-2:hover {
    background: linear-gradient(90deg, #4a3a2f 0%, #3a2a1f 100%);
}

[data-theme="dark"] .news-link.hot.rank-3 {
    background: linear-gradient(90deg, #1f2a3a 0%, #2a2a2a 100%);
}

[data-theme="dark"] .news-link.hot.rank-3:hover {
    background: linear-gradient(90deg, #2f3a4a 0%, #1f2a3a 100%);
}

.news-link.error {
    color: var(--text-light);
    cursor: default;
    pointer-events: none;
}

.news-link.error:hover {
    background-color: transparent;
}

.news-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    margin-right: 12px;
    flex-shrink: 0;
}

.news-link.hot .news-rank {
    background: var(--hot-color);
    color: #fff;
}

/* 前三名不同的颜色 */
.news-rank.rank-1,
.news-link.hot.rank-1 .news-rank,
.hot-badge.rank-1 {
    background: #ff4d4f; /* 红色 - 第1名 */
}

.news-rank.rank-2,
.news-link.hot.rank-2 .news-rank,
.hot-badge.rank-2 {
    background: #ff9800; /* 橙色 - 第2名 */
}

.news-rank.rank-3,
.news-link.hot.rank-3 .news-rank,
.hot-badge.rank-3 {
    background: #1890ff; /* 蓝色 - 第3名 */
}

.news-text {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--hot-color);
    color: #fff;
    font-size: 11px;
    border-radius: 3px;
    margin-left: 8px;
    flex-shrink: 0;
    font-weight: 600;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 50px;
    text-align: center;
}

.footer p {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 14px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }

    .nav {
        gap: 20px;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }

    .nav-link {
        font-size: 14px;
    }

    .news-card-header {
        padding: 12px 15px;
    }

    .news-link {
        padding: 10px 15px;
    }

    .news-text {
        font-size: 13px;
    }

    .card-refresh-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .news-card {
        max-height: 500px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card {
    animation: fadeIn 0.5s ease-out;
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }
.news-card:nth-child(5) { animation-delay: 0.5s; }
.news-card:nth-child(6) { animation-delay: 0.6s; }

