:root {
  --paper-bg: #f7f6e0;
  --ink-dark: #1a2438;
  --ink-red: #d83c3c;
  --rule-blue: #73a8c7;
  --mint: #b6e0d0;
  --marker-yellow: #ffdf70;
  --margins-pink: #f8c8d0;
  --graphite: #444;
  --card-bg: #fffcf2;
  --card-shadow: 3px 3px 8px rgba(0, 0, 0, 0.1);
  --sticky-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
  --radius: 3px;
  --radius-sm: 12px;
  --nav-height: 60px;
  --content-width: 680px;
  --sidebar-width: 260px;
  --admin-sidebar-width: 200px;
  --bottom-menu-h: 56px;           /* 手机端固定底部菜单的高度 */
  /* 导航栏品牌（logo + 网站名）外观：后台「页面设置」可调，base.html 会把数值覆盖到 <html> 上 */
  --brand-font: 28px;
  --brand-logo-h: 34px;
  --brand-color: #1a2438;
  --brand-pad: 0;
  /* 内容距页面顶部的距离（后台「页面间距」可调；base.html 把数值输出成自定义属性覆盖它） */
  --home-top: 0px;
  --detail-top: 0px;
}
/* ===== 基础 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--paper-bg) radial-gradient(circle, #ccc 0px, transparent 2px) 0 0 / 20px 20px fixed;
  color: var(--ink-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

hr {
  width: 100%;
  height: 1px;
  margin-bottom: 16px;
  color: var(--graphite);
  background: var(--margins-pink);
}

/* 表格（正文里 TinyMCE 也会插入 table） */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

table th,
table td {
  padding: 8px 12px;
  border: 1px solid var(--graphite);
  background: var(--card-bg);
  text-align: left;
}

table th {
  font-weight: 600;
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
}

/* 有背景图的页面：菜单保持透明，只加一层纯模糊，滚动经过的内容不至于糊在一起 */
body:has(.page-bg) .navbar {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* 导航栏：高度是**最小值**，后台把品牌区的上下间距调大时整条带子会跟着长高（不会把内容挤出去） */
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  min-height: var(--nav-height);
  justify-content: space-between;
}

/* 品牌区（logo + 网站名）：字号 / 颜色 / 四边间距都由后台「页面设置」的自定义属性控制 */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: var(--brand-font);
  padding: var(--brand-pad);
  text-decoration: none;
  color: var(--brand-color);
}

