/* NeoBlog 前台样式 —— 保留并扩展原有科技感视觉方向 */

:root {
  --bg: #05060f;
  --panel: rgba(13, 16, 32, 0.72);
  --panel-solid: #0d1020;
  --panel-2: rgba(17, 21, 40, 0.85);
  --border: rgba(96, 212, 255, 0.22);
  --border-glow: rgba(96, 212, 255, 0.6);
  --cyan: #60d4ff;
  --violet: #8b5cf6;
  --pink: #f472b6;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --text: #e8edf7;
  --text-dim: #8b93ab;
  --radius: 14px;
  --font-mono: "Consolas", "SFMono-Regular", "Menlo", monospace;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 背景粒子画布 ---------- */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- 网格叠加 ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(96, 212, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 212, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  z-index: 1;
  pointer-events: none;
}

/* ---------- 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 5vw;
  background: rgba(5, 6, 15, 0.6);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s ease, background .4s ease;
}

.site-header.scrolled {
  background: rgba(5, 6, 15, 0.85);
  border-bottom-color: var(--border);
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo .accent { color: var(--cyan); }

.main-nav { display: flex; gap: 26px; align-items: center; }

.nav-link {
  position: relative;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color .3s ease;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s ease;
  border-radius: 2px;
}

.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 15px;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------- 主内容 ---------- */
.app {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 5vw 60px;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.gradient {
  background: linear-gradient(120deg, var(--cyan), var(--violet) 55%, var(--pink));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientFlow 6s ease infinite;
}

.hero-sub {
  margin-top: 22px;
  max-width: 560px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero-sub b { color: var(--cyan); font-weight: 600; }

.hero-cta { margin-top: 34px; display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
}

.btn-primary {
  background: linear-gradient(120deg, var(--cyan), var(--violet));
  color: #05101a;
  box-shadow: 0 0 22px rgba(96, 212, 255, 0.35);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 34px rgba(139, 92, 246, 0.5); }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--border-glow);
  box-shadow: inset 0 0 18px rgba(96, 212, 255, 0.12);
  transform: translateY(-2px);
}

.btn-block { width: 100%; text-align: center; border: none; }

.btn-danger { background: transparent; border-color: rgba(248, 113, 113, 0.5); color: var(--red); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.12); border-color: var(--red); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
}

.section-en {
  font-family: var(--font-mono);
  font-size: 0.72em;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-left: 10px;
}

/* ---------- 搜索框 ---------- */
.search-bar { display: flex; gap: 10px; flex: 1; min-width: 220px; max-width: 420px; }

.search-input {
  flex: 1;
  background: rgba(5, 6, 15, 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 9px 18px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .3s ease, box-shadow .3s ease;
}

.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(96, 212, 255, 0.15);
}

/* ---------- 文章卡片 ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: transform .35s cubic-bezier(.22,.68,.36,1), box-shadow .35s ease, border-color .35s ease, opacity .3s;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-glow);
  box-shadow: 0 18px 44px rgba(96, 212, 255, 0.16);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  background: linear-gradient(120deg, var(--text), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card-excerpt {
  color: var(--text-dim);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.card-meta .views { white-space: nowrap; }

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 0.7rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s, color .2s;
}

.tag:hover { border-color: var(--border-glow); color: var(--text); }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 1px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
}

.badge-draft { background: rgba(251, 191, 36, 0.15); border: 1px solid rgba(251, 191, 36, 0.5); color: var(--amber); }
.badge-published { background: rgba(74, 222, 128, 0.12); border: 1px solid rgba(74, 222, 128, 0.4); color: var(--green); }
.badge-scheduled { background: rgba(96, 212, 255, 0.12); border: 1px solid rgba(96, 212, 255, 0.5); color: var(--cyan); }

.category-chip {
  font-size: 0.74rem;
  color: var(--violet);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 999px;
  padding: 2px 10px;
  text-decoration: none;
  font-family: var(--font-mono);
}

/* ---------- 加载骨架 ---------- */
.skeleton {
  height: 180px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--panel-solid) 25%, rgba(96, 212, 255, 0.08) 50%, var(--panel-solid) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(96, 212, 255, 0.06) 25%, rgba(96, 212, 255, 0.14) 50%, rgba(96, 212, 255, 0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* ---------- 空 / 错误状态 ---------- */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.empty-state .icon { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.7; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; font-size: 1.15rem; }
.empty-state p { font-size: 0.9rem; }

.error-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  background: rgba(248, 113, 113, 0.06);
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  font-family: var(--font-mono);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all .25s;
}

