:root {
    --bg: #ffffff;
    --surface: #f8f9fa;
    --surface-2: #f1f3f4;
    --border: #e8eaed;
    --text: #202124;
    --muted: #5f6368;
    --brand: #1a73e8;
    --brand-soft: #e8f0fe;
    --accent: #ea4335;
    --shadow: 0 10px 30px rgba(32, 33, 36, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Google Sans', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #dadce0;
    backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 230px;
}

.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 999px;
    cursor: pointer;
}

.menu-icon:hover {
    background: var(--surface-2);
}

.menu-icon svg,
.search-icon svg,
.nav-item svg {
    width: 24px;
    height: 24px;
    fill: var(--muted);
}

.logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.logo {
    padding-left: 16px;
    color: #202124;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    text-transform: lowercase;
}

.search-bar-container {
    flex: 1;
    max-width: 720px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: 10px;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    font-size: 16px;
}

.search-bar input::placeholder {
    color: #80868b;
}

.clear-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}

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

.search-btn {
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    padding: 9px 15px;
    font-weight: 500;
    cursor: pointer;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.dark-mode-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #dadce0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-btn:hover {
    background: var(--surface-2);
}

.dark-mode-icon {
    font-size: 18px;
}

.ai-lens-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.toggle-switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #c6c6c6;
    transition: 0.3s ease;
}

.slider::before {
    content: "";
    position: absolute;
    left: 4px;
    bottom: 4px;
    width: 16px;
    height: 16px;
    background: #fff;
    transition: 0.3s ease;
}

input:checked + .slider {
    background: var(--accent);
}

input:checked + .slider::before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 999px;
}

.slider.round::before {
    border-radius: 999px;
}

.profile-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.main-container {
    display: flex;
    gap: 28px;
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.sidebar {
    width: 256px;
    padding-right: 16px;
    display: none;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0 10px 20px;
    border-radius: 0 24px 24px 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--surface-2);
}

.nav-item.active {
    background: var(--brand-soft);
    color: var(--brand);
}

.nav-item.active svg {
    fill: var(--brand);
}

.sidebar-stats {
    display: none;
    margin-top: 20px;
    padding: 16px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.sidebar-stats-title {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--muted);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.stat-row:last-child {
    border-bottom: 0;
}

.stat-label {
    color: var(--muted);
}

.stat-val {
    font-weight: 700;
    color: var(--brand);
}

.feed-container {
    flex: 1;
    min-width: 0;
    max-width: 820px;
}

.section-title {
    margin: 0 0 18px;
    font-size: 22px;
    color: var(--text);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.category-btn {
    border: 0;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.category-btn:hover {
    background: #e7eaec;
    color: var(--text);
}

.category-btn.active {
    background: var(--brand);
    color: #fff;
}

.loading {
    display: none;
    padding: 40px 0;
    text-align: center;
}

.feed-empty {
    padding: 28px 0;
    color: var(--muted);
    font-size: 14px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid #edf0f2;
    border-top: 4px solid var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.factcheck-spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
}

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

.article-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.article-card:hover {
    background: rgba(32, 33, 36, 0.015);
}

.article-card:hover .article-headline {
    text-decoration: underline;
}

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

.article-source {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}

.article-source img {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.article-headline {
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    color: var(--text);
}

.article-excerpt {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    white-space: normal;
    overflow: visible;
}

.article-time {
    font-size: 12px;
    color: var(--muted);
}

.article-image,
.article-image-fallback {
    width: 112px;
    height: 112px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--surface-2);
    flex-shrink: 0;
}

.article-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa0a6;
    font-size: 13px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(32, 33, 36, 0.46);
    backdrop-filter: blur(5px);
    overflow: auto;
}

.modal-content {
    position: relative;
    width: min(920px, calc(100% - 32px));
    margin: 48px auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: modal-in 0.22s ease-out;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 18px;
    right: 20px;
    z-index: 2;
    color: #9aa0a6;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text);
}

.historical-section,
.similar-section {
    padding: 28px 34px;
}

.historical-section h3,
.similar-section h3,
.factcheck-heading {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article-body {
    padding: 40px 34px 30px;
}

.article-title {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.15;
}

.article-meta {
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 14px;
}

.tldr-section {
    margin: 0 0 26px;
    border: 1px solid #d6e4ff;
    border-radius: 14px;
    background: #f8fbff;
    overflow: hidden;
}

.tldr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 18px;
}

.tldr-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--brand);
    border: 1px solid #d6e4ff;
}