.logo:hover {
  color: var(--ink-red);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 导航里的按钮比正文按钮更紧凑（原来写在模板的 style 属性里） */
.nav-right .btn-outline {
  padding: 4px 10px;
  font-size: 12px;
}

.nav-right .btn-solid-red {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-outline {
  border: 1px solid var(--graphite);
  padding: 6px 14px;
  background: 0 0;
  border-radius: var(--radius);
  font-family: inherit;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-outline:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-solid-red {
  background: var(--ink-red);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}

.btn-solid-red:hover {
  background: #b82e2e;
}

/* ===== Main ===== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - var(--nav-height) - 80px);
}

/* 首页背景图层：两端顶到页面、**永远 16:9**（后台「背景效果」区就是它的预览，代表浏览器视口），
   压在所有内容与菜单之下；裁剪图在里面按自己的比例完整显示（见下方 .page-bg img）。
   **前台这里不铺黑底**：图片没盖到的地方（比例不一致留出的边、图片比带子小时）
   直接就是页面的纸张纹理，底部 120px 再叠马赛克镂空，所以图片下面看到的是马赛克/纸张，不是一块黑。
   （后台面板的「背景效果」区是编辑画布，那边保持黑底、不加马赛克，见 .home-image-band。） */
.page-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

/* 底部 120px：不规则 8×8px 马赛克镂空（遮罩图 static/blog/img/mosaic-mask.png，生成参数见 AGENTS.md）。
   两层遮罩叠加挂在**每一层图片自己身上**（`.page-bg img`），所以镂空带永远贴着那张图的底边：
   `bottom left` + `repeat-x` 的马赛克贴图，上面再叠一层渐变把「镂空带以外」保持完全不透明。
   `--mosaic-zone`（见 .page-bg img）按当前倍率折算，屏幕上就是图片底部的 120px 左右。
   背景层容器（.page-bg）**不铺底色**，所以挖空处透出的是页面的纸张纹理；
   后台面板的「背景效果」区是编辑画布，不加镂空（见 .home-image-band img）。 */

/* 固定视差：这条 16:9 背景带钉在视口顶部，内容从它上方滑过。
   注意**不要**把整层撑成视口高（那会把图放大铺满屏幕、看着像被拉伸） */
.page-bg.is-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

/* 滚动视差的载体（transform 由 page-background 组件绑定） */
.page-bg-motion {
  position: relative;
  height: 100%;
}

/* 多层背景：一层一个 img，按 DOM 顺序从底到顶叠。
   每层的**元素框就是图片本身**：`width: 100%` 跟着带子走、`max-height: 100%` 让太高的图按比例缩回去
   （等价于 contain，但元素框不铺满带子），所以：
   * 定位是「图片中心点百分比」（:style 绑定的 left/top）+ translate(-50%,-50%)，拖动是纯像素换算；
   * 底部 120px 的不规则马赛克镂空正好落在**图片底边**（元素框 = 图片，mask 的 bottom 就是图片底部），
     `--zoom`（由 :style 给出实际倍率）用来把镂空带换算回屏幕尺寸，缩放后镂空大小看起来不变。 */
.page-bg img {
  --zoom: 1;
  --mosaic-zone: min(calc(120px / var(--zoom)), 25%);
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  transform: translate(-50%, -50%);
  -webkit-mask-image: linear-gradient(to top, transparent 0 var(--mosaic-zone), #000 var(--mosaic-zone)), url("img/mosaic-mask.png");
  -webkit-mask-size: 100% 100%, auto var(--mosaic-zone);
  -webkit-mask-position: 0 0, bottom left;
  -webkit-mask-repeat: no-repeat, repeat-x;
  mask-image: linear-gradient(to top, transparent 0 var(--mosaic-zone), #000 var(--mosaic-zone)), url("img/mosaic-mask.png");
  mask-size: 100% 100%, auto var(--mosaic-zone);
  mask-position: 0 0, bottom left;
  mask-repeat: no-repeat, repeat-x;
}

/* 背景图透明度档位：后台按 10% 一档设置，对应 HomeImage.opacity_class（0% = 完全透明） */
.opacity-100 { opacity: 1; }
.opacity-90 { opacity: .9; }
.opacity-80 { opacity: .8; }
.opacity-70 { opacity: .7; }
.opacity-60 { opacity: .6; }
.opacity-50 { opacity: .5; }
.opacity-40 { opacity: .4; }
.opacity-30 { opacity: .3; }
.opacity-20 { opacity: .2; }
.opacity-10 { opacity: .1; }
.opacity-0 { opacity: 0; }

/* ===== Container / Sidebar ===== */
.container {
  display: block;
  padding-top: var(--home-top);   /* 首页内容距顶部（后台「页面间距」设置） */
}

/* 手机端固定**底部菜单**：日历 / 搜索 / 分类 / 标签 四项常驻在屏幕底部（没有「筛选」按钮），
   点其中一项就在菜单上方展开它的面板（见下面的 .sidebar[data-tab]）。宽屏（>=1024px）隐藏，改用常驻侧栏。 */
.bottom-menu {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 130;                    /* 在面板（120）与遮罩（110）之上，面板打开时还能切菜单项 */
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--graphite);
  padding-bottom: env(safe-area-inset-bottom);   /* iPhone 底部安全区 */
}

.bottom-menu-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--bottom-menu-h);
  padding: 6px 4px;
  border: none;
  background: none;
  color: var(--ink-dark);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
}

.bottom-menu-item.active {
  color: var(--ink-red);
}

.bottom-menu-item .el-icon {
  font-size: 18px;
}

/* 筛选条件数量角标挂在「分类」项右上角（不是单独一行） */
.bottom-menu-item .filter-count {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(9px);
}

/* 手机端：`.sidebar` 是**底部菜单上方**那块可展开的面板（日历 / 搜索 / 分类 / 标签 里的一项）。
   它是 position: fixed，关着时不占布局；`data-tab` 决定展示哪一项（由 sidebar-drawer 组件写上去）。
   宽屏（>=1024px）由下面的媒体查询还原成常驻侧栏，四项一起显示。 */
.sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bottom-menu-h) + env(safe-area-inset-bottom));
  z-index: 120;                    /* 压过顶部菜单（z-index: 100） */
  display: block;
  max-height: 60vh;
  max-height: 60dvh;               /* 支持 dvh 的浏览器按可视高度算，不被地址栏顶掉 */
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 16px;
  background: var(--paper-bg);
  border-top: 1px solid var(--graphite);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .18);
  transform: translateY(110%);
  visibility: hidden;
  transition: transform .22s ease, visibility .22s;
}

.sidebar.open {
  transform: translateY(0);
  visibility: visible;
}

/* 只显示「底部菜单」里点中的那一项；只有一项所以也不用留小组件之间的空隙（宽屏再补回来） */
.sidebar .widget {
  display: none;
  margin-bottom: 0;
}

