/* ==========================================================================
   极致·X 时间线主题（Z-BlogPHP）
   三栏骨架：左导航 / 中时间线 / 右信息栏
   配色、圆角、字号节奏对齐 X 网页端：Lights out 纯黑 / Dim 深蓝灰 / Light 亮色
   ========================================================================== */

/* ---------- 1. 变量与配色 ---------- */
:root {
  --x-blue: #1d9bf0;
  --x-blue-hover: #1a8cd8;
  --x-red: #f91880;
  --x-green: #00ba7c;

  --x-radius: 16px;
  /* 多图里每张小图的圆角，比单图小一号（X 的做法：单图 16、多图 8） */
  --x-radius-sm: 8px;

  --x-left-w: 275px;
  --x-main-w: 600px;
  --x-rail-w: 350px;

  --x-dur: 0.15s;
  --x-dur-fast: 0.1s;
  --x-ease: ease;

  --x-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Arial,
    sans-serif;
  --x-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Lights out（默认）：html:not([data-theme]) 是 JS 未执行时的兜底 */
html:not([data-theme]),
html[data-theme="dark"] {
  color-scheme: dark;
  --x-bg: var(--x-bg-dark, #000000);
  --x-bg-blur: rgba(0, 0, 0, 0.72);
  --x-bg-hover: rgba(255, 255, 255, 0.03);
  --x-bg-active: rgba(255, 255, 255, 0.06);
  --x-card: #16181c;
  --x-card-hover: #1c1f23;
  --x-border: #2f3336;
  --x-borderb: #2f3336;
  --x-text: #e7e9ea;
  --x-dim: #71767b;
  --x-field: #202327;
  --x-code-bg: #16181c;
  --x-shadow: rgba(255, 255, 255, 0.2);
}

/* Dim */
html[data-theme="dim"] {
  color-scheme: dark;
  --x-bg: var(--x-bg-dim, #15202b);
  --x-bg-blur: rgba(21, 32, 43, 0.78);
  --x-bg-hover: rgba(255, 255, 255, 0.03);
  --x-bg-active: rgba(255, 255, 255, 0.07);
  --x-card: #1e2732;
  --x-card-hover: #253341;
  --x-border: #38444d;
  --x-borderb: #38444d;
  --x-text: #f7f9f9;
  --x-dim: #8b98a5;
  --x-field: #273340;
  --x-code-bg: #1e2732;
  --x-shadow: rgba(255, 255, 255, 0.2);
}

/* Light */
html[data-theme="light"] {
  color-scheme: light;
  --x-bg: var(--x-bg-light, #ffffff);
  --x-bg-blur: rgba(255, 255, 255, 0.86);
  /* X 亮色下的悬停/按下是两块固定灰，不是半透明叠加，卡片悬停才不会发脏 */
  --x-bg-hover: #f7f9f9;
  --x-bg-active: rgba(15, 20, 25, 0.1);
  --x-card: #f7f9f9;
  --x-card-hover: #eff3f4;
  --x-border: #eff3f4;
  --x-borderb: #cfd9de;
  --x-text: #0f1419;
  --x-dim: #536471;
  --x-field: #eff3f4;
  --x-code-bg: #f7f9f9;
  --x-shadow: rgba(0, 0, 0, 0.1);
}

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--x-bg);
  color: var(--x-text);
  font-family: var(--x-font);
  font-size: var(--x-fs, 15px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.x-body--single { overflow-anchor: none; }

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3, h4, h5, h6, p, figure, ul, ol, dl, dd {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
html {
  opacity: 0;
}

::selection {
  background: var(--x-accent);
  color: #fff;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--x-border) transparent;
}

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--x-border); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

/* hidden 属性优先于任何 display 设定：浮层/弹层/遮罩的显隐统一交给 JS 的 hidden */
[hidden] { display: none !important; }

/* 图标：轮廓 / 实心两态，样式切换交给外层 */
.x-i-f { display: none; }
.x-nav__icon,
.x-tabbar__item {
  display: grid;
  place-items: center;
}
.x-nav__icon > i,
.x-tabbar__item > i { grid-area: 1 / 1; }
.x-nav__item:hover .x-i-o,
.x-nav__item.is-active .x-i-o,
.x-tabbar__item:hover .x-i-o,
.x-tabbar__item.is-active .x-i-o { display: none; }
.x-nav__item:hover .x-i-f,
.x-nav__item.is-active .x-i-f,
.x-tabbar__item:hover .x-i-f,
.x-tabbar__item.is-active .x-i-f { display: block; }

.x-verified {
  color: var(--x-accent);
  font-size: 17px;
  flex-shrink: 0;
}

/* ---------- 3. 骨架 ---------- */
.x-app {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-width: 1265px;
  margin: 0 auto;
  min-height: 100vh;
}

/* 左右两栏整体钉在视口高度上：文档滚动时它们不动，只有中栏内容在滚（X 的走法）。
   注意 sticky 必须有「行程」才生效 —— 父级 .x-app 比自身高，所以这里高度写成 100vh；
   不能只给内部元素 sticky，否则父级高度正好等于自身高度，会一起被滚走。 */
.x-left,
.x-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
}

.x-main {
  display: flex;
  flex-direction: column;
  width: var(--x-main-w);
  max-width: 100%;
  min-height: 100vh;
  min-width: 0;
  flex-shrink: 1;
  border-left: 1px solid var(--x-border);
  border-right: 1px solid var(--x-border);
}

/* ---------- 4. 头像 ---------- */
.x-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--x-field);
  color: var(--x-dim);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

.x-avatar--40 { width: 40px; height: 40px; font-size: 16px; }
.x-avatar--32 { width: 32px; height: 32px; font-size: 13px; }
.x-avatar--96 {
  width: 96px;
  height: 96px;
  font-size: 34px;
  border: 4px solid var(--x-bg);
}

.x-avatar--brand {
  background: rgba(29, 155, 240, 0.16);
  background: color-mix(in srgb, var(--x-accent) 16%, transparent);
  color: var(--x-accent);
}

/* 访客占位：灰底灰人，不与品牌色/左栏 logo 抢注意力 */
.x-avatar--guest {
  background: var(--x-field);
  color: var(--x-dim);
  font-size: 20px;
  font-weight: 400;
}

/* ---------- 5. 按钮 ---------- */
.x-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background var(--x-dur) var(--x-ease),
    color var(--x-dur) var(--x-ease), border-color var(--x-dur) var(--x-ease);
}

.x-btn--primary {
  background: var(--x-accent);
  color: #fff;
}
.x-btn--primary:hover { background: var(--x-blue-hover); }

.x-btn--outline {
  border: 1px solid var(--x-border);
  color: var(--x-text);
  background: transparent;
}
.x-btn--outline:hover { background: var(--x-bg-active); }

/* X 的主行动按钮：「登录」「发帖」都是黑白实心块，不是品牌蓝。
   浅色主题 = 黑底白字，深色主题 = 白底黑字，靠 --x-text/--x-bg 自动反转。 */
.x-btn--solid {
  background: var(--x-text);
  color: var(--x-bg);
}
.x-btn--solid:hover {
  background: var(--x-text);
  opacity: 0.88;
}
.x-btn--solid.is-disabled,
.x-btn--solid:disabled {
  opacity: 0.5;
  cursor: default;
}

.x-btn--sm { height: 32px; padding: 0 16px; font-size: 14px; }

.x-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--x-text);
  font-size: 19px;
  transition: background var(--x-dur) var(--x-ease);
}
.x-iconbtn:hover { background: var(--x-bg-active); }

