/* ==========================================================================
   我的小站 · 主题样式
   --------------------------------------------------------------------------
   想改外观，只需要动最下面「设计令牌」里的变量：
     想换主色调 → 改 --accent（或者在网页的设置面板里点色块）
     想换圆角   → 改 --radius
     想换字体   → 改 --font
   设置面板里能调的东西，都是通过 JS 往 :root 上写同名变量实现的，
   所以在这里改默认值 = 改「出厂样式」。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  /* 颜色 */
  --bg: #f7f7f4;
  --card: #ffffff;
  --text: #1c1c1a;
  --text-soft: #3a3a37;
  --muted: #6f6f6a;
  --line: #e6e6df;
  --line-strong: #d8d8d0;
  --accent: #2f6f4f;
  --accent-soft: #eaf3ee;
  --accent-text: #ffffff;
  --chip: #f2f2ec;
  --code-bg: #ecece5;
  --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 8px 24px rgba(20, 20, 18, .05);
  --shadow-lg: 0 12px 48px rgba(20, 20, 18, .14);

  /* 形状与排版 */
  --radius: 12px;
  --radius-sm: 9px;
  --width: 700px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* 背景图层 */
  --bg-image: none;
  --bg-overlay: 0.35;
  --bg-blur: 0px;
}

/* 夜间主题 */
[data-theme="dark"] {
  --bg: #16171a;
  --card: #1e2024;
  --text: #eceae4;
  --text-soft: #cfccc4;
  --muted: #9a978f;
  --line: #2e3035;
  --line-strong: #3b3e44;
  --accent: #5fb98a;
  --accent-soft: #21322a;
  --accent-text: #0d1210;
  --chip: #26282d;
  --code-bg: #2b2d33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 56px rgba(0, 0, 0, .55);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  padding: 0 16px 88px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

/* 背景图层：支持自定义背景图 + 遮罩 + 模糊 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0;
  transition: opacity .4s ease;
  filter: blur(var(--bg-blur));
  transform: scale(1.04); /* 模糊时避免边缘露白 */
}

body.has-bg::before { opacity: 1; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}

body.has-bg::after { opacity: var(--bg-overlay); }

.wrap { max-width: var(--width); margin: 0 auto; }

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

::selection { background: var(--accent-soft); color: var(--accent); }

/* ---------- 顶栏 ---------- */
/* V2：吸顶 + 毛玻璃。停留在大宽度时只覆盖内容区宽度，不用负 margin 撑满 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 52px 0 26px;
  border-bottom: 1px solid var(--line);
  transition: padding .2s ease;
}

/* 滚动后收紧，避免吸顶条一直占很高 */
.topbar.compact { padding: 12px 0 12px; }
.topbar.compact .brand .sub { display: none; }

/* 锚点跳转的目标不要藏进吸顶条下面（吸顶条收紧后约 100px，留一点余量） */
section.block, #featuresBlock { scroll-margin-top: 112px; }

.brand h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.6px;
  line-height: 1.25;
}

.brand .sub {
  color: var(--muted);
  margin-top: 8px;
  font-size: 15px;
}

.tools { display: flex; gap: 6px; flex-shrink: 0; padding-top: 4px; }

.tool-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s ease;
}

.tool-btn:hover {
  background: var(--card);
  border-color: var(--line);
  color: var(--accent);
  transform: translateY(-1px);
}

.tool-btn:active { transform: translateY(0); }
.tool-btn svg { width: 19px; height: 19px; }

.tool-btn.primary {
  width: auto;
  padding: 0 14px;
  gap: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 500;
}

.tool-btn.primary:hover { filter: brightness(1.06); color: var(--accent-text); }
.tool-btn.primary span { font-size: 14px; }

/* ---------- 区块 ---------- */
section.block { padding: 30px 0; border-bottom: 1px solid var(--line); }
section.block:last-of-type { border-bottom: 0; }

.block-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.block-title .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--chip);
  padding: 1px 8px;
  border-radius: 99px;
}

.about-text { font-size: 15px; color: var(--text-soft); }
.about-text br { line-height: 2; }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }

.tag {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 99px;
  margin-bottom: 9px;
}

.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.card p { font-size: 13.5px; color: var(--muted); line-height: 1.65; }

/* ---------- 动态流 ---------- */
.feed { display: flex; flex-direction: column; gap: 16px; }

.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}

.post:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }

.post-head {
  padding: 18px 20px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.post-title { font-size: 17px; font-weight: 600; letter-spacing: -.2px; }

.post-time {
  font-size: 12.5px;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.post-body { padding: 10px 20px 18px; }

.post-cover {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  background: var(--chip);
}

.post-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .18s;
}

.post:hover .post-actions, .post:focus-within .post-actions { opacity: 1; }

.mini-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}

.mini-btn:hover { color: var(--accent); border-color: var(--accent); }
.mini-btn.danger:hover { color: #c0392b; border-color: #c0392b; }
.mini-btn svg { width: 15px; height: 15px; }

/* ---------- Markdown 正文 ---------- */
.md { font-size: 15px; color: var(--text-soft); word-wrap: break-word; }
.md > *:first-child { margin-top: 0 !important; }
.md > *:last-child { margin-bottom: 0 !important; }
.md p { margin: .72em 0; }
.md h1, .md h2, .md h3, .md h4 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
  margin: 1.3em 0 .55em;
  letter-spacing: -.2px;
}
.md h1 { font-size: 22px; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 16.5px; }
.md h4 { font-size: 15px; }
.md strong { color: var(--text); font-weight: 600; }
.md em { font-style: italic; }
.md del { color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }

.md a { border-bottom: 1px solid var(--accent-soft); }
.md a:hover { border-bottom-color: var(--accent); text-decoration: none; }

.md ul, .md ol { margin: .7em 0; padding-left: 1.5em; }
.md li { margin: .18em 0; }

.md blockquote {
  margin: .9em 0;
  padding: .1em 0 .1em 1em;
  border-left: 3px solid var(--accent-soft);
  color: var(--muted);
}

.md code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--code-bg);
  padding: 1.5px 5px;
  border-radius: 5px;
  color: var(--text);
}

.md .md-pre {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1em 0;
  line-height: 1.6;
}

.md .md-pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  white-space: pre;
}

.md img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: .8em 0;
  display: block;
  background: var(--chip);
}

.md video { max-width: 100%; border-radius: var(--radius-sm); margin: .8em 0; display: block; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14.5px;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty .big { font-size: 30px; margin-bottom: 10px; opacity: .55; }
.empty button {
  margin-top: 14px;
  padding: 9px 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- 页脚 ---------- */
footer {
  padding: 34px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.9;
}

footer .dot { opacity: .5; margin: 0 6px; }

/* ==========================================================================
   弹层：编辑器 / 设置抽屉 / 通用模态
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 22, .32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.overlay.show { opacity: 1; pointer-events: auto; }

/* 居中模态（编辑器、数据管理） */
.modal {
  position: fixed;
  z-index: 61;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%) scale(.97);
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .3, 1);
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-head h3 { font-size: 15.5px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

/* 右侧抽屉（设置） */
.drawer {
  position: fixed;
  z-index: 61;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(400px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform .26s cubic-bezier(.2, .9, .3, 1);
}

.drawer.show { transform: translateX(0); }

.drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-head h3 { font-size: 15.5px; font-weight: 600; }
.drawer-body { overflow-y: auto; flex: 1; padding: 4px 20px 28px; }

/* ---------- 表单控件 ---------- */
.field { margin: 18px 0; }

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 7px;
}

.field .tip {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.6;
  opacity: .85;
}

input[type="text"], input[type="url"], input[type="number"], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select { background: var(--bg); }

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; line-height: 1.7; }

/* 色板 */
/* 原生控件跟随主题色，避免出现浏览器默认的蓝色滑块 */
input[type="range"] { accent-color: var(--accent); cursor: pointer; }
input[type="color"] { cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { cursor: grab; }
input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }

.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; }

.swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform .15s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.swatch:hover { transform: scale(1.12); }

.swatch.active::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid var(--text);
  border-radius: 10px;
  opacity: .55;
}

/* 分段选择器 */
.segmented {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented button {
  flex: 1;
  padding: 6px 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all .16s;
}

.segmented button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  font-weight: 500;
}

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
}

.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row .label { font-size: 14px; }

.switch {
  width: 42px; height: 24px;
  border-radius: 99px;
  background: var(--line-strong);
  border: 0;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1);
}

.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

/* 分区标题 */
.group-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 26px 0 2px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  opacity: .75;
}

.group-title:first-child { margin-top: 14px; padding-top: 0; border-top: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--line-strong); background: var(--bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
}