.sidebar[data-tab="calendar"] .widget-calendar { display: block; }
.sidebar[data-tab="search"] .widget-search { display: block; }
.sidebar[data-tab="cats"] .widget-cats { display: block; }
.sidebar[data-tab="tags"] .widget-tags { display: block; }

.sidebar-backdrop {
  display: none;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: var(--content-width);
}

.filter-bar {
  border: 1px solid var(--ink-red);
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--ink-red);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--card-bg);
  border-radius: var(--radius);
}

.filter-clear {
  color: var(--graphite);
  text-decoration: none;
  font-size: 12px;
}

.filter-clear:hover {
  color: var(--ink-red);
}

/* ===== Search ===== */
.search-box {
  display: flex;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--graphite);
  outline: none;
  font-size: 13px;
  min-height: 38px;
  background: var(--card-bg);
  font-family: inherit;
  border-radius: var(--radius) 0 0 var(--radius);
}

.search-box input:focus {
  border-color: var(--rule-blue);
}

.search-box button {
  padding: 8px 14px;
  background: var(--rule-blue);
  color: #fff;
  border: 1px solid var(--rule-blue);
  cursor: pointer;
  min-height: 38px;
  font-size: 12px;
  font-family: inherit;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===== Widgets ===== */
.widget {
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  overflow: hidden;
}

.widget-hd {
  padding: 8px 12px;
  border-bottom: 1px dashed var(--graphite);
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-dark);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(115, 168, 199, 0.08);
}

.widget-bd {
  padding: 10px 12px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* 分类用更紧的间距（原来写在模板的 style 属性里） */
.tag-cloud.tight {
  gap: 3px;
}

.tag-cloud .tag {
  padding: 3px 10px;
  background: 0 0;
  color: var(--ink-dark);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
}

.tag-cloud .tag:hover,
.tag-cloud .tag.active {
  background: var(--ink-dark);
  color: #fff;
  border-color: var(--ink-dark);
}

/* ===== Calendar ===== */
.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 6px;
  font-size: 13px;

}

.calendar-nav a {
  color: var(--rule-blue);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: var(--radius);
}

.calendar-nav a:hover {
  background: rgba(115, 168, 199, 0.1);
}

/* ===== 日历网格（由 _calendar.html 片段渲染） ===== */
.calendar-container {
  margin: 0;
}

.calendar-header,
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-header {
  margin-bottom: 4px;
}

.cal-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: var(--radius);
  color: var(--ink-dark);
  font-size: 12px;
  transition: background .2s, color .2s, border-color .2s;
}

.cal-header {
  aspect-ratio: auto;
  padding-bottom: 4px;
  border: none;
  color: var(--graphite);
  font-size: 11px;
  font-weight: 600;
}

.cal-empty {
  border-color: transparent;
}

.cal-cell:not(.cal-empty):not(.cal-header):hover {
  background: rgba(115, 168, 199, .12);
  cursor: default;
}

/* 有文章的日子：薄荷色印章 + 红墨色悬停 */
.cal-has {
  border-color: transparent;
}

.cal-has a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--mint);
  color: var(--ink-dark);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
}

.cal-has a:hover {
  background: var(--ink-red);
  color: #fff;
}

/* 今天：红墨色描边 */
.cal-cell.cal-today {
  border-color: var(--ink-red);
  color: var(--ink-red);
  font-weight: 600;
}

/* ===== Post Card ===== */
.post-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  position: relative;
}

.post-card:last-child {
  margin-bottom: 0;
}

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

.post-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.post-card-author {
  font-size: 13px;
  color: var(--graphite);
}

/* ===== Stamp ===== */
.stamp {
  display: none;
  flex-shrink: 0;
  width: 110px;
  align-self: flex-start;
  margin-top: -8px;
  position: relative;
}

.stamp-img {
  width: 100%;
  height: 82px;
  border: 2px dashed var(--ink-dark);
  padding: 4px;
  background: var(--card-bg);
  transform: rotate(3deg);
  position: relative;
}

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

.stamp-postmark {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 60px;
  height: 60px;
  z-index: 3;
  pointer-events: none;
  opacity: .85;
  transform: rotate(-6deg);
}

.stamp-postmark img {
  width: 100%;
  height: 100%;
  display: block;
}

.post-body h2 {
  font-size: 15px;
  margin-bottom: 8px;
  line-height: 1.35;
}

.post-body h2 a {
  color: #333;
  text-decoration: none;
}

.post-body h2 a:hover {
  color: var(--rule-blue);
}

.post-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--graphite);
  margin-top: 10px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.post-meta-sep {
  opacity: .4;
}

.post-meta-btn {
  background: none;
  border: none;
  color: var(--graphite);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}