/* ---------- 6. 左侧导航 ---------- */
/* .x-left 已经是 100vh 的固定块，这里占满它并在内部滚动（滚动条隐藏，与 X 一致） */
.x-left__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: var(--x-left-w);
  height: 100%;
  padding: 4px 12px 20px;
  z-index: 35;
  overflow-y: auto;
  scrollbar-width: none;
}
.x-left__inner::-webkit-scrollbar { display: none; }
/* 左栏是一整列 flex：自定义导航项一多，内容会超过 100vh。
   默认 flex-shrink:1 会把每个子项按比例压扁（logo 的 50×50 圆被压成 50×30），
   这里禁止收缩，让 .x-left__inner 自己滚动。 */
.x-left__inner > * { flex: 0 0 auto; }
.x-nav > li { flex: 0 0 auto; }

.x-logo {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin: 2px 0 4px;
  border-radius: 50%;
  font-size: 28px;
  color: var(--x-text);
  transition: background var(--x-dur) var(--x-ease);
}
.x-logo:hover { background: var(--x-bg-active); }
.x-logo > i { font-size: 30px; }

.x-logo__svg { width: 32px; height: 32px; display: block; fill: currentColor; }

.x-logo--text {
  width: auto;
  max-width: 100%;
  padding: 0 14px;
  border-radius: 14px;
  justify-content: flex-start;
}

.x-logo__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
  text-align: left;
}
.x-logo__main {
  font-size: 19px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-logo__sub {
  font-size: 12px;
  color: var(--x-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-logo__img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.x-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.x-nav > li { position: relative; width: 100%; }

.x-nav__item {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 12px 22px 12px 12px;
  border-radius: 9999px;
  font-size: 20px;
  font-weight: 400;
  color: var(--x-text);
  transition: background var(--x-dur) var(--x-ease);
  max-width: 100%;
  cursor: pointer;
}
.x-nav__item:hover { background: var(--x-bg-active); }
.x-nav__item.is-active { font-weight: 700; }

.x-nav__icon {
  width: 26px;
  height: 26px;
  font-size: 26px;
}

.x-nav__label {
  font-size: 20px;
  line-height: 24px;
  white-space: nowrap;
}

/* 后台「导航栏」模块里的链接：按 zblog 的 id 前缀给图标 */
.x-nav--extra {
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--x-border);
}
.x-nav--extra > li > a {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 12px 22px 12px 12px;
  border-radius: 9999px;
  font-size: 20px;
  color: var(--x-text);
  max-width: 100%;
  transition: background var(--x-dur) var(--x-ease);
}
.x-nav--extra > li > a:hover { background: var(--x-bg-active); }
.x-nav--extra > li > a::before {
  font-family: "remixicon";
  font-size: 26px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 400;
}
.x-nav--extra > li[id^="navbar-page-"] > a::before { content: "\ea7e"; }
.x-nav--extra > li[id^="navbar-category-"] > a::before { content: "\ed54"; }
.x-nav--extra > li[id^="navbar-tag-"] > a::before { content: "\f023"; }

/* 模块里的二级菜单：弱化显示，避免和一级导航抢注意力 */
.x-nav--extra li ul { margin: 2px 0 8px 34px; }
.x-nav--extra li ul a {
  display: block;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: 9999px;
  font-size: 15px;
  color: var(--x-dim);
  transition: background var(--x-dur) var(--x-ease), color var(--x-dur) var(--x-ease);
}
.x-nav--extra li ul a:hover { background: var(--x-bg-active); color: var(--x-text); }

/* 底部账号区 */
.x-left__foot {
  margin-top: auto;
  padding-top: 12px;
  width: 100%;
}

.x-account {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9999px;
  transition: background var(--x-dur) var(--x-ease);
}
.x-account:hover { background: var(--x-bg-active); }

.x-account__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 20px;
}
.x-account__name {
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-account__handle {
  color: var(--x-dim);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-account__more {
  margin-left: auto;
  width: 30px;
  height: 30px;
  font-size: 17px;
}

.x-account-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
}

/* 登录后的「发帖」按钮：X 放在导航正下方，不跟账号条一起沉到底部 */
.x-left__post {
  width: 100%;
  margin-top: 16px;
  margin-bottom: 0;
}
.x-account-actions__btn { width: 100%; height: 52px; font-size: 17px; }

.x-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 9999px;
  color: var(--x-dim);
  font-size: 14px;
  transition: background var(--x-dur) var(--x-ease), color var(--x-dur) var(--x-ease);
}
.x-theme-btn:hover { background: var(--x-bg-active); color: var(--x-text); }

/* ---------- 7. 顶栏 ---------- */
.x-topbar {
  position: sticky;
  top: 0;
  z-index: 99;
  background: var(--x-bg-blur);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--x-border);
}

/* 列表页（说说流 / 文章流）用 X 首页那种居中双 tab 代替标题+页码：
   两个等分，选中项 15px/700 + 4px 圆角短下划线，悬停整块变灰。 */
.x-topbar__row.x-topbar__row--tabs {
  position: relative;
  gap: 0;
  padding: 0;
}

.x-tabs {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.x-tabs__item {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 53px;
  font-size: 15px;
  font-weight: 500;
  color: var(--x-dim);
  transition: background var(--x-dur) var(--x-ease), color var(--x-dur) var(--x-ease);
}
.x-tabs__item:hover { background: var(--x-bg-hover); color: var(--x-text); }
.x-tabs__item.is-active { color: var(--x-text); font-weight: 700; }
.x-tabs__item.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 56px;
  height: 4px;
  margin-left: -28px;
  border-radius: 9999px;
  background: var(--x-accent);
}

