:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --text-dim: #9aa3b2;
  --accent: #5b9dff;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.site-header,
main,
.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem;
}

.site-header { padding-bottom: 0.5rem; }

.site-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.7rem;
  line-height: 1.2;
}

.subtitle { margin: 0; color: var(--text-dim); }
.cite { font-style: italic; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1rem 0 1.5rem;
}

#search,
#category-filter {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
}

#search {
  flex: 1 1 280px;
  min-width: 0;
}

#search:focus,
#category-filter:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.count {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-left: auto;
}

.category-group { margin-bottom: 2rem; }

.category-group h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.card p {
  margin: 0 0 0.6rem;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.refs {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
}

.refs li { color: var(--text-dim); }
.refs a { color: var(--accent); }

.empty-state,
.error-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.error-state { border-color: #6b3a3a; }
.empty-state code,
.error-state code {
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.hint { color: var(--text-dim); font-size: 0.88rem; }

.site-footer {
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

a { color: var(--accent); }

#overview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
}

#overview h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  border: 0;
}

#category-chart svg {
  display: block;
  max-width: 560px;
}

.bar {
  fill: var(--accent);
  transition: fill 0.15s ease;
}

.bar-row:hover .bar {
  fill: #7ab0ff;
}

.bar-label {
  fill: var(--text);
  font: 600 15px system-ui, sans-serif;
}

.bar-value {
  fill: var(--text-dim);
  font: 14px system-ui, sans-serif;
}
