:root {
  --bg: #f5f7fb;
  --bg-grad-1: rgba(120, 150, 255, .10);
  --bg-grad-2: rgba(120, 150, 255, .12);
  --card: #ffffff;
  --card-2: #f7f8fc;
  --text: #1d2130;
  --text-2: #3d4356;
  --muted: #7a8195;
  --border: #e9ecf3;
  --primary: #4b6bfb;
  --primary-2: #7b5cff;
  --primary-soft: rgba(75, 107, 251, .1);
  --hot: #ff5b5b;
  --shadow: 0 1px 2px rgba(20, 30, 70, .04), 0 6px 24px rgba(20, 30, 70, .05);
  --shadow-lg: 0 12px 40px rgba(20, 30, 70, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e1116;
  --bg-grad-1: rgba(90, 120, 255, .07);
  --bg-grad-2: rgba(90, 120, 255, .08);
  --card: #161a22;
  --card-2: #1c212b;
  --text: #e7e9f0;
  --text-2: #c3c8d6;
  --muted: #8a91a5;
  --border: #252b37;
  --primary: #7b93ff;
  --primary-2: #a28bff;
  --primary-soft: rgba(123, 147, 255, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background:
    radial-gradient(900px 500px at -10% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 600px at 110% -5%, var(--bg-grad-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; }
button, input, textarea { font: inherit; color: inherit; }
.icon { flex-shrink: 0; vertical-align: -0.15em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-inner { display: flex; align-items: center; gap: 28px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 17px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}
.brand-name { font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 14px; border-radius: 999px; color: var(--text-2); font-size: 14.5px; white-space: nowrap; transition: background .2s, color .2s; }
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 10px;
  border: 1px solid var(--border); background: var(--card); border-radius: 12px; cursor: pointer; color: var(--text-2);
  transition: border-color .2s, color .2s, transform .1s;
}
.icon-btn:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.icon-btn:active { transform: scale(.96); }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; line-height: 18px; }
.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: inline; }
.nav-toggle { display: none; }

/* Layout grids */
main { padding: 24px 0 48px; min-height: calc(100vh - var(--header-h) - 180px); }
.layout-3 { display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.layout-2, .layout-article { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.main-col, .left-col, .side-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.main-col > *, .left-col > *, .side-col > * { flex-shrink: 0; }
.left-col, .side-col { position: sticky; top: calc(var(--header-h) + 20px); }
.article-side { max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; scrollbar-width: thin; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 14px; }

/* Profile */
.profile { padding: 28px 16px 20px; text-align: center; background: var(--card); }
.profile-cover { display: none; }
.profile .avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; background: var(--card-2); border: 2px solid var(--border); }
.profile-name { font-weight: 700; font-size: 18px; margin-top: 6px; }
.profile-bio { color: var(--muted); font-size: 13.5px; margin: 6px 20px 0; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 16px 0; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.profile-stats > * { display: flex; flex-direction: column; line-height: 1.3; }
.profile-stats strong { font-size: 18px; }
.profile-stats span { font-size: 12px; color: var(--muted); }
.profile-social { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.profile-social > * { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); color: var(--text-2); cursor: pointer; transition: all .2s; }
.profile-social > *:hover { background: var(--primary); color: #fff; }
.social-pop { position: relative; }
.social-pop .pop {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(6px); opacity: 0; pointer-events: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; box-shadow: var(--shadow-lg); transition: all .2s; width: 160px; color: var(--text);
}
.social-pop .pop img { display: block; width: 140px; height: 140px; border-radius: 6px; }
.social-pop:hover .pop, .social-pop:focus .pop { opacity: 1; transform: translateX(-50%); pointer-events: auto; }

/* Widgets */
.widget { padding: 18px; }
.widget-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; }
.widget-title .icon { color: var(--primary); }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cat-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); }
.cat-list a:hover, .cat-list a.active { background: var(--primary-soft); color: var(--primary); }
.cat-list span { flex: 1; }
.cat-list em { font-style: normal; font-size: 12px; color: var(--muted); background: var(--card-2); padding: 0 8px; border-radius: 999px; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.rank-list a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
.rank-list a:hover { color: var(--primary); }
.rank { flex-shrink: 0; width: 20px; height: 20px; display: grid; place-items: center; font-size: 12px; font-weight: 700; border-radius: 6px; background: var(--card-2); color: var(--muted); margin-top: 1px; }
.rank-1 { background: #ff5b5b; color: #fff; } .rank-2 { background: #ff8a3d; color: #fff; } .rank-3 { background: #ffb52e; color: #fff; }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.simple-list li:last-child { border-bottom: 0; }
.simple-list time { color: var(--muted); font-size: 13px; flex-shrink: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--card-2); color: var(--text-2); border: 1px solid transparent; transition: all .2s; }
.tag-cloud a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.tag-cloud.big a { font-size: calc(14px * var(--w, 1)); padding: 5px 12px; }
.tag-cloud em { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 4px; }
.more-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 13px; color: var(--primary); }
.comment-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.comment-mini li { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.comment-mini img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; background: var(--card-2); }
.comment-mini a { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cm-head { display: flex; gap: 6px; align-items: center; }
.badge { font-size: 11px; padding: 0 6px; border-radius: 6px; background: var(--primary); color: #fff; line-height: 18px; }
.link-list { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 14px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; background: linear-gradient(90deg, var(--primary-soft), transparent); }
.notice p { margin: 0; font-size: 14px; color: var(--text-2); }
.notice .icon { color: var(--primary); margin-top: 4px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.7fr 1fr; gap: 12px; }
.hero-main, .hero-mini { position: relative; display: block; overflow: hidden; border-radius: var(--radius); background: var(--card-2); box-shadow: var(--shadow); }
.hero-main { aspect-ratio: 16 / 9; }
.hero-side { display: grid; gap: 12px; grid-template-rows: 1fr 1fr; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.hero a:hover img { transform: scale(1.05); }
.hero-overlay { position: absolute; inset: auto 0 0 0; padding: 40px 20px 18px; color: #fff; background: linear-gradient(to top, rgba(8, 10, 20, .88) 0%, rgba(8, 10, 20, .55) 55%, transparent); text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.hero-overlay h2 { margin: 8px 0 4px; font-size: 22px; line-height: 1.35; }
.hero-overlay h3 { margin: 0; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-overlay p { margin: 0; font-size: 13.5px; opacity: .85; }
.hero a:hover { color: #fff; }

.cat-tabs { display: flex; gap: 6px; padding: 10px; overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs a { padding: 6px 14px; border-radius: 10px; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.cat-tabs a:hover { background: var(--card-2); }
.cat-tabs a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent); }
.cat-tabs em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 4px; }

/* Post cards */
.post-list { display: grid; gap: 14px; }
.post-card {
  display: flex; gap: 20px; padding: 20px 22px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); }
.post-body { flex: 1; min-width: 0; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.post-meta > * { display: inline-flex; align-items: center; gap: 4px; }
.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 1px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.chip-light { background: rgba(255, 255, 255, .2); color: #fff; backdrop-filter: blur(6px); }
.post-title { margin: 8px 0 6px; font-size: 19px; line-height: 1.45; }
.post-title a { background-image: linear-gradient(var(--primary), var(--primary)); background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s; }
.post-title a:hover { background-size: 100% 2px; }
.post-excerpt { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-tags { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12.5px; }
.post-tags a { color: var(--muted); }
.post-tags a:hover { color: var(--primary); }
.post-thumb { flex-shrink: 0; width: 200px; aspect-ratio: 3 / 2; border-radius: 12px; overflow: hidden; background: var(--card-2); align-self: center; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.post-card:hover .post-thumb img { transform: scale(1.06); }
.empty { text-align: center; color: var(--muted); padding: 48px; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.page-nums { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.page-num, .page-step, .page-gap { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.page-num, .page-step { background: var(--card); border: 1px solid var(--border); }
.page-num.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-gap { color: var(--muted); min-width: 20px; padding: 0; }

/* List hero */
.list-hero { display: flex; align-items: center; gap: 16px; }
.list-hero h1 { margin: 0; font-size: 22px; }
.list-hero p { margin: 2px 0 0; font-size: 14px; }
.list-hero-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; flex-shrink: 0; }
.inline-search { display: flex; gap: 8px; margin: 12px 0 4px; }
.inline-search input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2); }
.inline-search button, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 600;
}
.btn-primary:hover, .inline-search button:hover { color: #fff; filter: brightness(1.05); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 13px; }

/* Archive */
.archive-year h2 { display: flex; align-items: baseline; gap: 10px; font-size: 20px; margin: 8px 0 8px; }
.archive-year h2 em { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 400; }
.archive-year ul { list-style: none; margin: 0 0 18px; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.archive-year li { position: relative; display: flex; gap: 14px; padding: 7px 0; }
.archive-year li::before { content: ""; position: absolute; left: -22px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--primary); }
.archive-year time { color: var(--muted); font-family: var(--mono); font-size: 13px; flex-shrink: 0; padding-top: 1px; }

/* Article */
.article { padding: 28px 40px 32px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.breadcrumb a { display: inline-flex; align-items: center; gap: 4px; }
.article-header h1 { font-size: 30px; line-height: 1.35; margin: 14px 0 14px; letter-spacing: -.01em; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13.5px; color: var(--muted); padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.article-meta > * { display: inline-flex; align-items: center; gap: 5px; }
.views-stat { color: var(--text); font-weight: 600; background: var(--card-2); padding: 3px 10px; border-radius: 999px; }
.views-meta { color: var(--muted); }
.meta-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.meta-author { color: var(--text-2); font-weight: 600; }
.article-cover { margin: 24px 0 0; border-radius: 14px; overflow: hidden; background: var(--card-2); }
.article-cover img { display: block; width: 100%; max-height: 460px; object-fit: cover; }
.toc-mobile { display: none; margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--card-2); }
.toc-mobile summary { cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 600; }

.prose { font-size: 16.5px; line-height: 1.9; color: var(--text-2); margin-top: 24px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose h2, .prose h3, .prose h4 { color: var(--text); line-height: 1.4; position: relative; }
.prose h2 { font-size: 23px; margin: 2em 0 .8em; padding-bottom: .35em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 19px; margin: 1.7em 0 .7em; }
.prose h4 { font-size: 17px; margin: 1.5em 0 .6em; }
.heading-anchor { margin-left: 8px; color: var(--primary); opacity: 0; font-weight: 400; transition: opacity .2s; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .prose h4:hover .heading-anchor { opacity: .7; }
.prose a { color: var(--primary); border-bottom: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); }
.prose a:hover { border-bottom-color: var(--primary); }
.prose img { display: block; margin: 1.4em auto; border-radius: 12px; cursor: zoom-in; box-shadow: var(--shadow); }
.prose ul, .prose ol { padding-left: 1.5em; margin: 0 0 1.15em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--primary); }
.prose blockquote { margin: 1.4em 0; padding: 12px 18px; border-left: 4px solid var(--primary); background: var(--primary-soft); border-radius: 0 12px 12px 0; color: var(--text-2); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; height: 1px; background: var(--border); margin: 2em 0; }
.prose :not(pre) > code { font-family: var(--mono); font-size: .87em; padding: .15em .45em; border-radius: 6px; background: var(--card-2); color: #e0457b; border: 1px solid var(--border); }
[data-theme="dark"] .prose :not(pre) > code { color: #ff8fb3; }
.prose pre { position: relative; margin: 1.4em 0; border-radius: 12px; background: #0f1320; color: #e6e8f0; overflow: hidden; font-size: 14px; line-height: 1.65; border: 1px solid #1f2535; }
.prose pre code { display: block; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); background: transparent !important; white-space: pre; }
.prose pre code.hljs { padding: 16px 18px; }
.code-copy { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 3px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.06); color: #c9cfe0; cursor: pointer; opacity: 0; transition: opacity .2s; }
.prose pre:hover .code-copy { opacity: 1; }
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--border); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { background: var(--card-2); color: var(--text); }
.prose tr:last-child td { border-bottom: 0; }
.prose iframe, .prose video { max-width: 100%; border-radius: 12px; }

.article-footer { margin-top: 32px; display: grid; gap: 18px; }
.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); }
.article-tags a { font-size: 13px; padding: 3px 12px; border-radius: 999px; background: var(--card-2); color: var(--text-2); }
.article-tags a:hover { background: var(--primary-soft); color: var(--primary); }
.article-license { font-size: 13.5px; color: var(--muted); padding: 14px 18px; border-radius: 12px; background: var(--card-2); border-left: 4px solid var(--primary); }
.article-license p { margin: 2px 0; word-break: break-all; }
.article-license strong { color: var(--text-2); }
.share-bar { display: flex; flex-wrap: wrap; gap: 8px; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.post-nav a { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; }
.post-nav a.next { text-align: right; align-items: flex-end; }
.post-nav span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.post-nav strong { font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.related-item { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.related-item img, .related-ph { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--card-2); }
.related-ph { display: grid; place-items: center; font-size: 28px; font-weight: 800; color: var(--primary); background: linear-gradient(135deg, var(--primary-soft), transparent); }
.related-item strong { font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-item time { font-size: 12px; color: var(--muted); }

.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.toc li.toc-l3 a { padding-left: 28px; font-size: 13px; }
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }

/* Comments */
.comment-form { display: grid; gap: 10px; margin-bottom: 24px; }
.comment-form textarea, .comment-fields input {
  width: 100%; border: 1px solid var(--border); background: var(--card-2); border-radius: 12px; padding: 10px 14px; transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.comment-form textarea:focus, .comment-fields input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.comment-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.comment-fields input { height: 40px; }
.hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; }
.comment-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.form-msg { font-size: 13px; color: var(--muted); }
.form-msg.error { color: var(--hot); }
.form-msg.ok { color: #1aa36f; }
[hidden] { display: none !important; }
.reply-to { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.comment-list { display: grid; gap: 4px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: 0; }
.comment .c-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; background: var(--card-2); }
.c-main { flex: 1; min-width: 0; }
.c-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.c-head strong { color: var(--text); font-size: 14px; }
.c-head a strong:hover { color: var(--primary); }
.c-body { margin: 4px 0 6px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); font-size: 14.5px; }
.c-children { margin-top: 6px; padding-left: 14px; border-left: 2px solid var(--border); }
.c-children .comment { padding: 10px 0; }
.c-children .c-avatar { width: 32px; height: 32px; }
.comment.pending { opacity: .7; }
.comment:target { background: var(--primary-soft); border-radius: 12px; padding-left: 10px; }

/* 404 */
.not-found { text-align: center; padding: 48px 24px; display: grid; justify-items: center; gap: 6px; }
.nf-code { font-size: 96px; font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.not-found h1 { margin: 6px 0 0; }
.not-found .inline-search { width: min(420px, 100%); margin: 12px 0; }
.narrow { display: grid; gap: 16px; }

/* Footer */
.site-footer {
  margin-top: 8px;
  padding: 0 0 28px;
  background: transparent;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.footer-top {
  display: flex;
  align-items: center;
  gap: 18px 24px;
  padding: 18px 22px;
  flex-wrap: wrap;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.footer-brand:hover { color: var(--text); }
.footer-brand .brand-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.footer-brand .brand-name { font-size: 15px; }
.footer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-left: auto;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--card-2);
  border: 1px solid transparent;
  transition: background .2s, color .2s, border-color .2s;
}
.footer-nav a:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 28%, transparent);
}
.footer-social { display: flex; align-items: center; gap: 8px; }
.footer-social a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--card-2);
  color: var(--text-2);
  transition: background .2s, color .2s, transform .12s;
}
.footer-social a:hover {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 22px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.footer-bottom p { margin: 0; }
.footer-meta { display: inline-flex; align-items: center; gap: 10px; }
.footer-meta a { color: var(--muted); }
.footer-meta a:hover { color: var(--primary); }

/* Search dialog */
.search-dialog { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-dialog[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 25, .45); backdrop-filter: blur(4px); }
.search-panel { position: relative; width: min(640px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.search-form { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--muted); }
.search-form input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; height: 36px; color: var(--text); }
.search-form .icon-btn { border: 0; }
.search-results { max-height: 56vh; overflow-y: auto; padding: 8px; }
.search-hint { color: var(--muted); text-align: center; font-size: 14px; padding: 18px; margin: 0; }
.search-item { display: block; padding: 10px 14px; border-radius: 12px; }
.search-item:hover, .search-item.active { background: var(--primary-soft); color: inherit; }
.search-item strong { display: block; font-size: 15px; }
.search-item strong mark { background: none; color: var(--primary); }
.search-item span { font-size: 13px; color: var(--muted); }

/* Misc */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .1s linear; }
.back-top { position: fixed; right: 22px; bottom: 26px; z-index: 40; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-lg); cursor: pointer; display: grid; place-items: center; opacity: 0; transform: translateY(12px); pointer-events: none; transition: all .25s; color: var(--text-2); }
.back-top.show { opacity: 1; transform: none; pointer-events: auto; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .85); display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 18px; border-radius: 999px; font-size: 14px; z-index: 130; animation: pop .2s; }

@media (max-width: 1180px) {
  .layout-3 { grid-template-columns: minmax(0, 1fr) 290px; }
  .left-col { display: none; }
}
@media (max-width: 920px) {
  .layout-3, .layout-2, .layout-article { grid-template-columns: minmax(0, 1fr); }
  .side-col, .left-col { position: static; }
  .article-side { max-height: none; overflow: visible; }
  .toc-card { display: none; }
  .toc-mobile { display: block; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { padding: 16px 16px 14px; }
  .footer-tools { margin-left: 0; width: 100%; }
  .footer-bottom { padding: 12px 16px; padding-right: 64px; }
}
@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .container { padding: 0 14px; }
  main { padding-top: 14px; }
  .nav-toggle { display: inline-flex; }
  .search-trigger .kbd { display: none; }
  .nav {
    position: fixed; top: var(--header-h); left: 0; right: 0; flex-direction: column; gap: 2px; padding: 10px 14px 16px;
    background: var(--card); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .2s;
  }
  .nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { padding: 10px 14px; border-radius: 10px; }
  .hero { grid-template-columns: 1fr; }
  .hero-side { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .hero-mini { aspect-ratio: 16 / 10; }
  .hero-overlay h2 { font-size: 18px; }
  .post-card { padding: 16px; gap: 14px; }
  .post-thumb { width: 108px; align-self: flex-start; margin-top: 4px; }
  .post-title { font-size: 16.5px; }
  .post-excerpt { -webkit-line-clamp: 2; font-size: 13.5px; }
  .post-tags { display: none; }
  .article { padding: 20px 18px 24px; }
  .article-header h1 { font-size: 24px; }
  .prose { font-size: 16px; }
  .comment-fields { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a.next { text-align: left; align-items: flex-start; }
  .page-step span { display: none; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .site-header, .side-col, .left-col, .site-footer, .comments, .share-bar, .post-nav, .related, .back-top, .read-progress { display: none !important; }
  .layout-article { display: block; }
  .card { box-shadow: none; border: 0; }
}