.x-topbar__row--tabs .x-topbar__actions {
  position: absolute;
  right: 8px;
  top: 50%;
  margin-left: 0;
  transform: translateY(-50%);
  gap: 2px;
}
/* tab 行右侧只留头像，名字会压到「文章」上（X 这里也只有一个「+」按钮） */
.x-topbar__row--tabs .x-avatar-btn__name { display: none; }
.x-topbar__row--tabs .x-avatar-btn { padding: 0 2px; }
/* RSS 入口右栏已有，这里不重复放，tab 行越干净越接近 X */
.x-topbar__row--tabs .x-topbar__actions .x-iconbtn { display: none; }

.x-topbar__row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 53px;
  padding: 0 16px;
}

.x-topbar__headline {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.x-topbar__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x-topbar__headline .x-topbar__title { font-size: 17px; line-height: 21px; }

.x-topbar__sub {
  color: var(--x-dim);
  font-size: 13px;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-topbar__sub:empty { display: none; }

.x-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.x-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 2px;
  border-radius: 9999px;
  transition: background var(--x-dur) var(--x-ease);
}
.x-avatar-btn:hover { background: var(--x-bg-active); }
.x-avatar-btn__name {
  font-size: 14px;
  font-weight: 600;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 8. 发布入口 ---------- */
.x-composer {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--x-border);
}

.x-composer__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.x-composer__placeholder {
  display: block;
  padding: 10px 0 4px;
  font-size: 20px;
  line-height: 24px;
  color: var(--x-dim);
  transition: color var(--x-dur) var(--x-ease);
}
.x-composer__placeholder:hover { color: var(--x-text); }
.x-composer__placeholder--guest { font-size: 20px; line-height: 24px; }

.x-composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.x-composer__icons {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: -8px;
}

.x-composer__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  /* X 的发布框工具条是品牌蓝，不是灰：灰会让整条工具行看着「禁用」 */
  color: var(--x-accent);
  font-size: 19px;
  transition: color var(--x-dur) var(--x-ease), background var(--x-dur) var(--x-ease);
}
.x-composer__icon:hover {
  color: var(--x-accent);
  background: rgba(29, 155, 240, 0.12);
  background: rgba(29, 155, 240, 0.12);
  background: color-mix(in srgb, var(--x-accent) 12%, transparent);
}

/* ---------- 9. 时间线卡片 ---------- */
.x-timeline {
  display: flex;
  flex-direction: column;
}

.x-post {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--x-border);
  transition: background var(--x-dur) var(--x-ease);
  position: relative;
  text-align: left;
}
.x-post:hover { background: var(--x-bg-hover); }

.x-post__avatar { flex-shrink: 0; }

.x-post__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.x-post__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 15px;
  line-height: 20px;
  min-height: 20px;
}

.x-post__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-bottom: 2px;
  color: var(--x-dim);
  font-size: 13px;
  font-weight: 700;
}
.x-post__badge i { font-size: 15px; }

.x-post__name {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  color: var(--x-text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-post__name:hover { text-decoration: underline; }

.x-post__handle,
.x-post__dot {
  color: var(--x-dim);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-post__handle { max-width: 40%; }

.x-post__time {
  color: var(--x-dim);
  font-size: 15px;
  white-space: nowrap;
}
.x-post__time:hover { text-decoration: underline; }

.x-post__reading {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--x-dim);
  font-size: 12px;
  white-space: nowrap;
}
.x-post__reading i { font-size: 13px; }

.x-post__more {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: -8px;
  border-radius: 50%;
  color: var(--x-dim);
  font-size: 18px;
  /* X 的「⋯」是常驻的，不靠悬停才出现——藏起来会让每条右边空一块 */
  opacity: 1;
  transition: background var(--x-dur) var(--x-ease), color var(--x-dur) var(--x-ease),
    opacity var(--x-dur) var(--x-ease);
}
.x-post:hover .x-post__more { opacity: 1; }
.x-post__more:hover {
  background: rgba(29, 155, 240, 0.12);
  background: color-mix(in srgb, var(--x-accent) 12%, transparent);
  color: var(--x-accent);
}

.x-post__content { margin-top: 2px; min-width: 0; }

.x-post__title {
  font-size: var(--x-fs, 15px);
  font-weight: 700;
  line-height: 20px;
  color: var(--x-text);
  word-break: break-word;
}
.x-post__title-link:hover .x-post__title { text-decoration: underline; }

.x-post__excerpt {
  margin-top: 2px;
  font-size: var(--x-fs, 15px);
  line-height: 20px;
  color: var(--x-text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 配图：单图圆角大（16px），多图每张各自小圆角（8px）+ 1px 边框，图间留 4px 缝 */
.x-post__media {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}

.x-post__media-item {
  display: block;
  min-width: 0;
  overflow: hidden;
  background: var(--x-field);
  border-radius: var(--x-radius-sm);
}

.x-post__media-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--x-dur) var(--x-ease);
}
.x-post__media-item:hover img { opacity: 0.92; }

/* 1 张：限高不限宽——横图铺满、竖图按比例收窄，都不裁切；圆角用大号 16px */
.x-post__media--1 {
  display: block;
  width: fit-content;
  max-width: 100%;
  width: 80%;
}

/* 边框放在 item 上（不是 img），窄图右侧才不会拖一条空框 */
.x-post__media--1 .x-post__media-item {
  border: 1px solid var(--x-borderb);
  border-radius: var(--x-radius);
  line-height: 0;
}

.x-post__media--1 .x-post__media-item img {
  /* width: auto; */
  height: auto;
  max-width: 100%;
  max-height: 512px;
}

/* 2 张：等高、宽度按各自比例自适应（--r 由 PHP 给出），横竖混排也等高、都不裁切 */
.x-post__media--2 {
  align-items: stretch;
}

.x-post__media--2 .x-post__media-cell {
  flex: 0 0 auto;
  height: 100%;
  min-width: 0;
  aspect-ratio: var(--r, 1.5);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-sm);
  overflow: hidden;
  background: var(--x-field);
}

.x-post__media--2 .x-post__media-cell .x-post__media-item {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* ---------- 多图画廊：同一行高、宽度按原图比例自适应、可横滑、悬停出左右箭头 ----------
   行高固定（--x-gal-h），每张 slide 的宽度 = 行高 × 原图宽高比（--r 由 PHP 写进 style），
   所以横图宽、竖图窄，但高度完全一致，且默认不裁切任何一张。
   超宽图（宽高比大于「轨道宽 / 行高」）会被裁到 max 宽度，此时才由 object-fit 兜底。
   保留 --x-gal-peek：最宽的图也留出一截，右侧始终能看到下一张的边。 */
.x-media-gallery {
  position: relative;
  margin-top: 12px;
}

.x-media-track {
  --x-gal-h: 264px;
  --x-gal-peek: 44px;
  display: flex;
  gap: 4px;
  height: var(--x-gal-h);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.x-media-track::-webkit-scrollbar { display: none; }

.x-media-slide {
  /* flex-basis 必须是 auto：宽度由 min() 从原图比例算出来，不能让 flex 再分配 */
  flex: 0 0 auto;
  width: min(calc(var(--x-gal-h) * var(--r, 1.5)), calc(100% - var(--x-gal-peek)));
  height: 100%;
  overflow: hidden;
  background: var(--x-field);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-sm);
  scroll-snap-align: start;
}
.x-media-slide .x-post__media-item {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
}
.x-media-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--x-dur) var(--x-ease);
}
.x-media-slide:hover img { opacity: 0.92; }