.btn.solid:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.danger { color: #c0392b; border-color: var(--line); }
.btn.danger:hover { background: #fdf1ef; border-color: #e8b4ab; }
[data-theme="dark"] .btn.danger:hover { background: #33201e; }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; }

/* 同上：.btn 的 display:inline-flex 会盖过 hidden 属性，首屏按钮「清空文字即隐藏」靠这条 */
.btn[hidden] { display: none; }

/* ---------- 编辑器 ---------- */
.editor-tabs { display: flex; gap: 6px; margin-bottom: 12px; }

.editor-tabs button {
  padding: 5px 13px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all .16s;
}

.editor-tabs button.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-weight: 500;
}

#postContent {
  min-height: 230px;
  font-size: 14.5px;
  line-height: 1.75;
  font-family: var(--mono);
}

.preview-pane {
  min-height: 230px;
  padding: 4px 2px;
  overflow-y: auto;
  max-height: 46vh;
}

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

/* 附件区 */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .18s;
  background: var(--bg);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.dropzone svg { width: 20px; height: 20px; display: block; margin: 0 auto 6px; }

.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.attach-item {
  position: relative;
  width: 76px; height: 76px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--chip);
  flex-shrink: 0;
}

.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.attach-item .del {
  position: absolute;
  top: 3px; right: 3px;
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.attach-item.uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .65);
  backdrop-filter: blur(1px);
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 99px;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: all .24s cubic-bezier(.2, .9, .3, 1);
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 40px);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #c0392b; color: #fff; }

/* ---------- 数据管理 ---------- */
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.stat-row:last-child { border-bottom: 0; }
.stat-row b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------- 响应式 ---------- */
@media (max-width: 620px) {
  body { padding: 0 14px 72px; }
  .topbar { padding: 36px 0 22px; flex-direction: column; gap: 14px; }
  .brand h1 { font-size: 25px; }
  .brand .sub { font-size: 14px; }
  .tools { padding-top: 0; }
  .tool-btn.primary span { display: none !important; }
  .tool-btn.primary { width: 38px !important; min-width: 38px; padding: 0 !important; gap: 0; }
  .post-body { padding: 8px 16px 16px; }
  .post-head { padding: 16px 16px 0; flex-direction: column; gap: 2px; }
  .post-actions { opacity: 1; top: 10px; right: 10px; }
  .modal { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; top: 0; left: 0; transform: none; }
  .modal.show { transform: none; }
  .drawer { width: 100vw; border-left: 0; }
  .md { font-size: 14.5px; }
}

/* 打印时隐藏一切工具 */
@media print {
  .tools, .post-actions, .overlay, .modal, .drawer, .toast { display: none !important; }
  body { padding: 0; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   权限：访客看不到编辑类按钮，只有站长登录后才出现
   ============================================================ */
body:not(.is-admin) .admin-only { display: none !important; }

/* ============================================================
   留言板
   ============================================================ */
.comment-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}
.comment-form input[type="text"],
.comment-form textarea { width: 100%; box-sizing: border-box; }
.comment-form textarea { margin-top: 9px; }
.comment-form-foot { display: flex; align-items: center; gap: 12px; margin-top: 11px; }
.comment-form-foot .tip { margin: 0; flex: 1; min-width: 0; }

.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.comment-name { font-size: 14px; font-weight: 600; }
.comment-time { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.comment-body { font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-reply {
  margin-top: 11px;
  padding: 9px 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.comment-reply .who { font-weight: 600; }
.comment-actions { display: flex; gap: 8px; margin-top: 9px; }
.comment-pending { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ==========================================================================
   V2：导航 / Hero / 功能入口
   ========================================================================== */

/* ---------- 导航行 ---------- */
.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 12px;
  flex: 1;
  justify-content: center;
  order: 2;
}
.tools { order: 3; }
.nav a {
  font-size: 13.5px;
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 999px;
  text-decoration: none;
  transition: background .18s, color .18s;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 站名 + 副标题 + 5 个工具按钮会把导航挤成三行（站长登录后尤其明显），
   所以桌面宽度下让导航单独占一行：第一行「站名 + 工具」，第二行居中导航。
   注意：这段必须写在 .nav / .tools 规则之后 —— 媒体查询不增加优先级。 */
@media (min-width: 621px) {
  .topbar { flex-wrap: wrap; padding: 38px 0 18px; }
  .nav { order: 3; flex: 1 0 100%; margin: 0; padding-top: 6px; justify-content: center; }
  .tools { order: 2; }
  .topbar.compact { padding: 10px 0 10px; }
  .topbar.compact .nav { padding-top: 2px; }
}

/* ---------- Hero 首屏 ---------- */
.hero {
  position: relative;
  min-height: 420px;
  margin: 18px 0 34px;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg,
      color-mix(in srgb, var(--accent) 9%, var(--card)),
      color-mix(in srgb, var(--accent) 2%, var(--card)));
  border: 1px solid var(--line);
  isolation: isolate;
}

/* 背景图层：有图时才显示 */
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .5s;
  z-index: -2;
}
.hero.has-bg .hero-bg { opacity: 1; }

/* 遮罩层：保证文字可读 */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  transition: opacity .4s;
  z-index: -1;
  pointer-events: none;
}
.hero.has-bg::after { opacity: var(--hero-overlay, .58); }

.hero-inner {
  position: relative;
  text-align: center;
  padding: 44px 26px;
  max-width: 560px;
}

.hero-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 18px;
  border: 3px solid var(--card);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .13);
}

