/* 24JK — 主题色由 base.html 按当前主题注入为 --c-* 变量，这里给出经典蓝白红作为兜底 */
:root {
  --c-primary: #1B2A4A;
  --c-primary-ink: #FFFFFF;
  --c-accent: #C8102E;
  --c-surface: #FFFFFF;
  --c-paper: #F4F5F9;
  --c-ink: #1A2033;
  --c-muted: #5B6478;
  --c-line: #DDE1EA;
  --c-overlay: rgba(244, 245, 249, 0.8);
  /* 可选变量：主题没提供时沿用下面的默认值 */
  --c-link: var(--c-primary);
  --c-accent-ink: #FFFFFF;

  /* 正文用访客系统自带的中文字体（不需下载）；标题字体自托管在 static/fonts/zcool/，按需分片加载 */
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --font-display: "ZCOOL XiaoWei", "Songti SC", "Noto Serif CJK SC", serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;

  --radius-s: 4px;
  --radius-m: 10px;
  --gutter: 16px;
  --wide: 1320px;
  --shadow: 0 1px 0 var(--c-line), 0 18px 40px rgba(15, 26, 48, 0.16);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--c-ink);
  font: 400 var(--step-0)/1.75 var(--font-body);
  background-color: var(--c-paper);
  background-image: var(--pattern, none);
  background-size: var(--tile, auto);
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--c-surface); padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; }
.muted { color: var(--c-muted); }
.small { font-size: var(--step--1); }