.x-media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--x-dur) var(--x-ease), background var(--x-dur) var(--x-ease);
}
.x-media-nav--prev { left: 10px; }
.x-media-nav--next { right: 10px; }
.x-media-nav:hover { background: rgba(0, 0, 0, 0.8); }
.x-media-nav[disabled] { display: none; }

@media (hover: hover) {
  .x-media-gallery:hover .x-media-nav:not([disabled]) { opacity: 1; pointer-events: auto; }
  .x-media-track:hover .x-media-nav { opacity: 1; }
}

/* ---------- 配图灯箱：点列表里的图片放大查看 ---------- */
/* 文章列表与说说列表都用它（插件那份只在说说页加载，两边体验会不一致） */
.x-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  /* 用 flex 而不是 grid：grid 的行高是 auto，图片的 max-height:100% 会跟行高互相依赖而失效，
     结果就是大图冲破容器。flex 下容器高度确定，百分比才真正生效 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 64px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.92);
  animation: x-lb-fade 0.18s var(--x-ease);
  /* 交给 JS 的 pointer 事件处理拖动/滑动，别让浏览器抢去做滚动或缩放 */
  touch-action: none;
}
.x-lightbox.is-out { animation: x-lb-fade-out 0.16s var(--x-ease) forwards; }
.x-lightbox[hidden] { display: none; }

@keyframes x-lb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes x-lb-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.x-lightbox__img {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  animation: x-lb-zoom 0.2s var(--x-ease);
}
.x-lightbox.is-dragging .x-lightbox__img { cursor: grabbing; }

/* 打开：整体略微放大淡入 */
@keyframes x-lb-zoom {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* 左右切换：新图从对应方向滑入 */
.x-lightbox__img.is-from-right { animation: x-lb-from-right 0.24s var(--x-ease); }
.x-lightbox__img.is-from-left { animation: x-lb-from-left 0.24s var(--x-ease); }

@keyframes x-lb-from-right {
  from { opacity: 0; transform: translateX(36px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
@keyframes x-lb-from-left {
  from { opacity: 0; transform: translateX(-36px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.x-lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  transition: background var(--x-dur) var(--x-ease);
}
.x-lightbox__btn:hover { background: rgba(255, 255, 255, 0.24); }
.x-lightbox__btn[hidden] { display: none; }

.x-lightbox__btn--prev { left: 18px; }
.x-lightbox__btn--next { right: 18px; }

.x-lightbox__btn--close {
  top: 16px;
  right: 18px;
  transform: none;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.4);
}

.x-lightbox__count {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  opacity: 0.75;
}

@media (max-width: 700px) {
  .x-lightbox { padding: 48px 12px; }
  .x-lightbox__btn--prev { left: 4px; }
  .x-lightbox__btn--next { right: 4px; }
}

html[data-round="0"] .x-post__media--1 .x-post__media-item,
html[data-round="0"] .x-post__media--2 .x-post__media-cell,
html[data-round="0"] .x-media-slide,
html[data-round="0"] .x-detail__cover,
html[data-round="0"] .x-prose img,
html[data-round="0"] .x-prose video,
html[data-round="0"] .x-prose iframe {
  border-radius: 4px;
}

html[data-timeline="compact"] .x-post__media,
html[data-timeline="compact"] .x-media-gallery,
html[data-timeline="compact"] .x-post__excerpt { display: none; }

html.selected {
  opacity: 1;
}
.x-post__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.x-post__topic {
  color: var(--x-accent);
  font-size: 15px;
}
.x-post__topic:hover { text-decoration: underline; }
.x-post__topic--cat { color: var(--x-dim); }

/* 互动栏 */
.x-post__actions,
.x-detail__actions {
  display: flex;
  align-items: center;
  margin-top: 10px;
  margin-left: -8px;
}

/* 动作等分剩余宽度、分享固定在最右，对齐 X 的操作栏节奏；
   原来给 106px 上限，图标全挤在左侧、右边留一大截空白，看着散 */
.x-post__actions > .x-action { flex: 1 1 0; min-width: 0; }
.x-post__actions > .x-action--share {
  flex: 0 0 auto;
  margin-left: auto;
}

.x-action__spacer { display: none; }

.x-action {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--x-dim);
  font-size: 13px;
  transition: color var(--x-dur) var(--x-ease);
  cursor: pointer;
}

.x-action__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  transition: background var(--x-dur) var(--x-ease);
}

.x-action__count {
  min-width: 14px;
  padding-right: 6px;
  font-size: 13px;
  line-height: 16px;
  text-align: left;
}

.x-action--reply:hover,
.x-action--link:hover,
.x-action--views:hover,
.x-action--share:hover { color: var(--x-accent); }

.x-action--reply:hover .x-action__icon,
.x-action--link:hover .x-action__icon,
.x-action--views:hover .x-action__icon,
.x-action--share:hover .x-action__icon {
  background: rgba(29, 155, 240, 0.12);
  background: color-mix(in srgb, var(--x-accent) 12%, transparent);
}

/* ---------- 10. 文章详情 ---------- */
.x-detail {
  padding: 12px 16px 4px;
  border-bottom: 1px solid var(--x-border);
}

.x-detail__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.x-detail__head-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 20px;
}

.x-detail__head-meta .x-post__handle { max-width: none; }

.x-detail__edit {
  margin-left: auto;
  width: 30px;
  height: 30px;
  font-size: 17px;
}

.x-detail__title {
  margin: 12px 0 2px;
  font-size: 23px;
  font-weight: 800;
  line-height: 30px;
  word-break: break-word;
}

.x-detail__content {
  margin-top: 12px;
  font-size: 17px;
  line-height: 27px;
  word-break: break-word;
}

.x-detail__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  font-size: 15px;
}

.x-detail__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 14px 0 4px;
  color: var(--x-dim);
  font-size: 15px;
  line-height: 20px;
}
.x-detail__meta a:hover { text-decoration: underline; }

.x-detail__actions {
  margin: 4px 0 0;
  padding: 10px 0 12px;
  border-top: 1px solid var(--x-border);
}

.x-detail--page { padding-bottom: 28px; }

/* ---------- 11. 正文排版 ---------- */
.x-prose > *:first-child { margin-top: 0; }
.x-prose p { margin: 0 0 16px; }

