/* style.css —— 现代化简约风格（可随意改主题色） */
:root {
  --bg: #f7f7f9;
  --card: #ffffff;
  --text: #26272b;
  --muted: #6b6d76;
  --border: #e5e5ea;
  --accent: #6d5b9e;          /* 主色：灰之魔女的紫 */
  --accent-soft: #f0ecfa;
  --danger: #d64545;
  --code-bg: #f4f4f7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 20, 40, 0.06), 0 8px 24px rgba(20, 20, 40, 0.05);
  /* 背景遮罩（浅色模式）：透明值由服务端注入 */
  --overlay-light: rgba(247, 247, 249, var(--overlay-op, 0.9));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171c;
    --card: #202027;
    --text: #e8e8ee;
    --muted: #9a9aa6;
    --border: #33333d;
    --accent: #a58fe0;
    --accent-soft: #2a2736;
    --danger: #f07178;
    --code-bg: #1d1d26;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    /* 背景遮罩（深色模式） */
    --overlay-dark: rgba(23, 23, 28, var(--overlay-op-dark, 0.78));
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  /* 自定义字体外链（SITE_FONT_URL + SITE_FONT_FAMILY 配置后由服务端注入 --site-font） */
  font-family: var(--site-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif);
  /* 自定义鼠标指针外链（SITE_CURSOR_URL 配置后由服务端注入 --site-cursor） */
  cursor: var(--site-cursor, auto);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
}

/* ---------- 页面入场动画（切换页面时轻量淡入上移，不影响阅读） ---------- */
body.fade-in { animation: pageIn 0.45s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  body.fade-in { animation: none; }
}

/* ---------- 鼠标点击涟漪（fixed 浮层，轻量动画，互不干扰布局） ---------- */
.ripple {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  background: var(--accent);
  opacity: 0.18;
  transform: translate(-50%, -50%) scale(0);
  animation: rippleAnim 0.55s ease-out forwards;
  z-index: 9999;
}
@keyframes rippleAnim { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* ---------- 文章卡片滚动渐入（进入视口才播放，动画轻量） ---------- */
.post-card { opacity: 1; transform: none; }
.post-card:not(.in-view) { opacity: 0; transform: translateY(12px); }
.post-card { transition: opacity 0.5s ease, transform 0.5s ease; }
@media (prefers-reduced-motion: reduce) {
  .post-card:not(.in-view) { opacity: 1; transform: none; }
}

/* ---------- 背景图 + 遮罩（SITE_BG_IMAGE 配置后自动启用） ---------- */
body.has-bg {
  background-image: var(--bg-img, none);
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}
body.has-bg::before {
  content: "";
  position: fixed; inset: 0;
  z-index: -1;
  background: var(--overlay-light, rgba(247, 247, 249, 0.9));
  opacity: var(--overlay-on, 0);
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  body.has-bg::before {
    background: var(--overlay-dark, rgba(23, 23, 28, 0.78));
  }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* ---------- 头部 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { height: 32px; width: auto; border-radius: 8px; }
.logo-emoji { font-size: 22px; }
.brand-name { font-size: 17px; letter-spacing: 0.5px; }

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.site-nav a.active { background: var(--accent); color: #fff; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 56px 0 30px; }
.hero-title { font-size: 34px; margin: 0 0 8px; letter-spacing: 1px; }
.hero-sub { color: var(--muted); margin: 0; font-size: 16px; }

.section-title { font-size: 20px; margin: 34px 0 18px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); display: inline-block; }
.count { color: var(--muted); font-weight: 400; font-size: 15px; }

.post-list { display: flex; flex-direction: column; gap: 18px; padding-bottom: 40px; }

.post-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(20, 20, 40, 0.1); }
.post-cover img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; margin-bottom: 14px; }
.post-card-title { margin: 0 0 6px; font-size: 21px; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); text-decoration: none; }
.post-meta { color: var(--muted); font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.post-excerpt { color: var(--muted); font-size: 14.5px; margin: 10px 0 0; }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px;
}
.tag-cat { background: var(--accent); color: #fff; }

/* ---------- 文章页 ---------- */
.post { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 32px; box-shadow: var(--shadow); }
.post-title { font-size: 28px; margin: 0 0 10px; }
.post > .post-meta { margin-bottom: 18px; }
.post-content { font-size: 16.5px; }
.post-content h1, .post-content h2, .post-content h3 { margin: 1.6em 0 0.6em; line-height: 1.4; }
.post-content h2 { font-size: 23px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.post-content h3 { font-size: 19px; }
.post-content img { max-width: 100%; border-radius: 8px; }
.post-content blockquote {
  margin: 1em 0; padding: 10px 18px; border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--muted);
}
.post-content table { border-collapse: collapse; margin: 1em 0; width: 100%; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 12px; }
.post-content th { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; }

/* ------ 代码块 + 一键复制 ------ */
.code-block {
  position: relative; background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 1.1em 0;
}
.code-block code { font-family: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace; font-size: 13.5px; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 3px 10px; font-size: 12px; cursor: pointer; opacity: 0.85;
}
.copy-btn:hover { opacity: 1; }

/* ------ 黑幕（hover 显示） ------ */
.heimu {
  background: var(--text); color: var(--text); border-radius: 4px;
  padding: 1px 5px; cursor: pointer; transition: color 0.25s ease;
  user-select: none;
}
.heimu:hover, .heimu:focus { color: var(--accent-soft); text-decoration: none; }

  /* ------ 回复后可见（默认模糊，悬停显示） ------ */
  .reply-hidden {
    background: var(--card); border: 1px dashed var(--border); border-radius: 6px;
    padding: 4px 10px; cursor: help; user-select: none;
    filter: blur(6px); transition: filter 0.3s ease;
  }
  .reply-hidden:hover, .reply-hidden:focus { filter: blur(0); user-select: text; }

  /* ------ 下载模块 ------ */
  .download-module { display: inline-block; margin: 4px 0; }
  .download-module .btn { display: inline-block; }

  /* ------ 正文音视频 ------ */
  .post-content audio { max-width: 100%; margin: 8px 0; display: block; }
  .post-content video { display: block; margin: 8px auto; border-radius: 8px; }

  /* ------ 后台编辑器工具栏 ------ */
  .md-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 6px 0 8px; padding: 8px 10px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  }
  .md-toolbar-label { font-size: 0.85em; color: var(--text-soft); margin-right: 2px; }
  .md-toolbar .btn { margin: 0; }

