:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --code-bg: #1e293b;
  --code-fg: #e2e8f0;
  --inline-code-bg: #f1f5f9;
  --max-width: 820px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-title:hover {
  text-decoration: none;
  color: var(--accent);
}

.brand-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

.nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: calc(100vh - 180px);
}

.intro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 26px;
}

.intro-card h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.intro-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-pill {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.86rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.filter-pill.active,
.filter-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

.badge.life {
  background: #fef3c7;
  color: #b45309;
}

.post-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.45;
}

.post-title a {
  color: var(--text);
}

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

.post-summary {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 30px;
}

.article-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.article-header h1 {
  margin: 0 0 10px;
  font-size: 1.65rem;
  line-height: 1.38;
}

.article-body h2 {
  margin-top: 28px;
  margin-bottom: 12px;
  font-size: 1.3rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  margin-top: 22px;
  margin-bottom: 10px;
  font-size: 1.12rem;
}

.article-body h4 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.article-body p {
  margin: 0 0 14px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 6px;
}

.article-body blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent);
  background: #f8fafc;
  color: #475569;
  border-radius: 0 6px 6px 0;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: var(--inline-code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: #0f172a;
}

.code-wrap {
  position: relative;
  margin: 16px 0;
  background: var(--code-bg);
  border-radius: 8px;
  overflow: hidden;
}

.code-lang {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 6px 14px 0;
  letter-spacing: 0.04em;
}

.code-wrap pre {
  margin: 0;
  padding: 10px 16px 14px;
  overflow-x: auto;
  line-height: 1.55;
}

.code-wrap pre code {
  background: transparent;
  color: var(--code-fg);
  padding: 0;
  font-size: 0.87rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

th {
  background: #f8fafc;
  font-weight: 600;
}

.md-figure {
  margin: 18px 0;
  text-align: center;
}

.md-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.md-figure figcaption {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.md-center {
  text-align: center;
  font-weight: 600;
}

.warn-text {
  color: #b91c1c;
  font-weight: 600;
}

.article-nav {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer .icp a {
  color: var(--text-muted);
}

.site-footer .icp a:hover {
  color: var(--accent);
}

.site-footer .sep {
  margin: 0 8px;
  color: #d1d5db;
}

@media (max-width: 640px) {
  .article-card {
    padding: 20px 18px;
  }
  .post-card {
    padding: 16px 18px;
  }
  .article-header h1 {
    font-size: 1.38rem;
  }
}
