/* ==========================================================================
   小蛋糕的博客 · 梦幻星空主题
   ========================================================================== */
:root {
  --bg-deep: #050816;
  --bg-1: #0a0f2a;
  --bg-2: #141b3f;
  --text: #e8ecff;
  --text-dim: #a9b2d8;
  --text-faint: #6b759c;
  --accent-1: #8b5cf6;   /* 紫 */
  --accent-2: #22d3ee;   /* 青 */
  --accent-3: #f472b6;   /* 粉 */
  --gradient: linear-gradient(120deg, #8b5cf6, #6366f1 35%, #22d3ee 70%, #f472b6);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.2);
  --danger: #f87171;
  --success: #34d399;
  --warn: #fbbf24;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(3, 6, 24, 0.55);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

/* ---------- 背景图层 ---------- */
#bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* 星云光斑 */
.nebula {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  z-index: -2;
  pointer-events: none;
  animation: nebula-drift 26s ease-in-out infinite alternate;
}
.nebula.n1 { width: 480px; height: 480px; background: #4c1d95; top: -140px; left: -120px; animation-delay: 0s; }
.nebula.n2 { width: 420px; height: 420px; background: #0e7490; top: 30%; right: -150px; animation-delay: -9s; }
.nebula.n3 { width: 380px; height: 380px; background: #9d174d; bottom: -130px; left: 24%; animation-delay: -17s; }
@keyframes nebula-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(60px, -40px) scale(1.18); }
  100% { transform: translate(-40px, 50px) scale(0.94); }
}

/* 背景图片模式 */
body.bg-image::before {
  content: "";
  position: fixed; inset: 0;
  background-image: var(--bg-image-url);
  background-size: cover;
  background-position: center;
  z-index: -3;
  animation: bg-slow-zoom 40s ease-in-out infinite alternate;
}
@keyframes bg-slow-zoom {
  from { transform: scale(1); } to { transform: scale(1.08); }
}
body.bg-image::after {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(5, 8, 22, 0.55), rgba(5, 8, 22, 0.88));
  z-index: -2;
}

/* 渐变背景模式 */
body.bg-gradient { background: var(--bg-gradient-css); }
body.bg-gradient .nebula { display: none; }

/* ---------- 通用组件 ---------- */
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); }

::selection { background: rgba(139, 92, 246, 0.45); color: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* 顶部导航 */
.navbar {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(18px);
  background: rgba(9, 12, 34, 0.62);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 22px;
  height: 64px;
  display: flex; align-items: center; gap: 26px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; letter-spacing: 0.5px;
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px; object-fit: cover;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.55);
  background: linear-gradient(135deg, #312e81, #701a75);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  padding: 8px 14px; border-radius: 10px;
  color: var(--text-dim); font-size: 14.5px; font-weight: 500;
  transition: all 0.25s;
}
.nav-links a:hover, .nav-links a.active { color: #fff; background: var(--glass-strong); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 99px; padding: 7px 14px;
  transition: all 0.3s;
}
.search-box:focus-within { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(139,92,246,0.2); }
.search-box input {
  background: transparent; border: none; outline: none;
  color: var(--text); width: 150px; font-size: 13.5px;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box .icon { font-size: 14px; opacity: 0.7; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  color: var(--text);
  padding: 9px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  transition: all 0.25s;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.14); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--gradient);
  border: none;
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  background-size: 180% 180%;
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(99, 102, 241, 0.55); background-position: 80% 20%; }
.btn-danger { border-color: rgba(248, 113, 113, 0.4); color: var(--danger); background: rgba(248,113,113,0.08); }
.btn-danger:hover { background: rgba(248,113,113,0.18); border-color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: #fff; background: var(--glass-strong); }

/* 玻璃卡片 */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

/* 首页 Hero */
.hero { padding: 92px 0 56px; text-align: center; position: relative; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 99px;
  background: var(--glass-strong); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim);
  animation: float-in 0.8s ease both;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 66px);
  font-weight: 900; letter-spacing: 1px;
  margin: 26px 0 6px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: gradient-shift 6s ease infinite, float-in 0.9s 0.1s ease both;
}
@keyframes gradient-shift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero .tagline {
  font-size: 17px; color: var(--text-dim);
  animation: float-in 0.9s 0.25s ease both;
}
.hero-actions { margin-top: 34px; display: flex; gap: 14px; justify-content: center; animation: float-in 0.9s 0.4s ease both; }