.page-btn:hover:not(:disabled) { border-color: var(--border-glow); color: var(--text); }
.page-btn.active { background: linear-gradient(120deg, var(--cyan), var(--violet)); color: #05101a; border-color: transparent; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-info { color: var(--text-dim); font-size: 0.82rem; font-family: var(--font-mono); }

/* ---------- 文章正文 ---------- */
.post-page { max-width: 780px; margin: 0 auto; }

.post-header { margin-bottom: 30px; }

.post-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.3;
  background: linear-gradient(120deg, var(--text), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

.post-cat { color: var(--violet); text-decoration: none; border: 1px solid rgba(139, 92, 246, 0.4); padding: 1px 10px; border-radius: 999px; font-size: 0.78rem; }
.post-cat:hover { border-color: var(--violet); }

.post-divider { border: none; border-top: 1px solid var(--border); margin-bottom: 30px; }

.article { font-size: 1rem; line-height: 1.85; overflow-wrap: break-word; }

.article h1, .article h2, .article h3, .article h4 {
  margin: 26px 0 12px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: break-word;
}
.article h1 { font-size: 1.6rem; color: var(--text); }
.article h2 { font-size: 1.35rem; color: var(--cyan); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.article h3 { font-size: 1.15rem; }
.article p { margin: 14px 0; }
.article a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.article a:hover { color: var(--text); }
.article ul, .article ol { margin: 14px 0; padding-left: 24px; }
.article li { margin: 6px 0; }
.article li::marker { color: var(--violet); }
.article strong { color: var(--text); font-weight: 700; }
.article em { color: var(--text); }
.article blockquote {
  border-left: 3px solid var(--violet);
  background: rgba(139, 92, 246, 0.08);
  padding: 12px 18px;
  color: var(--text-dim);
  margin: 16px 0;
  border-radius: 0 10px 10px 0;
}
.article blockquote p { margin: 6px 0; }
.article code {
  background: rgba(96, 212, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--cyan);
}
.article pre {
  background: #070a16;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
  margin: 16px 0;
  line-height: 1.6;
}
.article pre code { background: none; border: none; padding: 0; color: #d7e2f2; font-size: 0.85rem; white-space: pre; overflow-wrap: normal; word-break: normal; }
.article img { max-width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--border); }
.article hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.article table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 0.92rem; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article th { background: var(--panel-2); color: var(--cyan); }
.article input[type="checkbox"] { accent-color: var(--cyan); margin-right: 6px; }

/* ---------- V1.6-A：阅读体验（进度条 / TOC / 相邻导航 / 相关推荐 / 灯箱） ---------- */
.reading-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 250;
  pointer-events: none;
  background: transparent;
}
.reading-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width .12s ease-out;
}

.reading-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}
.post-toc {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 12px 10px;
  border-left: 1px solid var(--border);
  font-size: 0.82rem;
}
.post-toc-hidden { display: none; }
.post-toc .toc-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item { margin: 4px 0; }
.toc-item a {
  color: var(--text-dim);
  text-decoration: none;
  display: block;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color .2s, background .2s;
  word-break: break-word;
}
.toc-item a:hover { color: var(--text); }
.toc-item.toc-active a { color: var(--cyan); background: rgba(96, 212, 255, 0.08); }
.toc-l2 { padding-left: 10px; }
.toc-l3 { padding-left: 20px; }

.reading-main { min-width: 0; }

.post-adjacent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 32px;
}
.adjacent-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  transition: border-color .2s, transform .2s;
}
.adjacent-link:hover { border-color: var(--border-glow); transform: translateY(-2px); }
.adjacent-label { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; }
.adjacent-title { font-weight: 600; word-break: break-word; }
.adjacent-next { text-align: right; }
.adjacent-empty { visibility: hidden; }

