:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-elev: #ffffff;
  --border: #e5e7eb;
  --text: #1f2328;
  --text-muted: #57606a;
  --text-subtle: #8b95a1;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --accent: #f97316;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max: 1200px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --bg-elev: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #9da7b3;
    --text-subtle: #6e7681;
    --brand: #4f8cff;
    --brand-hover: #6ea0ff;
    --brand-soft: rgba(79, 140, 255, 0.12);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.content-page { background: var(--bg-soft); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(13, 17, 23, 0.85); }
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: contain;
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  transition: all .15s ease;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav-cta {
  padding: 8px 16px !important;
  background: var(--text) !important;
  color: var(--bg) !important;
  border-radius: 8px;
}
.nav-cta:hover { background: var(--brand) !important; color: #fff !important; }

.menu-btn {
  display: none;
  background: none; border: 0; padding: 6px; cursor: pointer;
  color: var(--text);
}

@media (max-width: 820px) {
  .nav { display: none; }
  .menu-btn { display: block; }
  .nav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 12px 24px; gap: 4px;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 56px;
  text-align: center;
  background:
    radial-gradient(60% 60% at 50% 0%, var(--brand-soft) 0%, transparent 70%),
    var(--bg);
}
.hero .eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  margin: 0 0 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--brand), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
}
.hero-cta { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ---------- Section ---------- */
.section { padding: 64px 0; }
.section-head { margin-bottom: 36px; }
.section-head h2 {
  font-size: 28px; font-weight: 700; margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.section-head p { color: var(--text-muted); margin: 0; font-size: 15.5px; }

/* ---------- Card grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all .18s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.card .icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.card .card-cover {
  margin: -24px -24px 14px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.card .card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--text); }
.card p { margin: 0 0 16px; color: var(--text-muted); font-size: 14.5px; flex: 1; }
.card .more { font-size: 13.5px; color: var(--brand); font-weight: 600; }
.card .more::after { content: " →"; }

/* ---------- 文章计数（卡片） ---------- */
.card-stats {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin: 0 0 14px; font-size: 12.5px; color: var(--text-subtle);
}
.post-card .card-stats { margin: 10px 0 0; }
.card-stats .stat { display: inline-flex; align-items: center; gap: 4px; }
.card-stats .stat-ic {
  width: 13px;
  height: 13px;
  color: var(--text-subtle);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-stats .stat b { font-weight: 700; color: var(--text-muted); }

/* ---------- Post cards ---------- */
.post-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: all .18s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.post-card .cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%);
  display: grid; place-items: center;
  font-size: 42px;
  color: var(--brand);
  overflow: hidden;
}
.post-card .cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.post-card .body { padding: 18px 20px 22px; }
.post-card .meta { font-size: 12.5px; color: var(--text-subtle); margin-bottom: 8px; }
.post-card .meta .tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; margin-right: 8px;
}
.post-card h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.4; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--brand); }
.post-card .excerpt { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.6; }

.collection-post-list {
  display: grid;
  gap: 14px;
}
.collection-empty {
  margin: 0;
  color: var(--text-muted);
}
.collection-post-item {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.collection-post-cover {
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  overflow: hidden;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 800;
  text-decoration: none !important;
}
.collection-post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.collection-post-body {
  min-width: 0;
}
.collection-post-body .meta {
  margin-bottom: 6px;
}
.collection-post-body .meta .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  margin-right: 8px;
}
.collection-post-body h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.4;
}
.collection-post-body h3 a {
  color: var(--text);
  text-decoration: none;
}
.collection-post-body h3 a:hover {
  color: var(--brand);
}
.collection-post-body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}
@media (max-width: 600px) {
  .collection-post-item {
    grid-template-columns: 1fr;
  }
}