/* 流星装饰 */
.hero .spark { position: absolute; font-size: 20px; opacity: 0.7; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: 0.25; transform: scale(1) rotate(0deg);} 50% { opacity: 1; transform: scale(1.3) rotate(14deg);} }
@keyframes float-in { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

/* 区块标题 */
.section-head {
  display: flex; align-items: center; gap: 12px;
  margin: 60px 0 24px;
}
.section-head .bar {
  width: 5px; height: 26px; border-radius: 99px;
  background: var(--gradient);
  box-shadow: 0 0 14px rgba(139,92,246,0.7);
}
.section-head h2 { font-size: 23px; font-weight: 800; letter-spacing: 0.5px; }
.section-head .sub { color: var(--text-faint); font-size: 13.5px; }

/* 精选（置顶）横幅 */
.featured-card {
  position: relative;
  display: flex; align-items: flex-end;
  min-height: 300px; border-radius: 24px; overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.35s, box-shadow 0.35s;
  animation: float-in 0.8s ease both;
}
.featured-card:hover { transform: translateY(-6px); box-shadow: 0 24px 70px rgba(76, 29, 149, 0.4); }
.featured-card .fc-bg { position: absolute; inset: 0; background-size: cover; background-position: center; transition: transform 0.6s; }
.featured-card:hover .fc-bg { transform: scale(1.06); }
.featured-card .fc-mask {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5,8,22,0) 0%, rgba(5,8,22,0.35) 45%, rgba(5,8,22,0.92) 100%);
}
.featured-card .fc-body { position: relative; padding: 30px; width: 100%; }
.featured-card .fc-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(139,92,246,0.85); color: #fff;
  padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 700;
  margin-bottom: 12px;
}
.featured-card h3 { font-size: 25px; font-weight: 800; line-height: 1.35; text-shadow: 0 2px 16px rgba(0,0,0,0.5); }
.featured-card .fc-meta { margin-top: 10px; font-size: 13px; color: rgba(232,236,255,0.75); display: flex; gap: 16px; }

