/* LunaX 主样式 */
:root {
  --primary: #0096fa;
  --primary-dark: #007acc;
  --primary-soft: #e6f4ff;
  --accent: #ff4060;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --bg-card: #ffffff;
  --text: #1f1f1f;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --radius: 10px;
  --header-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  /* 分割线：两头各留 12px 不画，和文字对齐。用 border-image 画（框的底色照样铺满），线宽跟着 border 宽度走 */
  --inset-line: linear-gradient(to right, transparent 12px, var(--border) 12px, var(--border) calc(100% - 12px), transparent calc(100% - 12px));
}
[data-theme="dark"] {
  --bg: #121417;
  --bg-alt: #1a1d21;
  --bg-card: #1e2227;
  --text: #e6e6e6;
  --text-muted: #9aa0a6;
  --border: #2c3138;
  --primary-soft: #16283a;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: hidden; max-width: 100vw; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { overflow-x: hidden; max-width: 100vw; margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.6; color: var(--text); background: #edf1f5; min-height: 100vh; }
[data-theme="dark"] body { background: #0c0e11; }
.app-wrap { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); border-left: 1px solid var(--border); border-right: 1px solid var(--border); box-shadow: 0 0 24px rgba(0,0,0,.06); display: flex; flex-direction: column; position: relative; }
[data-theme="dark"] .app-wrap { box-shadow: 0 0 24px rgba(0,0,0,.45); }
@media (max-width: 480px) { .app-wrap { border-left: 0; border-right: 0; box-shadow: none; } }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: .95rem; }
p { margin: 0 0 1em; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { font-family: inherit; font-size: inherit; color: var(--text); background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; max-width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; vertical-align: middle; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
textarea { width: 100%; resize: vertical; }
.container { width: 100%; max-width: 100%; margin: 0 auto; padding: 0 12px; }
.container.narrow { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--primary); color: #fff; padding: 8px; z-index: 1000; }
.skip-link:focus { left: 8px; }
.muted { color: var(--text-muted); }
.small { font-size: .85em; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.hp { position: absolute; left: -9999px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 14px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; background: var(--bg-card); color: var(--text); line-height: 1.2; white-space: nowrap; transition: .15s; font-size: .9rem; }
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-danger { background: var(--accent); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .82rem; }
.btn-lg { padding: 8px 16px; font-size: .92rem; }
.btn-block { display: flex; width: 100%; }
.btn.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-group { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.btn-group.wrap { display: flex; margin-bottom: 10px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-size: .88em; }
.link-btn.danger { color: var(--accent); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--text); position: relative; }
.icon-btn:hover { background: var(--bg-alt); text-decoration: none; }
.badge { position: absolute; top: 1px; right: -1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 700; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--border); font-size: .85em; }
.chip-sm { padding: 0 7px; font-size: .75em; }
.chip-danger { background: #fee; color: #c00; border-color: #fcc; }
.tag-r18 { position: absolute; top: 6px; left: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.tag-r18.inline { position: static; vertical-align: middle; }

/* 头部 */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--bg-card); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: var(--header-h); padding: 0 12px; }
.logo { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.15rem; color: var(--primary); letter-spacing: -.02em; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-text { font-size: 1.15rem; font-weight: 800; }
.nav-toggle { display: flex; flex-direction: column; justify-content: center; gap: 4px; background: none; border: 0; padding: 8px 6px; cursor: pointer; flex-shrink: 0; }
.nav-toggle span { width: 18px; height: 2px; background: var(--text); display: block; border-radius: 1px; }
.main-nav { display: none; position: absolute; top: calc(var(--header-h) + 6px); left: 8px; right: 8px; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 8px; z-index: 99; }
[data-theme="dark"] .main-nav { box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.main-nav.open { display: flex; }
.main-nav-group { display: flex; flex-direction: column; gap: 3px; }
.main-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: .92rem; border: 0; text-decoration: none; transition: background .15s ease, color .15s ease; }
.main-nav a svg { color: var(--text-muted); flex-shrink: 0; transition: color .15s ease; }
.main-nav a:hover { background: var(--bg-alt); text-decoration: none; color: var(--text); }
.main-nav a:hover svg { color: var(--text); }
.main-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.main-nav a.active svg { color: var(--primary); }
.main-nav-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* 抽屉内主题切换开关 */
.main-nav-theme-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px; background: transparent; border: 0; border-radius: 8px; color: var(--text); cursor: pointer; font-size: .92rem; transition: background .15s ease; }
.main-nav-theme-row:hover { background: var(--bg-alt); }
.theme-row-left { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.theme-icon-box { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--text-muted); }
.theme-icon-sun { display: block; }
.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; color: var(--primary); }
.theme-switch { width: 38px; height: 22px; background: var(--border); border-radius: 11px; position: relative; transition: background .2s ease; flex-shrink: 0; }
.theme-switch-slider { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1); }
[data-theme="dark"] .theme-switch { background: var(--primary); }
[data-theme="dark"] .theme-switch-slider { transform: translateX(16px); }

.search-form { flex: 1; min-width: 0; position: relative; display: flex; margin: 0 6px; }
.search-form input,
.search-form input[type="search"] {
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 999px;
  padding: 6px 30px 6px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-size: .84rem;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.search-form input:focus,
.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
  background: var(--bg-card);
}
.search-form input::-webkit-search-decoration,
.search-form input::-webkit-search-cancel-button,
.search-form input::-webkit-search-results-button,
.search-form input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.search-form button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-muted); padding: 4px; display: flex; }
.search-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  min-width: 220px;
  width: auto;
  max-width: min(340px, calc(100vw - 24px));
  max-height: min(360px, calc(100vh - 80px));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 60;
  scrollbar-width: thin;
}
.search-suggest::-webkit-scrollbar {
  width: 6px;
}
.search-suggest::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.search-suggest::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
.search-suggest .suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: .86rem;
  line-height: 1.4;
  white-space: nowrap;
}
.search-suggest .suggest-item:hover {
  background: var(--bg-alt);
  text-decoration: none;
}
.search-suggest .suggest-tag-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.search-suggest .suggest-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-suggest .suggest-user-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.search-suggest .suggest-user-handle {
  flex-shrink: 0;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
}
.search-suggest .suggest-meta {
  flex-shrink: 0;
  margin-left: auto;
}
.search-suggest .suggest-submit {
  border-top: 1px solid var(--border);
  font-size: .86rem;
}
.search-suggest .suggest-submit-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.header-auth-btn { padding: 5px 12px; font-size: .86rem; font-weight: 600; }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-btn { background: none; border: 0; padding: 2px; border-radius: 50%; display: flex; }
.user-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 0; z-index: 60; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 16px; color: var(--text); background: none; border: 0; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg-alt); text-decoration: none; }
.dropdown-head { padding: 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown .admin-link { color: var(--accent); }

/* flash */
/* 提示条：页面顶部的 flash（操作结果）和页面里的 .notice（状态说明）是同一套外观
   - 间距统一 12px：页头 ↓12 第一条 ↓12 下一条 ↓12 正文；几条叠在一起时间距也一样
   - 字号、行高、内边距、边框、圆角相同，文字左边缘对齐
   - 颜色按含义区分：成功绿、出错红、提示蓝；深色模式下换成对应的暗色，不再是亮色块 */
:root {
  --bar-success-bg: #e8f8ef; --bar-success-border: #c3e6cb; --bar-success-text: #17693a;
  --bar-error-bg: #fdeaea; --bar-error-border: #f5c6cb; --bar-error-text: #b21f1f;
  --bar-info-bg: var(--primary-soft); --bar-info-border: #c6e3fb;
}
[data-theme="dark"] {
  --bar-success-bg: rgba(16, 185, 129, .15); --bar-success-border: rgba(16, 185, 129, .35); --bar-success-text: #34d399;
  --bar-error-bg: rgba(239, 68, 68, .15); --bar-error-border: rgba(239, 68, 68, .35); --bar-error-text: #f87171;
  --bar-info-border: #24415e;
}
.flash-container {
  margin-top: 12px;
  margin-bottom: 0;
}
.flash-container,
.flash-auth-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.flash-container > .flash {
  margin: 0;
}
/* 点 × 关掉最后一条后，容器也一起收起，版面回到没有提示时的样子 */
.flash-container:not(:has(> .flash)) {
  display: none;
}
.flash {
  margin: 0 0 10px;
  padding: 10px 40px 10px 16px;
  border-radius: 8px;
  position: relative;
  font-size: .88rem;
  line-height: 1.45;
  box-sizing: border-box;
  border: 1px solid transparent;
}
.flash-success { background: var(--bar-success-bg); color: var(--bar-success-text); border-color: var(--bar-success-border); }
.flash-error { background: var(--bar-error-bg); color: var(--bar-error-text); border-color: var(--bar-error-border); }
.flash-info { background: var(--bar-info-bg); border-color: var(--bar-info-border); }
.flash-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  cursor: pointer;
  opacity: .65;
  border-radius: 4px;
  transition: opacity .15s ease, background-color .15s ease;
}
.flash-close:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .flash-close:hover {
  background-color: rgba(255, 255, 255, 0.08);
}
.flash-close svg {
  display: block;
  pointer-events: none;
}

/* 登录/注册等认证卡片页面的专属对称适配：宽度与 440px 表单卡片严格对齐，上下间距均为 20px 对称 */
.flash-auth-container {
  max-width: 440px;
  margin-top: 20px;
  margin-bottom: 0;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}
.flash-auth-container .flash {
  margin: 0;
}
.flash-auth-container + .site-main {
  padding-top: 0;
}
.flash-auth-container + .site-main .auth-wrap {
  padding-top: 20px;
}
.notice {
  margin: 8px 0 12px;
  padding: 10px 16px;
  border: 1px solid var(--bar-info-border);
  border-radius: 8px;
  background: var(--bar-info-bg);
  font-size: .88rem;
  line-height: 1.45;
}
.notice.small { font-size: .85em; }
/* 作品页顶部的状态提示：和页头、上面的 flash 都保持 12px（正文区本身已有 12px 上边距） */
.novel-main > .notice:first-child { margin-top: 0; }
.notice-info { }

/* 布局 */
.site-main { flex: 1 0 auto; min-height: 0; padding: 12px 0 20px; }
.section { margin: 18px 0; }
.section:first-child { margin-top: 0; }
.section:last-child { margin-bottom: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.section-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.more { font-size: .84rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 2px; line-height: 1; white-space: nowrap; }
.more:hover { color: var(--primary); text-decoration: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 3px; font-size: 1.25rem; line-height: 1.3; }
.ranking-title-bar { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 3px; }
.ranking-title-bar h1 { margin: 0; }
.ranking-title-bar .inline-form { margin: 0; }
.page-head p { margin: 0; font-size: .84rem; }
.page-head.compact { margin-bottom: 12px; align-items: center; }
/* 搜索页、标签搜索页：标题区下面紧跟作品/系列/标签/用户分类栏。分类按钮自己上下有 8 的留白，标题区不再另留 12，
   「找到…个结果」离分类字 15 左右，和页头线离标题一样 */
.app-wrap .page-head:has(+ .tabs-wrap) { margin-bottom: 0; }
.ranking-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ranking-filter-row { display: flex; align-items: center; }
.ranking-filter-row .inline-form { margin: 0; display: inline-flex; align-items: center; }
.ranking-select-wrap { position: relative; display: inline-flex; align-items: center; }
.ranking-select-wrap select {
  height: 28px;
  font-size: .82rem;
  font-weight: 500;
  padding: 0 24px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  line-height: 26px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: .15s;
}
.ranking-select-wrap select:hover {
  background: var(--bg-alt);
  border-color: var(--border);
}
.ranking-select-wrap select:focus {
  outline: none;
  border-color: var(--primary);
}
.ranking-select-wrap::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}
.ranking-date-controls { display: inline-flex; align-items: center; gap: 6px; }
.ranking-picker-wrap { position: relative; display: inline-flex; align-items: center; }
.ranking-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: all .15s ease;
}
.ranking-picker-wrap:hover .ranking-picker-btn {
  background: var(--bg-alt);
  color: var(--primary);
  border-color: var(--primary);
}
.ranking-date-picker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}
.empty-state { padding: 28px 16px; text-align: center; color: var(--text-muted); background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius); }
.tabs-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
  overflow: hidden;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(var(--tabs-total, 6), minmax(0, 1fr));
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 1px;
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: .85rem; /* 约 13.6px；搜索页、收藏页和用户主页的子导航共用这一个字号 */
  text-decoration: none;
  margin-bottom: -1px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transition: color .15s ease, border-color .15s ease;
}
.tabs a.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  font-weight: 600;
}
.tabs a:hover {
  text-decoration: none;
  color: var(--primary);
}

@media (max-width: 449px) {
  .tabs a {
    padding: 7px 0;
  }
}

