/* 站点基础样式：暖纸质、柔和圆角，与农场场景同一套配色 */
:root {
  --paper: #faf6ec;
  --card: #fffdf7;
  --ink: #3b332a;
  --ink-2: #7b7062;
  --accent: #6f9c62;
  --accent-soft: #cfe4c4;
  --line: #e8dfcd;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(95, 80, 55, .08);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a { color: inherit; }

.page-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 104px 24px 40px;
}

/* ---------- 顶部导航 ---------- */
.sitenav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(920px, calc(100% - 28px));
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 253, 247, .82);
  border: 1px solid rgba(232, 223, 205, .9);
  box-shadow: 0 8px 26px rgba(95, 80, 55, .1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f3c96b, #d98a5c);
  box-shadow: 0 0 0 3px rgba(217, 138, 92, .18);
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-links a {
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  color: var(--ink-2);
  transition: background .18s, color .18s;
}

.nav-links a:hover { color: var(--ink); background: rgba(111, 156, 98, .1); }
.nav-links a.on { color: var(--ink); background: var(--accent-soft); }

.nav-logout { margin: 0; }

.nav-logout button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .18s, color .18s;
}

.nav-logout button:hover { border-color: var(--accent); color: var(--accent); }

/* 导航头像入口 */
.nav-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  overflow: hidden;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .18s, transform .18s;
}
.nav-avatar:hover { border-color: var(--accent); transform: translateY(-1px); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-avatar-letter {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  user-select: none;
}

/* 更换头像弹窗 */
.avatar-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(59, 51, 42, .38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.avatar-modal[hidden] { display: none; }
.avatar-dialog {
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px 24px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(59, 51, 42, .24);
}
.avatar-dialog h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
}
.avatar-preview {
  width: 88px;
  height: 88px;
  margin: 0 auto 6px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preview-letter { font-size: 34px; font-weight: 600; color: var(--ink); user-select: none; }
.avatar-hint {
  margin: 10px 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  text-align: center;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}
.avatar-grid-empty {
  grid-column: 1 / -1;
  margin: 4px 0;
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
}
.avatar-pick {
  position: relative;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 16px;
  border: 2px solid transparent;
  background: var(--paper);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.avatar-pick:hover { transform: translateY(-1px); border-color: var(--accent-soft); }
.avatar-pick.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111, 156, 98, .16); }
.avatar-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.avatar-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 13.5px;
  color: #fff;
  background: var(--accent);
  border-radius: 10px;
  cursor: pointer;
  transition: filter .15s;
}
.avatar-upload:hover { filter: brightness(.96); }
.avatar-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.avatar-btn {
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.avatar-btn:hover { border-color: var(--accent); color: var(--accent); }
.avatar-btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.avatar-btn.primary:hover { filter: brightness(.96); color: #fff; }
.avatar-btn:disabled { opacity: .55; cursor: default; }
.avatar-msg {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--accent);
}
.avatar-msg.err { color: #b4523f; }

/* 头像可点击放大 */
.avatar-preview img { cursor: zoom-in; }
.avatar-lib-item img { cursor: zoom-in; }
.ddz-avatar img,
.ddz-wait-avatar img { cursor: zoom-in; }

/* 头像裁剪 */
.avatar-crop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(59, 51, 42, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.avatar-crop[hidden] { display: none; }
.avatar-crop-dialog {
  width: min(380px, 100%);
  padding: 20px 20px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(59, 51, 42, .28);
}
.avatar-crop-dialog h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
}
.avatar-crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #2a2622;
  border-radius: 12px;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.avatar-crop-stage.dragging { cursor: grabbing; }
.avatar-crop-stage img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  will-change: transform;
}
.avatar-crop-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(20, 18, 15, .42), inset 0 0 0 2px rgba(255, 255, 255, .85);
}
.avatar-crop-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 4px;
}
.avatar-crop-controls .avatar-crop-zoom {
  flex: 1;
  margin: 0;
}
.avatar-crop-result {
  flex: none;
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
  position: relative;
}
.avatar-crop-result img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
}
.avatar-crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.avatar-crop-zoom input { flex: 1; accent-color: var(--accent); }
.avatar-crop-tip {
  margin: 4px 0 14px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.avatar-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 头像大图 */
.avatar-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 18, 15, .82);
  cursor: zoom-out;
}
.avatar-lightbox[hidden] { display: none; }
.avatar-lightbox img {
  max-width: min(78vmin, 560px);
  max-height: 78vmin;
  width: auto;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

/* ---------- 页脚 ---------- */
.sitefoot {
  text-align: center;
  padding: 26px 16px 34px;
  font-size: 12.5px;
  color: var(--ink-2);
  letter-spacing: .02em;
}

.sitefoot .sep { margin: 0 6px; opacity: .6; }
.sitefoot a { text-decoration: none; color: var(--ink-2); }
.sitefoot a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- 首页占满视口 ---------- */
.page-home .page-main { max-width: none; padding: 0; margin: 0; }
.page-home .sitefoot {
  position: fixed;
  right: 18px;
  bottom: 12px;
  z-index: 30;
  padding: 0;
  color: rgba(59, 51, 42, .55);
  font-size: 11.5px;
  mix-blend-mode: multiply;
}
.page-home .sitefoot span:first-child,
.page-home .sitefoot .sep { display: none; }

/* ---------- 博客列表 ---------- */
.blog-hero { padding: 12px 4px 26px; }

.blog-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: .01em;
}

