:root {
    --primary-color: #F14D42;
    --bg-color: #f5f7fa;
    --surface-color: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e1e4e8;
    --hover-bg: #f0f2f5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    --header-height: 64px;
    --radius: 12px;
}

html.dark {
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --text-primary: #E0E0E0;
    --text-secondary: #A0A0A0;
    --border-color: #333333;
    --hover-bg: #2C2C2C;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    margin-left: 8px;
    color: var(--text-primary);
    width: 200px;
}

.theme-toggle,
.login-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--hover-bg);
}

.login-btn {
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
}

.login-btn:hover {
    opacity: 0.9;
}

/* Main Content */
.main-content {
    padding: 24px 0;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    align-items: start;
}

/* News Card */
.news-card {
    background-color: var(--surface-color);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 500px;
    /* Fixed height */
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* Prevent header from shrinking */
}

.source-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
}

.source-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.refresh-btn:hover {
    color: var(--primary-color);
}

.news-list {
    list-style: none;
    padding: 0;
    overflow-y: auto;
    /* Enable vertical scrolling */
    flex: 1;
    /* Take remaining space */
}

/* Custom Scrollbar */
.news-list::-webkit-scrollbar {
    width: 6px;
}

.news-list::-webkit-scrollbar-track {
    background: transparent;
}

.news-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.news-list::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

.news-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    transition: background-color 0.2s;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item:hover {
    background-color: var(--hover-bg);
}

.rank {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.rank.top-1 {
    color: #ff4d4f;
}

.rank.top-2 {
    color: #ff7a45;
}

.rank.top-3 {
    color: #ffa940;
}

.content {
    flex: 1;
}

.title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.hot-value {
    color: var(--primary-color);
}

/* Footer */
.site-footer {
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-actions .search-bar input {
        width: 120px;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }
}