/* ---------- 页头：水手服领 ---------- */
.collar {
  position: relative;
  z-index: 10;
  color: var(--c-primary-ink);
  background: var(--c-primary);
  /* 领口两道白色滚边 */
  box-shadow:
    inset 0 -10px 0 var(--c-primary),
    inset 0 -12px 0 var(--c-primary-ink),
    inset 0 -16px 0 var(--c-primary),
    inset 0 -18px 0 var(--c-primary-ink);
  padding-bottom: 24px;
}
.collar-inner, .cats, .foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.collar-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.wordmark { font-family: var(--font-display); font-size: var(--step-3); letter-spacing: 0.04em; line-height: 1; }
/* JK 细带领结 logo（static/img/logo-bow.svg 导出的 PNG） */
.logo-bow { display: block; width: 40px; height: 48px; margin: -6px 0 -8px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.search { flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: var(--step--1);
}
.search input::placeholder { color: rgba(255, 255, 255, 0.7); }
.tools { display: flex; align-items: center; gap: 10px; flex: none; }
.cats { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 4px; padding-bottom: 4px; }
.cats a { flex: none; text-decoration: none; padding: 4px 12px; border-radius: 999px; font-size: var(--step--1); opacity: 0.82; }
.cats a:hover { opacity: 1; }
.cats a[aria-current="page"] { opacity: 1; background: var(--c-primary-ink); color: var(--c-primary); font-weight: 500; }

/* 柄图小方块 + 图标按钮 */
.pattern-tools { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.swatch-mini {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 2px solid var(--c-primary-ink);
  background-color: var(--c-primary);
  background-image: var(--pattern, none);
  /* 小方块里放下整个柄图单元，横竖条纹都能看到 */
  background-size: 100% 100%;
  flex: none;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-menu .icon-btn svg circle { fill: currentColor; stroke: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.icon-btn[aria-pressed="true"] { background: var(--c-primary-ink); color: var(--c-primary); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }
.icon-btn:disabled { opacity: 0.5; cursor: progress; }

/* 下拉菜单 */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: var(--step--1);
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 20;
  min-width: 160px;
  background: var(--c-surface);
  color: var(--c-ink);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  padding: 6px;
  box-shadow: 0 12px 28px rgba(20, 28, 48, 0.18);
}
.menu-panel > a, .menu-panel > form > button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--step--1);
  text-decoration: none;
  border-radius: var(--radius-s);
  cursor: pointer;
  color: inherit;
}
.menu-panel > a:hover, .menu-panel > form > button:hover { background: var(--c-paper); }
.theme-panel { padding: 10px; min-width: 0; }
.themes { display: flex; flex-direction: column; gap: 6px; }
.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  border-radius: 999px;
  padding: 5px 14px 5px 6px;
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  color: var(--c-ink);
  white-space: nowrap;
}
.theme-chip[aria-checked="true"] { border-color: var(--c-link); box-shadow: inset 0 0 0 1px var(--c-link); font-weight: 500; }
.chip-dots {
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--a) 0 40%, var(--b) 40% 70%, var(--c) 70%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  background: var(--c-primary);
  color: var(--c-primary-ink);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn-accent { background: var(--c-accent); color: var(--c-accent-ink); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-outline { background: transparent; color: var(--c-link); border-color: var(--c-line); }
.btn-small { padding: 5px 12px; }
.btn[aria-pressed="true"] { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: var(--step--1); color: var(--c-muted); cursor: pointer; text-decoration: underline; }

/* ---------- 版面 ---------- */
main { flex: 1; width: 100%; }
.page {
  max-width: 820px;
  margin: 28px auto;
  background: var(--c-surface);
  border-radius: var(--radius-m);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}
.page-wide { max-width: var(--wide); background: none; box-shadow: none; padding: 0 var(--gutter); }
.page-detail { max-width: 1180px; padding: 0; overflow: hidden; }
.page-legal { max-width: 760px; }

.page-title { font-family: var(--font-display); font-weight: 400; font-size: var(--step-3); line-height: 1.3; margin: 0 0 6px; }
.page-sub { margin: 0 0 20px; color: var(--c-muted); }
h1, h2, h3 { line-height: 1.35; color: var(--c-ink); }

/* 列表页标题条：浮在柄图上，用纸面底色保证可读 */
.list-head {
  background: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.list-head .page-title { margin: 0; font-size: var(--step-2); }
.sort { display: flex; gap: 14px; font-size: var(--step--1); }
.sort a { text-decoration: none; color: var(--c-muted); padding-bottom: 2px; }
.sort a[aria-current="true"] { color: var(--c-ink); font-weight: 500; border-bottom: 2px solid var(--c-accent); }
.tag-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; padding: 2px 0; }
.tag {
  flex: none;
  display: inline-block;
  font-size: var(--step--1);
  text-decoration: none;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-link);
  box-shadow: 0 1px 0 var(--c-line);
}
.tag:hover, .tag.is-on { background: var(--c-primary); color: var(--c-primary-ink); }

/* ---------- 瀑布流 ---------- */
.wf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}
/* JS 接管后按卡片实际高度跨行，形成错落的瀑布流；无 JS 时退化为整齐的网格 */
.wf.is-masonry { grid-auto-rows: 4px; row-gap: 0; }
.wf.is-masonry .card { margin-bottom: 16px; }
.card {
  position: relative;
  background: var(--c-surface);
  border-radius: var(--radius-m);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 26, 48, 0.12);
}
.card-media { position: relative; background: var(--c-paper); }
.card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-count {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(15, 20, 35, 0.6);
  color: #fff;
  font-size: 12px;
  text-align: center;
}
.card-quote {
  padding: 20px 18px 18px;
  background: var(--c-primary);
  color: var(--c-primary-ink);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.75;
}
.card-quote p { margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-body { padding: 10px 12px 12px; }
.card-title { margin: 0 0 8px; font-size: 0.9375rem; font-weight: 500; line-height: 1.5; }
.card-title a { text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 整张卡片可点：标题链接铺满卡片，作者链接浮在上面 */
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--c-muted); }
.card-meta .author { position: relative; z-index: 1; min-width: 0; }
.author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.likes { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.likes svg { fill: none; stroke: currentColor; stroke-width: 2; }
.likes.is-on { color: var(--c-accent); }
.likes.is-on svg { fill: currentColor; }
.card-state { margin: 6px 0 0; font-size: 12px; color: var(--c-accent); }
.wf-status { text-align: center; padding: 20px 0 8px; font-size: var(--step--1); }
.wf-status span { display: inline-block; background: var(--c-surface); padding: 4px 14px; border-radius: 999px; color: var(--c-muted); }
.empty { padding: 48px 16px; text-align: center; color: var(--c-muted); background: var(--c-surface); border-radius: var(--radius-m); }
.empty .btn { margin-top: 12px; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: var(--step--1); color: var(--c-muted); }
.meta a { text-decoration: none; }
.meta a:hover { text-decoration: underline; }
.cat-label { color: var(--c-accent); font-weight: 500; }
.avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--c-line); display: inline-block; flex: none; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 112px; height: 112px; box-shadow: 0 0 0 4px var(--c-surface), 0 0 0 5px var(--c-line); }
.pill-user { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; }
.pill-user span { overflow: hidden; text-overflow: ellipsis; }

