:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface2: #f0f0f0;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #666666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --new-badge: #16a34a;
  --tag-bg: #e8f0fe;
  --tag-text: #1e40af;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #252525;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --text-muted: #999999;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --new-badge: #4ade80;
  --tag-bg: #1e3a5f;
  --tag-text: #93c5fd;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* Header */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#header h1 {
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

#updated {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#search {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#search:focus { border-color: var(--accent); }

#theme-toggle {
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
#theme-toggle:hover { background: var(--border); }

/* Tab bar */
#tabs {
  display: flex;
  gap: 2px;
  padding: 8px 16px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
#tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 7px 14px;
  border: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Stats bar */
#stats {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

/* Main content */
#content {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* Section */
.section { margin-bottom: 24px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Article card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }

.card-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 5px;
}
.card-title a {
  color: var(--text);
  text-decoration: none;
}
.card-title a:hover { color: var(--accent); text-decoration: underline; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-new {
  background: var(--new-badge);
  color: #fff;
}
.badge-source {
  background: var(--tag-bg);
  color: var(--tag-text);
}

/* Loading / error */
#loading, #error {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
#error { color: #dc2626; }

/* Responsive */
@media (max-width: 600px) {
  #header { padding: 10px 12px; gap: 8px; }
  #content { padding: 12px; }
  #tabs { padding: 6px 12px 0; }
}