/* 文章卡片网格 */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.post-card {
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.35s, box-shadow 0.35s, border-color 0.35s;
  animation: float-in 0.7s ease both;
}
.post-card:hover {
  transform: translateY(-7px);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 26px 70px rgba(30, 27, 75, 0.55);
}
.post-card .cover {
  position: relative; height: 180px; overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b, #0e7490);
}
.post-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.post-card:hover .cover img { transform: scale(1.07); }
.post-card .cover .ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; text-shadow: 0 0 30px rgba(255,255,255,0.4);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(139,92,246,0.5), transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(34,211,238,0.4), transparent 60%),
    linear-gradient(135deg, #1e1b4b, #134e4a);
}
.post-card .pin-badge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(5,8,22,0.65); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 3px 10px; border-radius: 99px; font-size: 11.5px;
  color: #fde68a; font-weight: 700;
}
.post-card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.post-card h3 {
  font-size: 17.5px; font-weight: 750; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.3s;
}
.post-card:hover h3 { color: #c4b5fd; }
.post-card .excerpt {
  color: var(--text-dim); font-size: 13.5px; margin-top: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card .foot {
  margin-top: auto; padding-top: 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-faint);
}
.post-card .foot .dot { opacity: 0.5; }

/* 标签 */
.tag-chip {
  display: inline-flex; align-items: center;
  padding: 3.5px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 550;
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  transition: all 0.25s;
}
.tag-chip:hover { background: rgba(139, 92, 246, 0.3); color: #fff; transform: translateY(-1px); }
.tag-chip.cyan { background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.3); color: #67e8f9; }
.tag-chip.pink { background: rgba(244,114,182,0.12); border-color: rgba(244,114,182,0.3); color: #f9a8d4; }
.tag-chip.plain { background: var(--glass); border-color: var(--border); color: var(--text-dim); }
.tag-chip.plain:hover { color: #fff; }

/* 侧边栏 */
.sidebar { display: flex; flex-direction: column; gap: 22px; }
.side-card { padding: 22px; }
.side-card h4 {
  font-size: 15.5px; font-weight: 750; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 9px; }
.stat-row { display: flex; gap: 12px; }
.stat-row .cell {
  flex: 1; text-align: center; padding: 14px 6px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 14px;
}
.stat-row .num { font-size: 21px; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-row .lbl { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 46px 0 30px; flex-wrap: wrap; }
.pagination button {
  min-width: 40px; height: 40px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--glass); color: var(--text-dim);
  font-size: 14px; font-weight: 600;
  transition: all 0.25s;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent-1); color: #fff; }
.pagination button.current { background: var(--gradient); border: none; color: #fff; }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }

/* 页脚 */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: rgba(9, 12, 34, 0.55);
  backdrop-filter: blur(14px);
}
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 34px 22px 30px;
  text-align: center; color: var(--text-faint); font-size: 13px;
}
.footer-inner .heart { color: #f472b6; animation: heartbeat 1.6s ease infinite; display: inline-block; }
@keyframes heartbeat { 0%,100% { transform: scale(1);} 25% { transform: scale(1.25);} 40% { transform: scale(1);} 55% { transform: scale(1.2);} }

/* ==========================================================================
   文章详情页
   ========================================================================== */
.article-wrap { max-width: 860px; margin: 0 auto; padding: 44px 22px 80px; }
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-dim); font-size: 14px; margin-bottom: 30px;
  transition: color 0.25s;
}
.back-link:hover { color: #fff; }
.article-head h1 {
  font-size: clamp(28px, 4.5vw, 42px); font-weight: 900; line-height: 1.32;
  animation: float-in 0.7s ease both;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  margin: 20px 0 8px; color: var(--text-faint); font-size: 13.5px;
  animation: float-in 0.7s 0.1s ease both;
}
.article-meta .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gradient);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; margin-right: 6px;
  flex-shrink: 0;
}
.article-tags { display: flex; gap: 9px; margin: 14px 0 30px; flex-wrap: wrap; animation: float-in 0.7s 0.18s ease both; }
.article-cover {
  border-radius: 22px; overflow: hidden; border: 1px solid var(--border);
  margin-bottom: 38px;
  animation: float-in 0.7s 0.26s ease both;
}
.article-cover img { width: 100%; display: block; }

/* Markdown 正文 */
.md-body { font-size: 16.5px; color: #dfe4f8; animation: float-in 0.7s 0.32s ease both; word-wrap: break-word; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  margin: 2em 0 0.8em; font-weight: 800; line-height: 1.4;
}
.md-body h1 { font-size: 1.8em; }
.md-body h2 {
  font-size: 1.45em;
  padding-left: 14px; border-left: 4px solid;
  border-image: linear-gradient(180deg, #8b5cf6, #22d3ee) 1;
}
.md-body h3 { font-size: 1.2em; }
.md-body p { margin: 0.9em 0; }
.md-body strong { color: #fff; }
.md-body a {
  color: #7dd3fc; border-bottom: 1px dashed rgba(125, 211, 252, 0.5);
  transition: all 0.25s;
}
.md-body a:hover { color: #bae6fd; border-bottom-style: solid; }
.md-body ul, .md-body ol { padding-left: 1.6em; margin: 0.9em 0; }
.md-body li { margin: 0.32em 0; }
.md-body li::marker { color: #a78bfa; }
.md-body hr {
  border: none; height: 1px; margin: 2.4em 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}
.md-body blockquote {
  margin: 1.4em 0; padding: 16px 22px;
  background: rgba(139, 92, 246, 0.08);
  border-left: 4px solid #8b5cf6;
  border-radius: 0 14px 14px 0;
  color: #c4b5fd;
}
.md-body img {
  max-width: 100%; border-radius: 14px; cursor: zoom-in;
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}
.md-body img:hover { box-shadow: 0 14px 40px rgba(0,0,0,0.5); }
.md-body table {
  width: 100%; border-collapse: collapse; margin: 1.4em 0;
  font-size: 0.92em; overflow: hidden; border-radius: 12px;
}
.md-body th, .md-body td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.md-body th { background: rgba(139,92,246,0.18); font-weight: 700; }
.md-body tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
.md-body code:not(pre code) {
  font-family: var(--mono); font-size: 0.86em;
  background: rgba(139, 92, 246, 0.16);
  color: #ddd6fe;
  padding: 2.5px 8px; border-radius: 7px;
  border: 1px solid rgba(139,92,246,0.25);
}

/* 代码块（带复制按钮） */
.code-block {
  position: relative; margin: 1.5em 0;
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.13);
  background: #0d1117;
  box-shadow: 0 14px 44px rgba(0,0,0,0.45);
}
.code-block .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255,255,255,0.045);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.code-block .code-lang {
  font-size: 12px; font-weight: 650; letter-spacing: 0.6px;
  color: #94a3b8; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.code-block .code-lang::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 10px rgba(139,92,246,0.8);
}
.code-block .copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: #cbd5e1; font-size: 12.5px; font-weight: 600;
  padding: 4px 12px; border-radius: 8px;
  transition: all 0.25s;
}
.code-block .copy-btn:hover { background: rgba(139,92,246,0.3); border-color: #8b5cf6; color: #fff; }
.code-block .copy-btn.ok { background: rgba(52,211,153,0.22); border-color: #34d399; color: #6ee7b7; }
.code-block pre { margin: 0; padding: 18px 20px; overflow-x: auto; }
.code-block pre code {
  font-family: var(--mono); font-size: 14px; line-height: 1.75;
  background: transparent; border: none; padding: 0; color: inherit;
  display: block;
}
.md-body pre { background: transparent; border-radius: 0; }

/* 视频块 */
.md-video {
  position: relative; margin: 1.5em 0; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 14px 44px rgba(0,0,0,0.45);
  background: #000;
}
.md-video video { display: block; width: 100%; max-height: 560px; }

/* 文件下载卡片 */
.md-file {
  display: flex; align-items: center; gap: 14px;
  margin: 1.1em 0; padding: 15px 18px;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.3s;
}
.md-file:hover { border-color: rgba(34,211,238,0.55); transform: translateX(4px); background: var(--glass-strong); }
.md-file .file-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #0e7490, #4c1d95);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
}
.md-file .file-meta { flex: 1; min-width: 0; }
.md-file .file-name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-file .file-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.md-file .file-dl { color: #67e8f9; font-size: 13px; font-weight: 700; white-space: nowrap; }

/* 上一篇 / 下一篇 */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 50px 0; }
.post-nav a {
  display: block; padding: 18px 20px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 15px;
  transition: all 0.3s;
}
.post-nav a:hover { border-color: rgba(139,92,246,0.5); transform: translateY(-3px); }
.post-nav .nav-lbl { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; }
.post-nav .nav-title {
  font-size: 14.5px; font-weight: 650; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-nav .next { text-align: right; }

/* 评论区 */
.comment-section { margin-top: 56px; }
.comment-section h3 { font-size: 21px; font-weight: 800; margin-bottom: 22px; display: flex; align-items: center; gap: 10px; }
.comment-section h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255,255,255,0.18), transparent); }
.comment-form {
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.comment-form .row { display: flex; gap: 12px; }
.comment-form input, .comment-form textarea {
  width: 100%;
  background: rgba(5,8,22,0.5); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 15px;
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.comment-form input:focus, .comment-form textarea:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
}
.comment-form textarea { resize: vertical; min-height: 100px; }
.comment-item {
  padding: 18px 20px; margin-bottom: 14px;
  display: flex; gap: 14px;
}
.comment-item .c-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
}
.comment-item .c-name { font-weight: 700; font-size: 14px; }
.comment-item .c-time { font-size: 12px; color: var(--text-faint); margin-left: 10px; }
.comment-item .c-content { margin-top: 6px; font-size: 14.5px; color: #d7dcf3; white-space: pre-wrap; word-break: break-word; }

/* 图片灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(2, 4, 14, 0.9);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: lb-in 0.25s ease;
}
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; box-shadow: 0 30px 90px rgba(0,0,0,0.7); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

/* Toast 提示 */
#toast-box { position: fixed; top: 84px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px; max-width: 340px;
  padding: 13px 18px; border-radius: 13px;
  background: rgba(20, 26, 58, 0.92); backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  font-size: 13.5px; box-shadow: var(--shadow);
  animation: toast-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  display: flex; align-items: center; gap: 9px;
}
.toast.err { border-color: rgba(248,113,113,0.55); }
.toast.ok { border-color: rgba(52,211,153,0.5); }
.toast.leaving { animation: toast-out 0.3s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px);} to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* 空状态 */
.empty { text-align: center; padding: 70px 20px; color: var(--text-faint); }
.empty .big { font-size: 52px; margin-bottom: 14px; opacity: 0.65; }
.empty p { font-size: 15px; }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(100deg, rgba(255,255,255,0.05) 40%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.05) 60%);
  background-size: 200% 100%;
  animation: sk-shine 1.3s infinite;
  border-radius: 12px;
}
@keyframes sk-shine { to { background-position: -200% 0; } }