.x-prose h1,
.x-prose h2,
.x-prose h3,
.x-prose h4,
.x-prose h5,
.x-prose h6 {
  margin: 26px 0 12px;
  font-weight: 800;
  line-height: 1.3;
}
.x-prose h2 { font-size: 1.35em; }
.x-prose h3 { font-size: 1.18em; }
.x-prose h4 { font-size: 1.05em; }

.x-prose a { color: var(--x-accent); }
.x-prose a:hover { text-decoration: underline; }

.x-prose img {
  margin: 16px auto;
  border-radius: var(--x-radius);
  border: 1px solid var(--x-border);
}

/* 正文里的图由 x.js 补上 data-x-full，点了进灯箱 */
.x-prose img[data-x-full] { cursor: zoom-in; }

.x-prose ul,
.x-prose ol { margin: 0 0 16px; padding-left: 1.4em; }
.x-prose ul { list-style: disc; }
.x-prose ol { list-style: decimal; }
.x-prose li { margin: 6px 0; }

.x-prose blockquote {
  margin: 16px 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--x-accent);
  color: var(--x-dim);
}

.x-prose code {
  font-family: var(--x-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--x-code-bg);
  border: 1px solid var(--x-border);
}

.x-prose pre {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--x-code-bg);
  border: 1px solid var(--x-border);
  overflow-x: auto;
}
.x-prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
  line-height: 22px;
}

.x-prose hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--x-border);
}

.x-prose table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 15px;
}
.x-prose th,
.x-prose td {
  padding: 10px 12px;
  border: 1px solid var(--x-border);
  text-align: left;
}
.x-prose th { background: var(--x-card); font-weight: 700; }

.x-prose video,
.x-prose iframe {
  width: 100%;
  margin: 16px 0;
  border-radius: var(--x-radius);
  border: 1px solid var(--x-border);
}

/* ---------- 12. 回复区 ---------- */
.x-replies { border-bottom: 1px solid var(--x-border); }

.x-replies__title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  font-size: 20px;
  font-weight: 800;
}

.x-replies__count {
  color: var(--x-dim);
  font-size: 15px;
  font-weight: 400;
}

.x-replies__body { padding: 0 16px 16px; }

.x-replies__empty {
  padding: 8px 16px 24px;
  color: var(--x-dim);
  font-size: 15px;
}

.x-replies__page { padding: 0 16px 16px; }

.x-reply-list { display: flex; flex-direction: column; }

.x-reply {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--x-border);
}

.x-reply__body { flex: 1; min-width: 0; }

.x-reply__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  line-height: 20px;
}

.x-reply__name { font-weight: 700; }
.x-reply__time { color: var(--x-dim); font-size: 15px; }

.x-reply__action {
  margin-left: auto;
  color: var(--x-dim);
  font-size: 13px;
}
.x-reply__action:hover { color: var(--x-accent); }

.x-reply__content {
  margin-top: 2px;
  font-size: 15px;
  line-height: 21px;
  word-break: break-word;
}
.x-reply__content p { margin: 0 0 8px; }
.x-reply__content p:last-child { margin-bottom: 0; }

.x-reply__children {
  margin-top: 10px;
  border-left: 1px solid var(--x-border);
  padding-left: 12px;
}
.x-reply__children .x-reply {
  padding: 10px 0 0;
  border-top: 0;
}

/* 回复框 */
.x-reply-composer {
  padding: 14px 16px;
  border-bottom: 1px solid var(--x-border);
}

.x-reply-composer__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.x-reply-composer__tip { font-size: 15px; font-weight: 700; }

.x-reply-composer__cancel {
  margin-left: auto;
  color: var(--x-accent);
  font-size: 14px;
}

.x-reply-composer__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.x-reply-composer__fields input,
.x-reply-composer__verify input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--x-border);
  background: var(--x-field);
  outline: 0;
  transition: border-color var(--x-dur) var(--x-ease);
}
.x-reply-composer__fields input:focus,
.x-reply-composer__verify input:focus,
.x-reply-composer textarea:focus { border-color: var(--x-accent); }

.x-reply-composer__verify {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.x-reply-composer__verify input { max-width: 160px; }
.x-reply-composer__verify img {
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--x-border);
}

.x-reply-composer textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--x-border);
  background: var(--x-field);
  resize: vertical;
  outline: 0;
  line-height: 22px;
  transition: border-color var(--x-dur) var(--x-ease);
}

.x-reply-composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.x-reply-composer__notice {
  color: var(--x-dim);
  font-size: 13px;
}

/* ---------- 13. 作者资料卡 ---------- */
.x-profile { border-bottom: 1px solid var(--x-border); }

.x-profile__banner {
  height: 190px;
  overflow: hidden;
  background: var(--x-field);
}
.x-profile__banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.x-profile__banner-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--x-accent) 0%, #7856ff 100%);
  opacity: 0.9;
}

.x-profile__bar {
  display: flex;
  align-items: flex-start;
  padding: 0 16px;
  min-height: 34px;
}
.x-profile__avatar {
  margin-top: -48px;
  position: relative;
  z-index: 1;
}

.x-profile__info { padding: 8px 16px 16px; }

.x-profile__name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 20px;
  font-weight: 800;
  line-height: 24px;
}

.x-profile__handle {
  display: block;
  color: var(--x-dim);
  font-size: 15px;
  line-height: 20px;
}

.x-profile__bio {
  margin-top: 12px;
  font-size: 15px;
  line-height: 20px;
  white-space: pre-wrap;
}

.x-profile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--x-dim);
  font-size: 15px;
}

.x-profile__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.x-profile__meta-item i { font-size: 17px; }
a.x-profile__meta-item:hover { text-decoration: underline; }

/* ---------- 14. 右栏 ---------- */
/* .x-rail 已是 100vh 固定块；内容比视口高时在内部滚，不带动整页 */
.x-rail__inner {
  width: var(--x-rail-w);
  height: 100%;
  padding-left: 30px;
}

.x-rail__sticky {
  height: 100%;
  overflow-y: auto;
  padding: 8px 0 24px;
  scrollbar-width: none;
}
.x-rail__sticky::-webkit-scrollbar { display: none; }

.x-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--x-borderb);
  border-radius: 9999px;
  transition: border-color var(--x-dur) var(--x-ease), background var(--x-dur) var(--x-ease);
}
.x-search:focus-within {
  border-color: var(--x-accent);
  background: var(--x-bg);
}

.x-search__icon { font-size: 19px; color: var(--x-dim); }
.x-search:focus-within .x-search__icon { color: var(--x-accent); }

.x-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}
.x-search__input::placeholder { color: var(--x-dim); }
.x-search__input::-webkit-search-cancel-button { display: none; }

