:root {
  --bg: #0b0c10;
  --bg-grad-top: #132134;
  --bg-grad-bottom: #0b0c10;
  --card-bg: #15171d;
  --card-hover: #1c1f26;
  --text: #e6e8ec;
  --muted: #a3a9b7;
  --brand: #6ee7ff;
  --brand-glow: rgba(110, 231, 255, 0.3);
  --accent: #9ef2d5;
  --border: #242832;
  --pill: #1f2230;
  --pill-hover: #2a2d3d;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --section-gap: 40px;
  --header-bg-blur: rgba(11, 12, 16, 0.8);
  --md-pre-bg: #161b22;
  --md-code-inline-bg: rgba(110, 118, 129, 0.4);
}
:root[data-theme="light"] {
  --bg: #f7f8fb;
  --bg-grad-top: #ffffff;
  --bg-grad-bottom: #eef1f6;
  --card-bg: #ffffff;
  --card-hover: #f3f5f9;
  --text: #1c1f26;
  --muted: #5d6474;
  --brand: #0066ff;
  --brand-glow: rgba(0, 102, 255, 0.18);
  --accent: #2bb673;
  --border: #e5e8ef;
  --pill: #f2f4f8;
  --pill-hover: #e8ebf3;
  --header-bg-blur: rgba(255, 255, 255, 0.8);
  --md-pre-bg: #f5f7fb;
  --md-code-inline-bg: rgba(110, 118, 129, 0.14);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
@media (min-width: 768px) {
  :root {
    --section-gap: 80px;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC","Hiragino Sans GB","Microsoft Yahei","Noto Sans CJK SC",sans-serif;
  background: radial-gradient(1200px 500px at 50% 0%, var(--bg-grad-top) 0%, var(--bg-grad-bottom) 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

main > section {
  margin-bottom: var(--section-gap);
}
main > section:last-of-type {
  margin-bottom: 0;
}

header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  background: var(--header-bg-blur);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { 
  display: flex; align-items: center; gap: 10px; 
  font-weight: 600; font-size: 16px; color: var(--text);
}
.logo { font-size: 22px; }
.logo-img { width: 22px; height: 22px; display: block; object-fit: contain; }
.nav-links {
  display: none;
  gap: 20px;
}
.nav-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); }
.nav .cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 16px; border-radius: 999px;
  background: linear-gradient(135deg, #2b3346, #1e2433);
  border: 1px solid var(--border); color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: all 0.2s;
}
.nav .cta:hover {
  border-color: var(--brand);
  box-shadow: 0 0 12px var(--brand-glow);
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

.hero {
  padding: 60px 0 20px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--section-gap);
}
.hero h1 { 
  margin: 0 0 16px; 
  font-size: 32px; 
  background: linear-gradient(to right, #fff, #a3a9b7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.hero p { margin: 0 0 20px; color: var(--muted); font-size: 16px; }
.badge { 
  display: inline-block; padding: 4px 12px; 
  border-radius: 999px; background: rgba(110, 231, 255, 0.1); 
  color: var(--brand); border: 1px solid rgba(110, 231, 255, 0.2); 
  font-size: 12px; margin-bottom: 24px;
}
.kpis { 
  margin: 24px 0; display: flex; flex-wrap: wrap; 
  justify-content: center; gap: 10px; 
}

.pill { 
  display: inline-flex; align-items: center; gap: 6px; 
  padding: 6px 14px; border-radius: 999px; 
  background: var(--pill); border: 1px solid var(--border); 
  color: var(--muted); cursor: pointer; transition: all 0.2s;
  font-size: 13px;
}
.pill:hover, .pill.active {
  background: var(--pill-hover);
  color: var(--text);
  border-color: var(--muted);
}

.search {
  display: flex; gap: 10px; margin: 30px auto 0;
  max-width: 500px;
}
.search input {
  flex: 1; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(21, 23, 29, 0.6); color: var(--text);
  outline: none; transition: all 0.2s;
  font-size: 14px;
}
.search input:focus {
  border-color: var(--brand);
  background: rgba(21, 23, 29, 0.9);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.toolbar {
  margin-top: 20px; display: flex; flex-wrap: wrap; 
  justify-content: center; gap: 8px;
}

.grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s ease-in-out;
  display: flex; flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: var(--muted);
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 10px; font-size: 18px; color: var(--text); }
.list { margin: 0; padding-left: 20px; color: var(--muted); }

.notes {
  display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 20px;
}
@media (min-width: 768px) { .notes { grid-template-columns: repeat(2, 1fr); } }

.note-card {
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  padding: 16px; 
  background: var(--card-bg);
  transition: all 0.2s;
}
.note-card:hover {
  background: var(--card-hover);
  border-color: var(--brand);
  box-shadow: var(--shadow);
}
.note-title { margin: 0 0 8px; font-weight: 600; font-size: 15px; color: var(--text); }
.note-desc { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.note-meta .pill {
  padding: 2px 8px; font-size: 11px; height: auto;
  background: rgba(255,255,255,0.05); border: none;
}
.fav-btn {
  margin-left: auto;
  background: none; border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted);
  font-size: 12px; padding: 4px 10px; cursor: pointer;
}
.fav-btn.active { color: var(--brand); border-color: var(--brand); }
.pager { margin-top: 16px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pill.disabled { opacity: 0.6; pointer-events: none; }
mark { background: rgba(255, 228, 0, 0.25); color: inherit; padding: 0 2px; border-radius: 3px; }
.fav-btn {
  margin-left: auto;
  background: none; border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted);
  font-size: 12px; padding: 4px 10px; cursor: pointer;
}
.fav-btn.active { color: var(--brand); border-color: var(--brand); }
mark {
  background: rgba(255, 228, 0, 0.25);
  color: inherit;
  padding: 0 2px; border-radius: 3px;
}

footer {
  margin-top: var(--section-gap);
  padding: 32px 0;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); 
  color: var(--muted); text-align: center;
  font-size: 13px;
}
.footer .beian {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.footer .beian a { color: var(--muted); }
.footer .beian a:hover { color: var(--text); text-decoration: underline; }
.footer .links {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.footer .links a { color: var(--muted); }
.footer .links a:hover { color: var(--text); text-decoration: underline; }

.modal {
  display: none; position: fixed; z-index: 1000;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: 20px;
}
.modal.show { display: flex; align-items: flex-start; justify-content: center; animation: fadeIn 0.2s; }
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 800px;
  margin: 40px auto;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  display: flex; flex-direction: column;
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--card-bg); z-index: 10;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-title { margin: 0; font-size: 18px; font-weight: 600; }
.close-btn {
  background: none; border: none; color: var(--muted);
  font-size: 24px; cursor: pointer; padding: 0 8px;
  transition: color 0.2s;
}
.close-btn:hover { color: var(--text); }
.markdown-body {
  padding: 24px;
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25;
  color: var(--text);
}
.markdown-body h1 { font-size: 2em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.markdown-body p { margin-bottom: 16px; }
.markdown-body blockquote {
  margin: 0 0 16px; padding: 0 1em;
  color: var(--muted); border-left: 0.25em solid var(--border);
}
.markdown-body code {
  padding: 0.2em 0.4em; margin: 0; font-size: 85%;
  background-color: var(--md-code-inline-bg); border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}
.markdown-body pre {
  padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45;
  background-color: var(--md-pre-bg); border-radius: 6px; margin-bottom: 16px;
}
.markdown-body pre code { background-color: transparent; padding: 0; }
.markdown-body ul, .markdown-body ol { padding-left: 2em; margin-bottom: 16px; }
.markdown-body img { max-width: 100%; box-sizing: content-box; background-color: #fff; }

/* 简化文章列表样式（blog-list & category-list） */
#blog-list .card, #category-list .card {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}
#blog-list .card h3, #category-list .card h3 {
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--muted);
}
#blog-list .notes, #category-list .notes {
  gap: 8px;
  margin-top: 8px;
}
#blog-list .blog-ul, #category-list .blog-ul { list-style: none; padding: 0; margin: 0; }
#blog-list .blog-ul, #category-list .blog-ul { counter-reset: blog-index; }
#blog-list .blog-item, #category-list .blog-item {
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
#blog-list .blog-item::before, #category-list .blog-item::before {
  counter-increment: blog-index;
  content: counter(blog-index) ".";
  display: inline-block;
  width: 28px;
  text-align: right;
  color: var(--muted);
  margin-right: 4px;
}
#blog-list .blog-item .note-link, #category-list .blog-item .note-link {
  flex: 1; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#blog-list .blog-item .fav-btn, #category-list .blog-item .fav-btn {
  font-size: 12px; padding: 2px 8px;
}

#fav-notes .fav-ul { list-style: none; padding: 0; margin: 0; }
#fav-notes .fav-ul { counter-reset: fav-index; }
#fav-notes .fav-item {
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
#fav-notes .fav-item::before {
  counter-increment: fav-index;
  content: counter(fav-index) ".";
  display: inline-block;
  width: 28px;
  text-align: right;
  color: var(--muted);
  margin-right: 4px;
}
#fav-notes .fav-item .note-link {
  flex: 1; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#fav-notes .fav-item .fav-btn {
  font-size: 12px; padding: 2px 8px;
}

/* 分类折叠面板（极简） */
#blog-list .cat-block {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
#blog-list .cat-block:last-child { border-bottom: none; }
#blog-list .cat-block > summary {
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
#blog-list .cat-block > summary::-webkit-details-marker { display: none; }
#blog-list .cat-title { font-size: 14px; color: var(--text); flex: 1; }
#blog-list .cat-count { 
  font-size: 11px; color: var(--muted); 
  background: var(--pill); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px;
}
#blog-list .cat-block[open] > summary .cat-title { color: var(--brand); }
#blog .toolbar { justify-content: center; }
