@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600&family=Sora:wght@400;600;700&display=swap');

:root {
    --bg: oklch(98% 0.005 260);
    --bg-surface: oklch(96% 0.005 260);
    --bg-card: oklch(99% 0.003 260);
    --bg-dark: oklch(20% 0.02 260);
    --bg-dark-surface: oklch(25% 0.02 260);
    --bg-dark-card: oklch(22% 0.02 260);
    --text-primary: oklch(20% 0.02 260);
    --text-secondary: oklch(45% 0.02 260);
    --text-muted: oklch(50% 0.01 260);
    --accent: oklch(50% 0.2 250);
    --accent-hover: oklch(45% 0.22 250);
    --accent-subtle: oklch(92% 0.05 250);
    --border: oklch(88% 0.01 260);
    --border-hover: oklch(78% 0.02 260);
    --success: oklch(65% 0.18 150);
    --warning: oklch(75% 0.15 80);
    --error: oklch(60% 0.2 25);
    --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.06);
    --shadow-md: 0 4px 12px oklch(0% 0 0 / 0.08);
    --shadow-lg: 0 8px 32px oklch(0% 0 0 / 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-overlay: 30;
    --z-modal: 50;
    --z-toast: 70;
}

.dark {
    --bg: oklch(12% 0.02 260);
    --bg-surface: oklch(16% 0.02 260);
    --bg-card: oklch(20% 0.02 260);
    --text-primary: oklch(92% 0.005 260);
    --text-secondary: oklch(72% 0.01 260);
    --text-muted: oklch(55% 0.01 260);
    --accent: oklch(70% 0.2 250);
    --accent-hover: oklch(75% 0.22 250);
    --accent-subtle: oklch(25% 0.08 250);
    --border: oklch(28% 0.02 260);
    --border-hover: oklch(38% 0.02 260);
    --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0% 0 0 / 0.3);
    --shadow-lg: 0 8px 32px oklch(0% 0 0 / 0.4);
}

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

html {
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.125rem);
    scroll-behavior: smooth;
}

body {
    font-family: 'Onest', system-ui, sans-serif;
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', system-ui, sans-serif;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-5);
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.app-header .logo {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.app-header .logo .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Buttons */
.btn {
    font-family: 'Onest', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition: all 150ms ease-out;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
}

.btn:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-sm {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-3);
    min-height: 44px;
}

.btn-danger { color: var(--error); }
.btn-danger:hover { background: oklch(95% 0.03 25); }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms ease-out, transform 150ms ease-out;
}

.card-clickable:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    cursor: pointer;
}

.card-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Report cards grid */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: var(--space-5);
}

.report-card .report-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.report-card .report-title {
    font-size: 1.05rem;
    margin-bottom: var(--space-2);
}

.report-card .report-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-accent { background: var(--accent-subtle); color: var(--accent); }
.badge-success { background: oklch(92% 0.04 150); color: var(--success); }
.badge-warning { background: oklch(94% 0.04 80); color: oklch(55% 0.15 80); }
.badge-error { background: oklch(94% 0.04 25); color: var(--error); }
.badge-muted { background: var(--bg-surface); color: var(--text-muted); }

.dark .badge-success { background: oklch(25% 0.06 150); }
.dark .badge-warning { background: oklch(25% 0.06 80); }
.dark .badge-error { background: oklch(25% 0.06 25); }
.dark .badge-accent { background: oklch(25% 0.08 250); }

/* Forms */
.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-primary);
    font-family: 'Onest', sans-serif;
    font-size: 0.9rem;
    min-height: 44px;
    transition: border-color 150ms ease-out;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px oklch(50% 0.2 250 / 0.15);
}

/* Skip navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: 8px;
    z-index: 100;
    background: var(--bg-card);
    color: var(--accent);
}

.skip-link:focus {
    top: 0;
}

.form-input::placeholder { color: var(--text-muted); }

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-5);
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: var(--space-2);
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: var(--space-6);
}

.login-error {
    padding: var(--space-3) var(--space-4);
    background: oklch(94% 0.04 25);
    color: var(--error);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: var(--space-4);
    display: none;
}

.dark .login-error { background: oklch(25% 0.06 25); }

/* Dashboard sections */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.section-title {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Parse controls */
.parse-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.parse-select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: 'Onest', sans-serif;
    font-size: 0.85rem;
    min-height: 44px;
    cursor: pointer;
}

/* Status bar */
.status-bar {
    display: none;
    flex-direction: column;
    padding: var(--space-4) var(--space-5);
    background: var(--accent-subtle);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    gap: var(--space-2);
}

.status-bar.active { display: flex; }