.blog-hero p { margin: 0; color: var(--ink-2); font-size: 15px; }

.post-list { display: grid; gap: 14px; }

.post-card {
  display: block;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  box-shadow: 0 2px 0 rgba(232, 223, 205, .6);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent-soft);
}

.post-date {
  font-size: 12.5px;
  letter-spacing: .06em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.post-card h2 {
  margin: 4px 0 6px;
  font-size: 20px;
  line-height: 1.45;
}

.post-summary {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.post-tags span, .post-tag {
  font-size: 12px;
  color: #557a4c;
  background: rgba(111, 156, 98, .12);
  border-radius: 999px;
  padding: 2px 9px;
}

.post-tag { text-decoration: none; }
.post-tag:hover { background: var(--accent-soft); color: var(--ink); }

/* ---------- 博客工具条 / 标签云 ---------- */
.hero-link { color: var(--accent); text-underline-offset: 3px; }

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}

.blog-search { display: flex; flex: 1 1 260px; gap: 8px; }

.blog-search input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.blog-search input:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(111, 156, 98, .12);
}

.blog-search button {
  font-family: inherit;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  transition: filter .18s;
}
.blog-search button:hover { filter: brightness(1.06); }

.blog-archive-link {
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.blog-archive-link:hover { color: var(--accent); }

.blog-tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.blog-tagcloud a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  background: rgba(255, 253, 247, .7);
  transition: border-color .18s, color .18s, background .18s;
}
.blog-tagcloud a:hover { border-color: var(--accent-soft); color: var(--ink); background: var(--card); }
.blog-tagcloud a.on { color: var(--ink); background: var(--accent-soft); border-color: var(--accent-soft); }
.blog-tagcloud a b { font-weight: 500; font-size: 11.5px; opacity: .75; }

/* ---------- 列表卡片：封面与阅读时长 ---------- */
.post-card.has-cover { display: flex; gap: 18px; align-items: flex-start; }