.post-meta-btn:hover {
  color: var(--ink-red);
}

/* 列表页里行内的删除表单（原来写在模板的 style 属性里） */
.post-meta form {
  display: inline-flex;
  align-items: center;
}

.post-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.post-title-row h1 {
  margin-bottom: 0;
}

.post-excerpt {
  color: var(--graphite);
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.7;
}

.read-more {
  color: var(--ink-red);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-more:hover {
  color: var(--ink-dark);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.page-link {
  padding: 6px 12px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink-dark);
  font-size: 13px;
  min-width: 32px;
  text-align: center;
  background: var(--card-bg);
}

.page-link:hover {
  border-color: var(--ink-red);
  color: var(--ink-red);
}

.page-link.active {
  background: var(--ink-dark);
  color: #fff;
  border-color: var(--ink-dark);
}

.page-link.dots {
  border: none;
  background: none;
  color: var(--graphite);
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--graphite);
  font-size: 14px;
}

/* 404 页 */
.error-code {
  font-size: 4rem;
}

.empty .btn {
  margin-top: 16px;
}

/* ===== Detail ===== */
.detail-container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-top: var(--detail-top);   /* 详情页内容距顶部（后台「页面间距」设置） */
}

.post-full {
  padding: 28px;
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
}

.post-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--graphite);
}

.post-header h1 {
  font-size: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.post-cover-wrap { position: relative; margin: 0 -28px 8px; }

.post-cover-scroll {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.post-cover-scroll::-webkit-scrollbar {
  display: none;
}

.post-cover-scroll-item {
  flex-shrink: 0;
  width: 100%;
  scroll-snap-align: start;
  background: var(--ink-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-cover-scroll-item img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
  cursor: pointer;
}

.cover-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 26px; color: #fff; cursor: pointer; opacity: 0; padding: 20px 12px; z-index: 2; transition: .3s; user-select: none; background: rgba(0,0,0,0.25); }
.post-cover-wrap:hover .cover-nav { opacity: .6; }
.cover-nav:hover { opacity: 1 !important; }
.cover-nav-prev { left: 0; border-radius: 0 6px 6px 0; }
.cover-nav-next { right: 0; border-radius: 6px 0 0 6px; }

.post-cover-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
  min-height: 8px;
}

.post-cover-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--graphite);
  opacity: .3;
  transition: .2s;
}

.post-cover-dots span.active {
  opacity: 1;
  background: var(--ink-dark);
}

/* ===== Lightbox ===== */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 999; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox-img { max-width: 85%; max-height: 85%; object-fit: contain; z-index: 1; }
.lightbox-close { position: absolute; top: 16px; right: 24px; font-size: 36px; color: #fff; cursor: pointer; opacity: .7; z-index: 2; border: none; background: none; padding: 8px; line-height: 1; }
.lightbox-close:hover { opacity: 1; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); font-size: 40px; color: #fff; cursor: pointer; opacity: .5; padding: 20px 16px; z-index: 2; user-select: none; transition: .2s; }
.lightbox-prev:hover, .lightbox-next:hover { opacity: 1; }
.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }
.lightbox-counter { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; opacity: .7; z-index: 2; }

.post-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.post-tags .tag {
  padding: 2px 10px;
  background: 0 0;
  color: var(--graphite);
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
}

.post-content {
  font-size: 15px;
  line-height: 1.9;
}

.post-content img {
  max-width: 100%;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  margin: 16px 0;
}