/* ---------- Article page ---------- */
.article {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px 24px 28px;
  display: grid;
  grid-template-columns: minmax(0, 760px) 300px;
  column-gap: 28px;
  align-items: start;
}
.article-main-card {
  grid-column: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.article header { margin-bottom: 32px; }
.article-side {
  grid-column: 2;
  grid-row: 1 / span 3;
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.article .crumb { font-size: 13px; color: var(--text-subtle); margin-bottom: 16px; }
.article .crumb a { color: var(--text-muted); }
.article h1 {
  font-size: clamp(28px, 4vw, 40px); line-height: 1.2;
  margin: 0 0 16px; letter-spacing: -0.01em;
}
.article .meta {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-subtle); font-size: 14px;
}
.article-actions {
  position: static;
  z-index: 30;
  display: flex;
  flex-direction: row;
  width: 100%;
  align-self: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.article-actions .act {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 54px;
  padding: 7px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.1;
}
.article-actions .act .ic {
  width: 19px;
  height: 19px;
  color: var(--text-muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color .15s ease, fill .15s ease, stroke-width .15s ease, transform .15s ease;
}
.article-actions .act .ic .fillable {
  fill: transparent;
}
.article-actions .act b {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.article-actions button.act { cursor: pointer; transition: all .15s ease; }
.article-actions button.act:hover { background: var(--brand-soft); color: var(--brand); }
.article-actions button.act:hover .ic,
.article-actions button.act:hover b { color: var(--brand); }
.article-actions button.act:hover .ic { transform: translateY(-1px); stroke-width: 2; }
.article-actions .act-btn.on { color: var(--brand); }
.article-actions .act-btn.on .ic,
.article-actions .act-btn.on b { color: var(--brand); }
.article-actions .act-btn.on .ic .fillable { fill: currentColor; }
.article-back-top {
  display: none;
  position: fixed;
  left: var(--article-back-top-left, 24px);
  right: auto;
  bottom: 28px;
  z-index: 31;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  width: 58px;
  min-height: 58px;
  padding: 7px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  line-height: 1.1;
  cursor: pointer;
  transition: all .15s ease;
}
.article-back-top.show-top { display: flex; }
.article-back-top:hover { background: var(--brand-soft); color: var(--brand); }
.article-back-top .ic {
  color: inherit;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 980px) {
  :root {
    --article-mobile-edge: max(12px, calc((100vw - 760px) / 4 + 12px));
    --article-mobile-rail: 54px;
    --article-mobile-gap: 10px;
  }
  .article {
    display: block;
    max-width: none;
    padding: 56px calc(var(--article-mobile-edge) + var(--article-mobile-rail) + var(--article-mobile-gap)) 28px var(--article-mobile-edge);
  }
  .article-main-card { padding-right: 4px; }
  .article-side {
    position: static;
    display: block;
    margin: 0;
  }
  .article-toc { display: none; }
  .article-actions {
    position: fixed;
    left: auto;
    right: var(--article-mobile-edge);
    top: calc(var(--header-h) + 56px);
    bottom: auto;
    width: var(--article-mobile-rail);
    align-self: auto;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 5px;
    border-radius: 12px;
  }
  .article-actions .act {
    width: auto;
    min-height: 36px;
    padding: 4px 2px;
    border-radius: 8px;
  }
  .article-actions .act .ic {
    width: 18px;
    height: 18px;
  }
  .article-back-top {
    left: auto;
    right: var(--article-mobile-edge);
    bottom: 28px;
    width: var(--article-mobile-rail);
    min-height: 42px;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
  }
  .article-back-top .ic { font-size: 16px; }
}

.article-content { font-size: 16.5px; line-height: 1.85; color: var(--text); }
.article-content h2 { font-size: 24px; margin: 40px 0 14px; }
.article-content h3 { font-size: 19px; margin: 28px 0 10px; }
.article-content p { margin: 0 0 18px; }
.article-content ul, .article-content ol { padding-left: 24px; margin: 0 0 18px; }
.article-content li { margin-bottom: 6px; }
.article-content code {
  background: var(--bg-soft);
  padding: 2px 6px; border-radius: 4px;
  font-size: 0.9em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.article-content pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 13.5px;
}
.article-content pre code { background: none; padding: 0; }
.article-content .table-wrap {
  width: 100%;
  margin: 0 0 22px;
  overflow-x: auto;
}
.article-content table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.65;
}
.article-content th,
.article-content td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.article-content th {
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 700;
}
.article-content td {
  color: var(--text-muted);
}
.article-content td code {
  white-space: nowrap;
}
.article-content blockquote {
  border-left: 3px solid var(--brand);
  margin: 0 0 18px;
  padding: 4px 0 4px 16px;
  color: var(--text-muted);
}
.article-content a { text-decoration: underline; text-underline-offset: 3px; }
.article-content h2[id],
.article-content h3[id],
.resource-panel h2[id] {
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.page-toc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 180px);
  overflow: auto;
}
.page-toc-card h2 {
  font-size: 1rem;
  margin: 0 0 12px;
  letter-spacing: 0;
}
.page-toc-links {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.page-toc-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: .92rem;
  line-height: 1.5;
}
.page-toc-links a span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-toc-links a span:last-child {
  flex: 0 0 auto;
}
.page-toc-links a:hover { color: var(--brand); }
.page-toc-links a.depth-3 {
  padding-left: 14px;
  font-size: .88rem;
}
.article-toc {
  width: 100%;
}
@media (min-width: 981px) {
  .article-side .page-toc-card {
    max-height: min(420px, calc(100vh - 380px));
  }
}
@media (max-width: 1320px) {
  .article-toc {
    width: auto;
    margin: 0 0 18px;
  }
}

.article-comments {
  margin-top: 52px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.shop-entry {
  position: fixed;
  right: 24px;
  bottom: 28px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg) !important;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 700;
}
.shop-entry:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .2);
}
@media (max-width: 1100px) {
  .shop-entry { bottom: 28px; }
}
@media (max-width: 980px) {
  .shop-entry {
    right: calc(var(--article-mobile-edge) + 6px);
    bottom: 78px;
    width: 42px;
    height: 42px;
    min-width: 0;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
  }
  .shop-entry::after {
    content: 'AI';
    font-size: 13px;
    font-weight: 800;
  }
}
.article-comments h2 {
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.3;
}
.comment-form {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}
.comment-form textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  box-sizing: border-box;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  line-height: 1.65;
}
.comment-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.comment-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.comment-msg {
  flex: 1;
  min-height: 20px;
  color: var(--text-subtle);
  font-size: 13px;
}
.comment-msg.ok { color: #16a34a; }
.comment-msg.error { color: #ef4444; }
.comment-count {
  color: var(--text-subtle);
  font-size: 12px;
  white-space: nowrap;
}
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.comment-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:first-child { border-top: 1px solid var(--border); }
.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--brand-soft);
  color: var(--brand);
}
.comment-avatar-sm {
  width: 28px;
  height: 28px;
}
.comment-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}
.comment-avatar-fallback.comment-avatar-sm { font-size: 12px; }
.comment-main {
  flex: 1;
  min-width: 0;
}
.comment-top {
  display: block;
}
.comment-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.comment-head strong {
  color: var(--text);
  font-size: 14px;
}
.comment-more {
  position: relative;
  flex: 0 0 auto;
}
.comment-more-btn {
  width: 28px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.comment-more-btn:hover,
.comment-more.open .comment-more-btn {
  background: var(--bg-soft);
  color: var(--text);
}
.comment-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 5;
  min-width: 88px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-md);
}
.comment-more.open .comment-menu { display: block; }
.comment-menu button {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 13px;
}
.comment-menu button:hover { background: #fee2e2; }
.comment-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.comment-actions-left {
  display: flex;
  align-items: center;
  gap: 18px;
}
.comment-actions-row time {
  color: var(--text-subtle);
  font-size: 12px;
  white-space: nowrap;
}
.comment-link-btn,
.reply-toggle {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.comment-link-btn:hover,
.reply-toggle:hover {
  color: var(--text);
}
.comment-text {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.reply-to {
  color: var(--text-muted);
  font-weight: 400;
  margin-right: 4px;
}
.comment-replies {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.comment-reply {
  gap: 10px;
  padding: 8px 0 0;
  border: 0;
}
.comment-replies .comment-item:first-child { border-top: 0; }
.comment-reply .comment-head { margin-bottom: 2px; }
.comment-reply .comment-text { font-size: 14.5px; }
.reply-toggle-wrap {
  list-style: none;
  margin: 8px 0 0 38px;
  padding: 0;
}
.reply-form {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}
.reply-form textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}
.reply-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.reply-form-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.comment-empty {
  padding: 16px 0;
  color: var(--text-subtle);
  font-size: 14px;
}

.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .42);
}
.modal-backdrop[hidden] { display: none; }
.confirm-modal {
  position: relative;
  width: min(320px, calc(100vw - 32px));
  padding: 30px 28px 24px;
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .24);
  text-align: center;
}
.confirm-modal h3 {
  margin: 0 32px 12px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
}
.confirm-modal p {
  margin: 0 0 26px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}
