:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --accent-light-border: #bfdbfe;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-full: 9999px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 14px 28px -6px rgba(15, 23, 42, 0.12), 0 8px 12px -4px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.logo-info {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    line-height: 1.2;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px;
    border-radius: var(--radius-full);
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    transition: all 0.15s ease;
}

.nav-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
    color: #ffffff;
    background: var(--accent);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.nav-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.nav-tab.active .nav-tab-count {
    background: rgba(255, 255, 255, 0.25);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-search .search-input {
    width: 160px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
}

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

.topbar-search .search-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.12);
}

.topbar-search .search-button {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-full);
}

/* Filters */
.filters {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 62px;
    z-index: 20;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.filters-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 38px;
}

.search-input {
    flex-grow: 1;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-button {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.search-button:hover {
    opacity: 0.9;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 76px;
}

.filter-group-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}

.filter-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 2px 2px;
    flex-grow: 1;
}

.filter-scroll::-webkit-scrollbar {
    display: none;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
    user-select: none;
}

.pill:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pill:active {
    transform: scale(0.97);
}

.pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.source-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.pill.active .source-dot {
    box-shadow: 0 0 0 1.5px #ffffff;
}

/* Active Filters Summary */
.active-filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
    font-size: 12px;
}

.active-filters-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.active-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    color: #334155;
}

.chip-remove {
    color: #64748b;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    margin-left: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transition: all 0.12s ease;
}

.chip-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.reset-all-link {
    margin-left: auto;
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.12s ease;
}

.reset-all-link:hover {
    background: rgba(239, 68, 68, 0.08);
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* Empty State */
.empty-state {
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 50px 24px;
    max-width: 540px;
    margin: 30px auto;
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.empty-state h2 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
}

.empty-state p {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.empty-state code {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #0f172a;
}

.empty-cta {
    display: inline-flex;
    padding: 8px 20px;
    font-size: 14px;
}

/* Grid & Cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

.pagination-link {
    padding: 8px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.pagination-link:hover {
    border-color: var(--accent, #666);
}

.pagination-status {
    font-size: 14px;
    color: var(--muted, #777);
}

.news-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
    border-color: #cbd5e1;
}

.news-card:active {
    transform: translateY(-1px);
}

.news-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 18px;
    color: inherit;
    text-decoration: none;
}

.news-card-source {
    position: static;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.news-card-source .source-dot {
    background: var(--source-color);
}

.news-card-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
}

.news-card-title {
    margin: 0;
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.38;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card:hover .news-card-title {
    color: var(--accent);
}

.news-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
}

.news-card-date {
    color: var(--text-muted);
}

.news-card-cta {
    color: var(--accent);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: gap 0.15s ease;
}

.news-card:hover .news-card-cta {
    gap: 5px;
}

/* Footer */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.site-footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    text-align: center;
}

.site-footer p {
    margin: 0 0 6px;
}

.site-footer .footer-note {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

/* Mobile & Responsive Breakpoints */
@media (max-width: 768px) {
    .topbar-inner {
        padding: 10px 16px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .topbar-search {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .topbar-search .search-input {
        width: auto;
        flex-grow: 1;
    }

    .logo-mark {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .logo-text {
        font-size: 17px;
    }

    .nav-tab {
        padding: 5px 10px;
        font-size: 12.5px;
    }

    .nav-tab-count {
        font-size: 10px;
        padding: 1px 5px;
    }

    .filters {
        top: 55px;
    }

    .filters-inner {
        padding: 8px 16px;
        gap: 6px;
    }

    .filter-row {
        gap: 8px;
        min-height: 34px;
    }

    .filter-label {
        min-width: 65px;
        font-size: 11px;
    }

    .pill {
        padding: 5px 11px;
        font-size: 12.5px;
    }

    .container {
        padding: 18px 16px 40px;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .news-card-title {
        font-size: 16px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}