.post-content pre {
  background: var(--ink-dark);
  color: var(--paper-bg);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.post-content code {
  font-size: 13px;
}

.post-content blockquote {
  border-left: 4px solid var(--ink-red);
  padding-left: 16px;
  color: var(--graphite);
  margin: 16px 0;
  font-style: italic;
}

.post-content h2,
.post-content h3 {
  margin-top: 32px;
  margin-bottom: 10px;
}

.post-content h2 {
  font-size: 15px;
}

.post-content h3 {
  font-size: 15px;
}

.post-content p {
  margin-bottom: 16px;
}

.post-content a {
  color: var(--ink-red);
}

.post-content ul,
.post-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

/* ===== Comments ===== */
.comments-section {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px dashed var(--graphite);
}

.comments-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.comment {
  padding: 14px 14px 10px;
  border-radius: var(--radius);
  background: var(--card-bg);
  margin-bottom: 10px;
}

.comment-time {
  text-align: right;
  font-size: 12px;
  color: var(--graphite);
  opacity: .6;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.comment-header {
  display: flex;
  margin-bottom: 4px;
  font-size: 12px;
}

.comment-header strong {
  color: var(--ink-dark);
}

.comment-body {
  font-size: 14px;
  color: var(--graphite);
  line-height: 1.6;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  resize: vertical;
  min-height: 70px;
  font-family: inherit;
  background: var(--card-bg);
}

.comment-form textarea:focus {
  border-color: var(--rule-blue);
}

.comment-form button {
  padding: 8px 20px;
  background: var(--ink-red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  min-height: 36px;
  font-family: inherit;
  align-self: flex-end;
}

.comment-form button:hover {
  background: #b82e2e;
}

/* ===== Admin layout ===== */
.admin-layout {
  display: block;
  min-height: calc(100vh - var(--nav-height) - 80px);
}

.admin-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.admin-sidebar .widget-hd {
  background: var(--ink-dark);
  color: #fff;
}

.admin-sidebar ul {
  list-style: none;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.admin-sidebar ul li {
  margin: 0;
}

.admin-sidebar ul li a {
  display: block;
  padding: 6px 10px;
  color: var(--ink-dark);
  text-decoration: none;
  font-size: 13px;
  border-radius: var(--radius);
}

.admin-sidebar ul li a:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-red);
}

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

.admin-main h1 {
  font-size: 20px;
  margin-bottom: 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-header h1 {
  margin-bottom: 0;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.stat-num {
  font-size: 28px;
  font-weight: bold;
  color: var(--ink-dark);
}

.stat-label {
  font-size: 12px;
  color: var(--graphite);
  margin-top: 2px;
}

.actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--ink-dark);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  min-height: 36px;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--ink-red);
  color: var(--ink-red);
}

.btn-primary {
  background: var(--ink-dark);
  color: #fff;
  border-color: var(--ink-dark);
}

.btn-primary:hover {
  background: var(--ink-red);
  border-color: var(--ink-red);
  color: #fff;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-dark);
  text-decoration: none;
  min-height: 28px;
  font-family: inherit;
}

.btn-sm:hover {
  border-color: var(--ink-red);
  color: var(--ink-red);
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.badge-green {
  background: var(--mint);
  color: var(--ink-dark);
}

.badge-gray {
  background: #eee;
  color: var(--graphite);
}

/* ===== Forms ===== */
.blog-form {
  max-width: 900px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--ink-dark);
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: var(--card-bg);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--rule-blue);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-row .form-group {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.alert-error {
  border: 1px solid var(--ink-red);
  background: var(--card-bg);
  color: var(--ink-red);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  border-radius: var(--radius);
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.inline-form input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  outline: none;
  font-size: 13px;
  min-width: 120px;
  min-height: 36px;
  background: var(--card-bg);
  font-family: inherit;
}

.inline-form input:focus {
  border-color: var(--rule-blue);
}

/* ===== Image ===== */
.image-dropzone {
  border: 2px dashed var(--graphite);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  color: var(--graphite);
  cursor: pointer;
  margin-bottom: 10px;
  background: var(--card-bg);
}

.image-dropzone:hover,
.image-dropzone.dragover {
  border-color: var(--rule-blue);
  background: rgba(115, 168, 199, 0.05);
}

.image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gallery-item {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 3px solid transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid #ddd;
}

.gallery-item:hover {
  border-color: #ddd;
}

.gallery-item.is-cover {
  border-color: var(--ink-red);
}

.gallery-item-cover {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ink-red);
  color: #fff;
  text-align: center;
  font-size: 9px;
  padding: 1px;
}

.gallery-item.is-cover .gallery-item-cover {
  display: block;
}

.gallery-item-del {
  display: none;
  position: absolute;
  top: 1px;
  right: 1px;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.gallery-item:hover .gallery-item-del {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item-del:hover {
  background: var(--ink-red);
}

/* ===== Login ===== */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 0 12px;
}

.login-form {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  padding: 32px 24px;
  border: 1px solid var(--graphite);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
}

.login-form h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 15px;
  font-style: italic;
}

.login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  margin-bottom: 12px;
  background: var(--card-bg);
  font-family: inherit;
}

.login-form input:focus {
  border-color: var(--rule-blue);
}

.login-form button {
  width: 100%;
  padding: 10px;
  background: var(--ink-red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
  font-family: inherit;
  font-weight: 500;
}

.login-form button:hover {
  background: #b82e2e;
}

.error {
  color: var(--ink-red);
  text-align: center;
  margin-bottom: 14px;
  font-size: 12px;
}

.login-hint {
  text-align: center;
  color: var(--graphite);
  font-size: 12px;
  margin-top: 14px;
}

/* ===== Back to Top ===== */
.back-top {
  position: fixed;
  bottom: 32px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--graphite);
  background: var(--card-bg);
  color: var(--ink-dark);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: .3s;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
}
.back-top.show { opacity: .8; visibility: visible; }
.back-top.show:hover { opacity: 1; }