.related-posts { margin-top: 32px; }
.related-posts .section-title { margin-bottom: 14px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  transition: border-color .2s, transform .2s;
}
.related-card:hover { border-color: var(--border-glow); transform: translateY(-2px); }
.related-cover {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-solid);
}
.related-cover img { display: block; width: 100%; height: 110px; object-fit: cover; }
.related-title { font-weight: 600; font-size: 0.92rem; line-height: 1.35; word-break: break-word; }
.related-cat { color: var(--violet); font-size: 0.75rem; font-family: var(--font-mono); }

/* 图片灯箱 */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(5, 6, 15, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { border-color: var(--border-glow); color: var(--red); }
.article img.lightboxable { cursor: zoom-in; }

.post-footer {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.post-tags .label { color: var(--text-dim); font-size: 0.82rem; font-family: var(--font-mono); }

/* ---------- 分类 / 标签云 ---------- */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  transition: all .25s;
}

.chip:hover { border-color: var(--border-glow); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(96, 212, 255, 0.12); }

.chip .count { color: var(--text-dim); font-size: 0.78rem; font-family: var(--font-mono); }

/* ---------- 表单 ---------- */
.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(10px);
}

.form-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.form-card input[type="text"],
.form-card input[type="password"],
.form-card input[type="search"],
.form-card textarea,
.form-card select {
  background: rgba(5, 6, 15, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 15px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color .3s ease, box-shadow .3s ease;
  width: 100%;
}

.form-card textarea { resize: vertical; line-height: 1.6; }
.form-card select option { background: var(--panel-solid); }

.form-card input:focus, .form-card textarea:focus, .form-card select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(96, 212, 255, 0.15), 0 0 24px rgba(96, 212, 255, 0.12);
}

.field-hint { font-size: 0.78rem; color: var(--text-dim); }

/* ---------- V1.5-A：后台文章管理（筛选/编辑器体验） ---------- */
.admin-filters { }
.admin-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-filter-row .search-input { min-width: 160px; }
.adm-select {
  background: rgba(5, 6, 15, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.adm-select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(96, 212, 255, 0.15); }
.adm-select option { background: var(--panel-solid); }

/* 编辑器信息面板 */
.editor-card { max-width: 1100px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.editor-status-line { display: flex; align-items: center; gap: 10px; }
.editor-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.editor-dirty { color: var(--amber) !important; }

/* ---------- V1.8-D：管理员 AI 写作工作台 ---------- */
.ai-writing-panel {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid rgba(126, 117, 255, 0.42);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(96, 212, 255, 0.055), rgba(126, 117, 255, 0.075));
  box-shadow: 0 12px 32px rgba(5, 6, 15, 0.16);
}
.ai-writing-head,
.ai-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ai-writing-head h4,
.ai-result-head h4 {
  margin: 0 0 5px;
  font-size: 1.05rem;
  color: var(--text);
}
.ai-writing-head p { margin: 0; }
.ai-writing-panel > label,
.ai-result > label { display: block; margin-bottom: 12px; }
.ai-writing-panel textarea,
.ai-result textarea { width: 100%; }
.ai-writing-panel #ai-topic { min-height: 94px; }
.ai-writing-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.ai-writing-options label { min-width: 0; }
.ai-writing-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.ai-writing-actions button:disabled { opacity: 0.55; cursor: not-allowed; }
.ai-writing-status { flex: 1 1 260px; min-width: 0; }
.ai-status-error { color: var(--amber) !important; }
.ai-result {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.ai-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.ai-result-pane { min-width: 0; display: flex; flex-direction: column; }
.ai-result-pane textarea { min-height: 360px; font-family: var(--font-mono); line-height: 1.65; }
.ai-result-pane .md-preview { min-height: 360px; max-height: 520px; }

/* Markdown 编辑/预览分栏（桌面两栏，移动堆叠） */
.md-editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}
.md-editor-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.md-pane-head {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.md-editor-pane textarea {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.65;
  min-height: 420px;
  resize: vertical;
}
.md-preview {
  min-height: 420px;
  padding: 14px 16px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(5, 6, 15, 0.4);
}
.editor-meta-line { display: flex; align-items: center; gap: 10px; min-height: 1.6em; }

/* ---------- V1.5-B2：Markdown 工具栏 + 独立预览 overlay ---------- */
.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.md-toolbar button {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  border-radius: 6px;
  padding: 3px 8px;
  min-height: 28px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
  line-height: 1.2;
  transition: color .2s, border-color .2s, background .2s;
}
.md-toolbar button:hover {
  color: var(--text);
  border-color: var(--border-glow);
  background: rgba(96, 212, 255, 0.08);
}
.md-toolbar .md-tb-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 0 2px;
}

/* 全屏预览 overlay */
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 6, 15, 0.96);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 80px;
}
.preview-overlay .preview-box {
  width: 100%;
  max-width: 780px;
}
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.preview-head .preview-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.preview-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 14px;
  word-break: break-word;
}
.preview-cover {
  display: block;
  width: 100%;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--panel-solid);
}
.preview-cover img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  object-position: center;
}
.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-bottom: 16px;
}
.preview-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.preview-overlay .article { font-size: 1rem; line-height: 1.85; }

