:root {
    --primary-color: #1a1a1a;
    --accent-color: #0066cc;
    --text-color: #333;
    --text-muted: #666;
    --bg-color: #f8f9fa;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    color: var(--primary-color);
    padding: 16px 0;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 a {
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.5rem;
    text-decoration: none;
}

.header-lang-select select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--card-bg);
    cursor: pointer;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 24px;
    margin-top: 12px;
}

header nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

header nav a:hover {
    color: var(--accent-color);
}

/* Home News Feed */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding-bottom: 80px;
}

.story-cluster {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    transition: box-shadow 0.2s;
}

.story-cluster-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.story-cluster-link:hover .story-cluster {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

/* Story layout: image + content side by side */
.story-layout {
    display: flex;
    gap: 28px;
}

.story-image {
    flex-shrink: 0;
    width: 220px;
}

.story-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
}

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

.story-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.coverage-stats {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.story-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.story-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 20px;
    color: var(--primary-color);
    letter-spacing: -0.3px;
}

.hero-story .story-title {
    font-size: 2.25rem;
}

@media (max-width: 768px) {
    .story-layout {
        flex-direction: column;
    }
    .story-image, .hero-story .story-image {
        width: 100%;
    }
    .story-image img, .hero-story .story-image img {
        height: 180px;
    }
}

/* Source Spectrum */
.source-spectrum {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin-bottom: 24px;
    display: flex;
    gap: 4px;
    overflow: hidden;
}

.source-marker {
    flex: 1;
    height: 100%;
    background: #e0e0e0;
    opacity: 0.8;
}

.source-marker.blocked {
    background: #dc3545;
}

.source-marker.accessible {
    background: #28a745;
}

.sources-comparison {
    margin-top: 16px;
}

.source-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.source-group {
    background: #fcfcfc;
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid #eee;
}

.source-group.blocked-group {
    border-left: 4px solid #dc3545;
}

.source-group.accessible-group {
    border-left: 4px solid #28a745;
}

.group-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}