/* X 的搜索框只有一个放大镜，右侧没有箭头按钮；回车仍然提交（form 原生行为），
   按钮保留在 DOM 里是为了无 JS 时也能点，视觉上不占位 */
.x-search__submit {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.x-search--page,
.x-search--sheet { margin: 12px 16px; }

.x-search__hint {
  padding: 12px 16px 0;
  color: var(--x-dim);
  font-size: 14px;
}

.x-card {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--x-radius);
  background: transparent;
  border: 1px solid var(--x-border);
  overflow: hidden;
}

.x-card__title {
  font-size: 20px;
  font-weight: 800;
  line-height: 24px;
  margin-bottom: 8px;
}

.x-card__text {
  color: var(--x-dim);
  font-size: 14px;
  line-height: 20px;
  margin-top: 10px;
}
.x-card__text--multiline { white-space: pre-line; overflow-wrap: break-word; }

.x-follow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.x-follow__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 19px;
}
.x-follow__name {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.x-follow__handle { color: var(--x-dim); font-size: 15px; }
.x-follow__btn { margin-left: auto; flex-shrink: 0; }

.x-account-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--x-border);
  color: var(--x-dim);
  font-size: 13px;
}
.x-account-links a { display: inline-flex; align-items: center; gap: 4px; }
.x-account-links a:hover { text-decoration: underline; }

.x-trends__item + .x-trends__item { border-top: 1px solid var(--x-border); }

.x-trends__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
}
.x-trends__link:hover .x-trends__name { text-decoration: underline; }

.x-trends__meta,
.x-trends__count {
  color: var(--x-dim);
  font-size: 13px;
  line-height: 16px;
}

.x-trends__name {
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
  word-break: break-word;
}

/* ---------- 14b. 侧栏模块（后台「模块管理」里启用的 Z-Blog 内置模块） ----------
   这些模块输出的是系统原生 HTML（ul/table/裸 form），没有可用的类名，
   只能按模块 id（divTags / divCalendar / …）分别接管，统一成主题的紧凑卡片风格。 */

/* 模块卡比「资料卡」轻一档：十几张卡同尺寸标题会显得很重 */
.x-rail .x-card[id^="div"] { padding: 12px 14px; }
.x-rail .x-card[id^="div"] .x-card__title { font-size: 16px; line-height: 20px; margin-bottom: 6px; }

.x-module-list { display: flex; flex-direction: column; }
.x-module-list li { border-top: 1px solid var(--x-border); color: var(--x-dim); font-size: 12px; }
.x-module-list li:first-child { border-top: 0; }
.x-module-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--x-text);
  word-break: break-word;
}
.x-module-list a:hover { color: var(--x-accent); }

/* 列表右侧的数量（归档的 (26)、作者的 (86)）：小胶囊，比裸括号清爽 */
.x-mod__count {
  margin-left: auto;
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 9999px;
  background: var(--x-field);
  color: var(--x-dim);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 最近发表：标题单行截断，长标题不再把卡片撑到三行
   （新 Chrome 把 -webkit-box 归一化成 flow-root，多行 clamp 会露出半截第二行，
   单行场景用 nowrap + ellipsis 最稳） */
#divPrevious .x-module-list a {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 标签列表：竖排列表 → chip 云（25 个标签从 ~900px 压到 ~4 行） */
#divTags .x-module-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
#divTags .x-module-list li { border: 0; }
#divTags .x-module-list a {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--x-field);
  font-size: 13px;
  line-height: 18px;
  color: var(--x-text);
}
#divTags .x-module-list a:hover { background: var(--x-bg-active); color: var(--x-text); }
#divTags .tag-count { color: var(--x-dim); font-size: 11px; }

/* 网站分类：两列，高度减半 */
#divCatalog .x-module-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 6px; }
#divCatalog .x-module-list li { border: 0; min-width: 0; }
#divCatalog .x-module-list a {
  display: block;
  margin: 1px 0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#divCatalog .x-module-list a:hover { background: var(--x-bg-active); color: var(--x-text); }
#divCatalog .x-module-list ul { margin-left: 10px; }

/* 站点信息：两列键值（标签/数值由 x.js 拆成 span） */
#divStatistics .x-module-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; }
#divStatistics .x-module-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  border: 0;
  font-size: 12px;
}
.x-mod__label { color: var(--x-dim); }
.x-mod__value { color: var(--x-text); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 最新留言：正文两行截断 + 作者/时间小字（从 title 里解析） */
#divComments .x-module-list a { display: block; padding: 10px 0; color: var(--x-text); }
#divComments .x-module-list a:hover { color: var(--x-text); }
#divComments .x-module-list a:hover .x-mod__text { text-decoration: underline; }
.x-mod__text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 38px;
  font-size: 13px;
  line-height: 19px;
}
.x-mod__meta { display: block; margin-top: 3px; color: var(--x-dim); font-size: 11px; }

/* 日历：7 列等宽，有文章的日期是实心圆 */
#divCalendar table { width: 100%; border-collapse: collapse; }
#divCalendar caption { padding: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--x-text); }
#divCalendar caption a { padding: 0 3px; color: var(--x-dim); }
#divCalendar caption a:hover { color: var(--x-accent); }
#divCalendar th { padding: 2px 0 4px; font-weight: 400; font-size: 11px; color: var(--x-dim); }
#divCalendar td { height: 30px; text-align: center; font-size: 12px; }
#divCalendar td a {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--x-field);
  color: var(--x-text);
  font-weight: 700;
}
#divCalendar td a:hover { background: var(--x-accent); color: #fff; }

/* 搜索面板：模块自带的裸 form，套成和顶栏搜索一致的样子 */
#divSearchPanel form { display: flex; gap: 8px; }
#divSearchPanel input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--x-border);
  border-radius: 9999px;
  background: var(--x-field);
  color: var(--x-text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--x-dur) var(--x-ease);
}
#divSearchPanel input[type="text"]:focus { border-color: var(--x-accent); }
#divSearchPanel input[type="submit"] {
  flex-shrink: 0;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 9999px;
  background: var(--x-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--x-dur) var(--x-ease);
}
#divSearchPanel input[type="submit"]:hover { background: var(--x-blue-hover); }

/* 控制面板：去掉自带的 <br>，改成两行 */
#divContorPanel .x-module-body { font-size: 13px; line-height: 22px; }
#divContorPanel .x-module-body a { color: var(--x-accent); }
#divContorPanel .x-module-body a:hover { text-decoration: underline; }
#divContorPanel br { display: none; }
#divContorPanel .cp-hello { display: block; margin-bottom: 4px; }

/* 收藏 / 友情链接：单行列表，字号收一档 */
#divFavorites .x-module-list a,
#divLinkage .x-module-list a { font-size: 13px; }