.status-bar-top {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.status-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.status-phase {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.status-percent {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 0;
}

.status-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.2em;
}

/* Settings panel */
.settings-panel {
    margin-top: var(--space-6);
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.keyword-tag button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyword-tag button:hover { color: var(--error); }

.keyword-add {
    display: flex;
    gap: var(--space-2);
}

.keyword-add .form-input { max-width: 300px; }

/* Header navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav-link {
    font-family: 'Onest', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 150ms ease-out;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.nav-link-active {
    color: var(--accent);
    background: var(--accent-subtle);
    font-weight: 600;
}

.nav-link-active:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

/* API Keys page */
.keys-table {
    margin-bottom: var(--space-4);
}

.key-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    background: var(--bg-surface);
    flex-wrap: wrap;
}

.key-value {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
    min-width: 120px;
}

.key-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.key-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.keys-add-section {
    margin-top: var(--space-4);
}

.form-textarea {
    resize: vertical;
    min-height: 88px;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

/* Report view */
.report-view {
    max-width: 800px;
    margin: 0 auto;
}

.report-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.report-content {
    max-width: 65ch;
    line-height: 1.8;
    font-size: 0.95rem;
}

.report-content h1 { font-size: 1.8rem; margin: var(--space-6) 0 var(--space-4); }
.report-content h2 { font-size: 1.4rem; margin: var(--space-5) 0 var(--space-3); }
.report-content h3 { font-size: 1.15rem; margin: var(--space-4) 0 var(--space-2); }
.report-content p { margin-bottom: var(--space-4); }
.report-content ul, .report-content ol { margin-bottom: var(--space-4); padding-left: var(--space-5); }
.report-content li { margin-bottom: var(--space-2); }
.report-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: var(--space-4);
    margin: var(--space-4) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.report-content strong { font-weight: 600; }
.report-content a { color: var(--accent); text-decoration: underline; }

/* Video list in report */
.video-list {
    margin-top: var(--space-6);
}

.video-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    background: var(--bg-card);
}

.video-thumb {
    position: relative;
    flex-shrink: 0;
    width: 160px;
    height: 90px;
}
.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.video-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.3;
}

.video-item-info { flex: 1; min-width: 0; }
.video-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.video-item-channel { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: var(--space-1); }
.video-item-stats { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: var(--space-3); flex-wrap: wrap; }
.video-item-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-title { margin: 0; font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 var(--space-1);
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body {
    padding: var(--space-4) var(--space-5);
    overflow-y: auto;
    flex: 1;
}
.modal-empty { color: var(--text-muted); text-align: center; padding: var(--space-6) 0; }

/* Comments */
.comment {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-reply {
    margin-left: var(--space-5);
    padding-left: var(--space-3);
    border-left: 2px solid var(--border);
    border-bottom: none;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
}
.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-likes { font-size: 0.75rem; color: var(--text-muted); }
.comment-text { font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* Transcript */
.transcript-text {
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-family: inherit;
}

.videos-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.videos-header h2 { margin: 0; }
.videos-count { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-5);
    padding: var(--space-3) 0;
}
.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.15s ease;
}
.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.pagination-btn-active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.pagination-btn-active:hover {
    background: var(--accent-hover);
}
.pagination-ellipsis {
    padding: 0 var(--space-1);
    color: var(--text-muted);
    user-select: none;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--border) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-card {
    height: 160px;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--space-2);
}

.skeleton-text-lg { height: 1.5rem; width: 60%; }

/* Toast */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    max-width: 360px;
    animation: toastIn 200ms ease-out;
}

.toast-error { border-color: var(--error); }
.toast-success { border-color: var(--success); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state p { font-size: 0.9rem; }

/* Dark mode toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all 150ms ease-out;
}

.theme-toggle:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* Articles / Insights */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.article-card {
    display: flex;
    gap: var(--space-5);
    padding: var(--space-5);
    align-items: flex-start;
}

.article-card-number {
    font-family: 'Sora', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.25;
    line-height: 1;
    flex-shrink: 0;
    min-width: 48px;
    text-align: right;
}

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

.article-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
    line-height: 1.3;
}

.article-card-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-footer {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-card-footer .badge { font-size: 0.68rem; }

/* Article view */
.article-view {
    max-width: 820px;
    margin: 0 auto;
}

.article-header-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.article-body {
    margin-top: var(--space-5);
}

.article-body .article-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-3);
}

.article-body .article-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.article-content {
    max-width: 68ch;
    line-height: 1.85;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.article-content h1 {
    font-size: 1.6rem;
    margin: var(--space-7) 0 var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.article-content h2 {
    font-size: 1.3rem;
    margin: var(--space-6) 0 var(--space-3);
    color: var(--text-primary);
}

.article-content h3 {
    font-size: 1.08rem;
    margin: var(--space-5) 0 var(--space-2);
    color: var(--text-primary);
}

.article-content p { margin-bottom: var(--space-4); }

.article-content ul, .article-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-5);
}

.article-content li {
    margin-bottom: var(--space-2);
    line-height: 1.7;
}