/* ===== sm: 640px+ ===== */
@media (min-width: 640px) {
  .main {
    padding: 32px 24px;
  }

  .post-body h2 {
    font-size: 15px;
  }

  .post-content {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-right {
    gap: 12px;
  }

  .form-row {
    flex-direction: row;
    gap: 12px;
  }

  .comment-form {
    flex-direction: row;
  }

  .comment-form button {
    align-self: auto;
  }

  .admin-sidebar ul {
    flex-direction: column;
  }

  .admin-sidebar ul li a {
    white-space: normal;
  }

  .post-header h1 {
    font-size: 32px;
  }

  .post-card {
    padding: 24px;
  }

  .stamp {
    display: block;
  }
}

/* ===== md: 768px+ ===== */
@media (min-width: 768px) {
  .container {
    display: flex;
    gap: 40px;
    justify-content: center;
  }

  .admin-layout {
    display: flex;
    gap: 24px;
  }

  .admin-sidebar {
    width: var(--admin-sidebar-width);
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 80px;
    margin-bottom: 0;
  }

  .admin-table {
    display: table;
    overflow: visible;
  }

  .admin-table thead {
    display: table-header-group;
  }

  .admin-table tbody {
    display: table-row-group;
  }

  .admin-table tr {
    display: table-row;
    padding: 0;
  }

  .admin-table td {
    display: table-cell;
    padding: 10px 14px;
  }

  .admin-table td::before {
    display: none;
  }

  .admin-table th {
    display: table-cell;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--graphite);
    background: var(--ink-dark);
    color: #fff;
    font-size: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .post-header h1 {
    font-size: 36px;
  }

  .post-card {
    padding: 28px;
  }
}

/* ===== lg: 1024px+ ===== */
@media (min-width: 1024px) {
  .main {
    padding: 40px 32px;
  }

  .container {
    gap: 56px;
  }

  /* 到这里才还原成常驻侧栏（<1024px 一律走底部菜单 + 可展开面板）：
     把面板的定位/位移/隐藏/圆角等全部清掉，否则宽屏上会留下手机端的 fixed 定位 */
  .sidebar {
    display: block;
    width: var(--sidebar-width);
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 80px;
    bottom: auto;
    left: auto;
    right: auto;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    transform: none;
    visibility: visible;
    margin: 0 0 20px;
    padding: 0;
    background: transparent;
    border-top: none;
    border-radius: 0;
    box-shadow: none;
    z-index: auto;
  }

  /* 宽屏四项一起显示（手机端只显示点中的那一项），小组件之间恢复空隙 */
  .sidebar .widget {
    display: block;
    margin-bottom: 20px;
  }

  .bottom-menu {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .post-body h2 {
    font-size: 15px;
  }

}

/* ===== 手机端（<1024px，含手机横屏 / 平板 / 窄窗口）：列表区贴顶 + 给底部菜单留位置 =====
   后台设的页面间距（最大 400px）是按宽屏调的，窄屏上会把文章列表推得很低；
   手机端直接忽略那个大间距（最多留 8px），列表紧贴顶部；页面底部再留出固定菜单的高度。 */
@media (max-width: 1023.98px) {
  .container {
    padding-top: min(var(--home-top), 8px);
  }

  /* 只有带底部菜单的页面（首页）需要给它腾高度 */
  body:has(.bottom-menu) .main {
    padding-bottom: calc(var(--bottom-menu-h) + env(safe-area-inset-bottom) + 16px);
  }
}

/* ===== 管理表格：移动端卡片式布局 =====
   模板里的 td[data-label] 与 768px 断点下的 display:table 覆盖属于同一套响应式方案，
   这里补齐缺失的移动端基础样式。 */
@media (max-width: 767.98px) {
  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tr {
    border: 1px solid var(--graphite);
    border-radius: var(--radius);
    background: var(--card-bg);
    margin-bottom: 10px;
    padding: 8px 10px;
  }

  .admin-table td {
    display: flex;
    gap: 8px;
    align-items: baseline;
    border: none;
    padding: 4px 0;
    background: none;
  }

  .admin-table td::before {
    content: attr(data-label);
    flex: 0 0 84px;
    font-size: 12px;
    font-weight: 600;
    color: var(--graphite);
  }

  .admin-table td.empty {
    display: block;
    padding: 40px 10px;
    text-align: center;
  }

  .admin-table td.empty::before {
    content: none;
  }
}

/* ===== 页面设置面板 =====
   分区卡片（站点信息 / 页面间距）：左边小标签、右边控件对齐；图片用「预览 + 选择图片」的一排。 */
.settings-form {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.settings-card {
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
}

.settings-card-hd {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--graphite);
}

.settings-card-hd h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--ink-dark);
}