/* 网站徽章（Z-Blog / RSS）：横排、灰度，悬停恢复 */
#divMisc .x-module-list { flex-direction: row; flex-wrap: wrap; gap: 8px; }
#divMisc .x-module-list li { border: 0; }
#divMisc .x-module-list a { padding: 0; }
#divMisc img {
  display: block;
  height: 31px;
  width: auto;
  border-radius: 6px;
  opacity: 0.75;
  filter: grayscale(1);
  transition: opacity var(--x-dur) var(--x-ease), filter var(--x-dur) var(--x-ease);
}
#divMisc a:hover img { opacity: 1; filter: none; }

.x-module-body { color: var(--x-dim); font-size: 14px; }
.x-module-body ul li { padding: 8px 0; border-top: 1px solid var(--x-border); }
.x-module-body ul li:first-child { border-top: 0; }
.x-module-body a:hover { color: var(--x-accent); }

/* ---------- 15. 分页 ---------- */
.x-pagebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 18px 16px 28px;
}

.x-pagebar__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9999px;
  border: 1px solid var(--x-border);
  color: var(--x-text);
  font-size: 14px;
  transition: background var(--x-dur) var(--x-ease), border-color var(--x-dur) var(--x-ease);
}
.x-pagebar__item:hover {
  background: var(--x-bg-active);
  border-color: var(--x-dim);
}
.x-pagebar__item.is-current {
  background: var(--x-accent);
  border-color: var(--x-accent);
  color: #fff;
  font-weight: 700;
}
.x-pagebar__nav { font-weight: 600; }

/* ---------- 16. 空状态 / 错误 ---------- */
.x-empty {
  padding: 48px 32px 56px;
  text-align: center;
  color: var(--x-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.x-empty__icon { font-size: 40px; opacity: 0.8; }
.x-empty h2 {
  color: var(--x-text);
  font-size: 23px;
  font-weight: 800;
}
.x-empty p { font-size: 15px; margin-bottom: 8px; }

.x-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 64px 32px;
}
.x-error__code {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: var(--x-dim);
}
.x-error__title { font-size: 30px; font-weight: 800; line-height: 36px; }
.x-error__desc { color: var(--x-dim); font-size: 15px; margin-bottom: 8px; }

/* ---------- 17. 独立页（分类 / 标签 / 归档） ---------- */
.x-page { padding-bottom: 28px; }

/* 分类：两列卡片 */
.x-catgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px;
}

.x-catcard {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius);
  transition: background var(--x-dur) var(--x-ease), border-color var(--x-dur) var(--x-ease);
}
/* X 的卡片悬停只加灰底，边框不换色——换蓝会把整页「点亮」，反而吵 */
.x-catcard:hover {
  background: var(--x-bg-hover);
}

.x-catcard__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  background: rgba(29, 155, 240, 0.14);
  background: color-mix(in srgb, var(--x-accent) 14%, transparent);
  color: var(--x-accent);
  font-size: 19px;
}

.x-catcard__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.x-catcard__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--x-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x-catcard__desc {
  font-size: 13px;
  line-height: 17px;
  color: var(--x-dim);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.x-catcard__count {
  flex-shrink: 0;
  color: var(--x-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* 标签：云 */
.x-tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
}

.x-tagchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 8px 13px;
  border: 1px solid var(--x-border);
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--x-text);
  transition: background var(--x-dur) var(--x-ease), border-color var(--x-dur) var(--x-ease),
    color var(--x-dur) var(--x-ease);
}
.x-tagchip:hover {
  border-color: var(--x-accent);
  color: var(--x-accent);
  background: rgba(29, 155, 240, 0.08);
  background: color-mix(in srgb, var(--x-accent) 8%, transparent);
}

.x-tagchip__hash { color: var(--x-dim); }
.x-tagchip:hover .x-tagchip__hash { color: inherit; }

.x-tagchip__name {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x-tagchip__count {
  color: var(--x-dim);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* 归档：年份分组 + 日期行 */
.x-arch__year {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 18px 16px 6px;
  font-size: 21px;
  font-weight: 800;
  line-height: 26px;
  color: var(--x-text);
}
.x-arch__year span {
  font-size: 13px;
  font-weight: 400;
  color: var(--x-dim);
}

.x-arch__row { border-bottom: 1px solid var(--x-border); }
.x-arch__row:last-child { border-bottom: 0; }

.x-arch__row a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 16px;
  transition: background var(--x-dur) var(--x-ease);
}
.x-arch__row a:hover { background: var(--x-bg-hover); }

.x-arch__day {
  flex-shrink: 0;
  width: 44px;
  color: var(--x-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.x-arch__title {
  font-size: 15px;
  line-height: 20px;
  color: var(--x-text);
  word-break: break-word;
}
.x-arch__row a:hover .x-arch__title { color: var(--x-accent); }

/* ---------- 18. 页脚 / 悬浮按钮 / 提示 ---------- */
/* 页脚在中栏末尾（X 的页脚也在栏内）：内容短时贴住中栏底部，不浮在半空 */
.x-footer {
  margin-top: auto;
  max-width: 1265px;
  padding: 18px 16px 28px;
  color: var(--x-dim);
  font-size: 12px;
  line-height: 19px;
  text-align: center;
}
.x-footer__inner { display: flex; flex-direction: column; gap: 4px; }
.x-footer a:hover { text-decoration: underline; }
.x-footer__power { opacity: 0.85; }

/* 回到顶部与写文章（x-fab）是同一组悬浮圆钮：尺寸、圆角、阴影、右边距必须完全一致，
   移动端上下叠放时才会对齐。这里用 right 定位，不要再叠 translateX(-50%)。 */
.x-top-btn {
  position: fixed;
  right: 16px;
  bottom: 24px;
  transform: translateY(10px);
  z-index: 41;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--x-accent);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--x-dur) var(--x-ease), transform var(--x-dur) var(--x-ease);
}
.x-top-btn.is-show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.x-toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(8px);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 9999px;
  background: var(--x-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--x-dur) var(--x-ease), transform var(--x-dur) var(--x-ease);
}
.x-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.x-fab {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 70px;
  z-index: 41;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--x-accent);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  text-decoration: none;
}

/* ---------- 19. 移动端底栏 / 浮层 ---------- */
.x-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  height: 53px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--x-bg-blur);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--x-border);
}

.x-tabbar__item {
  flex: 1;
  height: 53px;
  color: var(--x-dim);
  font-size: 25px;
  transition: color var(--x-dur) var(--x-ease);
}
.x-tabbar__item.is-active { color: var(--x-text); }

.x-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.5);
}

.x-sheet {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: var(--x-bg);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}
.x-sheet__inner { display: flex; align-items: center; gap: 8px; padding-right: 16px; }
.x-sheet__inner .x-search { flex: 1; margin: 0 0 0 16px; }
.x-sheet__cancel { color: var(--x-accent); font-size: 15px; }