.article-content li::marker { color: var(--accent); }

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: var(--space-3) var(--space-4);
    margin: var(--space-4) 0;
    background: var(--bg-surface);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content strong { font-weight: 600; color: var(--text-primary); }
.article-content em { color: var(--text-secondary); }

.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: oklch(50% 0.2 250 / 0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 150ms;
}

.article-content a:hover {
    text-decoration-color: var(--accent);
}

.article-content code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.article-content pre {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    overflow-x: auto;
    margin-bottom: var(--space-4);
}

.article-content pre code {
    background: none;
    border: none;
    padding: 0;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-4);
    font-size: 0.88rem;
}

.article-content th, .article-content td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    text-align: left;
}

.article-content th {
    background: var(--bg-surface);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Article images and video cards */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: var(--space-2) 0;
}

.article-video-card {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: all 150ms;
    overflow: hidden;
}

.article-video-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.article-video-card-thumb {
    position: relative;
    flex-shrink: 0;
    width: 240px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.article-video-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}

.article-video-card-thumb::after {
    content: "\25B6";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 1.8rem;
    opacity: 0;
    transition: opacity 150ms;
}

.article-video-card:hover .article-video-card-thumb::after {
    opacity: 1;
}

.article-video-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-1);
}

.article-video-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-video-card-channel {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.article-video-card-stats {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    gap: var(--space-3);
}

@media (max-width: 820px) {
    .article-video-card { flex-direction: column; }
    .article-video-card-thumb { width: 100%; aspect-ratio: 16/9; }
}

/* Article screenshot figures */
.article-screenshot {
    margin: var(--space-5) 0;
    padding: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

.article-screenshot a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.article-screenshot img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    border-radius: 0;
    transition: opacity 150ms;
}

.article-screenshot a:hover img {
    opacity: 0.9;
}

.article-screenshot figcaption {
    padding: var(--space-3) var(--space-4);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    border-top: 1px solid var(--border);
}

.article-screenshot figcaption a {
    display: inline;
    color: var(--accent);
    text-decoration: none;
}

.article-screenshot figcaption a:hover {
    text-decoration: underline;
}

.screenshot-channel {
    font-weight: 500;
    color: var(--text-secondary);
}

/* YouTube source link styling inside articles */
.article-content .yt-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 2px 10px 2px 6px;
    font-size: 0.78rem;
    font-style: normal;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 150ms;
    vertical-align: middle;
    white-space: nowrap;
}

.article-content .yt-source:hover {
    border-color: var(--error);
    color: var(--error);
    text-decoration: none;
}

.article-content .yt-source::before {
    content: "\25B6";
    font-size: 0.65rem;
    color: var(--error);
}

/* Source videos section */
.article-sources {
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.article-sources h3 {
    font-size: 1rem;
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

.source-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: var(--space-3);
}

.source-video-card {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    text-decoration: none;
    color: inherit;
    transition: all 150ms;
}

.source-video-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
    color: inherit;
}

.source-video-thumb {
    width: 100px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.source-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.source-video-info { flex: 1; min-width: 0; }

.source-video-title {
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 2px;
}

.source-video-channel {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Responsive — mobile + tablet (iPad Mini ~768px) */
@media (max-width: 820px) {
    .app-container { padding: var(--space-3); }
    .app-header {
        flex-wrap: wrap;
        gap: var(--space-3);
    }
    .header-nav {
        order: 3;
        width: 100%;
    }
    .header-actions { margin-left: auto; }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    .parse-controls { width: 100%; flex-wrap: wrap; }
    .parse-select { width: 100%; }
    .btn-primary { width: 100%; }
    .reports-grid { grid-template-columns: 1fr; }
    .video-item { flex-direction: column; }
    .video-thumb { width: 100%; height: auto; }
    .video-thumb img { width: 100%; height: auto; aspect-ratio: 16/9; }
    .video-item-title { white-space: normal; }
    .key-row { flex-direction: column; align-items: flex-start; }
    .key-value { width: 100%; word-break: break-all; }
    .modal { max-width: 95vw; max-height: 90vh; }
    .report-content { max-width: 100%; }
    .report-nav { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
    .keyword-add { flex-direction: column; }
    .keyword-add .form-input { max-width: 100%; }
    .toast-container { left: var(--space-3); right: var(--space-3); }
    .toast { max-width: 100%; }
    .settings-panel { padding: var(--space-4); }
    .videos-header { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
    .article-card { flex-direction: column; gap: var(--space-3); }
    .article-card-number { min-width: unset; text-align: left; font-size: 1.8rem; }
    .article-view { max-width: 100%; }
    .article-content { max-width: 100%; }
    .source-videos-grid { grid-template-columns: 1fr; }
}

/* Print styles */
@media print {
    body { background: white; background-image: none; }
    .app-header, .parse-controls, .settings-panel, .theme-toggle, .btn { display: none; }
    .report-content { max-width: 100%; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* Motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