.modal-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-btn {
  height: 32px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.modal-btn-ghost {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
}
.modal-btn-ghost:hover { background: var(--bg-soft); }
.modal-btn-primary {
  border: 1px solid #06aeea;
  background: #06aeea;
  color: #fff;
}
.modal-btn-primary:hover { background: #049bd1; border-color: #049bd1; }
@media (max-width: 600px) {
  .comment-form-foot {
    align-items: stretch;
    flex-direction: column;
  }
  .comment-form-foot .btn { width: 100%; }
  .comment-avatar {
    width: 36px;
    height: 36px;
  }
  .comment-avatar-sm {
    width: 26px;
    height: 26px;
  }
  .comment-actions-row {
    gap: 14px;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 48px 0 32px;
  margin-top: 64px;
  font-size: 14px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-subtle); margin: 0 0 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--brand); }
.footer-brand p { color: var(--text-muted); margin: 8px 0 0; max-width: 320px; }
.footer-wechat {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
.footer-wechat:hover,
.footer-wechat:focus-visible {
  color: var(--brand);
}
.footer-wechat-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.footer-wechat-qr {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  z-index: 60;
  display: none;
  width: 240px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
}
.footer-wechat-qr img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.footer-wechat:hover .footer-wechat-qr,
.footer-wechat:focus .footer-wechat-qr,
.footer-wechat:focus-visible .footer-wechat-qr {
  display: block;
}
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: var(--text-subtle); font-size: 13px;
}

/* Auth slot */
#authSlot { display: inline-flex; align-items: center; gap: 8px; }
.btn-xs { padding: 4px 14px !important; font-size: .8rem !important; }
.user-greeting { font-size: .875rem; color: var(--text-muted); white-space: nowrap; }
.header-avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border); cursor: pointer; transition: border-color .15s;
}
.header-avatar:hover { border-color: var(--brand); }
.header-avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: .85rem; font-weight: 700;
}
/* Avatar dropdown */
.avatar-dropdown { position: relative; }
.avatar-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 180px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: 8px 0; z-index: 999;
}
.avatar-menu.open { display: block; }
.avatar-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.avatar-menu-header .menu-av {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border); flex-shrink: 0;
}
.avatar-menu-header .menu-av-fallback {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 1rem; font-weight: 700;
}
.avatar-menu-header .menu-name { font-weight: 600; font-size: .92rem; color: var(--text); }
.avatar-menu a, .avatar-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px;
  border: none; background: none; font-size: .9rem; color: var(--text-muted);
  cursor: pointer; text-decoration: none; transition: all .12s;
}
.avatar-menu a:hover, .avatar-menu button:hover { background: var(--bg-soft); color: var(--text); }
.avatar-menu .menu-ic { font-size: 1rem; width: 20px; text-align: center; }
.avatar-menu .menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