/* Welcome 迎宾微卡（纯粹干练版：标语简介 + 极简微公告） */
.welcome-card { margin: 0 -12px 18px; padding: 12px 12px 10px; background: linear-gradient(135deg, var(--primary-soft), var(--bg-card)); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.welcome-header { display: flex; flex-direction: column; gap: 4px; }
.welcome-title { font-size: 1.05rem; font-weight: 700; margin: 0; color: var(--text); letter-spacing: -.01em; line-height: 1.3; }
.welcome-desc { font-size: .83rem; color: var(--text-muted); margin: 0; line-height: 1.45; }
.welcome-announcement { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; font-size: .8rem; color: var(--text); transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease; text-decoration: none; margin-top: 2px; position: relative; cursor: pointer; overflow: hidden; }
.welcome-announcement:hover { background: var(--bg-alt); border-color: var(--primary); box-shadow: 0 2px 8px rgba(0, 150, 250, 0.12); transform: translateY(-1px); text-decoration: none; }
.announce-badge { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), #38bdf8); color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; line-height: 1.35; box-shadow: 0 1px 4px rgba(0, 150, 250, 0.25); }
.announce-ticker-wrap { flex: 1; min-width: 0; height: 20px; position: relative; overflow: hidden; }
.announce-ticker-track { position: relative; width: 100%; height: 100%; }
.announce-ticker-item { display: none; width: 100%; height: 100%; align-items: center; }
.announce-ticker-item.is-active { display: flex; }
.announce-ticker-item.slide-in { animation: announceUpIn .25s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.announce-ticker-item.slide-out { display: flex; position: absolute; top: 0; left: 0; animation: announceUpOut .25s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.announce-ticker-title { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; color: var(--text); font-weight: 500; line-height: 20px; transition: color .15s ease; }
.welcome-announcement:hover .announce-ticker-title { color: var(--primary); }
.announce-action { display: inline-flex; align-items: center; gap: 2px; color: var(--text-muted); font-size: .78rem; font-weight: 400; flex-shrink: 0; padding-left: 2px; transition: color .2s ease; }
.welcome-announcement:hover .announce-action { color: var(--primary); }
.announce-action svg { transition: transform .2s ease; }
.welcome-announcement:hover .announce-action svg { transform: translateX(2px); }

@keyframes announceUpIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes announceUpOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-12px); }
}