/* 设置页：头像 */
.settings-section + .settings-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--c-line); }
.section-title { margin: 0 0 12px; font-size: var(--step-0); font-weight: 700; }
.avatar-panel { display: flex; align-items: center; gap: 24px; padding: 20px; background: var(--c-paper); border-radius: var(--radius-m); border: 2px dashed transparent; transition: border-color .15s, background-color .15s; }
.avatar-panel.is-dragover { border-color: var(--c-link); background: var(--c-surface); }
.avatar-edit { position: relative; display: block; flex: none; border-radius: 50%; cursor: pointer; }
.avatar-edit-overlay { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: rgba(15, 20, 35, 0.45); opacity: 0; transition: opacity .15s; }
.avatar-edit-overlay svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.avatar-edit:hover .avatar-edit-overlay, .avatar-edit:focus-visible .avatar-edit-overlay, #avatar-file:focus-visible + .avatar-edit .avatar-edit-overlay { opacity: 1; }
#avatar-file:focus-visible + .avatar-edit { outline: 3px solid var(--c-accent); outline-offset: 3px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; filter: none; }
.avatar-panel-body { min-width: 0; }
.avatar-panel .who { margin: 0; font-size: var(--step-1); }
.avatar-panel .muted { margin: 2px 0 0; }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.avatar-actions label.btn { cursor: pointer; }
#avatar-file:focus-visible ~ .avatar-panel-body label.btn { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.char-count { float: right; font-size: 12px; color: var(--c-muted); font-weight: 400; }
.char-count.is-full { color: var(--c-accent); }

/* 裁剪框 */
.dialog-crop { width: min(420px, calc(100vw - 24px)); }
.crop-stage {
  --stage: min(320px, calc(100vw - 72px));
  position: relative;
  width: var(--stage);
  height: var(--stage);
  margin: 4px auto 14px;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: repeating-conic-gradient(var(--c-line) 0 25%, var(--c-surface) 0 50%) 0 0 / 16px 16px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.crop-stage.is-dragging { cursor: grabbing; }
.crop-stage img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(15, 20, 35, 0.55); outline: 2px solid rgba(255, 255, 255, 0.9); pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 10px; }
.crop-zoom input { flex: 1; accent-color: var(--c-link); }
.crop-zoom svg { width: 16px; height: 16px; fill: none; stroke: var(--c-muted); stroke-width: 2; flex: none; }
.crop-zoom svg:last-child { width: 22px; height: 22px; }