/* 响应式 */
@media (max-width: 760px) {
  .hero { padding: 56px 0 40px; }
  .nav-links { display: none; }
  .post-nav { grid-template-columns: 1fr; }
  .comment-form .row { flex-direction: column; }
  .search-box input { width: 96px; }
  .layout { grid-template-columns: 1fr !important; }
}

/* 前台双栏布局 */
.layout { display: grid; grid-template-columns: 1fr 290px; gap: 30px; align-items: start; }
.layout .main-col { min-width: 0; }

/* ==========================================================================
   赞助卡片美化（联维云推广卡片，覆盖第三方脚本的内联白底样式）
   ========================================================================== */
.affcard-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 20px 0;
}
/* 卡片出现在页脚上方时，缩小页脚的顶部间距 */
.affcard-wrap:not(:empty) + .footer { margin-top: 30px; }
/* 脚本加载失败时容器为空，自动隐藏 */
.affcard-wrap:empty { display: none; }

.affcard-wrap > a {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(34, 211, 238, 0.09) 55%, rgba(244, 114, 182, 0.12)) !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 12px 44px rgba(3, 6, 24, 0.55) !important;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s !important;
  position: relative;
  overflow: hidden;
}
.affcard-wrap > a::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(139, 92, 246, 0.22), transparent 55%),
    radial-gradient(ellipse at 88% 100%, rgba(34, 211, 238, 0.16), transparent 55%);
  pointer-events: none;
}
.affcard-wrap > a:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.75) !important;
  box-shadow: 0 20px 60px rgba(76, 29, 149, 0.5) !important;
}
/* 文字颜色覆盖（脚本内联了深色文字，替换为主题浅色系） */
.affcard-wrap > a > div > div:first-child {
  color: #ffffff !important;
  text-shadow: 0 1px 12px rgba(139, 92, 246, 0.45);
}
.affcard-wrap > a > div > div:last-child {
  color: var(--text-dim) !important;
}
/* Logo 装进悬浮玻璃小框 */
.affcard-wrap > a > img {
  border-radius: 12px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.28);
  transition: transform 0.3s, box-shadow 0.3s;
}
.affcard-wrap > a:hover > img {
  transform: scale(1.06);
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.5);
}
@media (max-width: 760px) {
  .affcard-wrap { padding: 16px 16px 0; }
}