.settings-card-hd p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--graphite);
}

.settings-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 14px;
}

.settings-label {
  padding-top: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dark);
}

.settings-control {
  min-width: 0;
}

.settings-control-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--graphite);
}

.settings-hint code {
  font-size: 12px;
}

.settings-unit {
  font-size: 12px;
  color: var(--graphite);
}

/* 四边间距：上下左右各一个小输入框 */
.settings-pads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(112px, 100%), 1fr));
  gap: 8px;
}

.settings-pad {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--graphite);
}

.settings-pad input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--ink-dark);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.settings-pad input:focus {
  border-color: var(--rule-blue);
}

/* 取色器 */
.settings-control input[type="color"] {
  width: 46px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  cursor: pointer;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 0 24px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-control input[type="text"],
.settings-control input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--ink-dark);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.settings-control-inline input[type="number"] {
  width: 96px;
}

.settings-control input[type="text"]:focus,
.settings-control input[type="number"]:focus {
  border-color: var(--rule-blue);
}

/* 图片选择：预览缩略图 + 「选择图片」按钮（原生 file 控件藏起来，但仍可 Tab 到并用回车打开） */
.site-image {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.site-image-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--paper-bg);
  color: var(--ink-dark);
  font-size: 12px;
  cursor: pointer;
}

.file-picker:hover {
  border-color: var(--ink-red);
  color: var(--ink-red);
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.file-input:focus-visible + .file-picker {
  border-color: var(--rule-blue);
  outline: 2px solid var(--rule-blue);
  outline-offset: 2px;
}

.site-image-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--graphite);
  cursor: pointer;
}

.site-image-clear:hover {
  color: var(--ink-red);
}

/* 页面设置面板：网站 logo / 图标预览（当前图片 / 未上传时的占位） */
.favicon-preview {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  object-fit: contain;
}

.favicon-preview.is-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--graphite);
}

/* logo 一般比图标宽，预览给它一条横向空间（高度跟着后台设置走，所见即所得） */
.logo-preview {
  height: var(--brand-logo-h);
  max-height: 96px;
  width: auto;
  max-width: 180px;
  flex-shrink: 0;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  object-fit: contain;
}

.logo-preview.is-empty {
  width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--graphite);
}

/* 窄屏：标签挪到控件上方 */
@media (max-width: 639.98px) {
  .settings-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .settings-label {
    padding-top: 0;
  }
}

/* 导航栏 logo 图片（高度由后台设置，宽度按比例） */
.logo-img {
  display: block;
  height: var(--brand-logo-h);
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

/* ===== 首页图片管理面板 ===== */
/* 首页图片管理面板：卡片给足编辑面积（背景带是 16:9，卡片太窄就没法精调） */
.home-image-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr));
  gap: 20px;
}

.home-image-item {
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--graphite);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
}

.home-image-item.is-off {
  opacity: .65;
}

.home-image-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--graphite);
}

.home-image-order {
  font-weight: 600;
  color: var(--ink-dark);
}

.home-image-date {
  margin-right: auto;
}

/* 原图舞台：图片按自然比例铺满，裁剪框百分比即相对它 */
.home-image-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: var(--radius);
  background: #fff;
}

.home-image-stage img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.crop-box {
  position: absolute;
  border: 1px solid var(--ink-red);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45);
  cursor: move;
  touch-action: none;
}

.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--card-bg);
  border: 1px solid var(--ink-red);
}

.crop-handle.is-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.crop-handle.is-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.crop-handle.is-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.crop-handle.is-se { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* 背景效果：和首页一样是 16:9 全宽带（代表浏览器视口），图片按裁剪后的比例完整显示，拖动定位 */
.home-image-band-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
}

.home-image-band {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px dashed var(--graphite);
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  background: #000;   /* 图片按裁剪比例完整显示，多出来的四周露的就是这层黑；这里不加马赛克镂空 */
}

.home-image-band.is-loading::after {
  content: "图片载入中…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
}

.home-image-band:active {
  cursor: grabbing;
}

/* 图片保持裁剪后的比例完整显示：元素框**就是图片本身**（宽度跟带子走，太高就按比例缩回去），
   定位是「中心点百分比」（:style 绑定的 left/top）+ translate(-50%,-50%)，
   和首页 `.page-bg img` 是同一套几何，所以后台看到的构图与前台完全一致；这里不加马赛克镂空 */
.home-image-band img {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  transform: translate(-50%, -50%);
  user-select: none;
}

.home-image-band-hint {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
}