/* 作品卡片与系列卡片 */
.novel-grid { display: flex; flex-direction: column; }
.novel-card, .series-card { position: relative; background: var(--bg-card); overflow: hidden; display: flex; flex-direction: row; padding: 8px 12px; gap: 10px; transition: .15s; }
.novel-card-rank { display: flex; align-items: center; justify-content: center; width: 24px; flex-shrink: 0; align-self: center; }
.novel-card-rank .rank-medal { font-size: 1.25rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15)); user-select: none; }
.novel-card-rank .rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; font-size: .88rem; font-weight: 700; line-height: 1; color: var(--text-muted); }
.novel-card-rank.rank-1, .novel-card-rank.rank-2, .novel-card-rank.rank-3 { background: transparent; }
.novel-card-rank.rank-n .rank-badge { background: transparent; color: var(--text-muted); font-size: .88rem; font-weight: 700; }
[data-theme="dark"] .novel-card-rank.rank-1 .rank-badge { background: #d97706; color: #fff; box-shadow: 0 2px 4px rgba(217,119,6,.35); }
[data-theme="dark"] .novel-card-rank.rank-2 .rank-badge { background: #475569; color: #fff; }
[data-theme="dark"] .novel-card-rank.rank-3 .rank-badge { background: #9a3412; color: #fff; }
[data-theme="dark"] .novel-card-rank.rank-n .rank-badge { color: var(--text-muted); }
/* 前三名标记（rank_medal() 输出的内联 SVG：金/银/铜渐变斜体数字）：大小跟随所在位置的 font-size，各页面只需设 font-size。
   金/银/铜只换下面这组颜色变量（上→中→下的渐变） */
.rank-medal { display: inline-flex; line-height: 1; user-select: none; }
.rank-medal svg { display: block; width: 1.2em; height: 1.2em; }
.rank-medal .rm-top { stop-color: var(--rm-top); }
.rank-medal .rm-mid { stop-color: var(--rm-mid); }
.rank-medal .rm-bot { stop-color: var(--rm-bot); }
.rank-medal-1 { --rm-top: #ffc81a; --rm-mid: #e09a00; --rm-bot: #a86b00; }
.rank-medal-2 { --rm-top: #b4bfcc; --rm-mid: #8592a2; --rm-bot: #5d6877; }
.rank-medal-3 { --rm-top: #eda06a; --rm-mid: #c46e33; --rm-bot: #8a4718; }
.novel-card-cover, .series-card-cover { position: relative; display: block; width: 60px; height: 80px; flex-shrink: 0; border-radius: 6px; background: var(--bg-alt); overflow: hidden; }
.novel-card-cover img, .series-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, var(--c1, #798ca8), var(--c2, #62748f));
  color: #fff;
  overflow: hidden;
  user-select: none;
}
/* 实体书立体书脊压线 */
.cover-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,0.22), rgba(255,255,255,0.18) 50%, rgba(0,0,0,0.08));
  z-index: 2;
}
/* 封面极简内嵌压纹细框 */
.cover-placeholder::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  pointer-events: none;
}
/* 中央极简几何书卷徽标 */
.cover-placeholder-icon {
  width: 20px;
  height: 20px;
  opacity: 0.85;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
/* 深色模式：同样的颜色放在黑底上显得发亮，整块压暗一点（书本图标、细框跟着暗；角上的「N 篇」不在里面，不受影响） */
[data-theme="dark"] .cover-placeholder { filter: brightness(.85); }
.card-badge { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 9px; padding: 1px 3px; border-radius: 3px; }
/* 系列目录里上次读到的那一篇：放封面底部，标题多长都看得见 */
.card-lastread { position: absolute; left: 3px; right: 3px; bottom: 3px; background: var(--primary); color: #fff; font-size: 10px; line-height: 16px; text-align: center; border-radius: 3px; }
/* 第一行字（标题或系列小字）的行框上方本来有约 3px 空白（行高留白 + 汉字在字身里偏下），加上原来 1px 内边距，字顶比封面顶低 4px。
   去掉上内边距、整块往上提 3px，字顶正好和封面顶齐；往上伸的这 3px 在卡片内边距里，字不会被裁。底行不动（头像底本来就贴着封面底） */
.novel-card-body { padding: 0 0 1px; margin-top: -3px; display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; }
.novel-card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; width: 100%; max-width: 100%; min-width: 0; font-size: .93rem; font-weight: 600; margin: 0; line-height: 1.3; overflow: hidden; overflow-wrap: anywhere; }
.novel-card-title a { color: var(--text); }
.novel-card-title a:hover { color: var(--primary); }
/* 搜索时小字是「搜到的是哪一篇」的卡片，标题保持一行，小字不能让位（类加在卡片上，见 novel_card 的 $hitLine） */
.title-one-line .novel-card-title { display: block; white-space: nowrap; text-overflow: ellipsis; }
/* 标题 + 小字的格子，高度刚好「一行标题 + 间距 + 一行小字」（多留 1px 防取整）：标题折成两行时小字整行落到格子外被裁掉，卡片高度不变。
   间距让一行标题时小字落在正中：标题字底到小字字顶、小字字底到底行顶的空白一样。底行顶有头像时按头像顶算（头像比文字高），没头像时按文字顶算，
   所以有头像、没头像各一个值（小字是以系列为主的卡片的「最新一篇」，或者单篇、系列目录里各篇的简介；带系列名的卡片没有小字） */
.novel-card-main { --card-gap: 15.1px; flex-shrink: 0; height: calc(.93rem * 1.3 + var(--card-gap) + .72rem * 1.4 + 1px); overflow: hidden; }
.novel-card-body:has(.novel-card-author) .novel-card-main { --card-gap: 12.9px; }
/* 带系列名、没有那行小字的卡片（收藏、历史、作者主页里系列的篇）：系列名贴顶，标题在系列名和底行正中，一行两行都匀，不会一行时全挤在上半截。
   上下 auto 分的是行框，再用下内边距补行框和字面的差（有头像时底行顶按头像顶算）。不带系列名的（系列目录等）照旧标题贴顶 */
.novel-card-series ~ .novel-card-main:not(:has(.novel-card-latest)) { height: auto; margin: auto 0; padding-bottom: .8px; }
.novel-card-body:has(.novel-card-author) > .novel-card-series ~ .novel-card-main:not(:has(.novel-card-latest)) { padding-bottom: 5.3px; }
.novel-card-series ~ .novel-card-main:not(:has(.novel-card-latest)) ~ .novel-card-footer { margin-top: 0; }

.novel-card-series { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; line-height: 1.4; margin-bottom: 2px; }
.novel-card-series a { color: var(--text-muted); }
.novel-card-series a:hover { color: var(--primary); }
/* 篇名太长时只截篇名，后面的「· 等 N 篇」始终露出 */
.novel-card-latest { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-size: .72rem; line-height: 1.4; margin-top: var(--card-gap); }
.novel-card-latest a { color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.novel-card-latest svg { vertical-align: -1.5px; margin-right: 3px; }
.novel-card-latest-more { flex-shrink: 0; color: var(--text-muted); }
.novel-card-latest a:hover { color: var(--primary); }
.novel-card-caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; line-height: 1.4; margin-top: var(--card-gap); color: var(--text-muted); }
.novel-card-caption a { color: var(--text-muted); }
.novel-card-caption a:hover { color: var(--primary); }
.novel-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .75rem; color: var(--text-muted); margin-top: auto; }
.novel-card-author { display: inline-flex; align-items: center; gap: 4px; font-size: inherit; color: var(--text-muted); min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.novel-card-author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.novel-card-stats { display: inline-flex; align-items: center; gap: 8px; font-size: inherit; color: var(--text-muted); flex-shrink: 0; margin-left: auto; }
.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: inherit;
  line-height: 1;
  cursor: default;
  user-select: none;
}
.stat-item svg { flex-shrink: 0; }
.stat-item.stat-like.is-active,
.stat-item.like-btn.is-active { color: var(--accent); }
.stat-item.stat-bookmark.is-active,
.stat-item.bookmark-btn.is-active { color: var(--primary); }
.is-restricted .novel-card-cover img { filter: blur(12px); }
/* 阅读历史卡片：字数左边的“读到百分之几” */
.stat-progress { color: var(--primary); }

/* 前三名的颜色、作者链接 */
.rank-1 { color: #e6b800; } .rank-2 { color: #9aa5b1; } .rank-3 { color: #c47b3a; }
.author-link { display: inline-flex; align-items: center; gap: 4px; }

/* 排行侧栏 & 单栏排行网格 */
.rank-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.rank-card { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; min-height: 48px; }
.rank-card:hover { border-color: var(--primary); text-decoration: none; }
.rank-card .rank-num { width: 24px; text-align: center; font-size: 1.05rem; font-weight: 800; flex-shrink: 0; line-height: 1; }
.rank-card-body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; flex: 1; }
.rank-card-title { font-weight: 600; font-size: .88rem; line-height: 1.3; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-list li { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.rank-list li:first-child { border-top: 0; }
.rank-num { width: 22px; font-weight: 800; color: var(--text-muted); text-align: center; flex-shrink: 0; }
.rank-body { min-width: 0; display: flex; flex-direction: column; }
.rank-title { color: var(--text); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 标签：底色、字色从正文色和卡片色混出来，白天、深色和阅读纸色下都清楚又不抢眼；井号用主色 */
.tag-chip { display: inline-flex; gap: 3px; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: .78rem; line-height: 1.4; border: 1px solid transparent; background: color-mix(in srgb, var(--text) 7%, var(--bg-card)); color: color-mix(in srgb, var(--text) 78%, var(--bg-card)); font-weight: 500; text-decoration: none; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.tag-chip:hover { text-decoration: none; background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.tag-hash { color: var(--primary); }

/* 标签页 */
.tag-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tag-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px 8px;
  color: var(--text);
  overflow: hidden;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tag-card:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.tag-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}
.tag-card-name {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s ease;
}
.tag-card:hover .tag-card-name {
  color: var(--primary);
}
.tag-card-count {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.25;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-card.has-r18 .tag-card-name {
  padding-right: 28px;
}
.tag-card .tag-r18 {
  position: absolute;
  top: 4px;
  right: 4px;
  left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
  line-height: 14px;
  border-radius: 3px;
}
.tag-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tag-page-head-info {
  min-width: 0;
  flex: 1;
}
.tag-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 170px;
  flex-shrink: 0;
}
.tag-search-form input,
.tag-search-form input[type="search"] {
  width: 100%;
  height: 32px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 999px;
  padding: 5px 32px 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: .84rem;
  box-sizing: border-box;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.tag-search-form input:focus,
.tag-search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
  background: var(--bg-card);
}
.tag-search-form input::-webkit-search-decoration,
.tag-search-form input::-webkit-search-cancel-button,
.tag-search-form input::-webkit-search-results-button,
.tag-search-form input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.tag-search-form button {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.tag-search-form button:hover {
  color: var(--primary);
  background: var(--bg-alt);
}
@media (max-width: 380px) {
  .tag-page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tag-search-form {
    width: 100%;
  }
  /* 窄屏搜索框换到标题下面，框有边，离下面分类字留到 15 */
  .app-wrap .tag-page-head:has(+ .tabs-wrap) { margin-bottom: 4px; }
}
.tag-show-head {
  margin-bottom: 12px;
  align-items: flex-start;
}
.tag-show-head-info {
  min-width: 0;
  flex: 1;
}
.tag-show-head-info h1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.related-tags-box {
  background: var(--bg-card);
  padding: 8px 12px;
  margin: 0 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.related-tags-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.related-tags-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.related-tags-list a.tag-chip {
  padding: 2px 10px;
}

/* 用户 */
.user-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 340px) { .user-grid { grid-template-columns: 1fr; } }
.user-card { display: flex; gap: 8px; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; min-width: 0; position: relative; transition: .15s; }
.user-card:hover { border-color: var(--primary); text-decoration: none; }
.user-card-avatar { flex-shrink: 0; display: flex; }
.user-card-avatar .avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.user-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.user-card-body h3, .user-card-name { margin: 0; font-size: .88rem; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-body h3 a, .user-card-name a { color: var(--text); }
.user-card-body h3 a:hover, .user-card-name a:hover { color: var(--primary); text-decoration: none; }
.user-card-stats { font-size: .72rem; color: var(--text-muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-dot { margin: 0 1px; opacity: .7; }
.user-card .follow-btn { flex-shrink: 0; padding: 2px 8px; font-size: .74rem; border-radius: 999px; line-height: 1.4; }
.user-card-body p { margin: 0; }
.profile-banner {
  width: 100%;
  height: 160px;
  background-color: #e3f1fc;
  background-image: linear-gradient(140deg, #eef7fe 0%, #d6ebfb 55%, #e4ecfb 100%);
  background-size: cover;
  background-position: center;
  margin-top: -12px;
  position: relative;
  border-bottom: 1px solid rgba(0, 150, 250, 0.12);
}
[data-theme="dark"] .profile-banner {
  background-color: #0369a1;
  background-image: linear-gradient(140deg, #075985 0%, #0284c7 60%, #0369a1 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.profile-header { display: flex; flex-direction: column; padding-bottom: 12px; position: relative; }
.profile-top-bar { display: flex; justify-content: space-between; align-items: flex-end; margin-top: -40px; margin-bottom: 10px; gap: 10px; position: relative; }
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar { width: 78px; height: 78px; border-radius: 50%; border: 3.5px solid var(--bg); background: var(--bg-card); box-shadow: 0 2px 8px rgba(0,0,0,.12); display: block; object-fit: cover; }
[data-theme="dark"] .profile-avatar { border-color: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.45); }
.profile-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.profile-action-btn { display: inline-flex; align-items: center; gap: 4px; }
.profile-more-btn { padding: 4px 9px; min-width: 32px; height: 26px; box-sizing: border-box; }
.profile-identity { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.profile-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.profile-name { margin: 0; font-size: 1.25rem; font-weight: 800; line-height: 1.25; color: var(--text); }
.chip-admin { background: #e0f2fe; color: #0284c7; border-color: #bae6fd; font-weight: 600; }
.chip-mod { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; font-weight: 600; }
.chip-follows-you { background: var(--bg-alt); color: var(--text-muted); font-size: .72rem; padding: 1px 6px; border-radius: 4px; font-weight: 500; border-color: var(--border); }
[data-theme="dark"] .chip-admin { background: rgba(2, 132, 199, 0.2); color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); }
[data-theme="dark"] .chip-mod { background: rgba(22, 163, 74, 0.2); color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }
.profile-handle { font-size: .84rem; color: var(--text-muted); }
.profile-bio { font-size: .88rem; line-height: 1.55; color: var(--text); white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; }
.profile-bio a { color: var(--primary); }
.profile-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: .78rem; color: var(--text-muted); margin-bottom: 0; }
.profile-meta-item { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); text-decoration: none; }
.profile-meta-item svg { flex-shrink: 0; color: var(--text-muted); }
.profile-meta-item:hover { color: var(--primary); text-decoration: none; }
.profile-meta-item:hover svg { color: var(--primary); }
.profile-stats-row { display: flex; align-items: baseline; gap: 8px; font-size: .82rem; color: var(--text-muted); margin-top: 10px; line-height: 1.4; }
.profile-stat-item { display: inline-flex; align-items: baseline; gap: 4px; }
.profile-stat-item strong { color: var(--text); font-weight: 700; font-size: .88rem; }
.profile-stat-dot { opacity: .35; font-size: .75rem; user-select: none; }

/* 作品页 */
.novel-layout { display: block; width: 100%; margin: 0 auto; }
.novel-main { width: 100%; }

/* 作品头部卡片 */
/* 文章页一块接一块（信息、目录、阅读设置、正文、点赞、系列、作者）：块与块之间不留缝，只隔底边一条线，
   每块上下留白一样，内容正好在两条线中间。顶部间距由主内容区统一提供 */
.novel-header-card { background: var(--bg-card); padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.novel-series-pill { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text-muted); width: fit-content; max-width: 100%; flex-wrap: wrap; }
.series-pill-link { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); font-weight: 600; font-size: inherit; max-width: 320px; min-width: 0; }
.series-pill-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-pill-link svg { flex-shrink: 0; }
.series-pill-link:hover { text-decoration: underline; }
.series-pill-order { display: inline-block; padding: 2px 7px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font-size: .78rem; font-weight: 700; line-height: 1.35; flex-shrink: 0; }
.novel-view-title { margin: 0; font-size: 1.25rem; line-height: 1.35; font-weight: 700; color: var(--text); word-break: break-word; }
.novel-meta-group { display: flex; flex-direction: column; gap: 4px; }
.novel-meta-compact { font-size: .75rem; display: flex; align-items: center; flex-wrap: wrap; gap: 3px 6px; line-height: 1.3; color: var(--text-muted); }
.meta-dot { opacity: .6; }

/* 简介与标签 */
.novel-desc-wrap { display: flex; position: relative; }
.series-desc-wrap { padding-top: 10px; border-top: 1px solid var(--border); display: flex; position: relative; }
.series-tags-wrap { padding-top: 10px; border-top: 1px solid var(--border); }
.novel-caption,
.series-card-desc {
  position: relative;
  width: 100%;
  color: var(--text-muted);
  font-size: .86rem;
  line-height: 1.55;
  word-break: break-word;
  margin: 0;
  padding: 0;
  text-align: justify;
}
.series-card-desc { color: var(--text); }
.novel-caption a,
.series-card-desc a { color: var(--primary); }

.novel-caption.is-clamped,
.series-card-desc.is-clamped {
  max-height: calc(1.55em * 3);
  overflow: hidden;
}
.novel-caption.is-clamped::before,
.series-card-desc.is-clamped::before {
  content: '';
  float: right;
  width: 0;
  height: 100%;
  margin-bottom: -1.55em;
}
.desc-toggle-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.55;
  font-family: inherit;
  transition: opacity .15s ease;
}
.desc-toggle-btn:hover { text-decoration: underline; }
.desc-toggle-icon {
  vertical-align: -2px;
  flex-shrink: 0;
  transition: transform .2s ease;
}
.desc-toggle-icon.is-rotated { transform: rotate(180deg); }
.desc-btn-expand {
  float: right;
  clear: both;
  height: 1.55em;
  line-height: 1.55;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}
.desc-btn-collapse {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: baseline;
  margin-left: 6px;
  white-space: nowrap;
}
.novel-caption.is-clamped .desc-btn-collapse,
.series-card-desc.is-clamped .desc-btn-collapse {
  display: none;
}
.novel-caption:not(.is-clamped) .desc-btn-expand,
.series-card-desc:not(.is-clamped) .desc-btn-expand,
.novel-caption:not(.is-clamped)::before,
.series-card-desc:not(.is-clamped)::before {
  display: none;
}
.novel-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
/* 「添加标签」紧跟标签：不另加上边距；按钮用块级 flex（宽度贴着文字），免得外层按正文行高在文字上方多留一截空白 */
.reader-tag-add summary,
.reader-tag-add a,
.reader-tag-trigger {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 4px;
  font-size: .85em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  list-style: none;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  line-height: 1.4;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.reader-tag-add summary::-webkit-details-marker { display: none; }
.reader-tag-add summary::marker { display: none; content: ""; }
.reader-tag-trigger::before {
  content: "▶";
  font-size: .7em;
  color: currentColor;
  transition: transform .15s ease;
  line-height: 1;
}
details.reader-tag-add[open] > summary.reader-tag-trigger::before {
  transform: rotate(90deg);
}
.reader-tag-add summary:hover,
.reader-tag-add a:hover,
.reader-tag-trigger:hover,
.reader-tag-add summary:active,
.reader-tag-add a:active,
.reader-tag-trigger:active,
.reader-tag-add summary:focus,
.reader-tag-add a:focus,
.reader-tag-trigger:focus,
.reader-tag-add a:visited {
  color: var(--text);
  text-decoration: none;
  outline: none;
}
.reader-tag-add summary:hover::before,
.reader-tag-add a:hover::before,
.reader-tag-trigger:hover::before,
.reader-tag-add summary:active::before,
.reader-tag-add a:active::before,
.reader-tag-trigger:active::before {
  color: currentColor;
}
.reader-tag-form {
  margin-top: 8px;
  width: 50%;
  box-sizing: border-box;
}
.reader-tag-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.reader-tag-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.reader-tag-input {
  width: 100%;
  height: 32px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: .84rem;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.reader-tag-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.reader-tag-input-wrap .tag-suggest {
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 180px;
}
.reader-tag-submit-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  flex-shrink: 0;
  box-sizing: border-box;
  white-space: nowrap;
}
.reader-tag-status {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--text);
  line-height: 1.4;
  min-height: 0;
}
.reader-tag-status.is-error {
  color: var(--accent);
}
.reader-tag-status:empty {
  display: none;
}

/* 章节目录折叠 */
.chapter-toc-card { background: var(--bg-card); overflow: hidden; }
.chapter-toc-summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; cursor: pointer; list-style: none; font-size: .88rem; font-weight: 600; color: var(--text); user-select: none; }
.chapter-toc-summary::-webkit-details-marker { display: none; }
.toc-summary-left { display: flex; align-items: center; gap: 6px; }
.toc-summary-arrow { color: var(--text-muted); display: flex; align-items: center; transition: transform .2s ease; }
.chapter-toc-card[open] .toc-summary-arrow { transform: rotate(180deg); }
.chapter-toc-list { border-top: 1px solid var(--border); border-image: var(--inset-line) 1 0 0 0; padding: 4px 0; max-height: 240px; overflow-y: auto; }
.chapter-toc-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 14px; font-size: .84rem; color: var(--text); text-decoration: none; transition: background .15s ease; }
.chapter-toc-item:hover { background: var(--bg-alt); color: var(--primary); text-decoration: none; }
.chapter-toc-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 阅读器控制工具栏 */
.reader-toolbar-capsule { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--bg-card); padding: 10px 12px; }
.toolbar-section { display: flex; align-items: center; gap: 4px; }
.toolbar-btn { display: inline-flex; align-items: center; justify-content: center; padding: 4px 7px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px; font-size: .78rem; font-weight: 500; color: var(--text); line-height: 1.2; cursor: pointer; transition: border-color .15s, background .15s; }
.toolbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.toolbar-btn-icon { width: 28px; height: 28px; padding: 0; border-radius: 6px; }
.toolbar-indicator { font-size: .78rem; font-weight: 700; min-width: 18px; text-align: center; color: var(--text); }
.theme-swatches { display: inline-flex; align-items: center; gap: 5px; padding: 2px; }
.theme-swatch { width: 19px; height: 19px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; transition: transform .15s ease, border-color .15s ease; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.theme-swatch:hover { transform: scale(1.15); }
.theme-swatch.is-active { border-color: var(--primary); transform: scale(1.18); box-shadow: 0 0 0 1px var(--bg-card); }
.swatch-default { background: #ffffff; border: 1px solid #cbd5e1; }
.swatch-sepia { background: #f6efe1; }
.swatch-green { background: #e3edd9; }
.swatch-dark { background: #1b1b1b; }

/* 阅读背景色
   不再只给正文卡片上色（卡片两侧、页头、页面外侧还是白的，一圈白边很刺眼），而是把整页的配色变量换成同一种“纸色”：
   正文卡片、两侧留白、页头和其他卡片都跟着变，页面外侧换成同色系稍深一点的底色，仍看得出中间这一栏。
   data-reader-theme 只出现在作品阅读页，由 <head> 里的小脚本在页面渲染前写上，翻页时不会先闪一下白 */
html[data-reader-theme="sepia"] {
  --bg: #f6efe1; --bg-card: #f6efe1; --bg-alt: #efe6d4;
  --text: #3b3226; --text-muted: #8a7b65; --border: #e4d8c2;
  --reader-backdrop: #e9dec8;
}
html[data-reader-theme="green"] {
  --bg: #e3edd9; --bg-card: #e3edd9; --bg-alt: #d9e5cd;
  --text: #2b3a25; --text-muted: #67775d; --border: #cfdcc1;
  --reader-backdrop: #d5e2c8;
}
html[data-reader-theme="dark"] {
  --bg: #1b1b1b; --bg-card: #1b1b1b; --bg-alt: #242424;
  --text: #c9c9c9; --text-muted: #8a8a8a; --border: #2e2e2e;
  --reader-backdrop: #111111;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --bar-success-text: #34d399; --bar-error-text: #f87171;
  color-scheme: dark;
}
/* 浅色纸：即使全站开着深色模式，提示条文字也要用浅底的配色 */
html[data-reader-theme="sepia"], html[data-reader-theme="green"] {
  --bar-success-text: #17693a; --bar-error-text: #b21f1f;
  color-scheme: light;
}
/* 淡色块从主色/强调色和纸色混出来，在哪种纸上都协调 */
html[data-reader-theme] {
  --primary-soft: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
  --bar-info-border: color-mix(in srgb, var(--primary) 30%, var(--bg-card));
  --bar-success-bg: color-mix(in srgb, #10b981 14%, var(--bg-card)); --bar-success-border: color-mix(in srgb, #10b981 35%, var(--bg-card));
  --bar-error-bg: color-mix(in srgb, #ef4444 14%, var(--bg-card)); --bar-error-border: color-mix(in srgb, #ef4444 35%, var(--bg-card));
}
html[data-reader-theme] body { background: var(--reader-backdrop); }
html[data-reader-theme] .app-wrap { box-shadow: 0 0 24px rgba(0,0,0,.06); }
/* 写死颜色的几处：点赞高亮和纸色混合 */
html[data-reader-theme] .action-btn.like-btn.is-active { background: color-mix(in srgb, var(--accent) 12%, var(--bg-card)); }
html[data-reader-theme] .reply-cancel-btn:hover { background: var(--bg-alt); }
/* 点色块切换时整页颜色淡入淡出，而不是一下子从白跳到黑 */
@media (prefers-reduced-motion: no-preference) {
  html.reader-theme-fading, html.reader-theme-fading * { transition: background-color .3s ease, border-color .3s ease, color .3s ease, transform .15s ease !important; }
}

/* 正文。两端对齐：手机宽度各不一样，一行放不下整数个字，末尾总剩下几像素到一个多字的空（标点不能放行首时更多），
   左对齐的话这点空全堆在右边，看着右边比左边空；分到字和字之间就两边齐了，每段最后一行照常靠左 */
.novel-body { background: var(--bg-card); color: var(--text); padding: 18px 12px; font-size: var(--reader-size, 17px); line-height: var(--reader-lh, 1.9); font-family: var(--reader-font, var(--font)); text-align: justify; word-break: break-word; overflow-wrap: anywhere; transition: background .2s ease, color .2s ease; }
.novel-body > :first-child { margin-top: 0; }
.novel-body p { margin: 0 0 1.25em; text-indent: 0; }
.novel-body p:last-child { margin-bottom: 0; }
.novel-body h2.novel-chapter { font-size: 1.22em; font-weight: 700; line-height: 1.35; margin: 1.5em 0 8px; padding-bottom: 13px; border-bottom: 1px solid var(--border); color: inherit; }
.novel-body h2.novel-chapter:first-child { margin-top: 0; }

/* 沉浸阅读模式 */
body.reader-immersive .site-header, body.reader-immersive .site-footer, body.reader-immersive .novel-header-card, body.reader-immersive .novel-series-hub, body.reader-immersive .novel-author-profile, body.reader-immersive .comments-card, body.reader-immersive .novel-action-panel, body.reader-immersive .novel-rel-section, body.reader-immersive .section { display: none; }
body.reader-immersive .novel-layout { max-width: 100%; }
body.reader-immersive .reader-toolbar-capsule { top: 0; }

/* 交互操作面板 */
/* 上边 16、下边 8：正文底线→按钮、按钮→「举报」字、「举报」字→面板底线 都是 16 左右（举报那行自带上下留白，所以下边少留） */
.novel-action-panel { background: var(--bg-card); padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.action-panel-grid { display: flex; width: 100%; gap: 6px; align-items: center; }
.action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 28px; padding: 0 8px; font-size: .82rem; border-radius: 999px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; transition: all .15s ease; box-sizing: border-box; }
.action-btn:active { transform: scale(0.97); }
.action-btn svg { flex-shrink: 0; }
.action-count { font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; }
/* 点赞、收藏、分享三个按钮一样宽；数字太长放不下时（小屏 + 上万）那个自动宽一点，字不会挤出按钮 */
.action-btn.like-btn { flex: 1 1 0; border-color: var(--border); }
.action-btn.like-btn.is-active { background: #ffe8ec; color: var(--accent); border-color: var(--accent); }
[data-theme="dark"] .action-btn.like-btn.is-active { background: #3a1a22; }
.action-btn.bookmark-btn { flex: 1 1 0; border-color: var(--border); }
.action-btn.bookmark-btn.is-active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.action-btn.is-static { flex: 1 1 0; border-color: var(--border); color: var(--text-muted); cursor: default; }
.action-btn.is-static:hover { filter: none; }
.action-btn.is-static:active { transform: none; }
.share-btn { flex: 1 1 0; border-color: var(--border); }
.share-btn:hover { background: var(--bg-alt); border-color: var(--primary); color: var(--primary); }
/* 编辑 / 举报 这行紧跟在点赞收藏分享下面，不画线：离上面按钮、离面板底线都是 17 左右 */
.action-panel-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.link-action-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 3px 6px; color: var(--text-muted); font-size: .82rem; font-weight: 500; cursor: pointer; }
.link-action-btn:hover { color: var(--primary); text-decoration: none; }

/* 统一系列枢纽卡片 */
.novel-series-hub { background: var(--bg-card); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.series-hub-header { display: flex; align-items: center; gap: 10px; }
.series-hub-cover { width: 48px; height: 64px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--bg-alt); }
.series-hub-cover img { width: 100%; height: 100%; object-fit: cover; }
.series-hub-cover .cover-placeholder::before { width: 2px; }
.series-hub-cover .cover-placeholder::after { inset: 3px; }
.series-hub-cover .cover-placeholder-icon { width: 14px; height: 14px; }
.series-hub-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.series-hub-meta { font-size: .74rem; line-height: 1.2; color: var(--text-muted); }
.series-hub-title { margin: 0; font-size: .92rem; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-hub-title a { color: var(--text); }
.series-hub-title a:hover { color: var(--primary); }
.series-hub-watch { flex-shrink: 0; }
/* 上一篇 / 系列目录 / 下一篇 紧跟在所属系列下面，不画线：离封面 10，和这块上下边的 12 差不多 */
.series-hub-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: stretch; }
.series-nav-btn { display: flex; flex-direction: column; justify-content: center; padding: 6px 8px; min-height: 42px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px; font-size: .78rem; color: var(--text); min-width: 0; text-decoration: none; transition: border-color .15s; }
.series-nav-btn:hover { border-color: var(--primary); text-decoration: none; }
.series-nav-btn.next { text-align: right; }
.series-nav-btn.catalog { flex-direction: row; align-items: center; justify-content: center; gap: 4px; padding: 8px 10px; font-weight: 600; }
.series-nav-btn.disabled { opacity: .5; cursor: not-allowed; background: var(--bg-alt); border-style: dashed; }
.nav-dir { font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.nav-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 500; }

/* 底部作者档案卡片 */
.novel-author-profile { background: var(--bg-card); padding: 12px; }
.author-profile-main { display: flex; gap: 10px; align-items: center; }
.author-profile-avatar { flex-shrink: 0; display: flex; align-self: center; }
.author-profile-avatar .avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.author-profile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.author-profile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.author-profile-name { margin: 0; font-size: .95rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-profile-name a { color: var(--text); }
.author-profile-name a:hover { color: var(--primary); }
.author-profile-actions { display: flex; gap: 5px; flex-shrink: 0; }
.author-profile-stats { margin-top: 2px; }

/* 小说页推荐区块 */
.novel-rel-section { margin: 16px 0; }
.novel-rel-section .section-head { margin-bottom: 10px; padding: 0 2px; }
.novel-rel-section .section-head h2 { font-size: .95rem; font-weight: 600; color: var(--text); }

.r18-gate { text-align: center; padding: 32px 12px; background: var(--bg-card); }

/* 系列页 */
/* 系列顶部间距由主内容区统一提供；最下面是「举报」那行，自带上下留白，下边只留 8 */
.series-header-card { background: var(--bg-card); padding: 0 12px 8px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.series-main-row { display: flex; gap: 12px; align-items: flex-start; }
.series-cover { width: 76px; height: 102px; flex-shrink: 0; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-sm); background: var(--bg-alt); }
.series-cover img { width: 100%; height: 100%; object-fit: cover; }
.series-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.series-view-title { margin: 0; font-size: 1.1rem; font-weight: 700; line-height: 1.35; color: var(--text); word-break: break-word; }
.series-author-row { display: flex; align-items: center; font-size: .84rem; }
.series-author-row .author-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }
.series-author-row .author-link:hover { color: var(--primary); }
.series-meta-stats { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted); line-height: 1.4; }
/* 按钮那排：线→按钮、按钮→「举报」字、「举报」字→框底线 都是 16 左右，和文章页点赞那块一样 */
.series-actions-bar { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.series-actions-grid { display: flex; gap: 6px; align-items: center; width: 100%; }
.series-actions-grid .btn { flex: 1 1 0; min-width: 0; height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: .8rem; font-weight: 600; padding: 0 6px; white-space: nowrap; border-radius: 999px; }
.series-actions-grid .btn svg { flex-shrink: 0; width: 13px; height: 13px; }
.series-actions-grid .action-count { font-size: .76rem; font-weight: 700; margin-left: 1px; }
.series-actions-aux { display: flex; justify-content: flex-end; padding-top: 2px; }

/* 评论 */
.comments-card { background: var(--bg-card); padding: 14px 12px; margin: 14px 0 0; display: flex; flex-direction: column; gap: 12px; }
.comments-card-header { display: flex; align-items: center; justify-content: space-between; }
.comments-card-title { display: flex; align-items: center; gap: 6px; font-size: 1rem; font-weight: 700; color: var(--text); }
.comments-card-title h2 { margin: 0; font-size: inherit; font-weight: inherit; }
.comments-card-title svg { color: var(--primary); flex-shrink: 0; }
.comments-count-pill { display: inline-flex; align-items: center; justify-content: center; background: var(--bg-alt); color: var(--text-muted); font-size: .74rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; min-width: 20px; line-height: 1.3; }
.comments-closed { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); font-size: .84rem; padding: 16px 12px; background: var(--bg-alt); border-radius: 8px; }

.comment-form { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.comment-my-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-top: 2px; }
.comment-form-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.reply-to { display: flex; align-items: center; justify-content: space-between; background: var(--primary-soft); border-radius: 6px; padding: 4px 8px; font-size: .78rem; color: var(--primary); }
.reply-to-text { display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-cancel-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--primary); padding: 2px; cursor: pointer; border-radius: 4px; }
.reply-cancel-btn:hover { background: rgba(0,0,0,.06); }
[data-theme="dark"] .reply-cancel-btn:hover { background: rgba(255,255,255,.1); }

.comment-input-box { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.comment-input-box textarea { background: transparent; border: 0; outline: none; padding: 0; width: 100%; font-size: .86rem; line-height: 1.5; color: var(--text); resize: none; min-height: 48px; box-shadow: none; }
.comment-input-box:focus-within { border-color: var(--primary); background: var(--bg-card); box-shadow: 0 0 0 2px var(--primary-soft); }
.comment-form-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--border); }
.comment-submit-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; font-size: .8rem; font-weight: 600; border-radius: 999px; }

.comment-guest-prompt { display: flex; align-items: center; gap: 10px; background: var(--bg-alt); border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; text-decoration: none; transition: border-color .15s, background .15s; }
.comment-guest-prompt:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.guest-avatar-ph { width: 32px; height: 32px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.guest-prompt-text { flex: 1; font-size: .84rem; color: var(--text-muted); }
.guest-login-badge { font-size: .78rem; font-weight: 600; color: var(--primary); background: var(--bg-card); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); flex-shrink: 0; }

.comment-list { display: flex; flex-direction: column; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); position: relative; }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment:last-child { padding-bottom: 0; }
.comment-avatar { flex-shrink: 0; display: block; align-self: flex-start; margin-top: 1px; }
.comment-avatar .avatar { border-radius: 50%; object-fit: cover; }
.comment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; line-height: 1.3; margin: 0; }
.comment-head-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.comment-name { font-weight: 600; font-size: .86rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-name:hover { color: var(--primary); text-decoration: none; }
.comment-author-chip { display: inline-flex; align-items: center; font-size: .68rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 1px 5px; border-radius: 4px; line-height: 1.25; }
.comment-reply-indicator { font-size: .75rem; color: var(--text-muted); }
.comment-reply-user { color: var(--primary); font-weight: 500; }
.comment-time { font-size: .72rem; color: var(--text-muted); flex-shrink: 0; }
.comment-content { font-size: .86rem; line-height: 1.55; color: var(--text); word-break: break-word; white-space: pre-wrap; margin: 0; }
.comment-actions { display: flex; align-items: center; gap: 12px; margin: 0; }
.comment-actions:empty { display: none; margin: 0; }
.comment-action-btn { display: inline-flex; align-items: center; gap: 3px; background: none; border: 0; padding: 2px 4px; color: var(--text-muted); font-size: .75rem; font-weight: 500; cursor: pointer; border-radius: 4px; transition: color .15s ease; }
.comment-action-btn svg { flex-shrink: 0; }
.comment-action-btn:hover { color: var(--primary); text-decoration: none; }
.comment-action-btn.danger:hover { color: var(--accent); }
.comment-actions .comment-action-btn:first-child { padding-left: 0; margin-left: 0; }

.comment-replies { margin-top: 2px; padding-left: 10px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 0; }
.comment-replies:empty { display: none; margin: 0; padding: 0; border: 0; }
.comment-reply { padding: 6px 0; border-top: 1px dashed var(--border); }
.comment-reply:first-child { border-top: 0; padding-top: 0; }
.comment-reply:last-child { padding-bottom: 0; }
.comment-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px 12px; text-align: center; color: var(--text-muted); }
.comment-empty svg { color: var(--border); opacity: .8; }
.comment-empty p { margin: 0; font-size: .82rem; }
.comments-more-wrap { padding-top: 10px; border-top: 1px solid var(--border); }

/* 表单 */
.form { background: var(--bg-card); padding: 14px 12px; margin-bottom: 12px; }
.form-row { margin-bottom: 10px; }
.form-row > label:not(.checkbox):not(.radio) { display: block; font-weight: 600; margin-bottom: 6px; }
.form-row > label.checkbox, .form-row > label.radio { margin-bottom: 0; }
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="password"], .form-row input[type="url"], .form-row input[type="number"], .form-row input[type="date"], .form-row input[type="search"], .form-row input:not([type]), .form-row .admin-input, .form-row select, .form-row input[type="datetime-local"], .form-row textarea { width: 100%; }
.form-inline { display: flex; justify-content: space-between; align-items: center; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.req { color: var(--accent); }
.hint { font-size: .85em; margin: 4px 0 0; }
.radio-group { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.radio-group.vertical { flex-direction: column; }
.radio, .checkbox, label.checkbox, label.radio { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; cursor: pointer; user-select: none; line-height: 1.4; }
.radio input[type="radio"], .checkbox input[type="checkbox"], label.checkbox input[type="checkbox"], label.radio input[type="radio"] { margin: 0; flex-shrink: 0; position: relative; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; position: relative; }
.auth-wrap { max-width: 440px; padding-top: 24px; padding-bottom: 24px; }
.auth-form h1 { text-align: center; margin-bottom: 14px; }
.auth-form .btn-block { margin-top: 6px; }
.auth-form p.center { margin: 14px 0 2px; }
.tag-suggest { position: absolute; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 40; min-width: 200px; max-height: 240px; overflow: auto; }
.tag-suggest button { display: flex; justify-content: space-between; width: 100%; gap: 12px; padding: 6px 12px; background: none; border: 0; text-align: left; color: var(--text); }
.tag-suggest button:hover, .tag-suggest button.active { background: var(--bg-alt); }

/* 投稿页标签：输入框和「添加」连成一条，加好的标签在下面排开 */
.tag-entry-row { position: relative; display: flex; }
.tag-entry-row .settings-input { flex: 1; min-width: 0; border-radius: 8px 0 0 8px; }
.tag-entry-btn { margin-left: -1px; padding: 0 18px; border-radius: 0 8px 8px 0; }
.tag-entry-btn:disabled { opacity: .45; cursor: not-allowed; }
.tag-entry-row .tag-suggest { top: calc(100% + 4px); left: 0; }
.tag-entry-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.tag-entry-list:empty { display: none; }
.tag-entry-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 3px 2px 10px; border-radius: 999px; font-size: .82rem; line-height: 1.4; background: color-mix(in srgb, var(--text) 7%, var(--bg-card)); color: var(--text); word-break: break-all; }
.tag-entry-chip button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; }
.tag-entry-chip button:hover { background: color-mix(in srgb, var(--text) 12%, transparent); color: var(--text); }
.search-filters { background: var(--bg-card); padding: 12px; margin-bottom: 12px; }
.search-filters summary { cursor: pointer; font-weight: 600; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 12px 0 10px; }
.filter-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .85em; }
.filter-grid label.checkbox { flex-direction: row; align-items: center; align-self: end; }
.search-filters .hint { margin: 8px 0 12px; }
.search-filters .filter-form button[type="submit"] { margin-top: 0; }

/* 创作中心 / 设置 (单栏顶栏选项卡导航) */
.dash-layout { display: flex; flex-direction: column; gap: 12px; }
.dash-main { width: 100%; min-width: 0; }

/* 创作中心与设置现代化分段导航卡片 */
.dash-nav-card, .settings-nav-card {
  background: var(--bg-card);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--bg-alt);
  padding: 3px;
  border-radius: 10px;
}
.dash-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 4px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap;
}
.dash-tab svg { flex-shrink: 0; opacity: .75; }
.dash-tab:hover {
  color: var(--text);
  text-decoration: none;
}
.dash-tab.is-active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.dash-tab.is-active svg { opacity: 1; color: var(--primary); }
.dash-nav-actions {
  display: flex;
  gap: 8px;
}
.dash-action-btn {
  flex: 1 1 0;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0 8px;
  white-space: nowrap;
}

/* 页面标题栏 */
.dash-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 10px;
}
.dash-page-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-page-title {
  font-size: 1.18rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.dash-page-title svg {
  flex-shrink: 0;
  display: block;
}
.dash-head-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  height: 28px;
  padding: 0 10px;
  font-size: .78rem;
  font-weight: 600;
}

/* 8大核心指标网格 (2列并排，4行平衡布局) */
.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.dash-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s ease, transform .15s ease;
}
.dash-stat-card:hover {
  border-color: var(--primary);
}
.dash-stat-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-stat-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-stat-icon.icon-primary { background: var(--primary-soft); color: var(--primary); }
.dash-stat-icon.icon-warn { background: rgba(245, 158, 11, .15); color: #d97706; }
.dash-stat-icon.icon-purple { background: rgba(139, 92, 246, .15); color: #8b5cf6; }
.dash-stat-icon.icon-teal { background: rgba(20, 184, 166, .15); color: #0d9488; }
.dash-stat-icon.icon-blue { background: rgba(59, 130, 246, .15); color: #2563eb; }
.dash-stat-icon.icon-red { background: rgba(239, 68, 68, .15); color: #ef4444; }
.dash-stat-icon.icon-amber { background: rgba(245, 158, 11, .15); color: #b45309; }
.dash-stat-icon.icon-green { background: rgba(16, 185, 129, .15); color: #059669; }

[data-theme="dark"] .dash-stat-icon.icon-warn { background: rgba(245, 158, 11, .25); color: #fbbf24; }
[data-theme="dark"] .dash-stat-icon.icon-purple { background: rgba(139, 92, 246, .25); color: #a78bfa; }
[data-theme="dark"] .dash-stat-icon.icon-teal { background: rgba(20, 184, 166, .25); color: #2dd4bf; }
[data-theme="dark"] .dash-stat-icon.icon-blue { background: rgba(59, 130, 246, .25); color: #60a5fa; }
[data-theme="dark"] .dash-stat-icon.icon-red { background: rgba(239, 68, 68, .25); color: #f87171; }
[data-theme="dark"] .dash-stat-icon.icon-amber { background: rgba(245, 158, 11, .25); color: #f59e0b; }
[data-theme="dark"] .dash-stat-icon.icon-green { background: rgba(16, 185, 129, .25); color: #34d399; }

.dash-stat-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-muted);
}
.dash-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

/* 作品与系列管理卡片通用组件 (.dash-work-card, .dash-manage-card) */
.dash-work-list, .dash-manage-list {
  display: flex;
  flex-direction: column;
}
.dash-work-card, .dash-manage-card {
  background: var(--bg-card);
  padding: 9px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.dash-work-cover, .dash-manage-cover {
  width: 52px;
  height: 70px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-alt);
  position: relative;
}
.dash-work-cover img, .dash-manage-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dash-work-body, .dash-manage-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-work-title-row, .dash-manage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.dash-work-title, .dash-manage-title {
  margin: 0;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  min-width: 0;
  flex: 1;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-work-title a, .dash-manage-title a {
  color: var(--text);
  text-decoration: none;
}
.dash-work-title a:hover, .dash-manage-title a:hover {
  color: var(--primary);
  text-decoration: none;
}
.chip-sub {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  margin-right: 2px;
}

/* 状态药丸胶囊 */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}
.status-pill.status-public {
  background: rgba(16, 185, 129, .12);
  color: #059669;
}
.status-pill.status-draft {
  background: rgba(245, 158, 11, .15);
  color: #d97706;
}
.status-pill.status-fan {
  background: rgba(59, 130, 246, .12);
  color: #2563eb;
}
.status-pill.status-hidden {
  background: rgba(239, 68, 68, .12);
  color: #dc2626;
}
[data-theme="dark"] .status-pill.status-public { background: rgba(16, 185, 129, .22); color: #34d399; }
[data-theme="dark"] .status-pill.status-draft { background: rgba(245, 158, 11, .22); color: #fbbf24; }
[data-theme="dark"] .status-pill.status-fan { background: rgba(59, 130, 246, .22); color: #60a5fa; }
[data-theme="dark"] .status-pill.status-hidden { background: rgba(239, 68, 68, .22); color: #f87171; }

/* 卡片统计与时间指标行 */
.dash-work-metrics, .dash-manage-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
  font-size: .74rem;
  color: var(--text-muted);
}
.metric-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.metric-val {
  font-weight: 600;
  color: var(--text);
}
.metric-key {
  color: var(--text-muted);
}

/* 卡片底部操作栏 */
.dash-work-foot, .dash-manage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  gap: 8px;
}
.dash-work-time, .dash-manage-time {
  font-size: .72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dash-work-actions, .dash-manage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.dash-mini-btn, .btn-manage {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .74rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1.35;
}
.dash-mini-btn:hover, .btn-manage:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* 筛选工具栏 (作品管理) */
.dash-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dash-filter-chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
  flex: 1 1 auto;
}
.dash-filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  box-sizing: border-box;
  font-size: .78rem;
  font-weight: 500;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
  transition: all .15s ease;
}
.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.filter-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.dash-sort-box {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.dash-sort-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px 2px 8px;
}
.dash-sort-label {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}
.dash-select {
  border: 0;
  background: transparent;
  font-size: .78rem;
  color: var(--text);
  padding: 3px 0;
  outline: none;
  cursor: pointer;
}

/* 数据统计页周期与作品排行卡片 */
.stats-period-group {
  display: inline-flex;
  background: var(--bg-alt);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.period-btn {
  padding: 3px 8px;
  font-size: .76rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all .15s ease;
}
.period-btn:hover {
  color: var(--text);
  text-decoration: none;
}
.period-btn.is-active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.top-works-list {
  display: flex;
  flex-direction: column;
}
.top-work-card {
  background: var(--bg-card);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.top-work-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-work-rank {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}
.top-work-rank .rank-medal { font-size: 1.15rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12)); }
.top-work-rank.rank-n { background: var(--bg-alt); color: var(--text-muted); }
.top-work-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-work-title a {
  color: var(--text);
  text-decoration: none;
}
.top-work-title a:hover {
  color: var(--primary);
  text-decoration: none;
}
.top-work-recent-badge {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.recent-val {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.recent-lbl {
  font-size: .68rem;
  color: var(--text-muted);
}
.top-work-bar-track {
  height: 4px;
  background: var(--bg-alt);
  border-radius: 2px;
  overflow: hidden;
}
.top-work-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-soft) 0%, var(--primary) 100%);
  border-radius: 2px;
  transition: width .3s ease;
}
.top-work-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  color: var(--text-muted);
}
.stat-cell-val {
  font-weight: 600;
  color: var(--text);
}
.stat-cell-lbl {
  color: var(--text-muted);
}

/* ========== 用户设置中心 (Settings Redesign) ========== */
.settings-form,
.novel-workspace-form,
.series-workspace-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-card {
  background: var(--bg-card);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.settings-card-head-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.settings-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
}
.settings-card-title svg {
  color: var(--primary);
  flex-shrink: 0;
}
.settings-card-desc {
  font-size: .76rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* 主页视觉媒体定制器 (横幅 + 头像) */
.settings-banner-uploader {
  position: relative;
  width: 100%;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
}
.settings-banner-uploader img[data-banner-preview] {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.settings-banner-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: .78rem;
  background: linear-gradient(135deg, var(--bg-alt) 0%, rgba(30, 126, 255, .06) 100%);
}
.settings-banner-placeholder svg {
  color: var(--text-muted);
  opacity: .8;
}
.settings-banner-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}
.settings-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  transition: background .15s ease;
  user-select: none;
}
.settings-banner-btn:hover {
  background: rgba(0, 0, 0, .85);
}

.settings-avatar-uploader {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 2px;
}
.settings-avatar-frame {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
}
.settings-avatar-frame img.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.settings-avatar-trigger {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s ease, background .15s ease;
}
.settings-avatar-trigger:hover {
  transform: scale(1.08);
  background: var(--primary-dark);
}
.settings-avatar-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.settings-avatar-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.settings-avatar-hint {
  font-size: .74rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* 表单字段组件 */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.settings-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-label .req {
  color: var(--accent);
  margin-left: 2px;
}
.settings-label-hint {
  font-size: .72rem;
  font-weight: 400;
  color: var(--text-muted);
}
.settings-input,
.settings-select,
.settings-textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: .88rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  box-sizing: border-box;
  font-family: inherit;
}
.settings-input:focus,
.settings-select:focus,
.settings-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.settings-input:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: var(--bg-alt);
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  border-color: var(--border);
}
.settings-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}
.settings-field-hint {
  font-size: .74rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 1px 0 0;
}
.settings-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* 现代化开关行 (iOS风格 Switch) */
.settings-switch-group {
  display: flex;
  flex-direction: column;
}
.settings-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.settings-switch-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}
.settings-switch-row:first-child {
  padding-top: 2px;
}
.switch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.switch-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.switch-title {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.switch-desc {
  font-size: .74rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.switch-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.3;
  white-space: nowrap;
}
.switch-badge.badge-r18 {
  background: rgba(225, 29, 72, .12);
  color: #e11d48;
}
.switch-badge.badge-r18g {
  background: rgba(147, 51, 234, .12);
  color: #9333ea;
}
.switch-badge.badge-ai {
  background: rgba(59, 130, 246, .12);
  color: #2563eb;
}
[data-theme="dark"] .switch-badge.badge-r18 { background: rgba(225, 29, 72, .25); color: #fb7185; }
[data-theme="dark"] .switch-badge.badge-r18g { background: rgba(147, 51, 234, .25); color: #c084fc; }
[data-theme="dark"] .switch-badge.badge-ai { background: rgba(59, 130, 246, .25); color: #93c5fd; }

/* 核心 UI Switch */
.ui-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.ui-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
}
.ui-switch-track {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background .2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ui-switch-track::after {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.ui-switch input:checked + .ui-switch-track {
  background: var(--primary);
}
.ui-switch input:checked + .ui-switch-track::after {
  transform: translateX(18px);
}
.ui-switch input:focus-visible + .ui-switch-track {
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.ui-switch input:disabled + .ui-switch-track {
  opacity: .45;
  cursor: not-allowed;
}

/* 邮箱验证状态胶囊与提示栏 */
.verify-status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-top: 6px;
  font-size: .78rem;
}
.verify-status-box.is-unverified {
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .25);
  color: #b45309;
}
.verify-status-box.is-verified {
  background: rgba(16, 185, 129, .1);
  border: 1px solid rgba(16, 185, 129, .25);
  color: #059669;
}
[data-theme="dark"] .verify-status-box.is-unverified {
  background: rgba(245, 158, 11, .18);
  border-color: rgba(245, 158, 11, .3);
  color: #fbbf24;
}
[data-theme="dark"] .verify-status-box.is-verified {
  background: rgba(16, 185, 129, .18);
  border-color: rgba(16, 185, 129, .3);
  color: #34d399;
}
.verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.verify-badge.is-verified {
  background: rgba(16, 185, 129, .15);
  color: #059669;
}
.verify-badge.is-unverified {
  background: rgba(245, 158, 11, .18);
  color: #d97706;
}
[data-theme="dark"] .verify-badge.is-verified { background: rgba(16, 185, 129, .25); color: #34d399; }
[data-theme="dark"] .verify-badge.is-unverified { background: rgba(245, 158, 11, .25); color: #fbbf24; }

/* 标签屏蔽与用户屏蔽 */
.tag-input-bar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  position: relative;
  max-width: 520px;
}
.tag-input-prefix {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
}
.tag-input-prefix svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color .15s;
}
.tag-input-prefix:focus-within svg {
  color: var(--primary);
}
.tag-input-prefix input {
  /* 全站输入框那条通用规则优先级很高（带两个 :not），左边要给图标让位只能硬压 */
  padding-left: 34px !important;
  height: 38px;
  border-radius: 8px;
  font-size: .88rem;
  line-height: normal;
}
.tag-input-submit {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.tag-mute-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tag-mute-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 8px;
  border-radius: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
}
.tag-mute-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  transition: all .15s ease;
}
.tag-mute-del:hover {
  background: rgba(239, 68, 68, .15);
  color: #ef4444;
}

.blocked-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.blocked-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.blocked-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: var(--text);
}
.blocked-user-info:hover {
  text-decoration: none;
  color: var(--primary);
}
.blocked-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.blocked-user-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.blocked-user-name {
  font-size: .86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blocked-user-handle {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* 统一保存操作按钮与空状态 */
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.settings-save-btn {
  font-weight: 700;
  height: 36px;
  padding: 0 18px;
  font-size: .88rem;
  border-radius: 8px;
}
.settings-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: .82rem;
  text-align: center;
  background: var(--bg-alt);
  border-radius: 8px;
  border: 1px dashed var(--border);
}
.settings-empty-state svg {
  color: var(--text-muted);
  opacity: .5;
}

/* ========================================================
   通知中心 (.notif-feed, .notif-card)
   ======================================================== */
.notif-page-header {
  margin-bottom: 12px;
}
.notif-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-header-title-wrap .dash-page-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.notif-count-total {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.notif-readall-btn,
.notif-clear-btn {
  height: 28px;
  padding: 0 10px;
  font-size: .78rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}
.notif-readall-btn:hover {
  color: var(--text);
}
.notif-clear-btn:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}
.notif-feed {
  display: flex;
  flex-direction: column;
}
.notif-card {
  background: var(--bg-card);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}
.notif-card.is-unread {
  background: linear-gradient(90deg, rgba(30, 126, 255, .04) 0%, var(--bg-card) 100%);
  border-color: rgba(30, 126, 255, .4);
}
[data-theme="dark"] .notif-card.is-unread {
  background: linear-gradient(90deg, rgba(30, 126, 255, .1) 0%, var(--bg-card) 100%);
  border-color: rgba(30, 126, 255, .5);
}
.notif-card-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.notif-card-avatar-link img, .notif-card-avatar-wrap .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.notif-system-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-badge-icon {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  color: #fff;
  font-size: 9px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.badge-like { background: #e11d48; }
.badge-bookmark { background: #f59e0b; }
.badge-subscription { background: var(--primary); }
.badge-tip { background: #dc2626; }
.badge-comment { background: #3b82f6; }
.badge-follow { background: #10b981; }
.badge-update { background: #8b5cf6; }
.badge-tag { background: #06b6d4; }
.badge-system { background: #64748b; }
.badge-default { background: var(--primary); }

.notif-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.notif-card-text {
  font-size: .86rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}
.notif-title-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.notif-title-link:hover {
  color: var(--primary);
  text-decoration: none;
}
.notif-title-plain {
  font-weight: 500;
}
.notif-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 1px;
}
.notif-card-time {
  font-size: .74rem;
  color: var(--text-muted);
}
.notif-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 4px var(--primary);
}

/* ========================================================
   私信现代化收件箱与聊天室
   ======================================================== */
.msg-inbox-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-inbox-title-wrap .dash-page-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.msg-inbox-count {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* 空状态卡片 */
.msg-empty-card {
  text-align: center;
  padding: 42px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.msg-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text-muted);
  opacity: .6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.msg-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}
.msg-empty-desc {
  font-size: .84rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* 对话列表 (收件箱视图) */
.msg-inbox-card {
  background: var(--bg-card);
  overflow: hidden;
}
.msg-thread-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.msg-thread-item {
  position: relative;
  border-bottom: 1px solid var(--border);
  border-image: var(--inset-line) 0 0 1 0;
  transition: background .15s ease;
}
.msg-thread-item:hover {
  background: var(--bg-alt);
}
.msg-thread-item:hover .msg-thread-link {
  background: transparent;
}
.msg-thread-item:last-child {
  border-bottom: 0;
}
.msg-thread-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.msg-thread-link:hover {
  background: var(--bg-alt);
  text-decoration: none;
}
.msg-thread-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.msg-thread-avatar-wrap .avatar {
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.msg-unread-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}
.msg-thread-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-thread-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.msg-thread-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-thread-item.unread .msg-thread-name {
  color: var(--primary);
  font-weight: 700;
}
.msg-thread-time {
  font-size: .72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.msg-thread-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.msg-thread-preview {
  font-size: .8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 28px;
}
.msg-thread-item.unread .msg-thread-preview {
  color: var(--text);
}
.msg-thread-badge {
  background: var(--primary);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.3;
  flex-shrink: 0;
}
.msg-thread-del-form {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  z-index: 2;
}
.msg-thread-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  opacity: .4;
  transition: all .15s ease;
}
.msg-thread-del-btn:hover {
  opacity: 1;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
}
.msg-chat-header-action {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.msg-chat-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: all .15s ease;
}
.msg-chat-del-btn:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

/* 聊天室视图 */
.msg-chat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 520px;
  height: calc(100vh - 170px);
  max-height: 720px;
}
.msg-chat-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  flex-shrink: 0;
}
.msg-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-weight: 600;
  font-size: .85rem;
  text-decoration: none;
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  transition: background .15s ease;
  flex-shrink: 0;
}
.msg-back-btn:hover {
  background: var(--bg-alt);
  text-decoration: none;
}
.msg-chat-recipient {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  flex: 1;
}
.msg-chat-recipient:hover {
  color: var(--primary);
  text-decoration: none;
}
.msg-chat-recipient .avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.msg-chat-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.msg-chat-user-name {
  font-size: .92rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-chat-user-handle {
  font-size: .74rem;
  color: var(--text-muted);
}
.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-alt);
}
.msg-load-older-btn {
  align-self: center;
  margin-bottom: 6px;
  font-size: .76rem;
  padding: 4px 14px;
  border-radius: 999px;
}
.msg-start-hint {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: .86rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-start-hint strong {
  color: var(--text);
}
.msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 82%;
  gap: 2px;
}
.msg.mine {
  align-self: flex-end;
  align-items: flex-end;
}
.msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 14px 14px 14px 3px;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: .88rem;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.msg.mine .msg-bubble {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  border-radius: 14px 14px 3px 14px;
}
.msg.mine .msg-bubble a {
  color: #fff;
  text-decoration: underline;
}
.msg-time {
  font-size: .7rem;
  color: var(--text-muted);
  padding: 0 4px;
}
.msg-form {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.msg-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 6px 4px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.msg-input-container:focus-within {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
/* 写在输入框容器下面：比全站 textarea:focus 的描边规则更具体，聚焦时也不出框 */
.msg-input-container .msg-textarea {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
  font-size: .88rem;
  line-height: 1.4;
  color: var(--text);
  resize: none;
  min-height: 24px;
  max-height: 100px;
  padding: 4px 0;
}
.msg-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .15s ease, filter .15s ease;
}
.msg-send-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}
.msg-send-disabled {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  color: var(--text-muted);
  font-size: .84rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

/* 手机端原生 App 沉浸式聊天体验 (<= 600px) */
@media (max-width: 600px) {
  body.page-chat {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
  }
  body.page-chat .site-header,
  body.page-chat .site-footer,
  body.page-chat .flash-container {
    display: none;
  }
  body.page-chat .app-wrap {
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
  }
  body.page-chat .site-main {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  body.page-chat .container.narrow {
    padding: 0;
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  body.page-chat .msg-chat-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  body.page-chat .msg-chat-header {
    border-top: none;
    padding: 10px 14px;
  }
  body.page-chat .msg-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.page-chat .msg-form {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

/* 系列内章节排序组件美化 */
.series-sortable-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sortable-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sortable-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  transition: border-color .15s ease, background .15s ease;
}
.sortable-item:hover {
  border-color: var(--primary);
}
.sortable-item.dragging {
  opacity: .5;
  background: var(--primary-soft);
}
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}
.drag-handle:active {
  cursor: grabbing;
}
.sortable-order-num {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sortable-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sortable-name {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sortable-draft-badge {
  font-size: .68rem;
  background: rgba(245, 158, 11, .15);
  color: #d97706;
  padding: 1px 5px;
  border-radius: 4px;
}
.sortable-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.sortable-actions button { border: 1px solid var(--border); background: var(--bg-card); border-radius: 4px; padding: 2px 8px; }
.sort-move-btn, .sort-edit-link {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}
.sort-move-btn:hover, .sort-edit-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.sortable-submit-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* 分段选择器控件 (.segmented-control, .segmented-item) */
.segmented-control {
  display: inline-flex;
  width: 100%;
  background: var(--bg-alt);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 3px;
}
.segmented-item {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.segmented-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}
.segmented-item span {
  width: 100%;
  text-align: center;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s ease;
}
.segmented-item:hover span {
  color: var(--text);
}
.segmented-item input:checked + span {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* 投稿编辑器：正文标题行与字数胶囊 */
.editor-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.editor-status-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.editor-counter-pill {
  font-size: .74rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
}
.novel-editor-textarea {
  min-height: 360px;
  font-family: var(--font);
  font-size: .92rem;
  line-height: 1.8;
}

/* 封面默认收起（不鼓励单独上传，需要时再设置）。
   只有右边的“默认 ⌄ / 收起”能点：整行先不接收点击，只给这一小块打开，
   所以点左边“封面图片”几个字或中间空白都不会展开；键盘（Tab + 回车）照常能用 */
.cover-fold > summary {
  list-style: none;
  pointer-events: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cover-fold > summary::-webkit-details-marker {
  display: none;
}
.cover-fold > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.cover-fold[open] > summary {
  margin-bottom: 10px;
}
.cover-fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  /* 能点的范围比字大一圈，手机上好点中；负边距抵消，看上去位置不变 */
  padding: 8px 4px 8px 12px;
  margin: -8px -4px -8px -12px;
  font-size: .78rem;
  font-weight: 400;
  color: var(--text-muted);
  pointer-events: auto;
  cursor: pointer;
}
.cover-fold-toggle:hover {
  color: var(--primary);
}
.cover-fold-toggle svg {
  transition: transform .15s ease;
}
.cover-fold[open] .cover-fold-toggle svg {
  transform: rotate(180deg);
}
.cover-fold[open] .cover-fold-state,
.cover-fold:not([open]) .cover-fold-close {
  display: none;
}

/* 封面选择（投稿页、系列设置页）：一个 3:4 的封面框，框里显示保存后实际会用的封面；
   点框就能选图，旁边只有一行状态和两个文字按钮 */
.cover-picker {
  display: flex;
  align-items: center;
  gap: 14px;
}
.cover-slot {
  position: relative;
  flex-shrink: 0;
  width: 84px;
  aspect-ratio: 3 / 4;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-alt);
  cursor: pointer;
  transition: border-color .15s ease;
}
.cover-slot:hover {
  border-color: var(--primary);
}
.cover-picker input[type="file"]:focus-visible + .cover-slot {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.cover-picker[data-show="empty"] .cover-slot {
  border-style: dashed;
}
/* 框里三种内容只显示一种（用 !important 盖过裁切脚本写在元素上的 display） */
.cover-slot .cover-thumb-preview,
.cover-slot .cover-slot-series,
.cover-slot .cover-slot-badge,
.cover-slot .cover-slot-empty {
  display: none !important;
}
.cover-picker[data-show="own"] .cover-thumb-preview,
.cover-picker[data-show="series"] .cover-slot-series,
.cover-picker[data-show="series"] .cover-slot-badge {
  display: block !important;
}
.cover-picker[data-show="empty"] .cover-slot-empty {
  display: flex !important;
}
.cover-thumb-preview,
.cover-thumb-img,
.cover-slot-series {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.cover-slot-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .68rem;
  line-height: 1.6;
}
.cover-slot-empty {
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: .75rem;
}
.cover-picker-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cover-picker-state {
  font-size: .88rem;
  line-height: 1.4;
  color: var(--text);
}
.cover-picker-note {
  font-size: .78rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.cover-picker-actions {
  display: flex;
  gap: 16px;
}
.cover-action {
  margin: 0;
  font-size: .82rem;
  color: var(--primary);
  cursor: pointer;
}
.cover-action:hover {
  text-decoration: underline;
}
.cover-action-muted {
  color: var(--text-muted);
}
.cover-action[hidden] {
  display: none;
}
.cover-action input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 创作与系列表单底部操作栏与按钮 */
.novel-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  position: static;
}
.novel-action-btn {
  height: 32px;
  padding: 0 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1;
}
/* 编辑页底部左边的「删除作品 / 删除系列」：灰色小字，点了才弹小窗或确认 */
.form-delete {
  margin-right: auto;
  font-size: .78rem;
  color: var(--text-muted);
}
.form-delete-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.form-delete-btn:hover { color: var(--accent); }

/* 平滑曲线/面积走势图 */
.smooth-chart-container {
  background: var(--bg-card);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chart-stage {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: visible;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.chart-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.chart-grid-line {
  stroke: var(--border);
  stroke-dasharray: 3 3;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart-line {
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.chart-y-axis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.chart-y-label {
  position: absolute;
  transform: translateY(-100%);
  margin-top: -3px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  user-select: none;
  white-space: nowrap;
}
.chart-hover-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.chart-hover-item {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  transform: translateX(-50%);
  pointer-events: auto;
  cursor: pointer;
}
.chart-hover-line {
  position: absolute;
  top: 15px;
  bottom: 25px;
  left: 50%;
  width: 1px;
  background: var(--primary);
  opacity: 0;
  transition: opacity .15s;
}
.chart-node {
  position: absolute;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform .15s;
  box-shadow: 0 0 6px rgba(0,150,250,.4);
}
.chart-detail-card {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, transform .15s;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 20;
}
.chart-detail-card::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.92);
}
.chart-hover-item.is-active .chart-hover-line {
  opacity: 0.6;
}
.chart-hover-item.is-active .chart-node {
  transform: translate(-50%, -50%) scale(1);
}
.chart-hover-item.is-active .chart-detail-card {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-10px);
}
.chart-detail-card.align-left {
  left: 0;
  transform: translateX(0) translateY(-6px);
}
.chart-detail-card.align-left::after {
  left: 14px;
  transform: none;
}
.chart-hover-item.is-active .chart-detail-card.align-left {
  transform: translateX(0) translateY(-10px);
}
.chart-detail-card.align-right {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(-6px);
}
.chart-detail-card.align-right::after {
  left: auto;
  right: 14px;
  transform: none;
}
.chart-hover-item.is-active .chart-detail-card.align-right {
  transform: translateX(0) translateY(-10px);
}
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .72rem;
  line-height: 1.5;
  color: #e2e8f0;
}
.detail-row strong {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.detail-date {
  color: #94a3b8;
  font-size: .7rem;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  justify-content: center;
}
.chart-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.summary-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card-label {
  font-size: .75rem;
  color: var(--text-muted);
}
.card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.chart-x-axis {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 0;
  font-size: 11px;
  color: var(--text-muted);
}
.chart-hint-row {
  display: flex;
  justify-content: flex-end;
  padding: 2px 6px 0;
}
.chart-hint-row span {
  font-size: .72rem;
  color: var(--text-muted);
  opacity: .8;
}
.announce-list { list-style: none; padding: 0; }
.announce-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-card); font-size: .88rem; }
.announce-item-main { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.announce-item-main a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.announce-item-main a:hover { color: var(--primary); }
.announce-list time { flex-shrink: 0; }

/* 分页 */
.pagination { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
/* 前台分页共用留白规则：普通列表结合末项内边距，离内容、页脚约 20px。
   带边框的标签、用户及账单列表统一离边框 20px。后台仍使用上下 16px。 */
.app-wrap .pagination { margin: 10px 0 0; }
.app-wrap :is(.tag-grid, .user-grid, .commerce-card) + .pagination { margin-top: 20px; }
.page-link { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--bg-card); font-size: .85rem; }
.page-link:hover { border-color: var(--primary); text-decoration: none; }
.page-link.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-link.disabled { opacity: .4; }
.page-ellipsis { padding: 5px 3px; color: var(--text-muted); font-size: .85rem; }

/* 静态页 */
/* 公告、条款页正文：顶部沿用主内容区的统一留白 */
.prose { background: var(--bg-card); padding: 0 12px 18px; font-size: .92rem; }
.prose h2 { margin-top: 1.2em; font-size: 1.15rem; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose > :last-child { margin-bottom: 0; }
.error-page { text-align: center; padding: 40px 14px; }
.error-page h1 { font-size: 3.5rem; color: var(--primary); margin: 0; }

/* 自定义 HTML 区域容器 */
.custom-nav-html-wrap {
  width: 100%;
  padding-top: 8px;
  position: relative;
  z-index: 5;
}
.custom-footer-html-wrap {
  width: 100%;
  margin-bottom: 8px;
}

/* 页脚 */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 14px 0 18px; margin-top: auto; }
.footer-inner { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.footer-brand strong { font-size: .95rem; }
.footer-brand p { margin: 2px 0 0; font-size: .8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; font-size: .82rem; }
.footer-links a { color: var(--text-muted); }
.footer-copy { font-size: .78rem; }

@media print {
  .site-header, .site-footer { display: none !important; }
  .novel-body { border: 0; padding: 0; }
}

/* ==========================================================================
   全站通用全屏沉浸式取景裁切器 (Universal Image Cropper)
   ========================================================================== */
.banner-wx-cropper {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000000;
  display: none;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.banner-wx-cropper.is-active {
  display: flex;
  opacity: 1;
  visibility: visible;
}
.banner-wx-stage {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner-wx-img-wrap {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.banner-wx-img-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
/* 遮罩与高亮镂空取景框 */
.banner-wx-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: grab;
}
.banner-wx-overlay.is-dragging {
  cursor: grabbing;
}
.banner-wx-frame {
  position: relative;
  width: 92vw;
  max-width: 820px;
  aspect-ratio: 3 / 1;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
  transition: border-radius .15s ease;
}
/* 比例形态适配 */
.banner-wx-frame.is-aspect-1-1 {
  width: min(84vw, 360px);
  max-width: 360px;
  aspect-ratio: 1 / 1;
}
.banner-wx-frame.is-aspect-3-4 {
  width: min(78vw, 330px);
  max-width: 330px;
  aspect-ratio: 3 / 4;
}
/* 圆形遮罩高亮（头像模式） */
.banner-wx-frame.is-circle {
  border-radius: 50%;
}
.banner-wx-frame.is-circle .banner-wx-corners,
.banner-wx-frame.is-circle .banner-wx-grid {
  display: none;
}
/* 九宫格辅助线 */
.banner-wx-grid {
  position: absolute;
  inset: 0;
}
.wx-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}
.wx-grid-h1 { top: 33.333%; left: 0; right: 0; height: 1px; }
.wx-grid-h2 { top: 66.666%; left: 0; right: 0; height: 1px; }
.wx-grid-v1 { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.wx-grid-v2 { left: 66.666%; top: 0; bottom: 0; width: 1px; }

/* 四角粗框标记 */
.banner-wx-corners .wx-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: #ffffff;
  border-style: solid;
}
.banner-wx-corners .tl { top: -2px; left: -2px; border-width: 2.5px 0 0 2.5px; }
.banner-wx-corners .tr { top: -2px; right: -2px; border-width: 2.5px 2.5px 0 0; }
.banner-wx-corners .bl { bottom: -2px; left: -2px; border-width: 0 0 2.5px 2.5px; }
.banner-wx-corners .br { bottom: -2px; right: -2px; border-width: 0 2.5px 2.5px 0; }

/* 微信风格底部提示与操作栏 */
.banner-wx-hint {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-align: center;
  font-size: .84rem;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  letter-spacing: .5px;
}
.banner-wx-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  background: rgba(18, 18, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.banner-wx-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1.4;
}
.banner-wx-cancel {
  color: rgba(255, 255, 255, 0.9);
}
.banner-wx-cancel:active {
  opacity: .6;
}
.banner-wx-confirm {
  background: var(--primary);
  color: #ffffff;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 150, 250, 0.35);
}
.banner-wx-confirm:active {
  background: var(--primary-dark);
}

/* ==========================================================================
   密码可见性切换控件 (Password Visibility Toggle)
   ========================================================================== */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
/* 带 [type]：和全站输入框那条通用规则一样具体、写在后面，就不用硬压；点小眼睛切成明文时也还对得上 */
.password-wrap input[type] {
  width: 100%;
  padding-right: 36px;
  box-sizing: border-box;
}
.password-wrap input::-ms-reveal,
.password-wrap input::-ms-clear {
  display: none;
}
.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}
.password-toggle-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, .05);
}
[data-theme="dark"] .password-toggle-btn:hover {
  background: rgba(255, 255, 255, .08);
}
.password-toggle-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}
.password-toggle-btn .icon-eye-open { display: block; }
.password-toggle-btn .icon-eye-closed { display: none; }
.password-toggle-btn.is-active .icon-eye-open { display: none; }
.password-toggle-btn.is-active .icon-eye-closed { display: block; }
.password-toggle-btn.is-active { color: var(--primary); }



/* ============================================================
   Creator Ranking Page Styles
   ============================================================ */
.creator-list { display: flex; flex-direction: column; }
.creator-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  padding: 14px 12px;
}
.creator-card-rank { flex-shrink: 0; width: 34px; display: flex; justify-content: center; align-items: center; }
.creator-card-rank .rank-medal { font-size: 1.5rem; line-height: 1; display: inline-block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.creator-card-rank .rank-num { font-size: 1rem; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.creator-card-main { flex: 1; min-width: 0; }
.creator-card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.creator-card-user { display: flex; align-items: center; gap: 14px; min-width: 0; }
.creator-avatar .avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.creator-info { min-width: 0; }
.creator-name { margin: 0; font-size: .98rem; font-weight: 600; line-height: 1.3; }
.creator-name a { color: var(--text); }
.creator-name a:hover { color: var(--primary); text-decoration: none; }
.creator-stats { font-size: .8rem; line-height: 1.4; margin-top: 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.creator-stats strong { color: var(--text); }
.creator-action .btn { padding: 5px 16px; border-radius: 999px; font-size: .82rem; }

@media (max-width: 540px) {
  .creator-card { padding: 12px; gap: 10px; }
  .creator-card-rank { width: 26px; }
  .creator-card-rank .rank-medal { font-size: 1.25rem; }
  .creator-avatar .avatar { width: 42px; height: 42px; }
  .creator-action .btn { padding: 4px 12px; font-size: .78rem; }
}

/* 用户主页：手机与桌面均为五项单行，沿用全站配色及选中下划线。 */
.user-profile-tabs .tabs-wrap { margin-bottom: 12px; }
.user-profile-tabs .tabs { grid-template-columns: repeat(var(--tabs-total, 5), minmax(0, 1fr)); }
.user-profile-tabs .tabs a {
  min-height: 44px;
  padding: 10px 2px;
  font-size: .94rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  border-bottom: 2px solid transparent;
}
.user-profile-tabs .tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ==========================================================================
   用户主页 · 五个标签（作品/系列/收藏/打赏/留言）的空状态
   没有内容时不再是一条细长的虚线框：图标 + 标题 + 说明居中排布，上下留足空间，
   并撑满标签栏到页脚之间的剩余高度（不支持 :has 的旧浏览器保留最小高度）。
   ========================================================================== */
.profile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 40px 20px 44px;
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.profile-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}
.profile-empty-title {
  margin: 0;
  font-size: .98rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.profile-empty-desc {
  margin: 6px 0 0;
  max-width: 280px;
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.profile-empty-action {
  margin-top: 18px;
  padding: 6px 22px;
}
/* 留言板卡片里的空状态：外层已有卡片边框，不再套一层虚线框 */
.profile-empty.is-inset {
  min-height: 190px;
  padding: 24px 16px 28px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* 标签内容区：至少和空状态一样高。只有一两条内容时，下面也留出同样的空间，页脚不会贴着内容 */
.profile-tab-body {
  min-height: 260px;
}

/* 当前标签为空：主区域改为纵向弹性布局，空状态吃掉剩余高度，页面不再缩成一团 */
.site-main:has(> .profile-page.is-tab-empty) {
  display: flex;
  flex-direction: column;
}
.profile-page.is-tab-empty,
.profile-page.is-tab-empty > .profile-tab-body {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}
.profile-page.is-tab-empty > .profile-tab-body > .profile-empty,
.profile-page.is-tab-empty > .profile-tab-body > .comments-card > .profile-empty {
  flex: 1 0 auto;
}
/* 留言板：只在空状态可见时撑开；发出第一条留言后（空状态被隐藏）自动恢复正常高度 */
.profile-page.is-tab-empty > .profile-tab-body > .comments-card:has(> .profile-empty:not([hidden])) {
  flex: 1 0 auto;
}
/* 弹性布局下外边距不再折叠，抵消留言卡片行内的 4px 上边距，保持与有内容时同样的 12px 间距 */
.profile-page.is-tab-empty > .profile-tab-body > .comments-card {
  margin-top: 0 !important;
}

/* 系列页标签分组：主要标签 / 部分篇章（标签样式和全站一致，只靠组名和篇数区分） */
.series-tag-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.series-tag-group + .series-tag-group {
  margin-top: 6px;
}
.series-tag-label {
  flex-shrink: 0;
  font-size: .74rem;
  line-height: 22px;
  color: var(--text-muted);
}
.series-tag-group .novel-tags {
  flex: 1;
  min-width: 0;
}
.tag-chip-count {
  margin-left: 2px;
  font-size: .7rem;
  color: var(--text-muted);
}
/* 标签多时只显示两行（文章页一行），最后一行末尾一个“展开”（按行收起，下沿由 app.js 算）。
   按钮排在最后一个标签后面：展开后“收起”紧跟标签；收起时叠在最后一行右端（相对外层定位，不会被裁掉）。
   系列页的标签区、标签页的“相关标签”、文章页标签共用 */
.series-tags-wrap,
.related-tags-box,
.novel-tags-wrap {
  position: relative;
}
.series-tags-wrap.is-clamped .series-tags-body,
.related-tags-box.is-clamped .related-tags-list,
.novel-tags-wrap.is-clamped .novel-tags {
  overflow: hidden;
}
/* 刷新时 app.js 要等整页加载完才运行，在那之前先按收起后的高度显示，免得先全部展开、再收起跳一下；
   app.js 算好后给外层加 is-ready，之后由它管。一行 = 一个标签高（.78rem × 行高 1.4 + 上下内边距 4px + 边框 2px），
   两行再加行距（系列页 4px；相关标签 6px）。和 app.js 一样向上取整到整像素，算好前后高度不变
   （屏幕缩放 150% 等边框被画细时，app.js 算出来会少 1px，那时它沿用这里的高度） */
.series-tags-wrap:not(.is-ready) .series-tags-body,
.related-tags-box:not(.is-ready) .related-tags-list,
.novel-tags-wrap:not(.is-ready) .novel-tags {
  overflow: hidden;
}
.novel-tags-wrap:not(.is-ready) .novel-tags {
  max-height: calc(.78rem * 1.4 + 6px);
  max-height: round(up, .78rem * 1.4 + 6px, 1px);
}
.series-tags-wrap:not(.is-ready) .series-tags-body {
  max-height: calc((.78rem * 1.4 + 6px) * 2 + 4px);
  max-height: round(up, (.78rem * 1.4 + 6px) * 2 + 4px, 1px);
}
.related-tags-box:not(.is-ready) .related-tags-list {
  max-height: calc((.78rem * 1.4 + 6px) * 2 + 6px);
  max-height: round(up, (.78rem * 1.4 + 6px) * 2 + 6px, 1px);
}
/* 系列页分两组时，第二行多半是「部分篇章」的第一行，组间隔 6px（单独一条：不认识 :has 的浏览器只丢这一条） */
.series-tags-wrap:not(.is-ready) .series-tags-body:has(> .series-tag-group + .series-tag-group) {
  max-height: calc((.78rem * 1.4 + 6px) * 2 + 6px);
  max-height: round(up, (.78rem * 1.4 + 6px) * 2 + 6px, 1px);
}
.tags-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 0 2px;
}
.is-clamped .tags-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  height: 24px;
  padding-left: 28px;
  background: linear-gradient(to right, transparent, var(--bg-card) 24px);
}
.is-expanded .tags-toggle .desc-toggle-icon {
  transform: rotate(180deg);
}
/* 相关标签框有内边距：收起时按钮放在框内右下角 */
.related-tags-box.is-clamped .tags-toggle {
  right: 12px;
  bottom: 8px;
}

/* 投稿页「创建新系列」小窗（原生 dialog）；内边距放在里面的表单上，点灰色区域才算点到外面 */
.quick-dialog {
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.quick-dialog::backdrop {
  background: rgba(0,0,0,.4);
}
.quick-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
.quick-dialog-title {
  font-size: 1rem;
  margin: 0;
}
.quick-dialog-error {
  margin: 0;
  font-size: .8rem;
  color: var(--accent);
}
.quick-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   大框铺满整栏：框外原来有 .container 的 12px、框里又有 12~18px，两层空隙叠在一起，
   手机上正文只剩屏幕宽度的八成多。现在这些框往两边各伸 12px 贴到栏边，框里左右留 12px（各组件自己写），
   与页面标题对齐；没有圆角，框和框之间只靠底边一条线隔开，列表也不再留缝。
   底线两头各留 12px 不画（--inset-line），框的底色照样铺满，深色模式下看得出来。
   首页横幅、私信聊天窗不在里面；后台没有 .app-wrap，不受影响（后台用到表单、图表、正文框时的外框在 admin.css）
   ========================================================================== */
.app-wrap :is(.novel-card, .series-card, .creator-card, .novel-header-card, .chapter-toc-card, .reader-toolbar-capsule, .novel-body, .novel-action-panel, .novel-series-hub, .novel-author-profile, .comments-card, .r18-gate, .series-header-card, .search-filters, .related-tags-box, .prose, .form, .dash-nav-card, .settings-nav-card, .settings-card, .dash-work-card, .dash-manage-card, .top-work-card, .smooth-chart-container, .notif-card, .msg-inbox-card),
.app-wrap .announce-list li {
  margin-left: -12px;
  margin-right: -12px;
  border-bottom: 1px solid var(--border);
  border-image: var(--inset-line) 0 0 1 0;
}
/* 列表最后一项不画底线：第一项上面没线，最后一项下面也不要，和下面的翻页、下一个栏目靠留白隔开 */
.app-wrap :is(.novel-card, .series-card, .creator-card, .dash-work-card, .dash-manage-card, .top-work-card, .notif-card):last-child,
.app-wrap .announce-list li:last-child {
  border-bottom-width: 0;
}
/* 上一个栏目以作品列表结尾（最后一张不画线）时，下一个栏目标题离上面卡片的内容、离下面卡片的内容一样远：
   间隔取标题下面那段（一般 12，文章页推荐栏目 10），再加卡片自己上下各 8 的留白。
   上一个栏目以带线的框结尾时（如首页横幅、创作中心图表）照旧从线量 18 */
.app-wrap .section:has(> .novel-grid:last-child):has(+ .section) { margin-bottom: 0; }
.app-wrap .section:has(> .novel-grid:last-child) + .section { margin-top: 12px; }
.app-wrap .section:has(> .novel-grid:last-child) + .novel-rel-section { margin-top: 10px; }
/* 标题下面是带边框的用户小方格（首页人气创作者）：方格边框就是看得见的边，标题离它也留 20，和离上面内容一样 */
.app-wrap .section-head:has(+ .user-grid) { margin-bottom: 20px; }
/* 评论框、私信列表框下面紧跟翻页时，同样不画底线（不支持 :has 的旧浏览器照旧画） */
.app-wrap :is(.comments-card, .msg-inbox-card):has(+ .pagination) {
  border-bottom-width: 0;
}
/* 页脚自带一条通栏顶线。页面最后一块框（文章页评论、登录注册表单、条款正文、列表最后一张卡片……）后面
   再没有看得见的东西时，它的底线和页脚那条隔着一段空白叠成两条：这时框不画底线，只留页脚那条。
   框自己有上下留白，主区底下那 20 也收掉（-20），框里的留白就是离页脚线的距离，和页头线下面的 12 差不多。
   名单和上面那条一致；script、dialog、带 hidden 的元素看不见，不算「后面还有东西」（后面有翻页时照常画、照常留 20）。
   不支持 :has 的旧浏览器整条不生效，照旧两条线 */
.app-wrap .site-main :is(.novel-card, .series-card, .creator-card, .novel-header-card, .chapter-toc-card, .reader-toolbar-capsule, .novel-body, .novel-action-panel, .novel-series-hub, .novel-author-profile, .comments-card, .r18-gate, .series-header-card, .search-filters, .related-tags-box, .prose, .form, .dash-nav-card, .settings-nav-card, .settings-card, .dash-work-card, .dash-manage-card, .top-work-card, .smooth-chart-container, .notif-card, .msg-inbox-card, .announce-list li):not(:has(~ :not(script, style, template, dialog, [hidden], input[type="hidden"]))):not(.site-main :has(~ :not(script, style, template, dialog, [hidden], input[type="hidden"])) *) {
  border-bottom-width: 0;
  margin-bottom: -20px;
}
/* 作品卡片自己下边只留 8，当页面最后一张时补到 12，离页脚线和页头线离内容一样远 */
.app-wrap .site-main :is(.novel-card, .series-card):not(:has(~ :not(script, style, template, dialog, [hidden], input[type="hidden"]))):not(.site-main :has(~ :not(script, style, template, dialog, [hidden], input[type="hidden"])) *) {
  padding-bottom: 12px;
}
/* 设置、创作中心顶上那排切换按钮（资料/账号/浏览/屏蔽，概览/作品管理…）下面不画线，
   和下面的页面标题靠留白隔开 */
.app-wrap :is(.dash-nav-card, .settings-nav-card) {
  border-bottom-width: 0;
}
/* 首页横幅贴着页头（中间夹着广告按钮或提示条时不往上提） */
.site-header + .site-main > .container > .welcome-card:first-child {
  margin-top: -12px;
}
/* 文章页评论也紧跟上一块；前面隔着推荐列表时，列表底下不再多留缝。
   搜索页的分类标签栏、筛选、第一条结果之间同样不留缝 */
.app-wrap .novel-main > .comments-card {
  margin-top: 0;
}
.app-wrap .novel-main > .novel-rel-section:has(+ .comments-card),
.app-wrap .tabs-wrap:has(~ .search-filters) {
  margin-bottom: 0;
}
/* 搜索页「筛选与排序」下面不画线，结果紧接着。框下边只留 4，加上卡片上边的 8，
   「筛选与排序」离上面分类栏的线、离下面第一张卡片都是 16 左右。
   展开筛选时下边照旧 12（「应用筛选」按钮离卡片 20）；搜不到时下面是虚线框，没有卡片那 8，补 8 */
.app-wrap .search-filters {
  margin-bottom: 0;
  border-bottom-width: 0;
  padding-bottom: 4px;
}
.app-wrap .search-filters[open] { padding-bottom: 12px; }
.app-wrap .search-filters + .empty-state { margin-top: 8px; }
/* 设置页的框之间是弹性布局的 12px gap，两个框挨着时把这道缝收回去 */
.app-wrap .settings-card + .settings-card {
  margin-top: -12px;
}
/* 设置页（资料、账号、浏览、屏蔽）的框都不画底线，上一框内容到下一框标题靠两边留白隔开（28） */
.app-wrap .dash-layout:has(> .settings-nav-card) .settings-card {
  border-bottom-width: 0;
}
/* 投稿页框和框之间不画线（「正文创作」「作品资料」下面），最后「发布设置」和下面按钮之间那条留着 */
.app-wrap .novel-workspace-form > .settings-card:has(+ .settings-card) {
  border-bottom-width: 0;
}
/* 系列编辑页「基本信息」（系列封面）和「连载设置」下面都不画线 */
.app-wrap .series-workspace-form > .settings-card {
  border-bottom-width: 0;
}