/* ==========================================================================
   文章目录（TOC）
   ========================================================================== */
.toc-card {
  margin-bottom: 28px;
  padding: 18px 22px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  max-height: 340px;
  overflow-y: auto;
}
.toc-head {
  font-size: 14px; font-weight: 750;
  margin-bottom: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}
#a-toc .toc-link {
  display: block;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  border-left: 2px solid transparent;
  margin: 2px 0;
  line-height: 1.55;
  transition: all 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#a-toc .toc-link:hover { color: #fff; background: var(--glass-strong); }
#a-toc .toc-link.active {
  color: #fff;
  border-left-color: var(--accent-2);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), transparent);
}
#a-toc .toc-h2 { padding-left: 24px; }
#a-toc .toc-h3 { padding-left: 42px; }
.md-body h1, .md-body h2, .md-body h3 { scroll-margin-top: 80px; }

/* ==========================================================================
   归档页
   ========================================================================== */
.archive-group { margin-bottom: 28px; }
.archive-ym {
  font-size: 18px; font-weight: 800;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
  color: #c4b5fd;
}
.archive-ym::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.4), transparent);
}
.archive-item {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 18px; margin-bottom: 10px;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.25s;
  flex-wrap: wrap;
}
.archive-item:hover {
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateX(4px);
  background: var(--glass-strong);
}
.archive-item .archive-date {
  font-family: var(--mono); font-size: 12.5px;
  color: var(--text-faint); min-width: 86px;
}
.archive-item .archive-title { flex: 1; font-weight: 650; font-size: 15px; min-width: 180px; }
.archive-item .archive-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.archive-item .archive-views { font-size: 12px; color: var(--text-faint); }
@media (max-width: 760px) {
  .archive-item .archive-date { min-width: auto; }
}