@media (max-width: 640px) {
  .preview-overlay { padding: 16px 10px 60px; }
  .md-toolbar { gap: 2px; }
  .md-toolbar button { padding: 4px 7px; min-height: 32px; }
}

@media (max-width: 840px) {
  .md-editor-layout { grid-template-columns: 1fr; }
  .md-editor-pane textarea,
  .md-preview { min-height: 260px; }
  .ai-result-layout { grid-template-columns: 1fr; }
  .ai-result-pane textarea,
  .ai-result-pane .md-preview { min-height: 260px; }
  .admin-filter-row { flex-direction: column; align-items: stretch; }
}

@media (max-width: 560px) {
  .ai-writing-panel { padding: 13px; margin: 18px 0; }
  .ai-writing-options { grid-template-columns: 1fr; gap: 8px; }
  .ai-writing-actions { align-items: stretch; }
  .ai-writing-actions button { width: 100%; }
  .ai-writing-status { flex-basis: 100%; }
}

/* ---------- V1.5-B1：批量管理工具栏 ---------- */
.batch-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.batch-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}
.batch-select-all input { accent-color: var(--cyan); }
.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.batch-select-category, .batch-select-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.batch-select-tags select[multiple] {
  min-width: 200px;
  background: rgba(5, 6, 15, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 8px;
}
.batch-select-tags select[multiple] option { background: var(--panel-solid); }
.batch-row-check { accent-color: var(--cyan); }

@media (max-width: 640px) {
  .batch-toolbar-row { align-items: stretch; }
  .batch-actions { justify-content: flex-start; }
}

/* ---------- 封面图（后台预览 + 卡片/详情共用） ---------- */
.cover-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.cover-preview {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(96, 212, 255, 0.12);
}

.card-cover {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--panel-solid);
}

.card-cover img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: center;
}

.card-cover img[onerror],
.card-cover img.error,
.post-cover img.error,
.card-cover img.broken,
.post-cover img.broken {
  display: none;
}

.post-cover {
  display: block;
  width: 100%;
  margin: 0 0 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--panel-solid);
}

.post-cover img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  object-position: center;
}

.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--panel-2);
}

.admin-table td { padding: 12px 16px; border-bottom: 1px solid rgba(96, 212, 255, 0.08); vertical-align: middle; }

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td { background: rgba(96, 212, 255, 0.03); }

.admin-table .cell-title { font-weight: 600; color: var(--text); }
.admin-table .cell-mono { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim); }
.admin-table .cell-actions { display: flex; gap: 8px; white-space: nowrap; }

