:root {
  --paper: #f8f5ef;
  --paper-2: #fffdf9;
  --ink: #1f2328;
  --ink-2: #4a5158;
  --ink-3: #7b828a;
  --line: #e0d8c8;
  --line-2: #efe8db;
  --red: #a8322a;
  --red-soft: #f6e9e6;
  --jade: #2f5d62;
  --jade-soft: #e8f0ef;
  --gold: #b08a3e;
  --shadow: 0 1px 2px rgba(31, 35, 40, .05), 0 6px 20px rgba(31, 35, 40, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.75 -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--jade); text-decoration: none; }
a:hover { color: var(--red); }
h1, h2, h3, h4 { font-family: "Songti SC", "SimSun", "Source Han Serif SC", serif; font-weight: 600; margin: 0; letter-spacing: .02em; }
img { max-width: 100%; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.right { text-align: right; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { min-width: 0; }
.col { flex: 1 1 0; }
.grow { flex: 1; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- 顶部 ---------- */
.topbar { background: #fffdf9; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Songti SC", serif; font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: .06em; }
.brand .seal { width: 34px; height: 34px; border-radius: 6px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 18px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
/* 后台上传的站点 Logo：与印章同尺寸、等比缩放、透明底 */
.brand .blogo-pic { display: inline-flex; flex: 0 0 auto; }
.brand .blogo { height: 36px; width: auto; max-width: 190px; flex: 0 0 auto; border-radius: 6px; object-fit: contain; }
/* 电脑版横版 LOGO 里已含「云修谱」字样，桌面端不再重复显示站名；手机端用方形印章，仍需文字 */
@media (min-width: 901px) {
  .brand > span:not(.seal) { display: none; }
  .as-brand > span:not(.seal) { display: none; }
}
.nav { display: flex; gap: 18px; align-items: center; margin-left: 8px; }
.nav a { color: var(--ink-2); font-size: 14.5px; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.on { color: var(--red); border-color: var(--red); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; cursor: pointer; transition: .15s; line-height: 1.4; }
.btn:hover { border-color: var(--jade); color: var(--jade); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #8f2a23; color: #fff; }
.btn.ghost { background: transparent; }
.btn.jade { background: var(--jade); border-color: var(--jade); color: #fff; }
.btn.jade:hover { background: #24494d; color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[hidden] { display: none; }

/* ---------- 卡片 ---------- */
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 22px; box-shadow: var(--shadow); }
.card.tight { padding: 16px; }
.card h3 { font-size: 17px; margin-bottom: 4px; }
.card .sub { color: var(--ink-3); font-size: 13px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title h2 { font-size: 22px; }
.panel-title .line { flex: 1; height: 1px; background: var(--line); margin: 0 14px; }

/* ---------- 首页 ---------- */
.hero { padding: 54px 0 34px; background: radial-gradient(1200px 400px at 50% -10%, #fff 0%, rgba(255,255,255,0) 70%), var(--paper); }
.hero h1 { font-size: 40px; line-height: 1.25; margin-bottom: 12px; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero p.lead { color: var(--ink-2); font-size: 16px; max-width: 640px; }
.searchbar { display: flex; gap: 0; margin-top: 22px; max-width: 720px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.searchbar input { flex: 1; border: 0; padding: 14px 16px; font-size: 15px; outline: none; background: transparent; }
.searchbar select { border: 0; border-left: 1px solid var(--line-2); padding: 0 10px; background: #fbf9f4; color: var(--ink-2); }
.searchbar button { border: 0; background: var(--red); color: #fff; padding: 0 26px; font-size: 15px; cursor: pointer; }
.searchbar button:hover { background: #8f2a23; }

/* ---- 寻亲搜索：搜索框 + 四种找法（姓名 / 籍贯 / 现居地 / 族人），桌面手机同一套 ---- */
.srch-form { margin-top: 22px; max-width: 720px; }
.srch-form .searchbar { margin-top: 0; max-width: none; }
.srch-form.wide { max-width: none; }
.srch-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.srch-tabs label { position: relative; }
.srch-tabs input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.srch-tabs span { display: inline-block; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; cursor: pointer; transition: .15s; }
.srch-tabs span:hover { border-color: var(--jade); color: var(--jade); }
.srch-tabs input:checked + span { background: var(--jade); border-color: var(--jade); color: #fff; font-weight: 600; }
.srch-tabs input:focus-visible + span { outline: 2px solid var(--jade); outline-offset: 2px; }
.srch-hint { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
/* 还没输入关键词时下面的「三种找法」已逐条说明，顶部提示就不重复了 */
.srch-page.no-kw .srch-hint { display: none; }
.srch-how { display: grid; gap: 9px; margin-top: 10px; }
.how-row { display: flex; gap: 12px; align-items: baseline; font-size: 13px; line-height: 1.65; }
.how-row b { flex: 0 0 4.6em; color: var(--ink); font-weight: 600; }
.how-row span { color: var(--ink-3); }
.srch-same { color: var(--ink-3); }
/* 命中的关键词套浅金底，一眼看出为什么被搜到 */
mark { background: #fbefc9; color: inherit; padding: 0 1px; border-radius: 2px; }
.srch-name { font-family: 'Songti SC', serif; font-size: 16px; }
/* 搜索结果：能看的可点开，不能看的只给基本信息 + 求联系 */
.srch-namecell { white-space: nowrap; }
.srch-name-link { color: var(--jade); text-decoration: none; border-bottom: 1px dashed rgba(46,125,110,.45); }
.srch-name-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
/* 跨谱：仍可点开（进去是基本信息页 + 求联系），但用弱一点的样式区分 */
.srch-name-lock { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted rgba(0,0,0,.28); }
.srch-name-lock:hover { color: var(--ink); border-bottom-color: var(--ink); }
.srch-lock { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.055); color: var(--ink-3); font-size: 11px; vertical-align: middle; }
.srch-ask { display: inline-block; margin-left: 6px; vertical-align: middle; }
.srch-ask .btn { padding: 2px 9px; font-size: 12px; }
.srch-maker { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.stat { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.stat b { display: block; font-family: "Songti SC", serif; font-size: 28px; color: var(--red); line-height: 1.2; }
.stat span { color: var(--ink-3); font-size: 13px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2.asym { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
/* 栅格子项默认允许收缩，避免长串不换行内容把整页撑宽 */
.grid-2 > *, .grid-3 > *, .grid-4 > *, .stat-grid > * { min-width: 0; }

.clan-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 18px; transition: .18s; }
.clan-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.clan-card .name { font-family: "Songti SC", serif; font-size: 18px; font-weight: 700; }
.clan-card a.name { color: inherit; text-decoration: none; }
.clan-card a.name:hover { color: var(--jade); }
.clan-card .meta { color: var(--ink-3); font-size: 13px; margin-top: 6px; }
.clan-card .poem { margin-top: 10px; color: var(--jade); font-family: "Songti SC", serif; letter-spacing: .18em; font-size: 14px; }

/* 谱/支「人数」超链：指向人员组成与最高辈长辈 */
.cnt-link { text-decoration: underline dotted; text-decoration-underline-offset: 3px; }
.cnt-link:hover { color: var(--gold); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--red); }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=date],
.field input[type=email], .field input[type=tel], .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  font-size: 14px; color: var(--ink); outline: none; font-family: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(47,93,98,.08); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* 填写式录入：同名候选确认 */
.suggest-box { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggest-box:empty { display: none; }
.cand-chip {
  appearance: none; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; line-height: 1.5; transition: all .15s ease;
}
.cand-chip:hover { border-color: var(--red); color: var(--red); background: #fdf6f5; }
.cand-chip.exact { border-color: var(--red); color: var(--red); background: #fdf6f5; font-weight: 600; }
.cand-chip.ghost { border-style: dashed; color: var(--ink-3); }
.cand-chip.ghost:hover { color: var(--ink-2); border-color: var(--ink-3); background: transparent; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data th { background: #f3eee4; color: var(--ink-2); font-weight: 600; font-size: 13px; letter-spacing: .02em; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fdfaf3; }
table.data td.num { font-variant-numeric: tabular-nums; }
/* 表格横向滚动容器：窄屏下不让整页被长内容撑开 */
.tbl-scroll { overflow-x: auto; }
.tbl-scroll > table.data { min-width: max-content; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; line-height: 1.6; background: var(--jade-soft); color: var(--jade); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gray { background: #f0eeea; color: var(--ink-3); }
.badge.gold { background: #f8f0dd; color: var(--gold); }

/* ---------- 提示 ---------- */
.flash { margin: 16px 0; padding: 11px 16px; border-radius: 8px; font-size: 14px; border: 1px solid; }
.flash.ok { background: #eef6ef; border-color: #cfe4d1; color: #2c6b3a; }
.flash.err { background: #fbeceb; border-color: #f0cfcb; color: #a8322a; }
.notice { background: #fdf8e8; border: 1px solid #efe0b8; color: #7a5a14; padding: 12px 16px; border-radius: 8px; font-size: 14px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .big { font-family: "Songti SC", serif; font-size: 20px; color: var(--ink-2); margin-bottom: 6px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 9px 14px; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs a.on, .tabs button.on { color: var(--red); border-color: var(--red); }

/* ---------- 谱系树 ---------- */
.tree-scroll { overflow: auto; padding: 26px 10px 30px; background: #fffdf8; border: 1px solid var(--line); border-radius: 10px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree-root { display: flex; justify-content: center; min-width: max-content; }
.tree li { position: relative; padding: 22px 10px 0; display: flex; flex-direction: column; align-items: center; }
.tree > li { padding-top: 0; }
.tree ul { display: flex; justify-content: center; position: relative; padding-top: 22px; }
.tree ul::before { content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 22px; background: var(--line); }
.tree li::before, .tree li::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 1px solid var(--line); }
.tree li::before { right: 50%; }
.tree li::after { left: 50%; border-left: 1px solid var(--line); }
.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 1px solid var(--line); border-radius: 0 6px 0 0; }
.tree li:first-child::after { border-radius: 6px 0 0 0; }
.tree > li::before, .tree > li::after { display: none; }
.node { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; min-width: 108px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.node.living { border-color: #c8d9d7; background: #f7fbfa; }
.node-name { display: block; font-family: "Songti SC", serif; font-size: 16px; font-weight: 700; color: var(--ink); }
.node-meta { display: block; font-size: 11.5px; color: var(--ink-3); }
.node-date { display: block; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.node-spouse { display: block; margin-top: 5px; padding-top: 4px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.node-spouse a { color: var(--ink-2); border-bottom: 1px dotted var(--line); }
.node.self { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 3px rgba(168, 50, 42, .10); }
.node-self { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; line-height: 1.6; }
.node-more { display: block; margin-top: 4px; font-size: 10.5px; color: var(--ink-3); }

/* 个人家谱树：代数选择 */
.tree-more { position: relative; }
.tree-more > summary { list-style: none; cursor: pointer; }
.tree-more > summary::-webkit-details-marker { display: none; }
.tree-more-form { position: absolute; right: 0; top: 120%; z-index: 30; display: flex; align-items: flex-end; gap: 10px; padding: 12px 14px; background: var(--paper-2, #fffdf9); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(31, 35, 40, .12); white-space: nowrap; }
.tree-more-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); }
.tree-more-form select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; }

/* 人物页姓名旁「家谱树」入口：跳全屏缩放树（view/clan/ptree） */
.name-tree-link { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin-left: 10px; padding: 3px 11px; border: 1px solid var(--jade); border-radius: 999px; background: var(--jade-soft); color: var(--jade); font-size: 12px; font-weight: 600; letter-spacing: .05em; white-space: nowrap; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.name-tree-link:hover { background: var(--jade); color: #fff; }
.name-tree-link::before { content: '⑂'; font-size: 13px; line-height: 1; }
/* 移动端：底部内嵌小树改为姓名旁入口跳转全屏树，避免小屏挤压 */
@media (max-width: 900px) {
  #ptree { display: none; }
  .name-tree-link { margin-left: 6px; }
}

/* ---------- 关系图 ---------- */
.rel-board { background: #fffdf8; border: 1px solid var(--line); border-radius: 10px; padding: 26px; }
.rel-level { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.rel-line { height: 26px; width: 1px; background: var(--line); margin: 0 auto; }
.rel-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; text-align: center; min-width: 96px; }
.rel-card.self { border-color: var(--red); background: var(--red-soft); }
.rel-card.spouse { border-color: #d9c9a8; background: #fdf8ec; }
.rel-tag { font-size: 11px; color: var(--ink-3); display: block; }

/* ---------- 字辈比对 ---------- */
.gen-input { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.gen-box { width: 82px; height: 82px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; font-family: "Songti SC", serif; font-size: 34px; color: var(--red); }
.gen-box input { width: 100%; height: 100%; border: 0; text-align: center; font-family: "Songti SC", serif; font-size: 32px; background: transparent; outline: none; }
.score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red); }
.match-card { border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); padding: 18px; }
.match-card .rank { font-family: "Songti SC", serif; font-size: 13px; color: var(--gold); }
.evidence { font-size: 13px; color: var(--jade); background: var(--jade-soft); display: inline-block; padding: 3px 10px; border-radius: 20px; }
.hits { display: flex; gap: 6px; margin-top: 10px; }
.hit { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--red); color: var(--red); border-radius: 5px; font-family: "Songti SC", serif; }

/* 字辈套红：连续相同的三代字辈，一眼可见 */
.gc-seq { font-family: "Songti SC", serif; letter-spacing: .2em; color: var(--ink); }
.gc-hit {
  color: #fff; background: var(--red); font-weight: 700;
  border-radius: 3px; padding: 1px 3px; margin: 0 1px;
  letter-spacing: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.gc-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.gc-legend em { font-style: normal; color: #fff; background: var(--red); border-radius: 3px; padding: 0 4px; font-weight: 700; }

/* ---------- 后台会员列表：列多，给表格保底宽度，避免逐字竖排 ---------- */
.tbl-members { min-width: 1240px; }
.tbl-members .nowrap,
.tbl-members .badge { white-space: nowrap; }
.tbl-members th:nth-child(3),
.tbl-members td:nth-child(3) { min-width: 96px; }
.tbl-members th:nth-child(8),
.tbl-members td:nth-child(8) { min-width: 62px; }
.tbl-members .br-text { max-width: 240px; font-size: 12px; line-height: 1.45; word-break: break-word; }

/* ---------- 所属家谱 / 支系（会员档案只读块） ---------- */
.kin-box {
  background: var(--jade-soft); border: 1px solid #d3e2e0; border-radius: 10px;
  padding: 12px 14px; margin: 0 0 4px;
}
.kin-row { display: flex; gap: 10px; padding: 5px 0; font-size: 14px; line-height: 1.6; }
.kin-row + .kin-row { border-top: 1px dashed #cfe0de; }
.kin-k { flex: 0 0 5.2em; color: var(--ink-3); font-size: 13px; }
.kin-v { flex: 1 1 auto; min-width: 0; color: var(--ink); word-break: break-word; }
.kin-v em { font-style: normal; }
.kin-char { color: var(--red); font-weight: 700; }
.kin-link { margin-left: 8px; font-size: 12.5px; white-space: nowrap; }
.kin-box .hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* ---------- 分布柱状图（高度百分比，永不溢出卡片） ---------- */
.bars-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px -2px 0; padding: 0 2px 2px; }
.bars { display: flex; gap: 8px; align-items: stretch; height: 148px; padding-top: 4px; min-width: 100%; width: max-content; justify-content: center; }
.bar { flex: 1 1 0; min-width: 26px; max-width: 64px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.bar-col { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: flex-end; }
.bar-col i { display: block; width: 100%; height: 0; background: linear-gradient(180deg, #cfe0de, #9dbcb9); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar b { color: var(--ink); font-size: 12px; line-height: 1; }
.bar span { font-size: 11.5px; line-height: 1; white-space: nowrap; }

/* ---------- 地域分布（细条占比） ---------- */
.rgn-list { max-height: 360px; overflow: auto; margin-top: 8px; }
.rgn { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.rgn:last-child { border-bottom: 0; }
.rgn-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; line-height: 1.5; }
.rgn-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rgn-top b { flex: 0 0 auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.rgn-bar { height: 5px; border-radius: 3px; background: rgba(47, 93, 98, .10); margin-top: 5px; overflow: hidden; }
.rgn-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #9dbcb9, #2f5d62); }
.rgn.is-muted .rgn-top span, .rgn.is-muted .rgn-top b { color: var(--ink-3); font-weight: 400; }
.rgn.is-muted .rgn-bar i { background: #d8d3c6; }
.bars-tip { display: none; }

@media (max-width: 900px) {
  .kin-box { padding: 10px 11px; }
  .kin-row { font-size: 13px; gap: 8px; }
  .kin-k { flex-basis: 4.6em; font-size: 12px; }
  .bars { height: 118px; gap: 6px; }
  .bar { min-width: 22px; gap: 5px; font-size: 11px; }
  .bar b { font-size: 11px; }
  .bar span { font-size: 10px; }
  .rgn-list { max-height: none; }
  .bars-tip { display: block; margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); }
}

/* ---------- 谱地图 ---------- */
.map-board { position: relative; background: #f4f1e8; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.map-board svg { display: block; width: 100%; height: auto; }
.map-label { font-size: 9px; fill: #4a5158; }
.map-dot { fill: #a8322a; opacity: .82; }
.map-dot.big { fill: #2f5d62; }

/* ---------- 会员中心 ---------- */
.member-grid { display: grid; grid-template-columns: 262px 1fr; gap: 22px; align-items: start; }
.side { background: linear-gradient(180deg, #fffdf9 0%, #fdfaf3 100%); border: 1px solid var(--line); border-radius: 12px; padding: 0 0 12px; position: sticky; top: 80px; box-shadow: 0 1px 2px rgba(31, 35, 40, .04); }
.side-sprite { display: none; }
.side .me { position: relative; text-align: center; padding: 22px 16px 16px; background: radial-gradient(120% 100% at 50% 0%, #f6efe2 0%, rgba(255, 253, 249, 0) 72%); border-bottom: 1px solid var(--line-2); }
.side .me::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 46px; height: 2px; margin-left: -23px; background: linear-gradient(90deg, transparent, var(--red), transparent); opacity: .5; }
.side .avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--jade); color: #fff; display: grid; place-items: center; font-size: 23px; margin: 0 auto 9px; font-family: "Songti SC", serif; box-shadow: 0 0 0 4px #fffdf9, 0 0 0 5px var(--line); }
.side .me-name { font-family: "Songti SC", serif; font-size: 17px; font-weight: 600; letter-spacing: .04em; line-height: 1.4; }
.side .me-tags { margin-top: 7px; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.side nav { padding: 6px 10px 0; }
.side nav a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; color: var(--ink-2); font-size: 14px; line-height: 1.55; transition: background .16s, color .16s; }
.side nav a:hover { background: #f4efe5; color: var(--ink); }
.side nav a.on { background: var(--red-soft); color: var(--red); font-weight: 600; }
.side .si { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .55; transition: opacity .16s; }
.side nav a:hover .si, .side nav a.on .si { opacity: 1; }
.side .t { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side nav a.sub { color: #6a7178; font-size: 13.5px; padding-top: 7px; padding-bottom: 7px; }
.side nav a.sub:hover, .side nav a.sub.on { color: var(--ink-2); }
.side nav a.sub.on { color: var(--red); }
.side nav a.side-admin { justify-content: center; margin: 12px 0 2px; padding: 8px; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; background: #fffdf9; }
.side nav a.side-admin:hover { border-color: var(--red); color: var(--red); background: #fffdf9; }
.side-toggle { display: none; }

/* 会员侧栏：分组折叠（details/summary） */
.side nav details.mg { margin: 0; }
.side .mg > summary { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding: 7px 10px 6px;
  border-radius: 7px; font-size: 11.5px; letter-spacing: .14em; color: var(--ink-3); cursor: pointer;
  list-style: none; user-select: none; -webkit-tap-highlight-color: transparent; transition: background .16s, color .16s; }
.side .mg > summary::-webkit-details-marker { display: none; }
.side .mg > summary:hover { background: #f7f2e8; color: var(--ink-2); }
.side .mg[open] > summary { color: var(--ink-2); }
.side .mg .chev { width: 5px; height: 5px; flex: 0 0 auto; margin-top: -2px;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor;
  transform: rotate(-45deg); transition: transform .16s; }
.side .mg[open] .chev { transform: rotate(45deg); margin-top: -3px; }
.side .mg-name { flex: 0 0 auto; }
.side .mg-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), rgba(224, 216, 200, 0)); }
.side .mg-sum { flex: 0 0 auto; min-width: 17px; height: 17px; line-height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0; text-align: center; }
.side .mg-items { padding-top: 1px; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick a { background: var(--paper-2); border: 1px solid var(--line); border-radius: 9px; padding: 14px; text-align: center; color: var(--ink-2); font-size: 13.5px; transition: .15s; }
.quick a:hover { border-color: var(--red); color: var(--red); transform: translateY(-2px); }
.quick a b { display: block; font-family: "Songti SC", serif; font-size: 18px; color: var(--ink); margin-bottom: 2px; }

/* ---------- 后台 ---------- */
.admin { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; align-items: start; }
.as-sprite { display: none; }
.admin-side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #232b2e 0%, #1c2225 100%);
  color: #c3cccc; border-right: 1px solid #2b3438;
}
.as-top { padding: 18px 16px 13px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.as-brand { display: flex; align-items: center; gap: 9px; color: #fff; font-family: "Songti SC", "SimSun", serif; font-size: 16px; letter-spacing: .1em; }
.as-brand:hover { color: #fff; }
.as-brand .seal { width: 27px; height: 27px; flex: 0 0 auto; border-radius: 6px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 14px; letter-spacing: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.as-brand .blogo-pic { display: inline-flex; flex: 0 0 auto; }
.as-brand .blogo { height: 27px; width: auto; max-width: 140px; flex: 0 0 auto; border-radius: 6px; object-fit: contain; }
.as-who { margin-top: 10px; display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #a9b4b3; }
.as-user { max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-role { flex: 0 0 auto; font-size: 10.5px; line-height: 1.6; padding: 0 6px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .14); color: #8e9a99; }
.as-site { margin-top: 3px; font-size: 11.5px; color: #6f7b7a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-toggle { display: none; margin-left: auto; font-family: inherit; font-size: 12px; line-height: 1.7; padding: 2px 12px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #b8c3c2; cursor: pointer; }
.as-toggle:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }
.as-find { position: relative; margin: 10px 12px 2px; }
.as-find svg { position: absolute; left: 9px; top: 50%; width: 14px; height: 14px; margin-top: -7px; fill: none; stroke: #6f7b7a; stroke-width: 1.8; stroke-linecap: round; }
.as-find input { width: 100%; padding: 6px 9px 6px 28px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .09); background: rgba(255, 255, 255, .04); color: #dfe6e5; font-size: 12.5px; font-family: inherit; outline: none; transition: border-color .16s, background .16s; }
.as-find input::placeholder { color: #6b7675; }
.as-find input:focus { border-color: rgba(168, 50, 42, .8); background: rgba(255, 255, 255, .07); }
.as-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 10px; scrollbar-width: thin; scrollbar-color: #3b4548 transparent; }
.as-scroll::-webkit-scrollbar { width: 6px; }
.as-scroll::-webkit-scrollbar-thumb { background: #3b4548; border-radius: 3px; }
.as-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; color: #bfc9c8; font-size: 13.5px; line-height: 1.5; transition: background .16s, color .16s; }
.as-item[hidden], .as-grp[hidden] { display: none !important; }
.as-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.as-item.on { background: linear-gradient(90deg, #a8322a, #8f2a23); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(255, 255, 255, .07); }
.as-item .ai { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .68; transition: opacity .16s; }
.as-item:hover .ai, .as-item.on .ai { opacity: 1; }
.as-item .t { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.as-item.as-home { margin-bottom: 2px; }
.as-n { flex: 0 0 auto; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px; background: #c0392b; color: #fff; font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.as-n.quiet { background: rgba(255, 255, 255, .1); color: #9aa5a4; }
.as-item.on .as-n { background: #fff; color: var(--red); }
.as-grp { margin: 0; padding: 0; }
.as-grp > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 13px 10px 4px; font-size: 10.5px; letter-spacing: .16em; color: #8b9795; cursor: pointer; user-select: none; }
.as-grp > summary::-webkit-details-marker { display: none; }
.as-grp > summary:hover { color: #a7b2b1; }
.as-grp > summary .chev { width: 5px; height: 5px; flex: 0 0 auto; border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; transform: rotate(45deg); transition: transform .18s; opacity: .75; }
.as-grp:not([open]) > summary .chev { transform: rotate(-45deg); }
.as-gname { flex: 0 0 auto; }
.as-gsum { flex: 0 0 auto; font-size: 10px; letter-spacing: 0; padding: 0 5px; border-radius: 8px; background: rgba(192, 57, 43, .22); color: #e8908a; }
.as-grp > summary::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, 0)); }
.as-foot { padding: 10px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; gap: 8px; }
.as-foot a { flex: 1; text-align: center; font-size: 12px; padding: 6px 0; border-radius: 6px; color: #98a3a2; border: 1px solid rgba(255, 255, 255, .1); }
.as-foot a:hover { color: #fff; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .05); }
.as-empty { margin: 16px 0; text-align: center; font-size: 12.5px; color: #6f7b7a; }
.admin-main { min-width: 0; padding: 24px 28px 60px; background: var(--paper); }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-head h1 { font-size: 24px; }
.todo-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding: 10px 14px; background: #fffdf9; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 8px; }
.todo-cap { font-size: 11px; letter-spacing: .18em; color: var(--ink-3); }
.todo-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 20px; background: var(--red-soft); color: var(--red); font-size: 13px; }
.todo-chip b { min-width: 20px; height: 20px; line-height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; text-align: center; font-variant-numeric: tabular-nums; }
.todo-chip:hover { background: #f2dcd7; color: var(--red); }
.todo-none { font-size: 13px; color: var(--ink-3); }
.server-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.server-grid div { background: #fffdf9; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.server-grid span { color: var(--ink-3); display: block; font-size: 12px; }

/* ---------- 打印 ---------- */
.print-page { background: #fff; max-width: 900px; margin: 0 auto; padding: 60px 70px; box-shadow: var(--shadow); }
.print-page .cover { text-align: center; padding: 40px 0 30px; border-bottom: 3px double var(--ink); }
.print-page .cover h1 { font-size: 42px; letter-spacing: .18em; }
.print-page .cover .poem { font-family: "Songti SC", serif; letter-spacing: .3em; margin-top: 14px; color: var(--ink-2); }
.print-page .preface { margin: 26px 0; line-height: 2.1; text-indent: 2em; font-family: "Songti SC", serif; }
.print-page table { width: 100%; border-collapse: collapse; margin: 12px 0 26px; font-family: "Songti SC", serif; }
.print-page table th, .print-page table td { border: 1px solid #333; padding: 8px 10px; font-size: 13px; }
.print-page table th { background: #f2f2f2; text-align: center; }
.gen-table-title { text-align: center; font-family: "Songti SC", serif; font-size: 18px; margin: 26px 0 8px; letter-spacing: .1em; }

@media print {
  body { background: #fff; }
  .topbar, .no-print, .admin-side { display: none !important; }
  .print-page { box-shadow: none; padding: 0; max-width: none; }
  .admin { display: block; }
  .admin-main { padding: 0; }
  @page { margin: 18mm 16mm; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .stat-grid, .grid-3, .grid-4, .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.asym, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .member-grid { grid-template-columns: minmax(0, 1fr); }
  .member-grid > * { min-width: 0; }
  .side { position: static; }
  .side .me { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; }
  .side.collapsed .me, .side.collapsed nav { display: none; }
  .side-toggle { display: flex; align-items: center; gap: 9px; width: 100%; padding: 12px 15px;
    border: 0; border-bottom: 1px solid var(--line-2); background: transparent; font: inherit;
    color: var(--ink); cursor: pointer; text-align: left; }
  .side-toggle .st-ic { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: var(--ink-3); stroke-width: 1.7; stroke-linecap: round; }
  .side-toggle .st-cur { font-size: 14.5px; font-weight: 600; font-family: "Songti SC", serif; letter-spacing: .04em; }
  .side-toggle .st-hint { margin-left: auto; font-size: 12px; color: var(--ink-3); }
  .side-toggle .st-chev { width: 6px; height: 6px; flex: 0 0 auto; margin: 2px 2px 0 0;
    border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-135deg); transition: transform .18s; }
  .side.collapsed .side-toggle { border-bottom: 0; border-radius: 12px; }
  .side.collapsed .side-toggle .st-chev { transform: rotate(45deg); margin-top: -4px; }
  .side .me::after { display: none; }
  .side .avatar { margin: 0; width: 46px; height: 46px; font-size: 19px; }
  .side .me-tags { justify-content: flex-start; margin-top: 4px; }
  .side nav { display: block; padding: 4px 8px 6px; }
  .side nav a { padding: 8px 9px; gap: 7px; font-size: 13.5px; }
  .side .side-badge { height: 16px; line-height: 16px; min-width: 16px; padding: 0 4px; font-size: 10px; }
  /* 手机上每组的条目排两列，组标题独占一行，绝不横向滚动 */
  .side .mg-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
  .side .mg > summary { margin-top: 10px; padding: 10px 6px 6px; font-size: 12px; border-top: 1px dashed var(--line-2); border-radius: 0; }
  .side .mg:first-of-type > summary { border-top: 0; }
  .side .mg-line { background: none; }
  .side nav a.side-admin { margin-top: 10px; }
  .hero h1 { font-size: 30px; }
  .admin { grid-template-columns: minmax(0, 1fr); }
  .admin-side { position: static; height: auto; }
  .as-toggle { display: inline-block; }
  .as-top { position: sticky; top: 0; z-index: 3; padding: 12px 14px 10px; display: flex; align-items: center;
    gap: 10px; flex-wrap: wrap; background: #232b2e; }
  .as-who, .as-site { margin-top: 0; }
  .admin-side.collapsed .as-top { position: static; border-bottom: 0; padding-bottom: 12px; }
  .admin-side.collapsed .as-who, .admin-side.collapsed .as-site,
  .admin-side.collapsed .as-find, .admin-side.collapsed .as-scroll,
  .admin-side.collapsed .as-foot { display: none; }
  .as-find { margin: 8px 14px 0; }
  /* 展开后不再困在 58vh 小窗里：整段跟着页面滚动，分组内两列排，28 项一屏多点就能看全 */
  .as-scroll { max-height: none; overflow: visible; padding: 4px 10px 10px; }
  .as-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
  .as-grp:not([open]) .as-items { display: none; }
  .as-item { font-size: 13px; padding: 9px 10px; gap: 7px; }
  .as-item .t { line-height: 1.45; }
  .as-foot { padding: 8px 14px 12px; }
  .server-grid { grid-template-columns: 1fr 1fr; }
  /* 后台列表页大量用内联 grid-template-columns，窄屏统一收成一列/两列，避免横向溢出 */
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid-2, .grid-2.asym, .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .print-page { padding: 24px 18px; }
}

/* ==================== 在线祭祀 ==================== */
.mem-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px; }
.mem-card { display:flex; flex-direction:column; background:#fff; border:1px solid var(--line,#e5e0d5); border-radius:10px; overflow:hidden; text-decoration:none; color:inherit; transition:box-shadow .2s, transform .2s; }
.mem-card:hover { box-shadow:0 6px 18px rgba(0,0,0,.08); transform:translateY(-2px); }
.mem-card-top { display:flex; justify-content:center; padding:18px 0 8px; background:linear-gradient(#f8f5ef,#fff); }
.mem-face { width:64px; height:64px; border-radius:50%; background:var(--paper); border:1px solid var(--line,#e5e0d5); display:inline-flex; align-items:center; justify-content:center; font-size:30px; overflow:hidden; }
.mem-face.big { width:96px; height:96px; font-size:44px; }
.mem-face img, .mem-card-top img { width:64px; height:64px; border-radius:50%; object-fit:cover; }
.mem-card-body { padding:10px 14px; display:flex; flex-direction:column; gap:4px; text-align:center; }
.mem-card-go { padding:8px 14px; border-top:1px dashed var(--line,#e5e0d5); text-align:center; font-size:13px; color:var(--red); }
.ritual-key { display:flex; flex-wrap:wrap; gap:10px; }
.ritual-key-item { display:inline-flex; gap:6px; align-items:baseline; background:var(--paper); border:1px solid var(--line,#e5e0d5); border-radius:999px; padding:4px 12px; font-size:13px; }
.ritual-key-item i { color:var(--red); font-style:normal; }

/* 纪念馆主体：四款样式 */
.mem-stage { border-radius:12px; padding:28px 20px; text-align:center; border:1px solid var(--line,#e5e0d5); position:relative; overflow:hidden; }
.mem-stage.st1 { background:linear-gradient(#fdfaf3,#f3ecdd); }
.mem-stage.st2 { background:linear-gradient(#eef4ee,#dcead9); }
.mem-stage.st3 { background:linear-gradient(#f2f0f4,#e0dde6); }
.mem-stage.st4 { background:linear-gradient(#f0f5ef,#e2ecdd); }
.mem-hall { position:relative; display:flex; flex-direction:column; align-items:center; gap:14px; padding:12px 0; }
.hall-plaque { font-size:34px; font-weight:700; letter-spacing:8px; color:#7a1f1a; background:linear-gradient(#5b1210,#8c2a22); color:#f7e6c4; padding:14px 38px; border-radius:8px; box-shadow:0 4px 14px rgba(0,0,0,.25), inset 0 0 0 2px rgba(247,230,196,.4); }
.hall-sub { font-size:13px; letter-spacing:4px; color:#8a7d5c; }
.stele { background:linear-gradient(#d8d8d2,#b9b9b0); border:2px solid #8f8f86; border-radius:10px 10px 4px 4px; padding:26px 40px; box-shadow:0 6px 16px rgba(0,0,0,.18); display:flex; flex-direction:column; gap:6px; }
.stele-name { font-size:32px; font-weight:700; letter-spacing:6px; color:#3d3d38; text-shadow:0 1px 0 #fff; }
.stele-sub { font-size:12px; letter-spacing:3px; color:#6b6b62; }
.wall { background:linear-gradient(#8c2a22,#5b1210); border-radius:8px; padding:26px 40px; color:#f7e6c4; display:flex; flex-direction:column; gap:6px; box-shadow:inset 0 0 0 2px rgba(247,230,196,.25); }
.wall-name { font-size:32px; font-weight:700; letter-spacing:8px; }
.wall-sub { font-size:12px; letter-spacing:4px; opacity:.8; }
.garden { background:radial-gradient(circle at 50% 30%, #cfe3c8, #a8c7a0); border-radius:50% 50% 8px 8px / 30% 30% 8px 8px; padding:30px 44px; display:flex; flex-direction:column; gap:6px; border:3px solid #7d9a76; }
.garden-stone { font-size:30px; font-weight:700; letter-spacing:6px; color:#2f4a2c; }
.garden-sub { font-size:12px; letter-spacing:3px; color:#4a6346; }
.mem-portrait { position:absolute; right:26px; top:50%; transform:translateY(-50%); }
.mem-meta { display:flex; flex-wrap:wrap; gap:12px; justify-content:center; margin-top:14px; align-items:center; }
.mem-bio { max-width:640px; margin:12px auto 0; text-align:center; color:#5a5248; line-height:1.9; }

/* 祭拜按钮与动画 */
.ritual-bar { display:flex; flex-wrap:wrap; gap:10px; }
.ritual-btn { display:flex; flex-direction:column; align-items:center; gap:2px; padding:10px 18px; border:1px solid var(--line,#e5e0d5); background:#fff; border-radius:10px; cursor:pointer; transition:transform .15s, box-shadow .15s; }
.ritual-btn:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,.08); border-color:var(--red); }
.ritual-btn:disabled { opacity:.5; cursor:wait; }
.ritual-ico { font-size:26px; font-style:normal; }
.ritual-btn b { font-size:14px; }
.ritual-btn em { font-size:12px; color:var(--red); font-style:normal; }
.ritual-fx { position:absolute; inset:0; pointer-events:none; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.fx-ico { font-size:56px; opacity:0; }
.fx-flower { animation:fxPetal 3s ease-out forwards; }
.fx-offer { animation:fxRise 2.6s ease-out forwards; }
.fx-candle { animation:fxFlame 3s ease-in-out forwards; }
.fx-incense { animation:fxSmoke 3s ease-out forwards; }
.fx-burn { animation:fxBurn 2.8s ease-in forwards; }
.fx-wine { animation:fxPour 2.8s ease-in-out forwards; }
@keyframes fxPetal { 0% { opacity:0; transform:translateY(-40px) rotate(0deg); } 15% { opacity:1; } 100% { opacity:0; transform:translateY(60px) rotate(340deg); } }
@keyframes fxRise { 0% { opacity:0; transform:translateY(30px) scale(.6); } 25% { opacity:1; transform:translateY(0) scale(1.1); } 100% { opacity:0; transform:translateY(-70px) scale(1); } }
@keyframes fxFlame { 0% { opacity:0; transform:scale(.3); } 20% { opacity:1; transform:scale(1.2); } 50% { transform:scale(1) rotate(-4deg); } 80% { transform:scale(1.1) rotate(4deg); opacity:1; } 100% { opacity:.6; transform:scale(.95); } }
@keyframes fxSmoke { 0% { opacity:0; transform:translateY(20px); filter:blur(0); } 30% { opacity:.9; } 100% { opacity:0; transform:translateY(-90px) scale(1.6); filter:blur(4px); } }
@keyframes fxBurn { 0% { opacity:0; transform:scale(.4); filter:brightness(1); } 30% { opacity:1; transform:scale(1.3) rotate(8deg); filter:brightness(1.4); } 60% { transform:scale(1) rotate(-8deg); } 100% { opacity:0; transform:scale(.2) translateY(-30px); filter:brightness(2); } }
@keyframes fxPour { 0% { opacity:0; transform:rotate(-120deg) translateY(20px); } 30% { opacity:1; transform:rotate(-140deg) translateY(-10px); } 100% { opacity:.8; transform:rotate(-140deg) translateY(10px); } }

/* 祭文 */
.essay-list { display:flex; flex-direction:column; gap:12px; }
.essay { border:1px solid var(--line,#e5e0d5); border-radius:10px; padding:14px 16px; background:#fffdf8; }
.essay-body { line-height:2; margin:8px 0; color:#4c453c; white-space:pre-wrap; }
.essay-actions { display:flex; gap:8px; }
.essay-actions .vote { border:1px solid var(--line,#e5e0d5); background:#fff; border-radius:999px; padding:4px 14px; cursor:pointer; font-size:13px; }
.essay-actions .vote:hover { border-color:var(--red); }
.essay-actions .vote.did { background:var(--red); border-color:var(--red); color:#fff; opacity:.85; cursor:default; }
.essay-actions .vote i { font-style:normal; margin-left:4px; }
.interactions { border-top:1px dashed var(--line,#e5e0d5); padding-top:10px; }
.interactions h4 { font-size:13px; margin-bottom:6px; color:#8a7d5c; }
.interactions div { margin-bottom:2px; }
.style-picker { display:flex; gap:14px; flex-wrap:wrap; }
.style-opt { display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; border:1px solid var(--line,#e5e0d5); border-radius:10px; padding:10px 14px; background:#fff; }
.style-opt input { margin:0; }
.style-opt:has(input:checked) { border-color:var(--red); box-shadow:0 0 0 2px rgba(168,50,42,.15); }
.style-thumb { width:110px; height:74px; border-radius:6px; display:flex; align-items:center; justify-content:center; position:relative; }
.style-thumb.st1 { background:linear-gradient(#fdfaf3,#f3ecdd); border:1px solid #e0d6c0; }
.style-thumb.st2 { background:linear-gradient(#eef4ee,#dcead9); border:1px solid #c2d4bf; }
.style-thumb.st3 { background:linear-gradient(#8c2a22,#5b1210); }
.style-thumb.st4 { background:radial-gradient(circle at 50% 30%, #cfe3c8, #a8c7a0); border:1px solid #7d9a76; }
.style-plaque { font-size:11px; letter-spacing:2px; padding:4px 10px; border-radius:4px; font-style:normal; }
.st1 .style-plaque, .st2 .style-plaque { background:#b9b9b0; color:#3d3d38; }
.st3 .style-plaque { background:transparent; color:#f7e6c4; border:1px solid rgba(247,230,196,.5); }
.st4 .style-plaque { background:transparent; color:#2f4a2c; }

/* ---- 建馆：人物画像上传 ---- */
.portrait-uploader { display:flex; flex-direction:column; gap:8px; }
.portrait-uploader input[type=file] { font-size:13px; }
.portrait-preview { display:flex; align-items:center; gap:10px; }
.portrait-preview img { width:72px; height:72px; object-fit:cover; border-radius:8px; border:1px solid var(--line,#e5e0d5); background:#fff; }

/* ---- 危险操作按钮 / 行内编辑 ---- */
.btn.danger { background:#a8322a; color:#fff; border-color:#a8322a; }
.btn.danger:hover { background:#8c2a22; }
details.inline-edit { display:inline-block; position:relative; }
details.inline-edit summary { list-style:none; cursor:pointer; }
details.inline-edit summary::-webkit-details-marker { display:none; }
details.inline-edit form { position:absolute; z-index:30; right:0; background:#fff; border:1px solid var(--line,#e5e0d5); border-radius:10px; padding:14px; width:280px; box-shadow:0 10px 30px rgba(0,0,0,.12); }

/* ==================== 首页亲情化 ==================== */
.home-hero { padding: 64px 0 40px; background:
  radial-gradient(900px 380px at 82% -40px, rgba(168,50,42,.06), transparent 70%),
  radial-gradient(700px 300px at 8% 10%, rgba(47,93,98,.05), transparent 70%),
  var(--paper); }
.home-hero-inner { display: flex; gap: 40px; align-items: flex-start; }
.home-hero-text { flex: 1 1 0; min-width: 0; }
.home-hero-text h1 { font-size: 38px; line-height: 1.3; margin-bottom: 12px; }
.home-hero-text h1 em { color: var(--red); font-style: normal; }
.family-mark {
  width: 64px; height: 64px; border-radius: 14px; margin-bottom: 18px;
  background: linear-gradient(160deg, #a8322a, #7c2119); color: #f7e6c4;
  font-family: "Songti SC", serif; font-size: 36px; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(168,50,42,.28), inset 0 0 0 2px rgba(247,230,196,.35);
}
.home-hero-poem {
  flex: 0 0 240px; margin-top: 18px; padding: 26px 24px; border-radius: 12px;
  background: linear-gradient(170deg, #fdfaf3, #f4eddd); border: 1px solid var(--line);
  font-family: "Songti SC", serif; color: var(--ink-2); line-height: 2.2;
}
.home-hero-poem p { margin: 0; font-size: 17px; letter-spacing: .12em; }
.home-hero-poem span { display: block; margin-top: 12px; color: var(--ink-3); font-size: 12px; }

/* 新闻 / 帮助卡片 */
.news-card { display: flex; flex-direction: column; gap: 8px; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; color: inherit;
  transition: .18s; }
.news-card:hover { border-color: var(--gold); transform: translateY(-2px); color: inherit; }
.news-card h3 { font-size: 17px; }
.news-card p { margin: 4px 0 0; line-height: 1.7; }
.news-cover img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; }
.article-content { line-height: 2; font-size: 15.5px; color: var(--ink); }
.article-content img { border-radius: 8px; border: 1px solid var(--line); margin: 10px 0; max-width: 100%; height: auto; }
.article-content blockquote { margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--gold);
  background: #fdf8ec; color: var(--ink-2); border-radius: 0 8px 8px 0; }
.article-content h2 { font-size: 20px; margin: 22px 0 8px; }
.article-content p { margin: 10px 0; }

/* ==================== 工单 ==================== */
.ticket-msg { border-radius: 10px; padding: 12px 16px; margin: 10px 0; font-size: 14px; }
.ticket-msg.mine { background: #fdf6f0; border: 1px solid #eddcc8; }
.ticket-msg.admin { background: var(--jade-soft); border: 1px solid #cfe0de; }
.ticket-msg-head { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.ticket-msg-body { white-space: pre-wrap; line-height: 1.8; }
.kin-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px;
  background: var(--paper); border-radius: 8px; padding: 12px 16px; font-size: 13.5px; }
.kin-facts b { color: var(--ink-2); display: inline-block; width: 4.5em; font-weight: 600; }
.ml8 { margin-left: 8px; }

/* ==================== 富文本编辑器 ==================== */
.rich-toolbar { display: flex; gap: 4px; align-items: center; border: 1px solid var(--line);
  border-bottom: 0; border-radius: 8px 8px 0 0; background: #f6f2e9; padding: 6px 8px; }
.rich-toolbar button { border: 1px solid transparent; background: transparent; border-radius: 6px;
  min-width: 32px; height: 30px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.rich-toolbar button:hover { background: #fff; border-color: var(--line); color: var(--red); }
.rich-editor { min-height: 320px; max-height: 60vh; overflow: auto; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: #fff;
  font-size: 15px; line-height: 1.9; outline: none; }
.rich-editor:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(47,93,98,.08); }
.rich-editor img { max-width: 100%; border-radius: 8px; }
.rich-editor blockquote { border-left: 3px solid var(--gold); margin: 10px 0; padding: 8px 14px;
  background: #fdf8ec; color: var(--ink-2); }

/* ==================== H5 自适应增强 ==================== */
@media (max-width: 900px) {
  .home-hero-inner { flex-direction: column; }
  .home-hero-poem { flex: none; width: 100%; order: -1; padding: 18px 20px; }
  .home-hero-poem p { font-size: 15px; }
  .topbar { position: static; }
  .topbar .wrap { height: auto; flex-wrap: wrap; padding: 9px 14px 8px; gap: 8px 10px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand .seal { width: 30px; height: 30px; font-size: 16px; }
  .brand .blogo { height: 30px; width: auto; max-width: 150px; border-radius: 5px; }
  /* 主导航：一行放不下就换行成两行，绝不横向滚动藏起来 */
  .nav { order: 3; width: 100%; margin: 2px 0 0; padding: 8px 0 0; gap: 6px;
    display: flex; flex-wrap: wrap; overflow: visible; border-top: 1px solid var(--line-2); }
  .nav a { flex: 0 0 auto; white-space: nowrap; font-size: 13.5px; line-height: 1.5;
    padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
    background: #fbf8f1; color: var(--ink-2); }
  .nav a:hover, .nav a.on { color: var(--red); border-color: #e3c4bd; background: var(--red-soft); }
  .nav-right { gap: 7px; }
  .nav-right .btn { padding: 4px 9px; font-size: 12.5px; max-width: 42vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-right .badge { display: none; }
  .hero h1, .home-hero-text h1 { font-size: 26px; }
  .kin-facts { grid-template-columns: 1fr; }
  .admin-main { padding: 16px 14px 50px; }
  .admin-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .searchbar button { padding: 0 16px; }
  .between { gap: 8px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 12px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 16px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .gen-box { width: 64px; height: 64px; }
  .btn { padding: 7px 12px; font-size: 13.5px; }
  table.data th, table.data td { padding: 8px 10px; font-size: 13px; }
  .member-grid { gap: 14px; }
}

/* ---------- 头像：圆形展示 + 圆形裁剪 ---------- */
.avatar-block { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-round {
  width: 96px; height: 96px; flex: 0 0 auto; border-radius: 50%; overflow: hidden;
  background: var(--jade); color: #fff; display: grid; place-items: center;
  font-size: 38px; font-family: "Songti SC", serif; line-height: 1;
  border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, .06);
}
.avatar-round img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-round img[hidden], .avatar-round span[hidden] { display: none; }
.avatar-round.sm { width: 64px; height: 64px; font-size: 26px; border-width: 2px; }
.avatar-tools { min-width: 220px; flex: 1 1 220px; }
.avatar-tools .avatar-file { display: block; font-size: 13px; color: var(--ink-2); max-width: 100%; }
.avatar-tools .avatar-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.crop-modal { position: fixed; inset: 0; z-index: 120; background: rgba(24, 24, 22, .58); display: flex; align-items: center; justify-content: center; padding: 16px; }
.crop-modal[hidden] { display: none; }
body.crop-lock { overflow: hidden; }
.crop-box { background: #fff; border-radius: 14px; width: min(360px, 100%); padding: 20px 20px 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .28); }
.crop-box h3 { margin: 0 0 2px; font-size: 17px; }
.crop-box .crop-tip { margin: 0; font-size: 12px; color: var(--ink-3); }
.crop-stage { position: relative; width: 100%; max-width: 300px; margin: 14px auto 12px; }
.crop-stage canvas { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 50%; touch-action: none; cursor: grab; background: #f4f1ea; }
.crop-stage canvas.dragging { cursor: grabbing; }
.crop-zoom-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
.crop-zoom-row input[type=range] { flex: 1; accent-color: var(--jade); }
.crop-status { min-height: 18px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.crop-status.err { color: var(--red); }
.crop-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.avatar-msg { min-height: 16px; margin-top: 8px; font-size: 12px; }
.avatar-msg.ok { color: var(--jade); }
.avatar-msg.err { color: var(--red); }

/* ==================== 私信 / 五服宗亲 ==================== */
.top-badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; margin-left: 5px; text-align: center; }
.side-badge { flex: 0 0 auto; margin-left: auto; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; text-align: center; }
.side-badge.gray { background: #e7e2d7; color: var(--ink-3); font-weight: 600; }

.dm-ava { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; overflow: hidden;
  background: var(--jade); color: #fff; display: grid; place-items: center;
  font-family: "Songti SC", serif; font-size: 18px; line-height: 1; }
.dm-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dm-ava.sm { width: 34px; height: 34px; font-size: 15px; }
.dm-ava.lg { width: 52px; height: 52px; font-size: 22px; }

.dm-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px;
  border-bottom: 1px solid var(--line-2); color: inherit; }
.dm-row:last-child { border-bottom: 0; }
.dm-row:hover { background: #fdfaf3; border-radius: 8px; color: inherit; }
.dm-main { flex: 1; min-width: 0; }
.dm-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dm-top b { font-size: 15px; }
.dm-top time { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.dm-preview { display: block; font-size: 13px; color: var(--ink-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.dm-badge { flex: 0 0 auto; min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; text-align: center; }

.kin-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kin-chip { display: flex; gap: 10px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); color: inherit; }
.kin-chip:hover { border-color: var(--red); color: inherit; }
.kin-chip b { display: block; font-size: 14px; }
.kin-chip em { font-style: normal; font-size: 12px; color: var(--red); margin-left: 4px; }
.kin-chip small { display: block; font-size: 12px; color: var(--ink-3); }

.kin-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-2); }
.kin-row:last-child { border-bottom: 0; }
.kin-info { flex: 1; min-width: 0; }
.kin-info b { font-size: 15px; }

.chat-head .chat-peer { display: flex; align-items: center; gap: 12px; }
.chat-box { max-height: 52vh; min-height: 220px; overflow-y: auto; padding: 6px 2px 10px; }
.chat-box .chat-empty { text-align: center; padding: 40px 10px; }
.chat-box .chat-empty .big { font-family: "Songti SC", serif; font-size: 18px; color: var(--ink-2); margin-bottom: 6px; }
.bubble { display: flex; flex-direction: column; margin: 10px 0; max-width: 82%; }
.bubble.you { align-items: flex-start; }
.bubble.me { align-items: flex-end; margin-left: auto; }
.bubble-body { padding: 10px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word; }
.bubble.you .bubble-body { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.bubble.me .bubble-body { background: var(--red-soft); border: 1px solid #eed6d1; border-top-right-radius: 4px; }
.bubble-time { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.chat-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font: inherit; font-size: 14.5px; resize: vertical; background: #fff; outline: none; }
.chat-form textarea:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(47, 93, 98, .08); }

.nudge-mask { position: fixed; inset: 0; z-index: 130; background: rgba(24, 24, 22, .55);
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.nudge-box { position: relative; background: var(--paper-2); border-radius: 14px; width: min(560px, 100%);
  padding: 22px 22px 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, .3); max-height: 88vh; overflow: auto; }
.nudge-x { position: absolute; top: 8px; right: 12px; border: 0; background: transparent;
  font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.nudge-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 18px; }
.nudge-seal { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 8px; background: var(--red);
  color: #fff; display: grid; place-items: center; font-family: "Songti SC", serif; font-size: 20px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.nudge-head h3 { font-size: 18px; margin-bottom: 4px; }
.nudge-list { margin: 14px 0 12px; border-top: 1px solid var(--line-2); }
.nudge-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.nudge-info { flex: 1; min-width: 0; }
.nudge-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 900px) {
  .kin-chips { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; }
  .nudge-box { padding: 18px 14px 12px; }
}

/* 私信：好友状态 / 拉黑 */
.block-tip { border-left: 3px solid var(--red); }
.block-tip .big { font-family: "Songti SC", serif; font-size: 17px; color: var(--ink); margin-bottom: 4px; }
.chat-locked { padding: 14px 16px; border: 1px dashed var(--line); border-radius: 9px;
  background: var(--paper-2); font-size: 14px; color: var(--ink-2); text-align: center; }
.chat-locked b { color: var(--red); font-weight: 600; }

/* ==================== 并支对接（完美合并） ==================== */
.ml-box { width: min(720px, 100%); }
.ml-card { border-left: 3px solid var(--red); }
.ml-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 16px; }
.ml-head h3 { font-size: 18px; margin-bottom: 4px; }
.ml-head p { margin: 0; line-height: 1.8; }
.ml-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ml-label { font-size: 13px; color: var(--ink-2); margin: 16px 0 8px; }
.ml-cands { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 42vh; overflow: auto; padding: 2px; }
.ml-cand { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 10px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.ml-cand:hover { border-color: var(--jade); }
.ml-cand:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.ml-cand input { margin: 4px 0 0; accent-color: var(--red); flex: 0 0 auto; }
.ml-cand-main { min-width: 0; }
.ml-cand-main b { font-size: 14.5px; }
.ml-cand-main em { font-style: normal; font-size: 12px; color: var(--jade); margin-left: 5px; }
.ml-cand-main small { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.ml-cand-main .ml-bio { color: var(--ink-3); opacity: .85; }
.ml-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ml-note { margin-top: 14px; line-height: 1.8; }
.ml-empty { border: 1px dashed var(--line); border-radius: 9px; padding: 14px 16px;
  background: var(--paper-2); font-size: 13.5px; color: var(--ink-2); line-height: 1.85; }

@media (max-width: 760px) {
  .ml-cands { grid-template-columns: 1fr; max-height: 46vh; }
  .ml-head { gap: 10px; }
  .ml-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ==================== H5 合理化（手机/小平板） ==================== */
/* 原则：能换行就换行，宁可多一行也不横向藏内容；表格可横滑时给明确提示 */
@media (max-width: 900px) {
  /* 表格：可横滑时左右出现渐隐阴影（由脚本加 .is-scroll），滑到端点自动消失 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap.is-scroll {
    background-image:
      linear-gradient(to right, #fffdf9 40%, rgba(255, 253, 249, 0)),
      linear-gradient(to left, #fffdf9 40%, rgba(255, 253, 249, 0)),
      radial-gradient(farthest-side at 0 50%, rgba(31, 35, 40, .13), rgba(31, 35, 40, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(31, 35, 40, .13), rgba(31, 35, 40, 0));
    background-position: 0 0, 100% 0, 0 0, 100% 0;
    background-repeat: no-repeat;
    background-size: 26px 100%, 26px 100%, 11px 100%, 11px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  table.data th, table.data td { padding: 9px 10px; font-size: 13px; word-break: break-word; }

  /* 表单：16px 起步，iOS 聚焦时不会自动放大整页 */
  .field input[type=text], .field input[type=password], .field input[type=number], .field input[type=date],
  .field input[type=email], .field input[type=tel], .field select, .field textarea,
  .searchbar input, .chat-form textarea, .as-find input { font-size: 16px; }
  .field textarea { min-height: 110px; }
  .searchbar input { min-width: 0; }

  /* 富文本工具栏：按钮多了换行，不挤成一条 */
  .rich-toolbar { flex-wrap: wrap; row-gap: 4px; }
  .rich-editor { min-height: 240px; }

  /* 后台标题、按钮、页脚 */
  .admin-head h1 { font-size: 20px; }
  .admin-head > div { display: flex; flex-wrap: wrap; gap: 6px; }
  .panel-title h2 { font-size: 19px; }
  .card { padding: 16px 15px; }
  footer .between { flex-direction: column; align-items: flex-start; gap: 5px; }
  footer { margin-top: 36px; }

  /* 内容里的长链接、长串编号不撑破容器 */
  .card, .article-content, .dm-main, .kin-info, .nudge-info { overflow-wrap: anywhere; }
}

@media (max-width: 640px) {
  /* 数据表：手机上「一行一张卡」，表头自动变成字段名（脚本给 td 加 data-label），不用横滑也能看全 */
  table.data { min-width: 760px; }
  table.data th { white-space: nowrap; }
  table.data td { min-width: 4.5em; word-break: normal; overflow-wrap: anywhere; }
  table.data th:first-child, table.data td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--paper-2);
    box-shadow: 1px 0 0 var(--line-2);
  }
  table.data thead th:first-child { background: #f3eee4; }
  table.data tbody tr:hover td:first-child { background: #fdfaf3; }

  /* 空表：不撑宽度，只留一行提示 */
  table.data.tbl-empty { min-width: 0; }
  table.data.tbl-empty thead { display: none; }

  /* 卡片化（.resp 由脚本加，只对有标准表头的表生效） */
  .table-wrap:has(> table.data.resp) { border: 0; background: transparent; overflow: visible; }
  table.data.resp { min-width: 0; display: block; border-collapse: separate; }
  table.data.resp thead { display: none; }
  table.data.resp tbody { display: block; }
  table.data.resp tr { display: block; background: var(--paper-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 6px 13px 9px; margin-bottom: 10px; }
  table.data.resp tbody tr:hover { background: var(--paper-2); }
  table.data.resp td { display: block; padding: 3px 0 3px 5.4em; text-indent: -5.4em;
    border: 0; min-width: 0; font-size: 13.5px; line-height: 1.7; }
  table.data.resp td::before { content: attr(data-label); display: inline-block; width: 5.4em;
    color: var(--ink-3); font-size: 12.5px; line-height: 1.85; vertical-align: top;
    text-indent: 0; }
  table.data.resp td * { text-indent: 0; }
  table.data.resp td:empty, table.data.resp td:not([data-label]) { display: none; }
  table.data.resp td input, table.data.resp td select { max-width: 100%; }
  table.data.resp td .btn { white-space: nowrap; }
  table.data.resp td:first-child { position: static; box-shadow: none; color: var(--ink-3);
    font-variant-numeric: tabular-nums; }

  .tabs { gap: 2px; }
  .tabs a, .tabs button { padding: 8px 11px; font-size: 13.5px; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick a { padding: 12px 10px; }
  .ritual-bar { gap: 8px; }
  .ritual-btn { flex: 1 1 30%; padding: 9px 8px; }
  .gen-input { gap: 10px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
}

/* ---------- 删除二次确认弹窗 ---------- */
.btn.danger { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.rc-del-modal { position: fixed; inset: 0; z-index: 130; background: rgba(24, 24, 22, .58); display: flex; align-items: center; justify-content: center; padding: 16px; }
.rc-del-modal[hidden] { display: none; }
.rc-del-card { background: #fff; border-radius: 14px; width: min(340px, 100%); padding: 22px 20px 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .28); text-align: center; animation: rcDelIn .18s ease; }
@keyframes rcDelIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rc-del-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-family: "Songti SC", serif; font-size: 22px; font-weight: 700; }
.rc-del-card h3 { margin: 0 0 6px; font-size: 18px; font-family: "Songti SC", serif; }
.rc-del-text { margin: 0 0 4px; font-size: 14px; color: var(--ink); line-height: 1.6; }
.rc-del-hint { margin: 0 0 16px; font-size: 12px; color: var(--ink-3); }
.rc-del-btns { display: flex; gap: 10px; }
.rc-del-btns .btn { flex: 1; margin: 0; justify-content: center; display: inline-flex; align-items: center; }
.rc-del-btns .btn.danger { background: var(--red); color: #fff; }
.rc-del-btns .btn.danger:hover { background: #8f2a23; }
@media (prefers-reduced-motion: reduce) { .rc-del-card { animation: none; } }
.rc-del-hint[hidden] { display: none; }

/* ---------- 生卒日期选择（公元纪年） ---------- */
.cn-date { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cn-date .cn-date-mode { flex: 0 0 auto; width: auto; }
.cn-date .cn-date-full, .cn-date .cn-date-year { flex: 1 1 110px; width: auto; }
.cn-date input.cn-date-text { flex: 1 1 110px; width: auto; }
.field input[name="birth_date"], .field input[name="death_date"] { display: none; }
.field input[name="birth_date"].cn-date-text, .field input[name="death_date"].cn-date-text { display: block; }

/* ==================== 分页器（横排） ==================== */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 14px; margin-top: 16px;
  padding: 10px 2px 2px;
}
.pager-info { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.pager-info b { color: var(--ink); font-weight: 600; }
.pager-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: center; }
.pager-links .pg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--ink-2); font-size: 13px; line-height: 1; white-space: nowrap;
}
.pager-links a.pg-btn:hover { border-color: var(--jade); color: var(--jade); background: var(--jade-soft); }
.pager-links .pg-btn.on { background: var(--jade); border-color: var(--jade); color: #fff; font-weight: 600; }
.pager-links .pg-btn.disabled { color: var(--ink-3); background: var(--line-2); border-color: var(--line-2); cursor: not-allowed; }
.pager-links .pg-gap { color: var(--ink-3); padding: 0 2px; }
.pager-size select {
  height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.pager-size select:hover { border-color: var(--jade); }
@media (max-width: 640px) {
  .pager { justify-content: center; }
  .pager-info { order: 3; width: 100%; text-align: center; }
  .pager-links { order: 1; width: 100%; }
  .pager-size { order: 2; width: 100%; text-align: center; }
  .pager-links .pg-btn { min-width: 32px; height: 30px; padding: 0 8px; }
}

/* ==================== H5 极简版（手机优先） ====================
   思路：顶栏收成一行（品牌 + 汉堡），导航与账号全部进抽屉；
   正文字号、卡片留白、装饰图统一收小；功能一个不少，只是藏进折叠层。 */
.burger { display: none; }
.menu-extra { display: none; }
.nav-head { display: none; }
.nav-mask { display: none; }

@media (max-width: 900px) {
  /* ---- 基础排版收紧 ---- */
  body { font-size: 14px; line-height: 1.62; }
  .wrap { padding: 0 12px; }
  h1 { font-size: 20px !important; line-height: 1.38 !important; }
  h2 { font-size: 17px !important; line-height: 1.4 !important; }
  h3 { font-size: 15px !important; line-height: 1.45 !important; }
  h4 { font-size: 14px !important; }
  .small { font-size: 12.5px; }
  .lead { font-size: 13.5px; }

  /* ---- 顶栏：单行 48px ---- */
  /* topbar 是 sticky，本身即层叠上下文：必须抬它自己，光抬 .wrap / .nav 抬不出这一层，
     否则遮罩(1000)会压住抽屉与汉堡 → 表现为「菜单打开了但点不动」 */
  .topbar { z-index: 1002; }
  .topbar .wrap { height: 48px; padding: 0 12px; gap: 10px; flex-wrap: nowrap; }
  .brand { font-size: 15.5px; gap: 7px; letter-spacing: .04em; }
  .brand .seal { width: 26px; height: 26px; font-size: 14px; border-radius: 5px; }
  .brand .blogo { height: 26px; width: auto; max-width: 96px; border-radius: 5px; }
  .brand > span:last-child { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-right { display: none; }

  .burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    margin-left: auto; flex: 0 0 auto; width: 44px; height: 36px; padding: 0 11px;
    border: 1px solid var(--jade); border-radius: 9px; background: var(--jade); cursor: pointer;
    position: relative; box-shadow: 0 2px 8px rgba(47, 93, 98, .28);
    touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .burger span { display: block; height: 2px; background: #fff; border-radius: 2px;
    transition: transform .2s ease, opacity .16s ease; }
  .burger:active { background: #244b50; border-color: #244b50; }
  /* 菜单打开时：汉堡变「关闭」外观（红底 + 叉），顶栏仍浮在遮罩之上，点它就能收起 */
  body.menu-open .burger { background: var(--red); border-color: var(--red); box-shadow: 0 2px 8px rgba(168, 50, 42, .3); }
  body.menu-open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.menu-open .burger span:nth-child(2) { opacity: 0; }
  body.menu-open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .burger-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
    background: #f0c24b; box-shadow: 0 0 0 1.5px var(--jade); }

  /* ---- 抽屉菜单 ---- */
  .nav { position: fixed; top: 48px; right: 0; bottom: 0; left: auto; width: min(74vw, 290px);
    display: flex; flex-direction: column; align-items: stretch; gap: 0; flex-wrap: nowrap;
    margin: 0; padding: 0 12px 26px; background: var(--paper-2); border-top: 1px solid var(--line);
    border-left: 1px solid var(--line); box-shadow: -12px 0 36px rgba(20, 18, 15, .16);
    transform: translateX(102%); transition: transform .22s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    z-index: 1001; visibility: hidden; pointer-events: none;
    touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
  body.menu-open .nav { transform: none; visibility: visible; pointer-events: auto; }

  /* ---- 抽屉头顶部：带底色的标题条，明确「这是菜单」，并提供关闭按钮 ---- */
  .nav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin: 0 -12px 4px; padding: 10px 12px 11px;
    background: var(--jade-soft); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
  .nh-title { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600;
    color: var(--jade); letter-spacing: .06em; }
  .nh-seal { width: 20px; height: 20px; border-radius: 4px; background: var(--jade); color: #fff;
    display: inline-grid; place-items: center; font-size: 11.5px; font-style: normal; font-family: "Songti SC", serif; }
  .nh-close { flex: 0 0 auto; height: 26px; padding: 0 10px; border-radius: 999px;
    border: 1px solid rgba(47, 93, 98, .3); background: #fff; color: var(--jade);
    font-size: 12px; line-height: 1; cursor: pointer; touch-action: manipulation; }
  body.menu-open { overflow: hidden; }
  .nav a { display: block; width: auto; flex: none; padding: 12px 8px; font-size: 14.5px; color: var(--ink);
    border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; background: none; white-space: normal; }
  .nav a:hover, .nav a.on { color: var(--red); border-color: var(--line-2); background: none; }
  .nav a.on { font-weight: 600; }
  .nav a.on::before { content: ""; display: inline-block; width: 3px; height: 12px; margin-right: 8px;
    border-radius: 2px; background: var(--red); vertical-align: -1px; }
  .menu-extra { display: block; margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); }
  .menu-extra .me-line { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 8px 10px; font-size: 12.5px; color: var(--ink-3); }
  .menu-extra .lang-sw { font-size: 13px; }
  .menu-extra a { font-size: 14px; color: var(--ink-2); }
  .menu-extra a.primary { color: var(--red); font-weight: 600; }
  .menu-extra .top-badge { margin-left: 6px; }

  .nav-mask { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(20, 18, 15, .42);
    opacity: 0; pointer-events: none; transition: opacity .22s; }
  body.menu-open .nav-mask { opacity: 1; pointer-events: auto; }

  /* ---- 卡片 / 间距 ---- */
  .card { padding: 14px 13px !important; border-radius: 9px; }
  .card.tight { padding: 12px !important; }
  section.wrap { padding-top: 10px !important; }
  .mt24 { margin-top: 14px !important; }
  .mt16 { margin-top: 10px !important; }
  .mt8 { margin-top: 6px !important; }
  .mb16 { margin-bottom: 10px !important; }
  .panel-title { margin-bottom: 8px; }
  .panel-title h2 { font-size: 16px !important; }
  .panel-title .line { margin: 0 8px; }
  .row { gap: 8px; }
  .between { gap: 6px; }

  /* ---- 首页 ---- */
  .hero { padding: 16px 0 12px; }
  .home-hero-poem { display: none; }
  .family-mark { width: 32px; height: 32px; font-size: 17px; border-radius: 7px; margin-bottom: 6px; }
  .hero h1, .home-hero-text h1 { font-size: 19px !important; }
  .hero p.lead { font-size: 13px; line-height: 1.7; margin: 6px 0 0;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .searchbar { margin-top: 12px; border-radius: 8px; }
  .searchbar input { padding: 10px 12px; font-size: 14px; min-width: 0; }
  .searchbar button { padding: 0 13px; font-size: 13.5px; white-space: nowrap; flex: 0 0 auto; }
  /* 搜索方式切换：一行放得下四个胶囊，点按区域不小于 28px 高 */
  .srch-form { margin-top: 12px; }
  .srch-tabs { gap: 5px; margin-top: 7px; }
  .srch-tabs span { padding: 5px 9px; font-size: 12px; }
  .srch-hint { margin-top: 6px; font-size: 11.5px; line-height: 1.55; }
  .home-hero .srch-hint { display: none; }
  .srch-name { font-size: 14.5px; }
  .stat-grid { gap: 8px; margin-top: 14px; }
  .stat { padding: 8px 10px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 11.5px; }
  .clan-card { padding: 12px; }
  .clan-card .name { font-size: 15.5px; }
  .clan-card .meta { font-size: 12px; margin-top: 4px; }
  .clan-card .poem { font-size: 12.5px; letter-spacing: .1em; margin-top: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .news-card { padding: 10px 12px; }

  /* ---- 谱页：字辈诗从「半屏大字」收成一行行小字 ---- */
  .poem-big { font-size: 15px !important; letter-spacing: .14em !important; line-height: 2 !important; }

  /* ---- 按钮 / 徽标 ---- */
  .btn { padding: 6px 12px; font-size: 13px; }
  .btn.sm { padding: 4px 9px; font-size: 12.5px; }
  .badge { font-size: 11.5px; padding: 2px 7px; }
  .gen-box { width: 54px; height: 54px; font-size: 20px; }

  /* ---- 图片：装饰图隐藏、内容图限高，避免一张图吃掉一屏 ---- */
  .news-cover img { height: 108px; }
  .art-cover { max-height: 170px; object-fit: cover; width: 100%; }
  .news-item-cover { height: 108px !important; }
  .person-face { width: 52px !important; height: 52px !important; }
  .mem-face.big { width: 68px; height: 68px; font-size: 30px; }
  .mem-face.big img { width: 68px; height: 68px; }
  .table-wrap.is-scroll::after { opacity: .9; }

  /* ---- 页脚 ---- */
  footer { margin-top: 20px !important; padding: 12px 0 18px !important;
    font-size: 11.5px !important; line-height: 1.6; }
  footer .between { display: block; }
  footer .between > div + div { margin-top: 4px; }
}

/* 更窄的机型（iPhone SE 等）再压一档 */
@media (max-width: 380px) {
  body { font-size: 13.5px; }
  h1 { font-size: 18px !important; }
  .hero h1, .home-hero-text h1 { font-size: 17.5px !important; }
  .brand > span:last-child { max-width: 44vw; }
  .stat b { font-size: 18px; }
  .nav { width: 82vw; }
}

/* ---- H5 极简版：族页/树/弹窗的针对性收口 ---- */
@media (max-width: 900px) {
  /* 族人页「生卒籍贯职业…」8 项：保持两列（原先被全局表单规则拉成一列，占掉一屏） */
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px 12px !important; font-size: 13px !important; }
  .info-grid > div > .small { font-size: 11.5px; }
  .info-grid > div > div { line-height: 1.5; }

  /* 家谱树节点：缩小卡片，一屏能多看两三代 */
  .node { min-width: 88px; padding: 6px 9px; border-radius: 7px; }
  .node-name { font-size: 13.5px; }
  .node-meta, .node-spouse { font-size: 10.5px; }
  .node-date { font-size: 10px; }
  .node-self, .node-more { font-size: 9.5px; }
  .tree-scroll { padding: 14px 8px 18px; border-radius: 8px; }
  .tree li { padding: 16px 6px 0; }
  .tree ul { padding-top: 16px; }
  .tree ul::before { height: 16px; }
  .tree li::before, .tree li::after { height: 16px; }
  .tree-more-form { padding: 10px; gap: 8px; }
  .tree-more-form select { font-size: 12px; padding: 4px 6px; }

  /* 命名整改弹窗：窄屏内收，表格自动卡片化后不再横向溢出 */
  #namingFixMask > div { padding: 16px 14px !important; max-height: 88vh !important; }
  #namingFixMask { padding: 12px !important; }
  #namingFixMask h3 { font-size: 16px !important; }
  #namingFixMask .data { font-size: 12.5px; }
}

/* ---- 手机端折叠块（谱系简介等长文）与树横滑提示 ---- */
.tree-swipe-tip { display: none; }
.fold-m > summary { list-style: none; cursor: default; font-size: 13px; color: var(--ink-3); }
.fold-m > summary::-webkit-details-marker { display: none; }
.fold-m > summary::marker { content: ''; }

@media (max-width: 900px) {
  .tree-swipe-tip { display: block; margin: 12px 0 -6px; text-align: center;
    font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
  .fold-m > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    cursor: pointer; padding: 3px 0; font-size: 12.5px; }
  .fold-m > summary::after { content: '展开 ▾'; flex: 0 0 auto; font-size: 11.5px; color: var(--jade); }
  .fold-m[open] > summary::after { content: '收起 ▴'; }
  .fold-m.clan-intro p { font-size: 13px; line-height: 1.9 !important; }
}

/* ---- 手机端「紧凑表」：字段都很短（如搜索结果），一条压成一行，不逐字段堆卡片 ---- */
@media (max-width: 900px) {
  table.data.tbl-compact.resp tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px;
    padding: 9px 12px; margin-bottom: 6px; border-radius: 8px; }
  table.data.tbl-compact.resp td { display: inline; padding: 0; min-width: 0; text-indent: 0;
    font-size: 13px; line-height: 1.65; }
  table.data.tbl-compact.resp td::before { width: auto; font-size: 11px; margin-right: 3px; }
  table.data.tbl-compact.resp td:first-child { flex: 0 0 auto; font-weight: 600; color: var(--ink); }
  table.data.tbl-compact.resp td:first-child::before { content: ''; }
  table.data.tbl-compact.resp td:nth-child(2)::before { content: '·'; color: var(--line); }
  table.data.tbl-compact.resp td:nth-child(3)::before { content: '·'; color: var(--line); }
  table.data.tbl-compact.resp td:nth-child(3) { color: var(--ink-3); font-size: 12px; }
  table.data.tbl-compact.resp td span { font-size: 14px !important; }

  /* 分页器：页码一行，条数与每页选择并排，少占一行 */
  .pager { gap: 6px; margin-top: 10px; padding-top: 6px; }
  .pager-info { order: 2; width: auto; flex: 1; text-align: left; font-size: 12px; }
  .pager-size { order: 3; width: auto; text-align: right; }
  .pager-links { order: 1; width: 100%; }
}

/* ---- 手机端：卡片化表格整体收紧（后台列表一屏能多看几条），紧凑表除外 ---- */
@media (max-width: 900px) {
  table.data.resp:not(.tbl-compact) tr { padding: 5px 10px 7px; margin-bottom: 6px; border-radius: 8px; }
  table.data.resp:not(.tbl-compact) td { padding: 1px 0 1px 6.2em; font-size: 12.5px; line-height: 1.62; }
  table.data.resp:not(.tbl-compact) td::before { width: 6.2em; white-space: nowrap; font-size: 11.5px; line-height: 1.75; }
  table.data.resp:not(.tbl-compact) td .btn { padding: 3px 8px; font-size: 12px; }
  table.data.resp:not(.tbl-compact) td .badge { font-size: 11px; }
}

/* ---- 平板竖屏（761–900px）：保留折叠菜单，但字号、栅格回到桌面比例，别把小屏手机的做法硬套 ----
   放在极简段之后，覆盖同一断点里过小的字号 */
@media (min-width: 761px) and (max-width: 900px) {
  body { font-size: 15px; line-height: 1.7; }
  h1 { font-size: 24px !important; line-height: 1.4 !important; }
  h2 { font-size: 19px !important; }
  h3 { font-size: 16px !important; }
  .hero h1, .home-hero-text h1 { font-size: 26px !important; }
  .hero p.lead { font-size: 14px; -webkit-line-clamp: unset; display: block; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .stat b { font-size: 24px; }
  .stat span { font-size: 12.5px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 18px 16px !important; }
  .nav { width: 320px; }
  .clan-card .name { font-size: 17px; }
  .clan-card .poem { -webkit-line-clamp: unset; }
  .family-mark { width: 40px; height: 40px; font-size: 20px; }
  .poem-big { font-size: 17px !important; }
  .node { min-width: 100px; padding: 8px 12px; }
  .node-name { font-size: 15px; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; font-size: 14px !important; }
}

/* ---- 未登录访客：顶栏保留一个轻量「登录」入口，注册在抽屉里 ---- */
.m-login { display: none; }
@media (max-width: 900px) {
  .m-login { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    margin-left: auto; height: 30px; padding: 0 12px; border-radius: 999px;
    border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; }
  .m-login + .burger { margin-left: 8px; }
}


/* ---- 手机端顶栏抬到 1002（要压住抽屉遮罩 1000），全屏弹窗必须再高一层，否则会被顶栏盖住 ---- */
.crop-modal, .nudge-mask, .rc-del-modal { z-index: 1500; }


/* ---------- 会员中心侧栏品牌 LOGO（后台上传，未传则不显示该区） ---------- */
.side-brand { display: flex; align-items: center; justify-content: center; padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line-2); }
.side-brand img { height: 32px; width: auto; max-width: 100%; object-fit: contain; }
@media (max-width: 900px) {
  .side-brand { padding: 10px 14px 8px; justify-content: flex-start; }
  .side-brand img { height: 28px; max-width: 120px; }
  .side.collapsed .side-brand { display: flex; }
}

/* ---------- 品牌与图标：后台预览卡 ---------- */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.brand-card { border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); padding: 14px; }
.brand-card h4 { font-size: 14.5px; margin: 0 0 2px; }
.brand-card .bc-meta { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.brand-prev { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 78px;
  margin: 9px 0 10px; padding: 8px; border-radius: 8px; background:
  repeating-conic-gradient(#f2ece0 0% 25%, #fffdf9 0% 50%) 50% / 14px 14px; }
.brand-prev img { max-height: 64px; max-width: 100%; object-fit: contain; }
.brand-prev .bp-ico { width: 32px; height: 32px; }
.brand-prev .bp-empty { font-size: 12.5px; color: var(--ink-3); }
.brand-card form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-card input[type=file] { font-size: 12.5px; max-width: 100%; }
@media (max-width: 900px) {
  .brand-grid { grid-template-columns: 1fr; }
  .brand-prev img { max-height: 56px; }
  .brand-prev .bp-ico { width: 28px; height: 28px; }
}

/* ---------- 手机端删除确认：竖排大按钮，拇指好点，避免误触 ---------- */
@media (max-width: 900px) {
  .rc-del-modal { padding: 18px 16px; }
  .rc-del-card { width: 100%; max-width: 340px; padding: 22px 18px 18px; border-radius: 16px; }
  .rc-del-text { font-size: 14.5px; line-height: 1.7; }
  .rc-del-hint { font-size: 12.5px; }
  .rc-del-btns { flex-direction: column-reverse; gap: 9px; margin-top: 14px; }
  .rc-del-btns .btn { min-height: 46px; font-size: 15px; }
}

/* 品牌卡：手机端上传区改成整行大按钮，避免文件框和按钮挤在一行 */
@media (max-width: 900px) {
  .brand-card form { flex-direction: column; align-items: stretch; gap: 7px; }
  .brand-card input[type=file] { width: 100%; }
  .brand-card form .btn { width: 100%; min-height: 40px; }
  .brand-prev { min-height: 66px; }
}
