:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

h1 { font-size: 2.2rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h2 { font-size: 1.6rem; margin-top: 2.5rem; margin-bottom: 1rem; color: var(--accent); }
h3 { font-size: 1.25rem; margin-top: 1.8rem; margin-bottom: 0.6rem; }
h4 { font-size: 1.05rem; margin-top: 1.2rem; margin-bottom: 0.4rem; color: var(--text-muted); }

p { margin-bottom: 1rem; }

.subtitle { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 2rem; }
.date { color: var(--text-muted); font-size: 0.9rem; }

nav.breadcrumb { margin-bottom: 2rem; font-size: 0.9rem; color: var(--text-muted); }
nav.breadcrumb a { color: var(--text-muted); }
nav.breadcrumb a:hover { color: var(--accent); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin-top: 0; font-size: 1.15rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0; }
.card a { display: block; text-decoration: none; color: inherit; }
.card a:hover { text-decoration: none; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}
th, td {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}
th { background: var(--surface); color: var(--accent); font-weight: 600; }
td { background: var(--surface-2); }
tr:hover td { background: var(--surface); }

ul, ol { margin: 0.8rem 0 1.2rem 1.5rem; }
li { margin-bottom: 0.4rem; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.8rem 1.2rem;
  margin: 1.2rem 0;
  background: var(--surface);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-style: italic;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  flex: 1;
  min-width: 200px;
  text-align: center;
}
.stat-box .number { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-box .label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.3rem; }

.highlight { color: var(--green); font-weight: 600; }
.warning { color: var(--yellow); font-weight: 600; }
.danger { color: var(--red); font-weight: 600; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.toc h3 { margin-top: 0; }
.toc ul { margin-bottom: 0; }
.toc li { margin-bottom: 0.3rem; }

.source-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  margin-top: 2rem;
  font-size: 0.85rem;
}
.source-list h3 { margin-top: 0; font-size: 1rem; color: var(--text-muted); }
.source-list li { color: var(--text-muted); margin-bottom: 0.2rem; }

.nav-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}
.nav-footer a { padding: 0.5rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.nav-footer a:hover { border-color: var(--accent); text-decoration: none; }

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.3rem;
}
.tag-green { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.tag-yellow { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.tag-red { background: rgba(248, 81, 73, 0.15); color: var(--red); }
.tag-blue { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.tag-purple { background: rgba(188, 140, 255, 0.15); color: var(--purple); }

@media (max-width: 768px) {
  body { padding: 1rem; }
  h1 { font-size: 1.7rem; }
  .card-grid { grid-template-columns: 1fr; }
  .stat-row { flex-direction: column; }
  .nav-footer { flex-direction: column; gap: 0.5rem; }
}