/* ---------- 评论 ---------- */
.comments { padding-bottom: 50px; }
.comment-form { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 14px 0 24px; box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.comment-form input, .comment-form textarea, .stack-form input, .stack-form textarea, .stack-form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 14.5px;
}
.comment-form input:focus, .comment-form textarea:focus, .stack-form input:focus, .stack-form textarea:focus, .stack-form select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
}
.comment-form textarea, .stack-form textarea { resize: vertical; }
.form-tip { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.form-msg { background: var(--accent-soft); color: var(--accent); padding: 8px 12px; border-radius: 8px; font-size: 13.5px; margin: 10px 0; }
.form-msg.error { background: #fdecec; color: var(--danger); }

.comment { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px dashed var(--border); }
.c-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; background: var(--border); }
.c-main { flex: 1; min-width: 0; }
.c-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.c-name { font-weight: 600; font-size: 14.5px; }
.c-time { color: var(--muted); font-size: 12.5px; }
.c-content { font-size: 14.5px; word-break: break-word; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: 9px 18px; font-size: 14px; cursor: pointer;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 4px 12px; font-size: 12.5px; border-radius: 6px; }
.inline-form { display: inline-block; margin: 0; }

/* ---------- 后台 ---------- */
.admin-dash { display: flex; flex-direction: column; gap: 22px; padding: 28px 0 60px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; }
.dash-head h1 { margin: 0; font-size: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.stack-form label { display: block; margin: 12px 0 4px; font-size: 13.5px; color: var(--muted); }
.stack-form label > input, .stack-form label > textarea, .stack-form label > select { margin-top: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--border); color: var(--muted); }
.badge.ok { background: #e3f3e7; color: #2e9e5b; }
.pending-item { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--bg); }
.pending-head { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pending-content { margin: 8px 0; font-size: 14.5px; }
.pending-ai { font-size: 12.5px; color: var(--muted); background: var(--accent-soft); border-radius: 6px; padding: 4px 10px; display: inline-block; margin-bottom: 8px; }
.file-list { list-style: none; padding: 0; margin: 10px 0 0; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.file-key { flex: 1; word-break: break-all; font-family: Consolas, monospace; }

/* ---------- 登录 / 门页 ---------- */
.login-card, .gate-card { max-width: 440px; margin: 60px auto; }
.login-card h1, .gate-card h1 { margin: 0 0 14px; font-size: 22px; }
.gate-card ul { padding-left: 1.3em; color: var(--muted); }
.gate-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- 法律页面 ---------- */
.legal { max-width: 760px; }
.legal h1 { font-size: 26px; margin: 0 0 6px; }
.legal-date { color: var(--muted); font-size: 13px; }
.legal h2 { font-size: 18px; margin: 26px 0 10px; }
.legal p, .legal li { font-size: 14.5px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; }
.legal-table th, .legal-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.legal-table th { background: var(--accent-soft); }

/* ---------- Cookie 横幅 ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
  padding: 14px 0;
}
.cookie-banner-in { max-width: 860px; margin: 0 auto; padding: 0 20px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cookie-banner-in p { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 640px; }
.cookie-banner-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0 40px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 4px 0; }

.empty { color: var(--muted); font-size: 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .header-in { height: auto; flex-direction: column; padding: 10px 0; gap: 8px; }
  .site-nav { justify-content: center; }
  .hero-title { font-size: 27px; }
  .post { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .cookie-banner-in { flex-direction: column; align-items: flex-start; }
}/* ---------- Cloudflare Turnstile ---------- */
.cf-turnstile {
  margin-bottom: 12px;
}
.comment-form .cf-turnstile iframe {
  border-radius: 8px;
}/* ---------- 标签云 / 时间归档 / 归档页 ---------- */
.archive-block { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 20px; }
.archive-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.section-title.small { margin: 0 0 8px; font-size: 14px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud .tag { text-decoration: none; }
.tag-cloud .tag em { font-style: normal; opacity: 0.7; margin-left: 2px; font-size: 11px; }
.back-link { margin: 8px 0 30px; }
.back-link a { color: var(--accent); text-decoration: none; font-size: 14px; }

/* ---------- Google 广告占位（预留接口，配置后自动出现） ---------- */
.ad-slot {
  width: 100%;
  min-height: 90px;
  margin: 22px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
}

/* ---------- 评论：检举按钮 ---------- */
.c-actions { margin-top: 6px; }
.btn-link { background: none; border: 0; color: var(--muted); padding: 0; font-size: 12.5px; cursor: pointer; text-decoration: none; }
.btn-link:hover { color: var(--danger); }

/* ---------- 检举弹窗 ---------- */
.flag-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 10, 16, 0.5);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.25s ease both;
  padding: 16px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.flag-modal-box {
  width: 100%; max-width: 440px;
  position: relative;
  animation: popIn 0.3s ease both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.flag-modal-box h3 { margin: 0 0 6px; }
.flag-modal-box label { display: block; margin: 12px 0 4px; font-size: 13.5px; color: var(--muted); }
.flag-modal-box label > input, .flag-modal-box label > textarea { margin-top: 4px; }
.flag-modal-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: 0; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
body.no-scroll { overflow: hidden; }

/* ---------- 后台：被检举评论 ---------- */
.flag-item { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--bg); }
.flag-head { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flag-reason { margin: 8px 0 4px; font-size: 14px; color: var(--text); }
.flag-comment { font-size: 13.5px; color: var(--muted); background: var(--accent-soft); border-radius: 6px; padding: 8px 12px; margin: 6px 0; }

/* ---------- 后台：备份 / 还原 ---------- */
.backup-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0 6px; }

/* ---------- 代码块本地预览（动画限制在代码块范围内） ---------- */
.copy-btn.preview-btn { margin-left: 6px; }
pre.code-block.has-preview { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
.code-preview {
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
  overflow: hidden;
  animation: previewIn 0.35s ease both;
}
@keyframes previewIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.code-preview iframe {
  width: 100%; min-height: 140px;
  border: 0; display: block;
  background: #fff;
}
@media (prefers-reduced-motion: reduce) {
  .flag-modal, .flag-modal-box, .code-preview { animation: none; }
}