:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --accent:    #58a6ff;
  --accent-dim:#1f4070;
  --live:      #3fb950;
  --live-bg:   #0d2818;
  --radius:    8px;
  --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Nav ─────────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.3px;
}
.nav-brand span { color: var(--accent); }
.nav-brand:hover { text-decoration: none; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}
.nav-links a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); text-decoration: none; }

/* ── Main ────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
}
.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  letter-spacing: -0.5px;
}
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1rem; max-width: 520px; }

/* ── Section title ───────────────────────────────────────────── */
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Cards ───────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  transition: filter 0.3s, opacity 0.3s;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-name {
  font-weight: 600;
  font-size: 0.975rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-live        { background: var(--live-bg); color: var(--live); border: 1px solid #1a4228; }
.badge-placeholder { background: #1c1f26; color: var(--muted); border: 1px solid var(--border); }

.card-desc {
  font-size: 0.875rem;
  color: var(--muted);
  flex: 1;
}

.card-path {
  font-size: 0.78rem;
  color: var(--accent-dim);
  font-family: ui-monospace, monospace;
  margin-top: 0.25rem;
}

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

/* ── Markdown rendered pages ─────────────────────────────────────── */
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.markdown-body { max-width: 820px; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 700;
  line-height: 1.25;
  margin: 1.75rem 0 0.6rem;
  letter-spacing: -0.3px;
}
.markdown-body h1 { font-size: 1.75rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 1.3rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body h4 { font-size: 0.95rem; color: var(--muted); }

.markdown-body p  { margin: 0.75rem 0; color: var(--muted); font-size: 0.925rem; line-height: 1.7; }
.markdown-body li { color: var(--muted); font-size: 0.925rem; line-height: 1.7; }
.markdown-body ul,
.markdown-body ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.markdown-body li + li { margin-top: 0.2rem; }

.markdown-body a { color: var(--accent); }

.markdown-body code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--text);
}

.markdown-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
}
.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.markdown-body blockquote {
  border-left: 3px solid var(--border);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 0.75rem 0;
  color: var(--muted);
}
.markdown-body blockquote p { margin: 0; }

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0;
}
.markdown-body th,
.markdown-body td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.markdown-body th { background: var(--surface); color: var(--text); font-weight: 600; }
.markdown-body td { color: var(--muted); }
.markdown-body tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* ── Doc list (docs page) ────────────────────────────────────────── */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.doc-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

.doc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.doc-title {
  font-weight: 600;
  font-size: 0.975rem;
}

.doc-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  white-space: nowrap;
}

.doc-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.doc-path {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  margin-top: 0.1rem;
}

/* ── Info grid (about page) ──────────────────────────────────────── */
.info-grid {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-row {
  display: flex;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.info-row:last-child { border-bottom: none; }
.info-row:nth-child(even) { background: rgba(255,255,255,0.02); }

.info-label {
  color: var(--muted);
  min-width: 130px;
  font-size: 0.85rem;
}

.info-value { color: var(--text); }

.prose {
  color: var(--muted);
  font-size: 0.925rem;
  max-width: 580px;
  line-height: 1.7;
}

/* ── Disabled card ───────────────────────────────────────────────── */
.card-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  nav { padding: 0 1rem; }
  main { padding: 2rem 1rem 3rem; }
  .hero h1 { font-size: 1.5rem; }
  .cards { grid-template-columns: 1fr; }
}