/* 预设头像 */
.dialog-presets { width: min(560px, calc(100vw - 24px)); }
.preset-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--c-line); }
.preset-tabs button { border: 0; background: none; padding: 8px 14px; font: inherit; font-size: var(--step--1); color: var(--c-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.preset-tabs button[aria-selected="true"] { color: var(--c-ink); font-weight: 500; border-bottom-color: var(--c-accent); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; max-height: 50vh; overflow-y: auto; padding: 4px; }
.preset { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; aspect-ratio: 1; }
.preset img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.preset:hover img { transform: scale(1.06); }
.preset { position: relative; }
.preset[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--c-surface), 0 0 0 5px var(--c-accent); }
.preset[aria-pressed="true"]::after {
  content: attr(data-current-label);
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  background: var(--c-accent); color: var(--c-accent-ink);
  font-size: 10px; line-height: 1.6; padding: 0 6px; border-radius: 999px; white-space: nowrap;
}
.preset:disabled { opacity: 0.5; cursor: progress; }
.author { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: var(--step--1); }

/* ---------- 帖子详情：左图集、右文字 ---------- */
.detail.has-gallery { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.detail-text { padding: 28px 32px; min-width: 0; }
.detail.has-gallery .detail-text { max-height: calc(100vh - 160px); overflow-y: auto; }
.gallery { position: relative; background: var(--c-paper); min-width: 0; }
.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  height: min(78vh, 760px);
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; }
.gallery-slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.85);
  color: #1A2033;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.gallery-nav.prev { left: 12px; }
.gallery-nav.next { right: 12px; }
.gallery-counter { position: absolute; top: 12px; right: 12px; background: rgba(15, 20, 35, 0.6); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.gallery-thumbs { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; background: var(--c-surface); border-top: 1px solid var(--c-line); }
.gallery-thumbs button { flex: none; width: 52px; height: 52px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: var(--c-paper); }
.gallery-thumbs button[aria-current="true"] { border-color: var(--c-accent); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.article-head { margin-bottom: 16px; }
.article-title { font-size: var(--step-2); margin: 6px 0 12px; font-weight: 700; }
.prose { font-size: 1.0625rem; line-height: 1.85; overflow-wrap: anywhere; }
.prose img { border-radius: var(--radius-s); max-height: 70vh; width: auto; display: block; margin: 8px 0; }
.prose blockquote { margin: 1em 0; padding: 4px 16px; border-left: 3px solid var(--c-accent); color: var(--c-muted); }
.prose pre { background: var(--c-paper); padding: 12px 16px; border-radius: var(--radius-s); overflow-x: auto; }
.prose code { font-size: 0.9em; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.prose th, .prose td { border: 1px solid var(--c-line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--c-paper); }
.legal h2 { font-size: var(--step-1); margin: 1.6em 0 0.4em; }
.notice { background: var(--c-paper); border-left: 3px solid var(--c-accent); padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 18px; font-size: var(--step--1); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 8px; padding-top: 16px; border-top: 1px solid var(--c-line); }
.actions .spacer { flex: 1; }
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tags-row .tag { background: var(--c-paper); box-shadow: none; }

/* 评论 */
.comments { margin-top: 28px; }
.comments h2 { font-size: var(--step-1); margin: 0 0 12px; }
.comment { padding: 14px 0; border-top: 1px solid var(--c-line); }
.comment-body { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.replies { margin: 8px 0 0 28px; padding-left: 14px; border-left: 2px solid var(--c-line); }
.replies .comment { border-top: 0; padding: 8px 0; }
.comment-tools { display: flex; gap: 14px; }
.reply-form { margin-top: 8px; }

/* ---------- 表单 ---------- */
.form { display: grid; gap: 16px; }
.field label, .field .label, .form > label { display: block; font-weight: 500; margin-bottom: 4px; font-size: var(--step--1); }
.field .help { color: var(--c-muted); font-size: var(--step--1); margin: 0 0 6px; }
.errorlist { color: var(--c-accent); font-size: var(--step--1); margin: 4px 0 0; padding: 0; list-style: none; }
.field input[type="checkbox"] { width: 18px; height: 18px; vertical-align: middle; margin: 0 6px 0 0; accent-color: var(--c-link); }
.field label.check { display: flex; align-items: center; font-weight: 400; font-size: var(--step-0); cursor: pointer; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], select, textarea, .field input[type="search"] {
  width: 100%;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-s);
  padding: 9px 12px;
  font: inherit;
  background: var(--c-surface);
  color: var(--c-ink);
}
textarea { resize: vertical; line-height: 1.7; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--c-link); outline-offset: 0; border-color: transparent; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--c-muted);
  cursor: pointer;
  border-radius: var(--radius-s);
}
.pw-toggle:hover { color: var(--c-ink); }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.auth-sheet { max-width: 420px; }
.auth-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--c-paper);
  border-radius: 999px;
}
.auth-tabs button {
  border: 0;
  background: transparent;
  color: var(--c-muted);
  font: inherit;
  font-size: var(--step--1);
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.auth-tabs button[aria-selected="true"] {
  background: var(--c-surface);
  color: var(--c-ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(15, 26, 48, 0.1);
}
.wx-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  background: var(--c-paper);
  border-radius: var(--radius-m);
  text-align: center;
}
.wx-qr-frame {
  position: relative;
  width: 208px;
  height: 208px;
  border-radius: var(--radius-s);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--c-line);
}
.wx-qr-img { width: 192px; height: 192px; display: block; object-fit: contain; }
.wx-qr-mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
}
.wx-qr-status { margin: 0; }
.wx-bind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--c-paper);
  border-radius: var(--radius-m);
}
.wx-bind-row .who { margin: 0; font-weight: 600; }
.wx-bind-row .muted { margin: 4px 0 0; }