.post-cover {
  flex: 0 0 120px;
  height: 88px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(232, 223, 205, .45);
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-main { min-width: 0; flex: 1; }

.post-foot {
  margin-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.post-foot .post-tags { margin-top: 0; }

.post-read { font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* ---------- 归档页 ---------- */
.archive { margin-top: 8px; }

.archive-year { margin-bottom: 26px; }
.archive-year h2 {
  margin: 0 0 10px;
  font-size: 24px;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.archive-month { margin: 0 0 16px; }

.archive-month-label {
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: .06em;
  color: #557a4c;
  background: rgba(111, 156, 98, .12);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 8px;
}

.archive-month ul { list-style: none; margin: 0; padding: 0; }

.archive-month li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px dashed rgba(232, 223, 205, .9);
}
.archive-month li:last-child { border-bottom: none; }

.archive-month li a {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-month li a:hover { color: var(--accent); }
.archive-month li time { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.archive-read { font-size: 12px; color: var(--ink-2); opacity: .8; white-space: nowrap; }

.archive-foot { margin: 10px 0 20px; }

.empty-state {
  padding: 46px 24px;
  text-align: center;
  color: var(--ink-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, .6);
}

.empty-state p { margin: 4px 0; }
.empty-tip { font-size: 13.5px; }
.empty-state code {
  background: rgba(111, 156, 98, .12);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 13px;
}

/* ---------- 博客正文 ---------- */
.post { max-width: 720px; margin: 0 auto; }

.post-back {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
}
.post-back:hover { color: var(--accent); }

.post-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.post-topbar .post-back { margin-bottom: 0; }
.post-edit {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.post-edit:hover { color: var(--accent); border-color: var(--accent-soft); }

.post-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.35;
}

.post-meta {
  margin: 0 0 30px;
  color: var(--ink-2);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.post-meta .dot { opacity: .5; }

.post-body { font-size: 16.5px; line-height: 1.9; }
.post-body h2 { margin: 2em 0 .6em; font-size: 22px; }
.post-body h3 { margin: 1.6em 0 .5em; font-size: 18px; }
.post-body p { margin: 0 0 1.1em; }
.post-body a { color: #4f7a45; text-underline-offset: 3px; }
.post-body img { max-width: 100%; height: auto; border-radius: 12px; }
.post-body blockquote {
  margin: 1.3em 0;
  padding: 4px 18px;
  border-left: 3px solid var(--accent-soft);
  color: var(--ink-2);
  background: rgba(207, 228, 196, .18);
  border-radius: 0 10px 10px 0;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: rgba(59, 51, 42, .06);
  padding: 2px 6px;
  border-radius: 5px;
}
.post-body pre {
  background: #2f2b26;
  color: #f3ece0;
  padding: 16px 18px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
}
.post-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.post-body hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.post-body table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.post-body th { background: rgba(207, 228, 196, .25); }

/* ---------- 阅读页：进度条 / 封面 / 目录 / 相邻文章 ---------- */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

.post-cover-full { margin: 0 0 24px; padding: 0; }
.post-cover-full img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.draft-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 12px;
  font-weight: 500;
  color: #a45a3c;
  background: rgba(217, 138, 92, .16);
  border-radius: 999px;
  padding: 2px 9px;
}

.post-toc {
  margin: 0 0 30px;
  padding: 14px 18px;
  background: rgba(255, 253, 247, .82);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
}
.post-toc b {
  display: block;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ink-2);
  margin-bottom: 8px;
  font-weight: 600;
}
.post-toc ol { margin: 0; padding: 0; list-style: none; }
.post-toc li { padding: 3px 0; }
.post-toc li a {
  color: var(--ink-2);
  text-decoration: none;
  display: inline-block;
  line-height: 1.5;
}
.post-toc li a:hover { color: var(--accent); }
.post-toc .toc-l3 { padding-left: 18px; }
.post-toc .toc-l3 a { font-size: 13px; }

.post-nav {
  max-width: 720px;
  margin: 48px auto 0;
  display: flex;
  gap: 12px;
}
.post-nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-decoration: none;
  transition: border-color .18s, transform .18s;
}
.post-nav-item:hover { border-color: var(--accent-soft); transform: translateY(-2px); }
.post-nav-item small { font-size: 12px; color: var(--ink-2); }
.post-nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
}
.post-nav-item.newer { text-align: right; }
.post-nav-item.ghost { border: none; background: none; }
.post-nav-item.ghost:hover { transform: none; }

.related { max-width: 720px; margin: 40px auto 0; }
.related h2 {
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: .04em;
}
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.related-card {
  display: block;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  transition: border-color .18s, transform .18s;
}
.related-card:hover { border-color: var(--accent-soft); transform: translateY(-2px); }
.related-card time { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.related-card h3 { margin: 4px 0 5px; font-size: 15px; line-height: 1.4; }
.related-card p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 50;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .9);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  border-radius: 999px;
  padding: 8px 11px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 6px 18px rgba(95, 80, 55, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.to-top small { font-size: 9px; color: var(--ink-2); letter-spacing: .08em; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- 博客编辑器 ---------- */
.blog-write-btn {
  font-size: 13.5px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 5px 14px;
  text-decoration: none;
  white-space: nowrap;
}
.blog-write-btn:hover { filter: brightness(1.06); }

.editor { max-width: 1180px; margin: 0 auto; }

.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.editor-head .post-back { margin-bottom: 0; }

.editor-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.editor-status { font-size: 12.5px; color: var(--ink-2); }
.editor-status.err { color: #b5563f; }

.btn-primary, .btn-danger {
  font-family: inherit;
  font-size: 14px;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-danger { background: transparent; color: #a45a3c; border-color: rgba(217, 138, 92, .5); }
.btn-danger:hover { background: rgba(217, 138, 92, .12); }

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.editor-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.editor-main input[type="text"], .editor-main input[type="date"], .editor-main textarea {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .18s, box-shadow .18s;
}
.editor-main input:focus, .editor-main textarea:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(111, 156, 98, .12);
}

#f-title { font-size: 20px; font-weight: 600; padding: 12px 16px; }

.editor-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.editor-body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 4px;
}
.editor-draft { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

#f-body {
  min-height: 52vh;
  resize: vertical;
  line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  white-space: pre-wrap;
}

.editor-preview {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 18px 22px;
  min-height: 52vh;
  max-height: 78vh;
  overflow: auto;
  position: sticky;
  top: 22px;
}
.editor-preview .post-body { max-width: none; margin: 0; }
.preview-empty { color: var(--ink-2); font-size: 13.5px; }

@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-preview { position: static; max-height: none; }
}

/* ---------- 关于 ---------- */
.about { max-width: 700px; margin: 0 auto; text-align: center; }

.about-avatar {
  width: 108px;
  height: 108px;
  margin: 4px auto 18px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.about-avatar svg { width: 100%; height: 100%; display: block; }

.about h1 { margin: 0 0 10px; font-size: 32px; }
.about-lead { color: var(--ink-2); margin: 0 0 26px; }

.about-text { text-align: left; font-size: 16px; }
.about-text p { margin: 0 0 1em; }
.about-text a { color: #4f7a45; }

.about-facts {
  margin: 34px 0 0;
  text-align: left;
  display: grid;
  gap: 10px;
}
.about-facts div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.about-facts dt { color: var(--ink-2); font-size: 13.5px; }
.about-facts dd { margin: 0; font-size: 14.5px; }

/* ---------- 登录 ---------- */
.page-login {
  background:
    radial-gradient(circle at 18% 12%, rgba(207, 228, 196, .55), transparent 45%),
    radial-gradient(circle at 84% 82%, rgba(243, 201, 107, .35), transparent 48%),
    var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
}

.page-login .page-main {
  min-height: calc(100vh - 90px);
  min-height: calc(100dvh - 90px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 10px;
}

.login-wrap { width: 100%; max-width: 380px; }

.login-card {
  display: grid;
  gap: 14px;
  padding: 34px 30px 28px;
  background: rgba(255, 253, 247, .92);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  color: var(--accent);
}
.login-mark svg { width: 100%; height: 100%; }

.login-card h1 { margin: 0; font-size: 21px; letter-spacing: .02em; }
.login-tip { margin: 0 0 6px; color: var(--ink-2); font-size: 13.5px; }

.login-field { display: grid; gap: 6px; text-align: left; }
.login-field span { font-size: 12.5px; color: var(--ink-2); letter-spacing: .04em; }

.login-field input {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 156, 98, .16);
}

.login-btn {
  margin-top: 6px;
  padding: 11px 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: .12em;
  cursor: pointer;
  transition: filter .18s, transform .12s;
}
.login-btn:hover { filter: brightness(1.06); }
.login-btn:active { transform: translateY(1px); }

.login-err {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: #b4523f;
}

.login-foot {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}
.login-foot a {
  color: var(--accent);
  text-decoration: none;
}
.login-foot a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .sitenav {
    top: calc(10px + env(safe-area-inset-top));
    gap: 10px;
    padding: 8px 10px;
  }
  .nav-brand span:last-child { display: none; }
  .nav-links { margin-left: auto; gap: 2px; }
  .nav-links a { padding: 5px 9px; font-size: 13px; }
  /* 窄屏导航空间有限，游戏入口从首页卡片进入 */
  .nav-links a.nav-game { display: none; }
  .nav-avatar { width: 30px; height: 30px; }
  .page-main { padding: calc(86px + env(safe-area-inset-top)) 16px 30px; }
  .about-facts div { grid-template-columns: 70px 1fr; }
  /* 输入框字号不小于 16px，避免 iOS 聚焦时自动放大 */
  .login-field input { font-size: 16px; }
  .login-card { padding: 30px 22px 24px; }
  /* 窄屏下表格横向滚动，避免撑破页面 */
  .post-body table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* 博客卡片/目录/相邻文章在窄屏改为纵向排布 */
  .post-card.has-cover { flex-direction: column; }
  .post-cover { flex-basis: auto; width: 100%; height: 150px; }
  .blog-search { flex-basis: 100%; }
  .post-nav { flex-direction: column; margin-top: 34px; }
  .post-nav-item.newer { text-align: left; }
  .related-grid { grid-template-columns: 1fr; }
  .to-top { right: 14px; bottom: 16px; }
}

@media (max-width: 400px) {
  .sitenav { gap: 6px; padding: 7px 8px; }
  .nav-links a { padding: 5px 7px; }
  .nav-avatar { width: 28px; height: 28px; }
  .nav-logout button { padding: 5px 9px; }
  .page-main { padding-left: 14px; padding-right: 14px; }
  .about h1 { font-size: 26px; }
  .post-card { padding: 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