/* 背景带右下角的实时倍率（跟着缩放档位走） */
.home-image-band-zoom {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* 面板顶部对「层级」列法的说明：列表是从下到上的图层顺序，第一张是最下层 */
.home-image-note {
  margin: 0;
  max-width: 52em;
  font-size: 12px;
  line-height: 1.5;
  color: var(--graphite);
}

/* 层级角标 */
.home-image-layer {
  padding: 1px 6px;
  border: 1px solid var(--graphite);
  border-radius: 999px;
  font-size: 10px;
  color: var(--graphite);
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink-dark);
}

/* 透明度为 0 等需要提醒的情况 */
.home-image-warn {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-red);
}

/* 下移用的图标：把 Element Plus 的上箭头转 180°（不引入第二套图标） */
.icon-flip {
  transform: rotate(180deg);
}

.home-image-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
}

.home-image-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 54px;
  color: var(--graphite);
}

.home-image-value {
  color: var(--ink-dark);
  font-variant-numeric: tabular-nums;
}

.home-image-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--ink-red);
}

.home-image-number {
  width: 56px;
  padding: 2px 6px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-family: inherit;
  font-size: 12px;
}

.home-image-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: var(--graphite);
}

.home-image-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.home-image-dirty {
  color: var(--ink-red);
  font-size: 12px;
}

/* ===== 图标（Element Plus 图标集，见 templates/blog/_icons.html） ===== */
/* 精灵容器本身不占布局 */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* 默认比字号略小：汉字是满格方块，图标取 1em 会显得比文字大 */
.el-icon {
  width: .9em;
  height: .9em;
  flex-shrink: 0;
  vertical-align: -0.15em;
  fill: currentColor;
}

/* 图标 + 文字的组合统一留出间距 */
.btn,
.btn-sm,
.page-link,
.read-more,
.filter-clear,
.post-meta-btn,
.admin-sidebar ul li a {
  gap: 5px;
}

.btn-sm,
.post-meta-btn,
.filter-clear {
  gap: 3px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.filter-clear,
.post-meta-btn,
.admin-sidebar ul li a {
  display: inline-flex;
  align-items: center;
}

.admin-sidebar ul li a {
  gap: 6px;
}

/* 各处图标的尺寸 */
.back-top .el-icon {
  width: 19px;
  height: 19px;
}

.cover-nav .el-icon {
  width: 22px;
  height: 22px;
}

.lightbox-prev .el-icon,
.lightbox-next .el-icon {
  width: 30px;
  height: 30px;
}

.lightbox-close .el-icon {
  width: 24px;
  height: 24px;
}

.gallery-item-del .el-icon {
  width: 10px;
  height: 10px;
}

.widget-hd .el-icon {
  width: 12px;
  height: 12px;
}

.alert-error .el-icon,
.error .el-icon {
  vertical-align: -0.18em;
}

/* ===== Vue 组件 ===== */
/* 需要 JS 就绪才显示的片段 */
[v-cloak] {
  display: none !important;
}

/* 抽屉与灯箱打开时锁定页面滚动 */
.scroll-locked {
  overflow: hidden;
}

/* 回到顶部：挂载点自身不参与布局（原来挂在 button 的行内 script 上） */
.back-top-app {
  display: contents;
}

/* 侧栏抽屉：挂载点不参与布局，保证桌面端 .container 的 flex 布局与原来一致 */
.sidebar-app {
  display: contents;
}

.sidebar-backdrop.show {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 110;                    /* 盖住顶部菜单，抽屉打开时页面不可点 */
}

/* 筛选条件数量角标 */
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--ink-red);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

/* 评论发布：提交中 / 错误提示 */
.comment-form button:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.comment-error {
  margin-bottom: 10px;
  color: var(--ink-red);
  font-size: 12px;
}

/* 管理后台列表搜索 */
.admin-search {
  position: relative;
  margin-bottom: 16px;
}

.admin-search input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--graphite);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.admin-search input:focus {
  border-color: var(--rule-blue);
}

.admin-search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  display: flex;
  align-items: center;
  transform: translateY(-50%);
  padding: 0;
  border: none;
  background: none;
  color: var(--graphite);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.admin-search-clear:hover {
  color: var(--ink-red);
}

/* 管理表格：行内操作与编辑中状态 */
.actions form {
  display: inline-flex;
}

.table-link {
  color: var(--ink-dark);
  text-decoration: none;
}

.table-link:hover {
  color: var(--ink-red);
}

.btn-delete {
  color: var(--ink-red);
}

.btn-sm[disabled] {
  cursor: default;
  color: var(--graphite);
  opacity: .7;
}

.admin-table tr.is-editing {
  background: rgba(115, 168, 199, 0.12);
}

.admin-table tr.is-editing td::before {
  color: var(--rule-blue);
}