:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-bg: #eff6ff;
  --code-bg: #f4f4f5;
  --quote-bar: #d1d5db;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --fg: #e6e6e6;
    --muted: #9aa0a6;
    --border: #2a2d33;
    --accent: #6ea8fe;
    --accent-bg: #1c2536;
    --code-bg: #1e2126;
    --quote-bar: #3a3d44;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  font-size: 17px;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.site-header a.site-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--fg);
  text-decoration: none;
}

.site-header .back {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.site-header .back:hover { color: var(--accent); }

h1.title {
  font-size: 26px;
  line-height: 1.4;
  margin: 0 0 8px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.tag:hover { text-decoration: underline; }

article { word-wrap: break-word; }

article h2 { font-size: 21px; margin-top: 2em; }
article h3 { font-size: 18px; margin-top: 1.8em; }

article p, article ul, article ol, article blockquote, article table, article pre {
  margin: 1em 0;
}

article img { max-width: 100%; border-radius: 6px; }

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

article code {
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

article pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
}

article pre code {
  background: none;
  padding: 0;
}

article blockquote {
  margin: 1em 0;
  padding: 2px 16px;
  border-left: 3px solid var(--quote-bar);
  color: var(--muted);
}

article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}

article th, article td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

/* index page */
.controls {
  margin-bottom: 24px;
}

.search-box {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  margin-bottom: 14px;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-filter {
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.tag-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
}

.post-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.post-item a.post-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}

.post-item a.post-title:hover { color: var(--accent); }

.post-item .meta { margin: 4px 0 8px; }

.empty-hint {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}
