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

:root {
  --bg: #0f0f1a;
  --bg-surface: #1a1a2e;
  --bg-card: #16213e;
  --border: #0f3460;
  --text: #e0e0e0;
  --text-muted: #8892a4;
  --accent: #4fc3f7;
  --accent-hover: #81d4fa;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.nav-links {
  display: flex;
  gap: 1.5rem;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.nav-links a:hover {
  color: var(--text);
}

/* Container */
.container {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.filter-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Diagram grid */
.diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.diagram-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s;
  color: var(--text);
}
.diagram-card:hover {
  border-color: var(--accent);
  color: var(--text);
}
.diagram-card h3 {
  font-size: 1.05rem;
  color: #fff;
}
.diagram-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.diagram-category {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
}
.diagram-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* Diagram view */
.diagram-view {
  padding: 1rem 0;
}
.back-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: 1rem;
}
.diagram-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}
.diagram-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.7;
}
.diagram-figures {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 0 2rem;
}
.diagram-figure {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.diagram-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.diagram-figure .cytoscape {
  width: 100%;
  height: 800px;
  background: var(--bg);
  border-radius: 6px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 0;
}
.empty-state code {
  background: var(--bg-card);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* Not found */
.not-found {
  text-align: center;
  padding: 4rem 0;
}
.not-found h1 {
  font-size: 4rem;
  color: var(--border);
}
.not-found p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