/* ---------- 面板卡片 ---------- */
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.stat-card .num { font-size: 1.9rem; font-weight: 800; font-family: var(--font-mono); background: linear-gradient(120deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.stat-card .label { font-size: 0.8rem; color: var(--text-dim); margin-top: 4px; }

/* ---------- 页面加载指示 ---------- */
.page-loading {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  text-align: center;
  padding: 8px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--cyan);
  background: rgba(5, 6, 15, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.page-loading::before {
  content: "";
  display: inline-block;
  width: 11px; height: 11px;
  border: 2px solid rgba(96, 212, 255, 0.35);
  border-top-color: var(--cyan);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}

.hidden { display: none !important; }

/* ---------- 页面切换动画 ---------- */
.fade-page { animation: pageIn .3s ease; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  background: var(--panel-solid);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 0.9rem;
  box-shadow: 0 0 40px rgba(96, 212, 255, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  max-width: 90vw;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(248, 113, 113, 0.6); color: var(--red); }

/* ---------- 页脚 ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 36px 5vw;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  border-top: 1px solid var(--border);
  letter-spacing: 0.06em;
}

/* ---------- 动画 ---------- */
@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--cyan), var(--violet)); border-radius: 6px; }

/* ---------- 语法高亮 ---------- */
.hljs { background: transparent; color: #d7e2f2; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag { color: #c792ea; }
.hljs-number, .hljs-meta { color: #f78c6c; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #a5e075; }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: #82aaff; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-type { color: #ffcb6b; }
.hljs-comment, .hljs-quote, .hljs-deletion { color: #637777; font-style: italic; }
.hljs-built_in, .hljs-symbol, .hljs-bullet { color: #ff9d00; }
.hljs-section, .hljs-title.class_, .hljs-class .hljs-title { color: #ffd700; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .site-header { padding: 12px 5vw; flex-wrap: wrap; }
  .main-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 6px;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
  }
  .main-nav.open { display: flex; }
  .main-nav.open .nav-link {
    padding: 12px 6px;
    font-size: 1.02rem;
  }
  .nav-toggle { display: block; }
  .app { padding: 26px 5vw 44px; }
  .post-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: stretch; }
  .search-bar { max-width: none; }
  .hero { min-height: auto; padding: 30px 0; }
  .form-card { padding: 20px; }
  .pagination { gap: 6px; }
  .page-btn { min-width: 32px; height: 32px; }

  /* 移动端阅读体验 */
  .article { font-size: 0.97rem; }
  .article h1 { font-size: 1.4rem; }
  .article h2 { padding-bottom: 6px; font-size: 1.18rem; }
  .article h3 { font-size: 1.04rem; }
  .article pre { padding: 14px; margin: 14px 0; }
  .article blockquote { padding: 10px 14px; }

  /* 移动端封面 */
  .card-cover img { height: 150px; }
  .post-cover img { max-height: 240px; }

  /* V1.6-A 移动端阅读体验 */
  .reading-layout { grid-template-columns: 1fr; gap: 16px; }
  .post-toc {
    position: static;
    max-height: none;
    border-left: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
  }
  .post-adjacent { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .lightbox-overlay { padding: 12px; }

  /* 移动端空 / 错误状态 */
  .empty-state { padding: 48px 16px; }
  .error-state { padding: 32px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
/* ======================= 第二阶段：AI 文档工作台 ======================= */
.wb-editor { display: flex; flex-direction: column; gap: 12px; }
.wb-topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wb-title-input-wrap { flex: 1; min-width: 200px; }
.wb-title-input-wrap input { width: 100%; font-size: 1.15rem; font-weight: 600; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.wb-status { display: inline-flex; align-items: center; gap: 8px; }

.wb-ai-panel { background: linear-gradient(135deg, rgba(96,212,255,0.08), rgba(139,92,246,0.08)); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.wb-ai-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.wb-ai-head h4 { margin: 0; }
.wb-ai-panel textarea { width: 100%; min-height: 64px; resize: vertical; }
.wb-ai-options { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.wb-ai-options label { display: inline-flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.wb-ai-options select, .wb-ai-options input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.wb-ai-actions { display: flex; gap: 8px; }

.wb-ai-progress { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,0.2); }

/* ---- AI 写作陪伴助手 ---- */
.wb-ai-companion { padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px;
  background: linear-gradient(135deg, rgba(96,212,255,0.07), rgba(139,92,246,0.10)); }
.wb-ai-companion-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wb-ai-companion-icon { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(139,92,246,0.25); color: #c9b8ff; font-size: 0.85rem; }
.wb-ai-companion-title { font-weight: 600; font-size: 0.92rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-ai-companion-stage { font-size: 0.98rem; color: var(--text); line-height: 1.55; }
.wb-ai-companion-hint { margin-top: 4px; font-size: 0.85rem; color: var(--muted); line-height: 1.55; min-height: 1.3em; }
.wb-ai-companion-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wb-ai-step { font-size: 0.78rem; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: rgba(255,255,255,0.03); }
.wb-ai-step.active { color: #fff; border-color: rgba(139,92,246,0.6); background: rgba(139,92,246,0.22); }
.wb-ai-step.done { color: #7fe3b1; border-color: rgba(127,227,177,0.45); background: rgba(127,227,177,0.10); }
.wb-ai-companion-resume { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.wb-ai-progress-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wb-ai-progressbar { position: relative; height: 10px; border-radius: 999px; background: rgba(139,92,246,0.15); overflow: hidden; }
.wb-ai-progressfill { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #60d4ff, #8b5cf6, #f472b6);
  transition: width 0.4s ease; }
.wb-ai-progress-pct { font-size: 0.85rem; color: var(--muted); }
.wb-ai-livepreview { margin-top: 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 0.95rem; line-height: 1.7; }

.wb-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.wb-toolbar button { padding: 5px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; font-size: 0.85rem; }
.wb-toolbar button:hover { background: var(--hover, rgba(96,212,255,0.12)); border-color: var(--border); }
.wb-tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.wb-mode-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.wb-mode-group { display: flex; gap: 4px; }
.wb-mode-btn { padding: 6px 12px; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 0.85rem; }
.wb-mode-btn.active { background: var(--accent, #8b5cf6); color: #fff; border-color: transparent; }
.wb-ai-revise { display: flex; gap: 6px; flex: 1; min-width: 240px; }
.wb-ai-revise input { flex: 1; }

.wb-content-wrap { position: relative; }
.wb-editable { min-height: 50vh; max-height: 70vh; overflow: auto; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; line-height: 1.8; outline: none; color: var(--text); }
.wb-editable:focus { border-color: var(--accent, #8b5cf6); box-shadow: 0 0 0 2px rgba(139,92,246,0.15); }
.wb-editable h1, .wb-editable h2, .wb-editable h3, .wb-editable h4 { margin: 0.6em 0 0.3em; line-height: 1.3; }
.wb-editable p { margin: 0.4em 0; }
.wb-editable ul, .wb-editable ol { margin: 0.4em 0 0.4em 1.4em; padding: 0; }
.wb-editable blockquote { margin: 0.6em 0; padding: 6px 14px; border-left: 3px solid var(--accent, #8b5cf6); background: rgba(96,212,255,0.06); }
.wb-editable table { border-collapse: collapse; width: 100%; margin: 0.6em 0; }
.wb-editable th, .wb-editable td { border: 1px solid var(--border); padding: 6px 10px; }
.wb-editable th { background: rgba(96,212,255,0.08); }
.wb-editable a { color: var(--accent, #8b5cf6); }
.wb-editable pre { background: rgba(0,0,0,0.25); padding: 10px; border-radius: 8px; overflow: auto; white-space: pre-wrap; }
.wb-editable code { font-family: Consolas, monospace; background: rgba(0,0,0,0.2); padding: 1px 5px; border-radius: 4px; }

.wb-preview { min-height: 50vh; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.wb-source { width: 100%; min-height: 50vh; padding: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; font-family: Consolas, monospace; color: var(--text); line-height: 1.6; }

.wb-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.wb-footer .form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.wb-export-box { max-width: 480px; }
.wb-export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.wb-export-grid a { text-align: center; }

.ai-status-error { color: #f09a9a; }

@media (max-width: 640px) {
  .wb-ai-options { flex-direction: column; }
  .wb-ai-options label { width: 100%; }
  .wb-ai-revise { flex-direction: column; }
  .wb-footer { flex-direction: column; align-items: stretch; }
  .wb-footer .form-actions { justify-content: space-between; }
  .wb-export-grid { grid-template-columns: 1fr; }
  .wb-ai-companion { padding: 8px 10px; }
  .wb-ai-companion-stage { font-size: 0.92rem; }
  .wb-ai-companion-hint { font-size: 0.82rem; }
  .wb-ai-step { font-size: 0.74rem; padding: 2px 7px; }
}
