:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-hover: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --text-dim: #484f58;
  --accent: #58a6ff;
  --accent-dim: #1f4068;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 6px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

/* ── Layout ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  z-index: 100;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.site-title .prompt {
  color: var(--green);
}

.site-title .cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--accent);
  animation: blink 1.2s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

nav {
  display: flex;
  gap: 4px;
}

nav a {
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: all 0.15s;
}

nav a:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

nav a.active {
  color: var(--accent);
}

/* ── Search bar ── */
.search-bar {
  margin: 40px 0 24px;
  position: relative;
}

.search-bar input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 12px 10px 36px;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar input::placeholder {
  color: var(--text-dim);
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}

/* ── Category tabs ── */
.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.cat-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 14px;
  transition: all 0.15s;
}

.cat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cat-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Post list ── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.post-item:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
  text-decoration: none;
}

.post-title {
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-title .arrow {
  color: var(--text-dim);
  font-size: 12px;
  transition: transform 0.15s;
}

.post-item:hover .arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.post-date {
  color: var(--text-dim);
  font-size: 12px;
}

.cat-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid;
}

.cat-tag.技术  { color: var(--accent);  border-color: var(--accent-dim);  background: rgba(88,166,255,0.08); }
.cat-tag.随笔  { color: var(--green);   border-color: rgba(63,185,80,0.3); background: rgba(63,185,80,0.08); }
.cat-tag.日记  { color: var(--purple);  border-color: rgba(188,140,255,0.3); background: rgba(188,140,255,0.08); }
.cat-tag.读书  { color: var(--yellow);  border-color: rgba(210,153,34,0.3); background: rgba(210,153,34,0.08); }
.cat-tag.生活  { color: #ff7b72;        border-color: rgba(248,81,73,0.3);  background: rgba(248,81,73,0.08); }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
}

.empty .icon {
  font-size: 32px;
  margin-bottom: 12px;
}

/* ── Post count ── */
.result-info {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 16px;
}

.result-info span {
  color: var(--text-muted);
}

/* ── Hero section ── */
.hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.hero-line {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 4px;
}

.hero-line .comment { color: var(--text-dim); }
.hero-line .key     { color: var(--purple); }
.hero-line .val     { color: var(--green); }
.hero-line .str     { color: var(--yellow); }

/* ── Single post page ── */
.post-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.post-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  font-family: var(--font-sans);
  line-height: 1.4;
}

.post-header .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
}

.post-body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.8;
  color: #cdd9e5;
  padding-bottom: 80px;
}

.post-body h1,
.post-body h2,
.post-body h3 {
  font-family: var(--font-mono);
  color: var(--text);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-body h1 { font-size: 20px; }
.post-body h2 { font-size: 17px; }
.post-body h3 { font-size: 15px; border-bottom: none; }

.post-body p { margin: 0 0 16px; }

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

.post-body code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--purple);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 6px;
}

.post-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow-x: auto;
  padding: 16px 20px;
}

.post-body pre code {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 0;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  margin: 20px 0;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

.post-body li { margin-bottom: 4px; }

.post-body img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13px;
}

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

.post-body th {
  background: var(--bg-secondary);
  color: var(--text);
  font-family: var(--font-mono);
}

/* ── Back button ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 28px;
  padding: 6px 0;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  color: var(--text-dim);
  font-size: 12px;
}

.footer-text span { color: var(--text-muted); }

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
  font-size: 13px;
}

.loading::before {
  content: '$ ';
  color: var(--green);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .post-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .post-meta { justify-content: flex-start; }
  .hero { padding: 32px 0 24px; }
  header .container { flex-wrap: wrap; }
}