/* display:block 会盖过 hidden 属性的默认 display:none，这里补回来 */
.hero-avatar[hidden] { display: none; }

.hero-kicker {
  font-size: 11.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: -.8px;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text);
}

.hero-desc {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.hero-actions .btn { text-decoration: none; }
.hero-actions .btn:hover { text-decoration: none; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .07);
}
.hero-stats .stat {
  flex: 1;
  text-align: center;
  padding: 0 10px;
  border-right: 1px solid var(--line);
}
.hero-stats .stat:last-child { border-right: 0; }
.hero-stats .stat b {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.hero-stats .stat span {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 功能入口卡片 ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.feature {
  position: relative;
  display: block;
  padding: 18px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  cursor: pointer;
}
.feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
  text-decoration: none;
}
.feature .ico {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 11px;
  display: block;
}
.feature h4 {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}
.feature p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}
.feature.has-badge::after {
  content: attr(data-badge);
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- V2 响应式 ---------- */
@media (max-width: 720px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .features { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .hero { min-height: 360px; }
  .hero-inner { padding: 34px 18px; }
  .hero-stats { padding: 12px 2px; }
  .hero-stats .stat b { font-size: 17px; }
  .hero-stats .stat span { font-size: 11px; }
}

/* ==========================================================================
   V2 P1：动态详情 / 归档 / 搜索 / 标签筛选
   ========================================================================== */

.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-more { flex: 1; }
.post-more a { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.post-more a:hover { color: var(--accent); }
#postModalBody { max-height: 62vh; overflow-y: auto; }

/* 归档列表 */
.archive-list { display: flex; flex-direction: column; }
.archive-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.archive-item:last-child { border-bottom: 0; }
.archive-item:hover { background: var(--accent-soft); text-decoration: none; }
.archive-day {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 26px;
  flex-shrink: 0;
}
.archive-title { font-size: 14.5px; color: var(--text); }

/* 搜索结果 */
.search-results { display: flex; flex-direction: column; }
.search-hit {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.search-hit:hover { background: var(--accent-soft); text-decoration: none; }
.search-hit b { font-size: 14.5px; font-weight: 600; }
.search-hit .tip { margin: 0; white-space: nowrap; }

/* 标签筛选提示条 */
.tag-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.tag-filter .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  padding: 4px 6px 4px 12px;
  border-radius: 99px;
}
.tag-filter .chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tag-filter .chip button:hover { filter: brightness(1.1); }

/* 动态上的标签胶囊（可点筛选） */
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 4px; }
.post-tags .tag { cursor: pointer; margin-bottom: 0; }
.post-tags .tag:hover { filter: brightness(1.05); }
.post-title .pin { font-size: 14px; margin-right: 4px; }

/* ==========================================================================
   V2 P3：页脚三列 / 回到顶部
   ========================================================================== */
.site-foot {
  margin-top: 46px;
  padding: 30px 0 26px;
  border-top: 1px solid var(--line);
  text-align: left; /* 覆盖旧 footer 选择器的居中 */
}
.foot-cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 26px;
  margin-bottom: 24px;
}
.foot-brand b { font-size: 15px; display: block; margin-bottom: 7px; color: var(--text); }
.foot-brand .tip { margin: 0; line-height: 1.7; }
.foot-links b { font-size: 13px; display: block; margin-bottom: 9px; color: var(--text); }
.foot-links a { display: inline-block; font-size: 13px; color: var(--muted); text-decoration: none; padding: 3px 0; margin-right: 12px; }
.foot-links a:hover { color: var(--accent); }
.foot-bottom { text-align: center; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 620px) {
  .foot-cols { grid-template-columns: 1fr 1fr; gap: 20px; }
  .foot-brand { grid-column: 1 / -1; }
}

.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  z-index: 45;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { transform: translateY(-2px); color: var(--accent); }