.badge-icon,
.tldr-icon {
    font-size: 14px;
}

.badge-text,
.btn-text {
    font-size: 13px;
    font-weight: 600;
}

.tldr-btn,
.read-full-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.tldr-btn {
    padding: 11px 18px;
    background: var(--brand);
    color: #fff;
}

.tldr-btn:disabled {
    background: #adc9f5;
    cursor: not-allowed;
}

.btn-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-arrow {
    font-size: 16px;
}

.tldr-content {
    padding: 18px;
    border-top: 1px solid #d6e4ff;
    background: #fff;
    color: #2d3136;
    font-size: 16px;
    line-height: 1.7;
}

.tldr-content.loading {
    text-align: center;
    color: var(--brand);
}

.tldr-label {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.factcheck-section {
    margin: 0 0 28px;
    padding: 20px 0 0;
    border-top: 1px solid var(--border);
}

.factcheck-loading {
    padding: 16px 0 10px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.factcheck-unavailable {
    padding: 12px 14px;
    border-radius: 10px;
    background: #fef7e0;
    color: #7c5d00;
    font-size: 14px;
}

.factcheck-list {
    display: flex;
    flex-direction: column;
}

.factcheck-card {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.factcheck-card:first-child {
    border-top: 0;
}

.factcheck-claim {
    margin-bottom: 10px;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

.factcheck-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.verdict-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.verdict-true,
.verdict-supported {
    background: #e6f4ea;
    color: #137333;
}

.verdict-mostly-true {
    background: #ecf7ed;
    color: #237b38;
}

.verdict-false,
.verdict-refuted {
    background: #fce8e6;
    color: #c5221f;
}

.verdict-unverifiable,
.verdict-misleading {
    background: #eceff1;
    color: #5f6368;
}

.factcheck-whats-true,
.factcheck-rationale {
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
}

.factcheck-rationale {
    margin-top: 10px;
    color: #4d555e;
}

.factcheck-sources {
    margin-top: 12px;
}

.factcheck-sources-title {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.factcheck-source-link {
    display: block;
    margin-bottom: 6px;
    color: var(--brand);
    font-size: 13px;
    text-decoration: none;
}

.factcheck-source-link:hover {
    text-decoration: underline;
}

.factcheck-no-sources,
.factcheck-empty {
    color: var(--muted);
    font-size: 14px;
}

.factcheck-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.factcheck-toggle-label {
    color: var(--muted);
    font-size: 13px;
}

.article-text {
    color: var(--text);
    font-size: 18px;
    line-height: 1.8;
}

.article-text p {
    margin: 0 0 18px;
}

.read-full-btn {
    margin-top: 24px;
    padding: 12px 22px;
    background: var(--brand);
    color: #fff;
}

.historical-section {
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.timeline-text {
    margin-top: 8px;
}

.timeline {
    position: relative;
    margin-top: 4px;
    padding-left: 20px;
    border-left: 2px solid #d2d6db;
}

.timeline-item {
    position: relative;
    margin-bottom: 18px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 5px;
    left: -27px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--brand);
}

.timeline-date {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.timeline-content {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

.timeline-empty {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.similar-section {
    border-top: 1px solid var(--border);
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.similar-card {
    display: block;
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    background: #fff;
}

.similar-card:hover {
    border-color: #c6dafc;
    box-shadow: 0 8px 20px rgba(26, 115, 232, 0.08);
}

.similar-source {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.similar-title {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}

.similar-meta {
    margin-top: 10px;
    color: #80868b;
    font-size: 12px;
}

.highlight {
    position: relative;
    display: inline;
    padding: 1px 3px;
    border-radius: 4px;
    cursor: help;
}

.highlight::after {
    content: attr(data-reason);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    width: min(260px, 70vw);
    padding: 8px 10px;
    border-radius: 8px;
    background: #202124;
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease;
    z-index: 2;
    pointer-events: none;
}

.highlight:hover::after {
    opacity: 1;
    visibility: visible;
}

.highlight-factcheck {
    background: rgba(26, 115, 232, 0.08) !important;
    border-bottom: 2px dotted var(--brand) !important;
}

.spy-feature {
    display: none !important;
}

body.spy-mode-active .spy-feature {
    display: block !important;
}

body.spy-mode-active .toggle-label {
    color: var(--accent);
}

body.spy-mode-active .article-card {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
}

body.spy-mode-active .news-feed {
    border-top: 2px solid var(--accent);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body.dark-mode {
    --bg: #111827;
    --surface: #172032;
    --surface-2: #1a2538;
    --border: #263247;
    --text: #edf2f8;
    --muted: #a7b2c1;
    --brand: #60a5fa;
    --brand-soft: #1c2d4f;
    --shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
}

body.dark-mode .header {
    background: rgba(17, 24, 39, 0.94);
    border-bottom-color: var(--border);
}

body.dark-mode .logo {
    color: var(--text);
}

body.dark-mode .menu-icon:hover,
body.dark-mode .dark-mode-btn:hover,
body.dark-mode .article-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .search-bar,
body.dark-mode .timeline-content,
body.dark-mode .similar-card,
body.dark-mode .modal-content,
body.dark-mode .tldr-content {
    background: #111827;
}

body.dark-mode .search-bar input::placeholder {
    color: #92a1b5;
}

body.dark-mode .search-btn,
body.dark-mode .read-full-btn,
body.dark-mode .tldr-btn {
    color: #08101d;
}

body.dark-mode .article-image,
body.dark-mode .article-image-fallback {
    background: #1a2538;
}

body.dark-mode .historical-section,
body.dark-mode .sidebar-stats,
body.dark-mode .factcheck-unavailable,
body.dark-mode .tldr-section {
    background: var(--surface);
}

body.dark-mode .factcheck-unavailable {
    color: #f7dfa1;
}

body.dark-mode .tldr-section {
    border-color: #29446d;
}

body.dark-mode .tldr-badge {
    background: #111827;
    border-color: #29446d;
}

body.dark-mode .tldr-content {
    border-top-color: #29446d;
}

body.dark-mode .nav-item.active {
    background: var(--brand-soft);
}

body.dark-mode .nav-item.active,
body.dark-mode .stat-val,
body.dark-mode .similar-source,
body.dark-mode .factcheck-source-link {
    color: var(--brand);
}

body.dark-mode .dark-mode-btn {
    border-color: var(--border);
}

body.dark-mode .highlight::after {
    background: #f3f4f6;
    color: #111827;
}

@media (max-width: 980px) {
    .main-container {
        width: calc(100% - 24px);
        padding-top: 18px;
    }

    .header {
        gap: 14px;
        padding: 8px 12px;
    }

    .header-left {
        min-width: auto;
    }

    .header-right {
        gap: 10px;
    }

    .modal-content {
        width: calc(100% - 18px);
        margin: 16px auto;
    }

    .historical-section,
    .similar-section,
    .article-body {
        padding-left: 22px;
        padding-right: 22px;
    }
}

@media (max-width: 720px) {
    .header {
        flex-wrap: wrap;
    }

    .search-bar-container {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .header-right {
        margin-left: 0;
    }

    .article-card {
        gap: 14px;
    }

    .article-image,
    .article-image-fallback {
        width: 88px;
        height: 88px;
    }

    .article-title {
        font-size: 28px;
    }

    .similar-grid {
        grid-template-columns: 1fr;
    }

    .factcheck-toggles,
    .tldr-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