/* ---------- 20. 开屏 ---------- */
.x-splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: var(--x-bg);
  animation: x-splash-out 0.45s var(--x-ease) 1.1s forwards;
}
html.x-splash-skip .x-splash { display: none; }
.x-splash.is-done { animation: none; opacity: 0; pointer-events: none; }

.x-splash__icon { font-size: 64px; color: var(--x-text); }
svg.x-splash__icon { width: 58px; height: 58px; display: block; fill: currentColor; }
.x-splash__img { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; background: var(--x-field); }
.x-splash__text { font-size: 28px; font-weight: 800; letter-spacing: 0.02em; }

@keyframes x-splash-out {
  to { opacity: 0; visibility: hidden; }
}

/* ---------- 21. 响应式 ---------- */
@media (max-width: 1265px) {
  .x-app { max-width: 1000px; }

  .x-left__inner {
    width: 88px;
    align-items: center;
    padding: 4px 8px 16px;
  }
  .x-logo--text { padding: 0; width: 50px; justify-content: center; }
  .x-logo__text { display: none; }

  .x-nav { align-items: center; }
  /* li 占满整行，锚点是 shrink-to-fit 的 inline-flex，必须靠 text-align 才能真正居中 */
  .x-nav > li { text-align: center; }
  .x-nav__item { padding: 14px; gap: 0; }
  .x-nav__label { display: none; }
  .x-nav--extra > li > a { padding: 14px; font-size: 0; gap: 0; }
  .x-nav--extra > li > a::before { width: auto; }
  .x-nav--extra li ul { display: none; }

  .x-account { padding: 8px; justify-content: center; }
  .x-account__meta,
  .x-account__more { display: none; }
  /* 折叠成圆钮：宽高必须相等，否则 9999px 圆角会拉成椭圆 */
  .x-account-actions { align-items: center; }
  .x-account-actions__btn { width: 44px; height: 44px; padding: 0; font-size: 0; border-radius: 50%; }
  .x-account-actions__btn span { display:none; }
  .x-account-actions__btn::before { font-family: "remixicon"; content: "\ec86"; font-size: 20px; }
  .x-theme-btn { padding: 12px; font-size: 0; }
  .x-theme-btn i { font-size: 20px; }
  .x-left__foot { text-align: center; }

  .x-rail__inner { width: 300px; padding-left: 20px; }
}

@media (max-width: 1005px) {
  .x-rail { display: none; }
  .x-app { max-width: 780px; }
  .x-main { width: 100%; border-right: 0; }
  .x-media-track { --x-gal-h: 232px; --x-gal-peek: 36px; }
}

@media (max-width: 700px) {
  .x-app { max-width: 100%; display: block; }
  /* 窄屏一行更矮一点，保证 16:9 横图也基本不被裁 */
  .x-media-track { --x-gal-h: 196px; --x-gal-peek: 24px; }

  /* 窄屏左栏是抽屉：用 top/bottom 定高（100vh 会把抽屉推到视口外），不参与 sticky */
  .x-left {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: auto;
    z-index: 90;
    width: 280px;
    background: var(--x-bg);
    border-right: 1px solid var(--x-border);
    transform: translateX(-100%);
    transition: transform 0.22s var(--x-ease);
    visibility: hidden;
  }
  .x-left.is-open { transform: translateX(0); visibility: visible; }

  /* 窄屏：分类卡片改为单列 */
  .x-catgrid { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; }
  .x-tagcloud { padding: 12px; }
  .x-arch__year { padding: 16px 12px 4px; }
  .x-arch__row a { padding: 10px 12px; }

  .x-left__inner {
    width: 280px;
    align-items: flex-start;
    padding: 8px 12px 20px;
    height: calc(100vh - 53px);
  }
  .x-logo--text { width: auto; padding: 0 14px; justify-content: flex-start; }
  .x-logo__text { display: flex; }
  .x-nav { align-items: flex-start; }
  /* 抵消 ≤1265 折叠态的居中规则，抽屉里恢复左对齐全宽 */
  .x-nav > li { text-align: left; }
  .x-account-actions { align-items: stretch; }
  .x-left__foot { text-align: left; }
  .x-nav__item { padding: 12px 20px 12px 12px; gap: 18px; }
  .x-nav__label { display: inline; font-size: 18px; }
  .x-nav--extra > li > a { padding: 12px 20px 12px 12px; font-size: 18px; gap: 18px; }
  .x-nav--extra > li > a::before { width: 26px; }
  .x-nav--extra li ul { display: block; margin-left: 42px; }
  .x-nav--extra li ul a { font-size: 16px; }

  .x-account { padding: 10px 12px; justify-content: flex-start; }
  .x-account__meta, .x-account__more { display: flex; }
  .x-account-actions__btn { width: 100%; height: 52px; padding: 0 16px; font-size: 15px; border-radius: 9999px; }
  .x-account-actions__btn span { display: block; }
  .x-account-actions__btn::before { content: none; }
  .x-theme-btn { padding: 10px 16px; font-size: 14px; }

  .x-main { width: 100%; border-left: 0; border-right: 0; padding-bottom: 53px; }

  .x-tabbar { display: flex; }
  .x-fab { display: grid; }

  .x-topbar__row { gap: 10px; padding: 0 12px; }
  /* 窄屏顶栏右侧的 RSS/登录会压住「文章」tab（只剩 60px 余量）；
     底部 tabbar 与左栏抽屉里都有同样的入口，这里直接让位给 tab */
  .x-topbar__row--tabs .x-topbar__actions { display: none; }
  .x-topbar__title { font-size: 17px; }
  .x-avatar-btn__name { display: none; }

  .x-post { padding: 12px; gap: 10px; }
  .x-post__more { opacity: 1; }
  .x-post__excerpt { -webkit-line-clamp: 5; line-clamp: 5; }
  .x-detail { padding: 12px 12px 4px; }
  .x-detail__title { font-size: 21px; line-height: 27px; }
  .x-detail__content { font-size: 16px; line-height: 26px; }
  .x-reply { padding: 12px; }
  .x-card { margin-top: 12px; }
  .x-timeline { border-top: 0; }

  /* 悬浮圆钮：写文章在上、回到顶部在下，同尺寸同右边距，整体抬到 tabbar（53px）之上 */
  .x-top-btn { bottom: calc(65px + env(safe-area-inset-bottom)); }
  .x-fab { bottom: calc(123px + env(safe-area-inset-bottom)); }
  .x-footer { padding-bottom: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .x-splash { animation-duration: 0.01s; animation-delay: 0.01s; }
  * { transition-duration: 0.01s !important; }
}