/* 正文编辑器（Vditor）：配色跟随站点主题 */
.vditor {
  --border-color: var(--c-line);
  --second-color: var(--c-muted);
  --panel-background-color: var(--c-surface);
  --panel-shadow: 0 12px 28px rgba(20, 28, 48, 0.18);
  --toolbar-background-color: var(--c-paper);
  --toolbar-icon-color: var(--c-muted);
  --toolbar-icon-hover-color: var(--c-link);
  --textarea-background-color: var(--c-surface);
  --textarea-text-color: var(--c-ink);
  --resize-icon-color: var(--c-muted);
  --resize-background-color: var(--c-paper);
  --resize-hover-icon-color: var(--c-surface);
  --resize-hover-background-color: var(--c-link);
  --heading-border-color: var(--c-line);
  --blockquote-color: var(--c-muted);
  border-radius: var(--radius-s);
}
.vditor-reset { font-family: var(--font-body); font-size: 1rem; color: var(--c-ink); }
.vditor-toolbar { padding-left: 6px !important; }
.md-editor-fallback { display: none; }

/* 正文里的任务列表 */
.prose .task-list { list-style: none; padding-left: 4px; }
.prose .task-list-item input { margin: 0 6px 0 0; vertical-align: middle; accent-color: var(--c-link); }

/* 多图上传 */
.uploader { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.up-item, .up-add { position: relative; aspect-ratio: 1; border-radius: var(--radius-s); overflow: hidden; background: var(--c-paper); }
.up-item { cursor: grab; }
.up-item.is-dragging { opacity: 0.4; }
.up-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-item.is-uploading::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.6); }
.up-cover { position: absolute; left: 4px; top: 4px; background: var(--c-accent); color: var(--c-accent-ink); font-size: 11px; padding: 0 6px; border-radius: 999px; }
.up-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 3px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); }
.up-controls button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.9); color: #1A2033; font-size: 14px; line-height: 1; cursor: pointer; padding: 0; }
.up-add label { display: grid; place-items: center; width: 100%; height: 100%; border: 2px dashed var(--c-line); border-radius: var(--radius-s); cursor: pointer; font-size: 32px; color: var(--c-muted); }
.up-add label:hover { border-color: var(--c-link); color: var(--c-link); }
.up-add:focus-within label { outline: 3px solid var(--c-accent); outline-offset: 2px; }