.source-item {
    text-decoration: none;
    color: inherit;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f9f9f9;
    border: 1px solid transparent;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.source-item:hover {
    background: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.source-brand {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.source-headline {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Full Article View */
.full-article {
    background: #fff;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 16px 0;
    line-height: 1.2;
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.article-content {
    font-size: 1.15rem;
    line-height: 1.7;
}

.article-content p {
    margin-bottom: 24px;
}

/* Clusters List */
.cluster-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent-color);
}

.source-tag {
    background: #f0f4f8;
    color: #444;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
}

/* Evaluation / Sources Table */
.evaluation-table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.evaluation-table {
    width: 100%;
    border-collapse: collapse;
}

.evaluation-table th {
    padding: 16px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.evaluation-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .story-title { font-size: 1.5rem; }
    .hero-story .story-title { font-size: 1.75rem; }
    .story-cluster { padding: 20px; }
    .news-feed { gap: 20px; }
    .source-links-grid { grid-template-columns: 1fr; }
}

footer {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Language Badges */
.language-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.language-badge.chinese {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.language-badge.english {
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #90caf9;
}

.language-badge.german {
    background: #f3e5f5;
    color: #4a148c;
    border: 1px solid #ce93d8;
}

.language-badge.french {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}

.language-badge.unknown {
    background: #f5f5f5;
    color: #616161;
    border: 1px solid #e0e0e0;
}

/* Language Filter */
.language-filter {
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.language-filter label {
    font-weight: 600;
    margin-right: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.language-filter select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.language-filter select:hover {
    border-color: var(--accent-color);
}

.language-filter select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.language-stats {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.lang-stat {
    display: inline-block;
}

.lang-stat strong {
    color: var(--text-color);
}

.clusters-header {
    margin-bottom: 24px;
}

.clusters-header h2 {
    margin-bottom: 8px;
}

.stats-info {
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Articles Page */
.articles-page { padding-bottom: 60px; }
.articles-page h2 { margin-bottom: 16px; }

.articles-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.articles-stats .stat { color: var(--text-muted); }
.articles-stats .stat strong { color: var(--text-color); }
.articles-stats .stat.valid strong { color: #2e7d32; }
.articles-stats .stat.warning strong { color: #f57c00; }
.articles-stats .stat.error strong { color: #c62828; }

.articles-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.articles-filters label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.articles-filters select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
}

.articles-table-wrapper {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.articles-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--card-bg);
}
.articles-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.articles-table tbody tr:hover { background: #f8f9ff; }

.row-error { background: #fff5f5; }
.row-warning { background: #fffdf5; }

.col-source { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.78rem; }
.col-title { max-width: 300px; }
.col-title a { color: var(--text-color); text-decoration: none; font-weight: 500; }
.col-title a:hover { color: var(--accent-color); text-decoration: underline; }
.col-lang { white-space: nowrap; }
.col-clusters { text-align: center; }
.col-date { white-space: nowrap; font-size: 0.78rem; }
.col-image { text-align: center; }
.col-method { font-size: 0.75rem; }
.col-issues { font-size: 0.75rem; color: var(--text-muted); max-width: 200px; }
.col-validation { text-align: center; width: 50px; }

.thumb {
    width: 48px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.badge-valid { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #f57c00; }
.badge-error { background: #ffebee; color: #c62828; }

.missing { color: #c62828; font-weight: 600; }
.not-scraped { color: #bdbdbd; }

.method-fetch { color: #2e7d32; }
.method-playwright { color: #1565c0; }

.issues-list { color: #e65100; }

.articles-count {
    margin-top: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.empty-row { text-align: center; padding: 40px; color: var(--text-muted); }

/* ─── Article Reader ──────────────────────────────────────────────────── */

.read-article {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 60px;
}

.article-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 12px 0;
    letter-spacing: -0.3px;
    color: var(--primary-color);
}

.article-meta {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.article-meta .source-name {
    font-weight: 600;
    color: var(--accent-color);
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #222;
}

.article-body p {
    margin: 0 0 1.2em 0;
}

.article-body h1, .article-body h2, .article-body h3 {
    font-weight: 800;
    margin: 1.5em 0 0.5em;
    line-height: 1.3;
    letter-spacing: -0.3px;
    color: var(--primary-color);
}

.article-body h1 { font-size: 1.75rem; }
.article-body h2 { font-size: 1.5rem; }
.article-body h3 { font-size: 1.25rem; }

.article-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
    border-radius: 8px;
}

.article-body a {
    color: var(--accent-color);
    text-decoration: underline;
}

.article-body blockquote {
    border-left: 3px solid var(--accent-color);
    margin: 1.5em 0;
    padding: 0.5em 0 0.5em 1.5em;
    color: #555;
    font-style: italic;
}

.article-body ul, .article-body ol {
    padding-left: 1.5em;
    margin: 0 0 1.2em 0;
}

.article-body figure {
    margin: 20px 0;
}

.no-content {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.no-content-title {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 16px;
    line-height: 1.4;
}

.no-content-image {
    margin-bottom: 16px;
}

.no-content-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    object-fit: cover;
}

.no-content-date {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.no-content p {
    margin: 8px 0;
}

.no-content-link {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 24px;
    background: var(--accent-color);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.no-content-link:hover {
    opacity: 0.9;
}

/* Article Navigation */
.article-nav {
    background: var(--card-bg);
    padding: 10px 20px 8px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-nav .back-link,
.article-nav .original-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 0;
}

.article-nav .back-link:hover {
    color: var(--accent-color);
}

.article-nav .original-link {
    color: var(--accent-color);
    font-weight: 600;
}

.article-nav .original-link:hover {
    text-decoration: underline;
}

/* Related Articles */
.related-articles {
    margin-top: 40px;
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

/* Cluster Bar (top of article page) */
.cluster-bar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.cluster-bar-top {
    padding: 32px 32px 16px;
}

.cluster-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0 0 4px 0;
    line-height: 1.25;
    letter-spacing: -0.3px;
}

.cluster-bar-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cluster-sources-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cluster-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.source-tabs-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    border-top: 1px solid var(--border-color);
}

.source-tabs-container::-webkit-scrollbar {
    height: 4px;
}

.source-tabs-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.source-tabs {
    display: flex;
    gap: 0;
    white-space: nowrap;
    padding: 0;
}

.source-tab {
    padding: 12px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-color);
    border-right: 1px solid var(--border-color);
    transition: background 0.15s;
    flex-shrink: 0;
}

.source-tab:last-child {
    border-right: none;
}

.source-tab:hover {
    background: #f5f5f5;
}

.source-tab.accessible {
    color: #2e7d32;
}

.source-tab.blocked {
    color: #c62828;
}

.source-tab.current {
    font-weight: 800;
    cursor: default;
    border-bottom: 3px solid;
}

.source-tab.current.accessible {
    background: #e8f5e9;
    border-bottom-color: #2e7d32;
}

.source-tab.current.blocked {
    background: #ffebee;
    border-bottom-color: #c62828;
}

.related-articles h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 16px 0;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    transition: background 0.15s;
}

.related-item:hover {
    background: #f5f5f5;
}

.related-source {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-color);
    min-width: 120px;
}

.related-title {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ─── Tags ──────────────────────────────────────────────────────────────── */

.tag-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.78em;
    font-weight: 600;
    background: #e8eaf6;
    color: #3949ab;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.tag-pill:hover {
    background: #c5cae9;
}

.tag-pill.active {
    background: #3949ab;
    color: #fff;
}

.tag-pill.small {
    font-size: 0.7em;
    padding: 1px 7px;
    cursor: default;
}

.index-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tag-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-clear {
    font-size: 0.78em;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    margin-left: 4px;
}

.tag-clear:hover {
    color: var(--text-color);
}

.tags-display {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.cluster-tags {
    display: inline-flex;
    gap: 4px;
    margin-left: 4px;
}
