:root {
  --bg: #0d1117; --surface: #161b22; --surface2: #1c2128;
  --border: #30363d; --accent: #2563eb;
  --text: #e6edf3; --text-muted: #8b949e; --text-dim: #6e7681; --heading: #f0f6fc;
}
[data-theme="light"] {
  --bg: #ffffff; --surface: #f6f8fa; --surface2: #eaeef2;
  --border: #d0d7de; --accent: #0969da;
  --text: #1f2328; --text-muted: #656d76; --text-dim: #6e7781; --heading: #1f2328;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; opacity: 0.85; }

.header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 2.5rem 1.5rem 2rem; text-align: center; position: relative; overflow: hidden; }
.header::before { content:''; position:absolute; inset:0; background: radial-gradient(ellipse 60% 50% at 50% -10%, rgba(37,99,235,0.15) 0%, transparent 70%); pointer-events:none; }
.header-eyebrow { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem; opacity: 0.9; }
.header-eyebrow a { color: inherit; }
.header h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; color: var(--heading); letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.header h1 span { color: var(--accent); }
.header-sub { font-size: 0.95rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.nav { background: var(--surface2); border-bottom: 1px solid var(--border); padding: 0.6rem 1.5rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
.nav a { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); padding: 0.3rem 0.55rem; border-radius: 4px; border: 1px solid transparent; transition: color 0.12s, border-color 0.12s, background 0.12s; }
.nav a:hover { color: var(--text); border-color: var(--border); background: var(--surface); text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.page-heading { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.page-heading h2 { font-size: 1.5rem; font-weight: 700; color: var(--heading); margin-bottom: 0.4rem; }
.page-heading p { font-size: 0.9rem; color: var(--text-muted); max-width: 700px; line-height: 1.65; }

.topic-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1rem; }
.topic-pills a { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; transition: all 0.15s; }
.topic-pills a:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.topic-pills a .pill-count { font-size: 0.68rem; opacity: 0.75; font-weight: 700; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.84rem; table-layout: fixed; }
.table thead th { background: var(--surface2); color: var(--text-muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
.table thead th:nth-child(1) { width: 14%; }
.table thead th:nth-child(2) { width: 56%; }
.table thead th:nth-child(3) { width: 30%; }
.table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:nth-child(odd) { background: var(--surface); }
.table tbody tr:nth-child(even) { background: var(--bg); }
.table tbody tr:hover { background: var(--surface2); }
.table td { padding: 0.65rem 1rem; vertical-align: top; color: var(--text); }
.table td:nth-child(1) { white-space: nowrap; color: var(--text-dim); font-size: 0.78rem; font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace; }
.table td:nth-child(2) { word-break: break-word; overflow-wrap: break-word; }
.table td:nth-child(3) { color: var(--text-muted); font-size: 0.82rem; line-height: 1.55; }

.topic-tag { display: inline-block; font-size: 0.6rem; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: var(--surface2); color: var(--text-muted); margin-left: 4px; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.04em; }
.topic-tag:hover { background: var(--accent); color: #fff; text-decoration: none; }

.age-tag { display: inline-block; font-size: 0.55rem; font-weight: 700; padding: 1px 5px; border-radius: 3px; margin-left: 6px; vertical-align: middle; letter-spacing: 0.02em; }
.age-fresh { background: rgba(35,134,54,0.15); color: #3fb950; }
.age-recent { background: rgba(56,139,253,0.15); color: #58a6ff; }
.age-older { background: rgba(139,148,158,0.1); color: var(--text-dim); }
.age-classic { background: rgba(139,148,158,0.06); color: var(--text-dim); opacity: 0.7; }

.footer { text-align: center; padding: 1.5rem 0 2.5rem; margin-top: 2rem; font-size: 0.82rem; color: var(--text-dim); border-top: 1px solid var(--border); }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .container { padding: 1.25rem 1rem 2rem; }
  .nav a { font-size: 0.78rem; padding: 0.4rem 0.65rem; }
  .table-wrap { border: none; border-radius: 0; overflow-x: visible; }
  .table, .table tbody, .table tbody tr, .table tbody td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tbody tr { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 0.75rem; padding: 0.75rem 0.9rem; background: var(--surface) !important; }
  .table tbody tr:hover { background: var(--surface2) !important; }
  .table td { padding: 0; border: none; }
  .table td:nth-child(1) { font-size: 0.72rem; margin-bottom: 0.35rem; }
  .table td:nth-child(2) { font-size: 0.9rem; margin-bottom: 0.5rem; }
  .table td:nth-child(3) { font-size: 0.8rem; line-height: 1.5; padding-top: 0.5rem; border-top: 1px solid var(--border); }
}

/* Index page card grid */
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.source-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); transition: border-color 0.15s, background 0.15s, transform 0.15s; }
.source-card:hover { border-color: var(--accent); background: var(--surface2); text-decoration: none; transform: translateY(-1px); }
.source-card .sc-name { font-size: 0.95rem; font-weight: 700; color: var(--heading); word-break: break-all; }
.source-card .sc-count { font-size: 0.72rem; font-weight: 600; color: var(--accent); letter-spacing: 0.03em; }
.source-card .sc-topics { font-size: 0.75rem; color: var(--text-muted); line-height: 1.45; }