/* 个人主页 */
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; background: var(--c-surface); padding: 20px; border-radius: var(--radius-m); box-shadow: var(--shadow); }
.profile-head h1 { margin: 0; }
.stats { display: flex; gap: 18px; font-size: var(--step--1); color: var(--c-muted); }
.stats b { color: var(--c-ink); font-size: var(--step-0); }

/* ---------- 提示条 ---------- */
.flash { list-style: none; margin: 0 0 16px; padding: 0; }
.flash li { padding: 10px 14px; border-radius: var(--radius-s); background: var(--c-surface); border-left: 3px solid var(--c-link); font-size: var(--step--1); box-shadow: 0 1px 0 var(--c-line); }
.flash .flash-error { border-left-color: var(--c-accent); }
.page-wide .flash { margin-top: 0; }
.privacy-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px var(--gutter);
  background: var(--c-surface);
  border-bottom: 3px solid var(--c-accent);
  font-size: var(--step--1);
  text-align: center;
}
.privacy-notice p { margin: 0; }
.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--c-surface);
  border-radius: var(--radius-m);
  box-shadow: 0 16px 40px rgba(15, 26, 48, 0.28);
  font-size: var(--step--1);
}
.cookie-banner p { margin: 0; flex: 1; }
.cookie-actions { display: flex; gap: 8px; flex: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--c-ink);
  color: var(--c-surface);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: var(--step--1);
  z-index: 40;
  max-width: calc(100vw - 32px);
}
.dialog { border: 0; border-radius: var(--radius-m); padding: 22px 24px; width: min(420px, calc(100vw - 32px)); color: var(--c-ink); }
.dialog::backdrop { background: rgba(15, 26, 48, 0.5); }
.dialog h2 { margin: 0 0 12px; font-size: var(--step-1); }
.dialog fieldset { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.dialog label { font-size: var(--step--1); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.foot { padding-top: 8px; padding-bottom: 28px; text-align: center; }
.foot nav { display: inline-flex; gap: 18px; background: var(--c-surface); padding: 6px 18px; border-radius: 999px; font-size: var(--step--1); }
.foot a { color: var(--c-muted); }
.foot nav { flex-wrap: wrap; justify-content: center; }
.beian { margin: 8px 0 0; font-size: 12px; }
.beian a { display: inline-block; background: var(--c-surface); padding: 2px 12px; border-radius: 999px; text-decoration: none; }
.field .check label { display: inline; font-weight: 400; font-size: var(--step-0); margin: 0; }
.field .check { display: flex; align-items: flex-start; gap: 0; }
.field .check input { margin-top: 5px; flex: none; }

/* ---------- 窄屏 ---------- */
@media (max-width: 960px) {
  body { background-attachment: scroll; }
  .detail.has-gallery { grid-template-columns: minmax(0, 1fr); }
  .detail.has-gallery .detail-text { max-height: none; }
  .gallery-track { height: min(70vh, 560px); }
}
@media (max-width: 720px) {
  .avatar-panel { flex-direction: column; text-align: center; }
  .avatar-actions { justify-content: center; }
  .pill-user span { display: none; }
  .pill-user { padding: 3px; }
  .collar-inner { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .tools { margin-left: auto; gap: 6px; }
  .tools > .btn { padding: 5px 10px; }
  .wordmark { font-size: var(--step-2); }
  .logo-bow { width: 32px; height: 38px; }
  .page { margin: 12px; padding: 20px 16px; }
  .page-wide { margin: 12px 0; padding: 0 10px; }
  .page-detail { padding: 0; }
  .detail-text { padding: 20px 16px; }
  .wf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wf.is-masonry { row-gap: 0; }
  .wf.is-masonry .card { margin-bottom: 10px; }
  .card-body { padding: 8px 10px 10px; }
  .card-title { font-size: 0.875rem; }
  .card-quote { padding: 16px 14px; font-size: 0.9375rem; }
  .list-head { padding: 10px 14px; }
  .page-title { font-size: var(--step-2); }
  .cookie-banner { flex-direction: column; align-items: stretch; bottom: 8px; }
  .cookie-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
