:root {
  --bg: #faf7f1;
  --card: #ffffff;
  --ink: #2e2a24;
  --ink-soft: #5c5548;
  --muted: #8f8578;
  --line: #ded6c8;
  --line-soft: #ece6da;
  --accent: #8a6746;
  --accent-dark: #6d4f34;
  --green: #46664f;
  --green-soft: #eaf0ea;
  --danger: #a5462f;
  --shadow: 0 1px 2px rgba(60, 45, 25, .05), 0 4px 14px rgba(60, 45, 25, .06);
  --radius: 14px;
  /* 已故人员的统一配色（家庭树 / 直系树 / 全谱 / 父系 / 母系 / 近亲 共用一套）。
     在世是浅蓝、浅粉两档很淡的色相；已故必须一眼分开，所以走「更深的冷灰」，
     比在世的蓝粉明度低整两档，且没有色相。改这一处，六个界面同时生效。 */
  --dead-1: #d8d5cb;
  --dead-2: #b8b5a8;
  --dead-line: #7e7c6f;
  --dead-ink: #3f3e38;
  --dead-soft: #454339;
}

* { box-sizing: border-box; }

/* hidden 属性必须真的藏起来：作者样式里的 display:flex/grid 会盖掉浏览器默认的
   [hidden]{display:none}，所以这里统一兜底（弹窗、去世字段、闰月勾选都靠它） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 40px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px 14px;
  background: linear-gradient(180deg, #fffdf9, #faf7f1);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--green);
  color: #fff;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: .5px;
  cursor: pointer;
}
.brand-text h1:hover { color: var(--accent-dark); }

.stats { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

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

/* ============ 页头聊天新消息提示 ============ */
/* 注意：[hidden] 必须用 !important 压住，否则会被下面的 display:inline-flex 盖掉 */
.chat-tip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px 0 9px;
  border-radius: 999px; cursor: pointer;
  border: 1px solid #cfdccf;
  background: var(--green-soft);
  color: var(--green);
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
  transition: background .15s, box-shadow .15s;
}
.chat-tip[hidden] { display: none !important; }
.chat-tip:hover { background: #e2eee2; box-shadow: 0 0 0 3px rgba(70,102,79,.08); }
.chat-tip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.ct-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #c9544a; flex: 0 0 auto;
  animation: ctPulse 1.9s ease-out infinite;
}
@keyframes ctPulse {
  0%   { box-shadow: 0 0 0 0 rgba(201,84,74,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(201,84,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,84,74,0); }
}
.ct-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #c9544a; color: #fff;
  font-size: 11px; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums;
}
/* 新消息到达时轻轻弹一下，余光能注意到 */
.chat-tip.bump { animation: ctBump .55s ease; }
@keyframes ctBump {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.07); }
}
@media (max-width: 720px) {
  .chat-tip { padding: 0 9px; gap: 6px; }
  /* 手机上保留文字：只留一个红数字，用户不知道那是什么意思 */
  .chat-tip .ct-label { display: inline; font-size: 11.5px; }
}

.search {
  width: 210px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138,103,70,.12); }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: #3a5742; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: #f6f2ea; border-color: var(--accent); }
.btn-danger { background: #fff; border-color: #e2c4ba; color: var(--danger); }
.btn-danger:hover { background: #fbf0ec; }
/* 二次确认态：第一下点完按钮变实心，提示「再点一次」。用于撤销/转让权限这类
   一点就生变、且当事人当场就换了的操作。4 秒没再点自动退回。 */
.btn-danger-armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-armed:hover { background: var(--danger); filter: brightness(.94); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
/* 顶栏两个主控件：新增人员收小、个人设置放大，避免抢戏 */
.top-actions #btnAdd {
  height: 32px; padding: 0 12px; font-size: 12.5px;
  display: inline-flex; align-items: center; justify-content: center;
}

.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 17px; color: var(--muted); padding: 4px 8px; border-radius: 8px;
}
.icon-btn:hover { background: #f2ede4; color: var(--ink); }

/* ---------------- 标签页 ---------------- */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: #fffdf9;
  position: sticky; top: 0; z-index: 20;
}
.tab {
  border: none; background: transparent;
  padding: 12px 14px;
  font-size: 14.5px; font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.tab-spacer { flex: 1; }
/* 导航图标：桌面端跟着文字横排，手机端（见文件末尾）竖排在上方 */
.tab .ico {
  width: 17px; height: 17px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px; margin-right: 5px;
  display: inline-block;
}

/* ---------------- 视图 ---------------- */
.view { display: none; padding: 20px 22px 0; }
.view.active { display: block; }

.focus-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; font-size: 13px; color: var(--muted);
}
.focus-bar strong { color: var(--green); font-size: 14px; }

/* ---------------- 树 ---------------- */
.tree {
  position: relative;
  min-height: 320px;
  /* 放大后在框内滚动查看，而不是把整页拉长。
     高度由 JS 按「视口剩余空间」写入 --tree-max-h：固定 78vh 会让树块底部
     落到手机屏幕外，树内怎么拖都看不到最下面那一代 */
  max-height: var(--tree-max-h, 78vh);
  border-radius: 20px;
  /* 同代人多时可横向滑动：容器滚，页面不滚 */
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  /* ★ 2026-10-24：缩放引擎已下线，画布不再接管手势。
     touch-action:none 会让浏览器连原生滚动都不给，手指怎么推都不动；
     改为交给浏览器做原生横竖滚动（这才是「不缩放」该有的手感）。 */
  cursor: default;
  touch-action: pan-x pan-y;
  /* 中央淡暖色晕开、两侧淡出：树窄时不显空旷，像族谱卷轴 */
  background: radial-gradient(ellipse 62% 78% at 50% 42%,
              rgba(240, 233, 218, .85) 0%,
              rgba(245, 240, 230, .55) 45%,
              rgba(250, 247, 240, 0) 78%);
}
/* 顶栏里"应用名"和"当前家谱名"是两件事：上面一行小字是应用名（云家谱），
   下面 h1 是当前这家谱的名字（可点击改名） */
.app-name {
  margin: 0 0 1px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--muted);
  line-height: 1.2;
}

.tree.dragging { cursor: grabbing; }

/* 缩放用的隐形占位块：transform 不改布局尺寸，靠它撑出真实滚动范围 */
.zoom-spacer {
  position: absolute; left: 0; top: 0;
  width: 1px; height: 1px;
  pointer-events: none; z-index: 0;
}
/* 内容层压在占位块之上，才点得到卡片 */
.tree-inner, .oft-canvas { z-index: 1; }
.tree::-webkit-scrollbar { height: 9px; width: 9px; }
.tree::-webkit-scrollbar-thumb { background: #d8c9b0; border-radius: 6px; }
.tree::-webkit-scrollbar-track { background: transparent; }

/* 家谱外层：让缩放控件浮在右上角，不随内容滚动 */
.tree-wrap { position: relative; }

/* 缩放控件（家谱右上角 / 全谱头部） */
.zoom-bar {
  display: inline-flex; align-items: center; gap: 2px;
  background: rgba(255, 253, 249, .95);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 2px 10px rgba(60, 45, 25, .12);
  padding: 3px;
}
.zoom-bar button {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; color: var(--ink-soft);
  font-size: 15px; line-height: 1;
  height: 27px; min-width: 27px; padding: 0 5px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
/* 全屏后按钮显示「关闭」二字（Boss 2026-10-25：一个图标看不出是干什么的）。
   文字态要放开内边距并禁止换行，否则两个汉字会被挤成竖排或裁掉。 */
.zoom-bar .zoom-full { min-width: auto; padding: 0 8px; white-space: nowrap; letter-spacing: .5px; }
.zoom-bar button:hover { background: #f2ede4; color: var(--ink); }
.zoom-bar button:active { background: #e9e1d3; }
.zoom-bar [data-z="reset"] {
  font-size: 11.5px; font-weight: 650; min-width: 44px; color: var(--muted);
}
/* 复位：独立的按钮，回到 100% 并把视图移回左上（100% 时再点也有反应） */
.zoom-bar [data-z="fit"] {
  font-size: 11.5px; font-weight: 650; min-width: 40px; color: var(--muted);
  border-left: 1px solid var(--line) !important; border-radius: 0 7px 7px 0;
  margin-left: 1px;
}
#treeZoomBar { flex: 0 0 auto; }
/* 家庭树缩放条：只在整屏（body.tree-focus）里出现。
   平时按真实字号排版、装不下就横滑；整屏后屏幕全给树，才需要按百分比看全/看细。
   （Boss 2026-10-25：家庭树全屏后不支持按比例缩放） */
/* ★ 2026-10-26 Boss 定稿：缩放套件不再只在整屏里出现，家庭树随时可放大缩小 */
.tree-zoom-ctl { display: inline-flex; align-items: center; gap: 2px; }
body.tree-focus .tree-zoom-ctl { display: inline-flex; }
.tree-zoom-ctl[hidden] { display: none !important; }
.tree-zoom-ctl .zoom-val {
  font-size: 11.5px; font-weight: 650; min-width: 42px; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
/* 中心人物那一行：左边是中心人物/全谱入口，右边是缩放控件，同一行对齐 */
.focus-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.focus-row .focus-bar { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }

/* 可滑动内容层：宽度按内容撑开，居中靠 margin auto */
.tree-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: max-content;
  margin: 0 auto;
  padding: 24px 24px 34px;
}

/* SVG 谱系连线层：位于卡片之下 */
.tree-lines {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.gen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: none;
  position: relative;
}

.gen-label {
  font-size: 11.5px;
  color: #8b7a60;
  letter-spacing: 3px;
  line-height: 1;
  font-weight: 600;
}

/* 连接线 */
.gen-gap {
  width: 2px;
  height: 34px;
  background: #b09c7d;
  position: relative;
}
.gen-gap::before, .gen-gap::after {
  content: "";
  position: absolute; left: 50%;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #b09c7d;
  transform: translateX(-50%);
}
.gen-gap::before { top: -2px; }
.gen-gap::after { bottom: -2px; }

/* 卡片 */
.pcard {
  position: relative;
  z-index: 1;
  width: 252px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .14s, box-shadow .14s, border-color .14s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(60,45,25,.12);
  border-color: #cbbfa9;
}

/* 男女底色：男浅蓝、女浅粉。放在 is-focus/deceased 之前，
   让「中心人物」「已故」这类更强的语义仍能覆盖它 */
.pcard.sex-m { background: linear-gradient(180deg, #f0f7ff, #daeafb); border-color: #b4d0ec; }
.pcard.sex-f { background: linear-gradient(180deg, #fff3f9, #fbdfea); border-color: #ecbed1; }

.pcard.is-focus {
  border-color: var(--green);
  /* ★ 2026-10-27 Boss 要求「除始祖外卡片大小一致」：高亮原来靠 border-width:2px，
     比别的卡多出 2px（且 .couple 是 stretch，配偶卡会被一起拉高）。
     改成 1px 边框 + 1px 外描边环，视觉仍是 2px 粗线，但外尺寸一分不多。 */
  box-shadow: 0 0 0 1px var(--green), var(--shadow);
  background: linear-gradient(180deg, #fbfdfb, #f4f8f4);
}
.pcard.is-focus::after {
  content: "中心人物";
  position: absolute; top: -9px; left: 10px;
  background: var(--green); color: #fff;
  font-size: 10.5px; letter-spacing: 1px;
  padding: 2px 7px; border-radius: 8px;
}

/* 已故：整张卡换成冷灰麻色（去掉所有色相），跟在世的浅蓝/浅粉一眼分开。
   2026-10-25 Boss 反馈「已故人员卡片底色区别不明显」：原来用的米白 #f6f3ec
   跟在世卡片的浅蓝浅粉明度同档，手机屏上几乎看不出；这里压到灰 #e8e5dc→#cfc9ba、
   边框加深两档，头像也彻底去色。 */
.pcard.deceased { background: linear-gradient(180deg,var(--dead-1),var(--dead-2)); border-color: var(--dead-line); }
.pcard.deceased .pname { color: var(--dead-ink); }
.pcard.deceased .pmeta, .pcard.deceased .prow { color: var(--dead-soft); }
.pcard.deceased .prow .k { color: #55534a; }
.pcard.deceased.sex-m,
.pcard.deceased.sex-f { background: linear-gradient(180deg,var(--dead-1),var(--dead-2)); border-color: var(--dead-line); }
.pcard.deceased .phead .avatar,
.pcard.deceased .pface { filter: grayscale(1) opacity(.8); }
/* 已故卡上的「已故」标签：底色跟着压深，否则浅色胶囊在灰底上浮起来 */
.pcard.deceased .dead-tag { background: #cdcabf; color: #43423b; }

.role-tag {
  position: absolute; top: -8px; left: 10px;
  background: #f1ebe0;
  color: #8a7554;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: .5px;
  border: 1px solid #e6dccb;
}
.pcard.is-focus .role-tag { display: none; }

.pname {
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: .5px;
  margin-top: 3px;
  word-break: break-all;
}
.pmeta { font-size: 12px; color: var(--muted); }
.prow {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  display: flex;
  gap: 4px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.prow .k { color: #b0a696; flex: 0 0 auto; }
.pcard .cross { color: #a58c72; }

.pbadge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: #f3efe7;
  color: #7d6a4f;
  margin-right: 4px;
}

/* 同代分组 */
.group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.group-cards { display: flex; gap: 28px; flex-wrap: nowrap; justify-content: center; align-items: stretch; }
.group-title {
  font-size: 11.5px;
  color: #a89c88;
  letter-spacing: 2px;
}

/* 回收站分组小标题：已删除的家谱 / 已删除的人员 */
.sec-title {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 2px;
  padding: 6px 2px 0;
}
.sec-title:not(:first-child) { margin-top: 10px; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 70px 20px;
  font-size: 14px;
  line-height: 2;
}
.empty-state .big { font-size: 40px; display: block; margin-bottom: 10px; }
.empty-state .empty-hint {
  margin: 8px auto 0; max-width: 34em; font-size: 12px; line-height: 1.6;
  color: var(--muted); text-align: left;
}

/* ---------------- 名单 ---------------- */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  padding-bottom: 30px;
}

.row-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .14s, transform .14s;
  /* ★ 2026-11-01 Boss 第 4 条：千人谱下名单滚动发涩。
     名单是一次性渲染全部人员的，一千多张卡都在文档流里，滚动时浏览器每帧
     都要为屏外的卡重新排版绘制。content-visibility:auto 让屏外卡片跳过渲染，
     滚到眼前再现画；contain-intrinsic-size 给出占位高度，滚动条长度不跳。
     只加在名单卡上——族系页的卡要靠真实尺寸算连线，不能用。 */
  content-visibility: auto;
  contain-intrinsic-size: auto 96px;
}
.row-card:hover { border-color: #cbbfa9; transform: translateY(-1px); }
/* 人员名单里的已故行：素色底，和在世行拉开色差（在世是米白卡片） */
.row-card.is-dead {
  background: linear-gradient(180deg,var(--dead-1),var(--dead-2));
  border-color: var(--dead-line);
}
.row-card.is-dead .rp-name { color: var(--dead-ink); }
.row-card.is-dead .rp-sub { color: var(--dead-soft); }
.row-card .rp-name { font-size: 15.5px; font-weight: 620; }
.row-card .rp-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }

.hint { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

.trash-actions { margin-top: 8px; display: flex; gap: 8px; }

/* ---------------- 弹窗 ---------------- */
/* 全谱浮层的层级要低于人员编辑弹窗（#modal 是 100）：
   在全谱上单击卡片会直接在这之上打开编辑表单，层级相同就会被浮层盖住。
   地址候选浮层是 900，仍在这些之上。 */
.modal-mask.oft-mask { z-index: 90; }

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(38, 32, 24, .42);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-mask[hidden] { display: none; }

.modal {
  background: #fffdfa;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(40,30,15,.28);
  animation: pop .16s ease-out;
}
/* 人员表单更宽：出生/去世两列并排才放得下；手机上仍是满宽 */
#modal .modal { max-width: 800px; max-height: 92vh; }
@media (max-width: 700px) {
  #modal .modal { max-width: 100%; max-height: 94vh; }
}
@keyframes pop {
  from { transform: translateY(8px) scale(.99); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 650; }

.modal-body {
  padding: 16px 18px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 基本身份四格：姓 / 名 / 性别 / 婚姻。桌面一行，窄屏两行两格 */
.grid-id4 { display: grid; grid-template-columns: 1fr 1.15fr 0.85fr 1fr; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-soft); }
.field > span { display: flex; align-items: center; gap: 3px; }
.field .req { color: var(--danger); font-style: normal; }
.field .opt { color: #b0a696; font-style: normal; font-size: 11.5px; }

.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 14.5px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138,103,70,.12);
}
.field textarea { resize: vertical; }

.divider {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 2px;
  color: #b5aa98; font-size: 12px; letter-spacing: 2px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f1ece1;
  border: 1px solid #e3d9c7;
  color: #6d5b42;
  font-size: 12.5px;
  padding: 3px 8px 3px 10px;
  border-radius: 20px;
}
.chip button {
  border: none; background: transparent; cursor: pointer;
  color: #a89478; font-size: 13px; line-height: 1; padding: 0;
}
.chip button:hover { color: var(--danger); }

.spouse-add { margin-top: 2px; }

.form-error {
  background: #fbf0ec;
  border: 1px solid #e8c9bd;
  color: #8f3a24;
  font-size: 13px;
  padding: 8px 11px;
  border-radius: 9px;
}

.modal-foot {
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding: 12px 0 2px;
  margin-top: 2px;
  /* 三个按钮（移入回收站 / 以他为中心查看 / 保存）必须同一行：
     原来 wrap 会在窄屏把「保存」挤到第二行，容易点了上面那个危险按钮 */
  flex-wrap: nowrap;
  position: sticky;
  bottom: 0;
  background: #fffdfa;
  box-shadow: 0 -6px 12px -6px rgba(60, 45, 25, .16);
  z-index: 2;
  padding-bottom: 16px;
}
.modal-foot .spacer { flex: 1; }
/* 字号收小一档，三个按钮并排才放得下（含「以他为中心查看」这种长文案） */
.modal-foot .btn { font-size: 12.5px; padding: 7px 11px; flex: 0 0 auto; }
/* 手机上再收一档，保证 375px 宽也能三个按钮同一行 */
@media (max-width: 430px) {
  .modal-foot { gap: 5px; }
  .modal-foot .btn { font-size: 11.5px; padding: 7px 7px; letter-spacing: 0; }
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%; bottom: 34px;
  transform: translateX(-50%);
  background: rgba(46, 42, 36, .93);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 10px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  max-width: 88vw;
}
.toast[hidden] { display: none; }

/* ---------------- 页脚 ---------------- */
.foot {
  text-align: center;
  color: #b3a999;
  font-size: 12px;
  padding: 24px 20px 8px;
}
.foot code { background: #f2ede4; padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 14px 10px; }
  .brand-text h1 { font-size: 17.5px; }
  .search { width: 100%; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
  /* 「新增人员」在手机上也不该撑满整行 */
  .top-actions #btnAdd { flex: 0 0 auto; }
  .tabs { padding: 0 10px; overflow-x: auto; }
  .view { padding: 14px 12px 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-id4 { grid-template-columns: 1fr 1fr; }   /* 手机上两行两格，姓/名一行、性别/婚姻一行 */
  .pcard { width: 158px; padding: 10px; }
  .pname { font-size: 15px; }
  .gen { gap: 10px; }
  .group-cards { gap: 10px; }
  .modal { max-height: 94vh; }
  .modal-body { padding: 14px 14px 0; }
  .gen-label { display: none; }
}


/* ================================================================
   v1.1 追加：账号页面 / 用户菜单 / 多配偶 / 按婚姻分组的子女块
   ================================================================ */

/* ---------------- 登录 / 注册 ---------------- */
.auth-page { padding-bottom: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 430px; padding: 26px 18px 40px; }
.auth-card {
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 24px 20px;
  box-shadow: 0 10px 34px rgba(60,45,25,.10);
}
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.auth-brand h1 { margin: 0; font-size: 21px; font-weight: 660; letter-spacing: 1px; }
.auth-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.auth-card form { display: flex; flex-direction: column; gap: 13px; }
.btn-block { width: 100%; padding: 11px 16px; font-size: 15px; letter-spacing: 2px; }
.auth-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--muted); flex-wrap: wrap;
}
.auth-foot a { color: var(--accent-dark); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.auth-copy { text-align: center; font-size: 11.5px; color: #b8ae9d; margin: 16px 0 0; }
.hint-line { font-size: 11.5px; color: #a99d8a; line-height: 1.5; }

/* ---------------- 用户菜单 ---------------- */
/* 欢迎语 + 菜单：两件东西绑成一行，窄屏下只会压缩欢迎语，不会折行 */
.greet-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.greet {
  display: flex; align-items: baseline; gap: 2px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
  min-width: 0; max-width: 12em;
}
.greet-hi { flex: 0 0 auto; }
.greet-name {
  color: var(--ink); font-weight: 650; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 9px;
  height: 46px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px 0 7px;
  cursor: pointer; font-family: inherit; font-size: 14.5px; color: var(--ink);
  font-weight: 600;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.user-btn:hover { border-color: var(--accent); background: #fffdf9; }
.user-btn:focus-visible { outline: 2px solid var(--green-soft); border-color: var(--green); }
/* 个人设置入口：做成顶栏最大的按钮，头像同步放大 */
.user-btn .avatar { width: 32px; height: 32px; font-size: 14.5px; border-radius: 9px; }
.avatar {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--green-soft); color: var(--green);
  display: grid; place-items: center; font-size: 13px; font-weight: 650;
}
.user-set { white-space: nowrap; }
/* 登录者姓名直接显示在菜单按钮上：完整显示，不截断（2026-10-25 Boss 要求） */
.user-btn .user-name {
  white-space: nowrap; max-width: none;
  font-size: 14px; font-weight: 650; color: var(--ink);
}
/* 菜单顶部显示「谁 · 什么角色」，替代原来挤在按钮上的用户名 */
.menu-who {
  padding: 7px 10px 8px; margin-bottom: 4px;
  font-size: 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.caret { color: #b7ac9b; font-size: 10px; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 168px; background: #fffdfa;
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(50,38,20,.16);
  padding: 6px; z-index: 60;
  /* 菜单项多（家谱/人员/称谓/数据/个人设置），手机上必须一屏放得下：
     行高压到 34px + 分区标题收紧，再给一层滚动兜底，绝不让「退出登录」掉到屏外。 */
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.menu-pop[hidden] { display: none; }
.menu-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 8px;
  padding: 7px 11px; font-size: 13px; font-family: inherit;
  color: var(--ink-soft); cursor: pointer;
}
.menu-item:hover { background: #f5f0e7; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 5px 4px; }

/* ---------------- 多配偶 ---------------- */
.spouse-col { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.spouse-wrap { position: relative; }
.sp-status {
  position: absolute; right: 8px; bottom: -7px;
  background: #f3efe7; border: 1px solid #e4dac9; color: #7d6a4f;
  font-size: 10.5px; padding: 1px 7px; border-radius: 8px;
}

/* ---------------- 按婚姻分组的子女 ---------------- */
.fam-row {
  display: flex; gap: 16px; flex-wrap: nowrap; justify-content: center;
  align-items: flex-start;
}
.fam-block {
  background: linear-gradient(180deg, #fffefb, #fbf8f2);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px 12px 12px;
  min-width: 210px;
  max-width: 100%;
}
.fam-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 9px;
}
.fam-name { font-size: 13px; color: var(--ink-soft); letter-spacing: .5px; }
.fam-name b { color: var(--green); font-weight: 640; }
.fam-tag {
  font-size: 11px; color: #8d7c60; background: #f2ece1;
  border-radius: 7px; padding: 1px 7px;
}
.fam-add { margin-left: auto; padding: 3px 9px; font-size: 12px; }
.fam-kids { display: flex; gap: 12px; flex-wrap: nowrap; margin-top: 20px; }
.fam-kids .pcard { width: 252px; padding: 12px 13px 10px; }
/* 子女与配偶并排：媳妇/女婿登记后必须能在这行看见，否则「加了配偶树上没变化」 */
.couple { display: flex; align-items: stretch; gap: 22px; }
.couple-sp { display: flex; gap: 12px; align-items: stretch; }
/* 多配偶改为竖排：横排时第二任的连线只能穿过第一任的卡片 */
.couple.multi { align-items: flex-start; }
.couple.multi .couple-sp { flex-direction: column; gap: 12px; }
.couple .pcard { flex: 0 0 auto; }
.fam-empty { font-size: 12.5px; color: #b3a898; padding: 6px 2px 8px; }

/* ---------------- 婚姻行（表单）：两行，避免挤成细条 ---------------- */
.marriage-rows { display: flex; flex-direction: column; gap: 8px; }
.marriage-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #fbf8f2; border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 9px;
}
.mr-top { display: flex; gap: 8px; align-items: center; }
.mr-top .m-spouse { flex: 1 1 auto; min-width: 0; }
.mr-top .m-status { flex: 0 0 88px; }
.mr-dates { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.mr-cap { font-size: 12px; color: #a89c88; flex: 0 0 auto; }
.mr-cap-2 { margin-left: 8px; }
.mr-dates input { text-align: center; padding: 6px 4px; }
.mr-dates .dt-y { flex: 0 0 60px; }
.mr-dates .dt-m, .mr-dates .dt-d { flex: 0 0 42px; }
.marriage-row select, .marriage-row input {
  font-family: inherit; font-size: 13.5px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); outline: none; width: 100%;
}
.marriage-row select:focus, .marriage-row input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138,103,70,.10);
}
.marriage-add { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.mini-select {
  font-family: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}

/* ---------------- 面板 ---------------- */
.modal-wide { max-width: 720px; }
.panel-h { margin: 4px 0 0; font-size: 13px; color: #9c8f7b; letter-spacing: 1.5px; font-weight: 600; }
.panel-form { display: flex; flex-direction: column; gap: 11px; }
.panel-actions { display: flex; justify-content: flex-end; gap: 8px; }
#panelBody { gap: 14px; padding-bottom: 18px; }

/* 邀请码 */
.invite-create { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.invite-create .search { flex: 1; min-width: 160px; width: auto; }
.invite-new {
  background: var(--green-soft); border: 1px solid #cfe0d2;
  border-radius: 12px; padding: 14px;
}
.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px; letter-spacing: 2px; color: var(--green);
  font-weight: 700; margin-bottom: 5px;
}
.invite-meta { font-size: 12px; color: #6d7f6f; margin-bottom: 9px; }
.inv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
}
.inv-prefix { font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; }
.inv-state { font-size: 11.5px; padding: 1px 7px; border-radius: 7px; margin-left: 7px; background: #f1ece1; color: #7d6a4f; }
.inv-state.s-可用 { background: var(--green-soft); color: var(--green); }
.inv-state.s-已使用, .inv-state.s-已过期, .inv-state.s-已吊销 { background: #f4efe9; color: #a1968a; }
.inv-sub { font-size: 11.5px; color: #a99d8a; margin-top: 3px; line-height: 1.6; }

/* 账号列表 */
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.user-row.is-deleted { opacity: .72; background: #faf7f2; }
.user-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: #f1ece1; color: #7d6a4f;
  display: grid; place-items: center; font-size: 14px; font-weight: 650; flex: 0 0 auto;
}
.user-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.uname { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.user-ops { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 7px; font-weight: 500; }
.tag-admin { background: var(--green-soft); color: var(--green); }
.tag-off { background: #f7ece8; color: var(--danger); }
.tag-trash { background: #f1ece1; color: #8b7c66; }

/* 审计 */
.audit-row {
  display: grid;
  grid-template-columns: 132px 132px 92px 1fr;
  gap: 8px; font-size: 12.5px;
  padding: 6px 0; border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
}
.audit-ts { color: #a99d8a; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.audit-act { color: var(--accent-dark); }
.audit-who { color: var(--muted); }
.audit-detail { word-break: break-all; }

/* ---------------- 移动端补充 ---------------- */
@media (max-width: 720px) {
  .auth-wrap { padding: 18px 14px 30px; }
  .auth-card { padding: 22px 18px 18px; }
  /* 移动端也保留「个人设置」文字：按钮名要看得见，只缩字号 */
  .user-set { font-size: 13px; }
  .user-btn { height: 42px; gap: 7px; padding: 0 11px 0 6px; }
  .user-btn .avatar { width: 28px; height: 28px; font-size: 13px; }
  /* 手机端菜单做成贴边浮层（.menu-sheet，由 JS 定位）：
     旧版只有 max-height: calc(100vh - 92px)，但菜单的实际 top 在页面里是「按钮底 + 6px」，
     按钮本身在顶栏里已占 ~100~150px ⇒ 菜单底边超出视口 50px 左右，而内容高度又没超过
     max-height ⇒ 根本不产生内部滚动，手机上一屏看不全也滑不动。
     现在 JS 打开时按「按钮真实底边」算 top / max-height，超出部分由内部滚动承担。 */
  .menu-pop { min-width: 150px; }
  .menu-pop.menu-sheet {
    position: fixed; left: auto; min-width: 0;
    width: min(76vw, 252px); padding: 5px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .menu-pop.menu-sheet .menu-item { height: 34px; }
  /* 缩放控件在手机上收紧，别把全谱头部挤爆 */
  #treeZoomBar { right: 8px; top: 8px; }
  .zoom-bar { padding: 2px; border-radius: 9px; }
  .zoom-bar button { height: 25px; min-width: 25px; font-size: 14px; padding: 0 4px; }
  .zoom-bar [data-z="reset"] { min-width: 40px; font-size: 11px; }
  .oft-sum { display: none; }
  .oft-zoom { margin-right: 0; }
  .marriage-row { grid-template-columns: 1fr 1fr; }
  .marriage-row .m-spouse { grid-column: 1 / -1; }
  .fam-row { gap: 12px; }
  .fam-block { width: auto; }
  .audit-row { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
  .spouse-col { flex-direction: row; flex-wrap: nowrap; }
  .tree-inner { padding: 18px 14px 26px; }
}

/* ================= 家族聊天 ================= */

.tab-badge {
  display: inline-block;
  min-width: 17px;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  vertical-align: 1px;
}

.chat-root {
  height: calc(100dvh - 290px);
  min-height: 380px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 275px minmax(0, 1fr);
  /* 必须显式锁死行高，否则 grid 子项按内容撑开，输入栏会被顶到可视区外 */
  grid-template-rows: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ---------- 会话列表 ---------- */
.chat-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  background: #fffdfa;
}

.chat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
/* 会话栏右上角：提示音开关 + 发起 */
.chat-side-act { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.chat-sound {
  width: 30px; height: 30px; flex: 0 0 30px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); color: var(--ink-soft);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.chat-sound:hover { border-color: var(--accent); }
.chat-sound.is-off { opacity: .55; filter: grayscale(1); }

.chat-rooms { flex: 1; overflow-y: auto; }

.chat-none {
  margin: 0;
  padding: 26px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.chat-room {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}

.chat-room:hover { background: #f7f3ea; }
.chat-room.active { background: var(--green-soft); }

.chat-room-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #efe8db;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
  line-height: 34px;
  text-align: center;
}

.chat-room-icon.group { background: var(--green); color: #fff; }

.chat-room-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.chat-room-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-room-top strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-room-top time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }

.chat-room-prev {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-unread {
  flex: 0 0 auto;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* ---------- 消息区 ---------- */
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;   /* flex 子项默认 min-height:auto，不加这条消息区不会收缩 */
  height: 100%;
}

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 30px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: #fffdfa;
}

.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-title strong {
  overflow: hidden;
  font-size: 14.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat-title span { color: var(--muted); font-size: 11.5px; }

.chat-back { display: none; font-size: 22px; line-height: 1; }

.chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--bg);
  scroll-behavior: smooth;
}

.chat-day { margin: 14px 0 10px; text-align: center; }
.chat-day span {
  padding: 2px 9px;
  border-radius: 9px;
  background: #e9e2d4;
  color: var(--ink-soft);
  font-size: 11px;
}

.chat-sys {
  margin: 9px auto;
  max-width: 80%;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

.chat-msg { display: flex; margin-bottom: 10px; }
.chat-msg.mine { justify-content: flex-end; }

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: min(76%, 520px);
  padding: 8px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 12px 12px 12px 4px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(60, 45, 25, .04);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-msg.mine .chat-bubble {
  border-color: #cfdcd2;
  border-radius: 12px 12px 4px 12px;
  background: var(--green-soft);
}

.chat-sender { color: var(--accent-dark); font-size: 11.5px; font-weight: 600; }

.chat-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

.chat-meta { color: var(--muted); font-size: 10.5px; text-align: right; }

.chat-revoked { color: var(--muted); font-size: 12.5px; font-style: italic; }

.chat-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 9px;
  cursor: zoom-in;
  object-fit: cover;
}

.chat-img.zoom { max-height: none; cursor: zoom-out; }

.chat-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 9px;
  background: #000;
}

.chat-voice { display: flex; align-items: center; gap: 6px; }
.chat-voice audio { max-width: 230px; height: 34px; }

.chat-file {
  color: var(--accent-dark);
  font-size: 13px;
  text-decoration: underline;
}


/* ---------- 输入区（微信式） ---------- */
.wx-compose {
  position: relative;
  border-top: 1px solid var(--line-soft);
  background: #f6f2ea;
  padding: 8px 10px;
}
.wx-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 10px 2px 6px;
}
.wx-panel[hidden] { display: none; }
.wx-panel-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border: 0; border-radius: 12px;
  background: var(--card); color: var(--ink-soft);
  font: inherit; font-size: 12px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 45, 25, .06);
}
.wx-panel-item:hover { color: var(--accent-dark); background: #fffdf6; }
.wx-pi { font-size: 20px; line-height: 1; }
.wx-bar { display: flex; align-items: flex-end; gap: 8px; }
.wx-round {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  font-size: 16px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.wx-round:hover { border-color: var(--accent); color: var(--accent-dark); }
.wx-round[hidden] { display: none; }
.wx-input-wrap { flex: 1; min-width: 0; display: flex; }
.wx-input-wrap textarea {
  flex: 1; min-height: 38px; max-height: 120px;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; line-height: 1.45; resize: none;
}
.wx-input-wrap textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 103, 70, .12);
}
.wx-input-wrap textarea[hidden] { display: none; }
.wx-hold {
  flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px;
  cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  /* 长按不再触发系统的「选择/复制」气泡与长按菜单（Boss 2026-10-25 反馈） */
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.wx-hold[hidden] { display: none; }
.wx-hold.recording { background: #eaf0ea; border-color: var(--green); color: var(--green); font-weight: 600; }
.wx-send {
  flex: 0 0 auto; height: 36px; padding: 0 16px; border: 0; border-radius: 8px;
  background: var(--green); color: #fff; font: inherit; font-size: 14px; cursor: pointer;
}
.wx-send:hover { background: #3b5743; }
.wx-send[hidden] { display: none; }
.wx-hint {
  position: absolute; left: 50%; top: -44px; transform: translateX(-50%);
  padding: 7px 15px; border-radius: 10px; background: rgba(46, 42, 36, .85);
  color: #fff; font-size: 13px; white-space: nowrap; pointer-events: none;
}
.wx-hint[hidden] { display: none; }
.wx-hint.cancel { background: rgba(165, 70, 47, .92); }
/* 录音中放弃：提示条上的「取消」（提示条本身 pointer-events:none，这里单独放开） */
.wx-hint-cancel {
  margin-left: 10px; padding: 2px 10px; border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 7px; background: transparent; color: #fff;
  font: inherit; font-size: 12.5px; line-height: 1.5; cursor: pointer;
  pointer-events: auto;
}
.wx-hint-cancel:hover { background: rgba(255, 255, 255, .16); }

/* 语音条 */
.wx-voice {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 8px 12px; border: 0; border-radius: 10px;
  background: var(--green-soft); color: var(--green);
  font: inherit; cursor: pointer;
}
.chat-msg.mine .wx-voice { flex-direction: row-reverse; background: #dce8dd; }
.wx-voice-wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.wx-voice-wave i { display: block; width: 3px; height: 6px; border-radius: 2px; background: currentColor; opacity: .5; }
.wx-voice-wave i:nth-child(2) { height: 10px; }
.wx-voice-wave i:nth-child(3) { height: 14px; }
.wx-voice.playing .wx-voice-wave i { opacity: 1; animation: wxWave .9s ease-in-out infinite; }
.wx-voice.playing .wx-voice-wave i:nth-child(2) { animation-delay: .15s; }
.wx-voice.playing .wx-voice-wave i:nth-child(3) { animation-delay: .3s; }
@keyframes wxWave { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }
.wx-voice-dur { font-size: 12px; opacity: .75; }

/* 视频封面 */
.wx-video {
  position: relative; display: inline-block; max-width: 230px; line-height: 0;
  border-radius: 10px; overflow: hidden; background: #000; cursor: pointer;
}
.wx-video video { width: 100%; max-height: 240px; display: block; }
.wx-video-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%; padding-left: 3px;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.wx-video.playing .wx-video-play { display: none; }
.wx-video-dur {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; line-height: 1.6;
}

/* 文件卡片 */
.wx-file {
  display: inline-flex; align-items: center; gap: 9px; max-width: 240px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); text-decoration: none;
}
.wx-file-ic { font-size: 19px; color: var(--accent-dark); }
.wx-file-body { display: flex; flex-direction: column; min-width: 0; }
.wx-file-body strong {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.wx-file-body em { font-style: normal; font-size: 11px; color: var(--muted); }

@media (max-width: 640px) {
  .wx-compose { padding: 7px 8px; }
  .wx-hint { top: -40px; font-size: 12px; }
}

/* ---------- 输入区 ---------- */
.chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--line-soft);
  background: #fffdfa;
}

.chat-tools { display: flex; gap: 2px; flex: 0 0 auto; }
.chat-tools .icon-btn { padding: 5px 7px; font-size: 12px; color: var(--ink-soft); }
.chat-tools .icon-btn:hover { color: var(--accent-dark); background: #f2ece0; }
.chat-tools .icon-btn.recording {
  background: #fbe9e4;
  color: var(--danger);
  font-weight: 600;
}

.chat-compose textarea {
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
}

.chat-compose textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 103, 70, .12);
}

.chat-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #e9e2d4;
}
.chat-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width .15s linear;
}

/* ---------- 新建会话 / 群设置 ---------- */
.chat-new-kind { display: flex; gap: 18px; margin-bottom: 4px; font-size: 13.5px; }
.chat-new-kind label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- 选人（新建会话）2026-10-27 重做 ---------- */
.pick-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pick-bar input {
  flex: 1; min-width: 0; height: 34px; padding: 0 11px;
  border: 1px solid var(--line-soft); border-radius: 9px;
  background: #fffdfa; font-size: 13.5px; color: inherit;
}
.pick-bar input:focus { outline: none; border-color: var(--green); }
.pick-mode {
  flex: none; padding: 3px 9px; border-radius: 20px;
  background: var(--green-soft); color: var(--green); font-size: 12px;
}

.pick-chosen { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pick-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border: 1px solid var(--green); border-radius: 15px;
  background: var(--green-soft); color: var(--green);
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.pick-chip span { opacity: .6; font-size: 11px; }

.chat-pick-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 262px; padding: 4px; overflow-y: auto;
  border: 1px solid var(--line-soft); border-radius: 10px; background: #fffdfa;
  -webkit-overflow-scrolling: touch;
}
.chat-pick-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 8px; cursor: pointer;
}
.chat-pick-row:hover { background: var(--green-soft); }
.chat-pick-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick-av {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-soft); color: var(--green);
  font-size: 13px; font-weight: 600;
}
.pick-nm { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-tick { flex: none; font-size: 13px; color: var(--green); opacity: 0; }
.chat-pick-row:has(input:checked) { background: var(--green-soft); }
.chat-pick-row:has(input:checked) .pick-av { background: var(--green); color: #fff; }
.chat-pick-row:has(input:checked) .pick-tick { opacity: 1; }
.chat-pick-row:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: -2px; }
.chat-pick-row.is-deceased { opacity: .5; cursor: not-allowed; }
.chat-pick-row.is-deceased:hover { background: none; }
.pick-empty { padding: 14px 4px 2px; text-align: center; font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .chat-pick-list { max-height: 44vh; }
  .chat-pick-row { padding: 9px; }
  .pick-nm { font-size: 15px; }
  .pick-av { width: 30px; height: 30px; }
}

.chat-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 190px;
  padding: 9px;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fffdfa;
}

.chat-pick-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
}

.chat-pick-item:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
}

.chat-members { display: flex; flex-direction: column; gap: 1px; }

.chat-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 3px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.muted { color: var(--muted); font-size: 11.5px; }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .chat-root { height: calc(100dvh - 250px); min-height: 380px; }

  .chat-layout { grid-template-columns: 1fr; }

  .chat-layout .chat-side { display: flex; }
  .chat-layout .chat-main { display: none; }

  .chat-layout.show-room .chat-side { display: none; }
  .chat-layout.show-room .chat-main { display: flex; }

  .chat-back { display: inline-flex; }

  .chat-bubble { max-width: 84%; }
  .chat-tools { gap: 0; }
  .chat-tools .icon-btn { padding: 5px 6px; }
}

/* ---------------- 家谱切换（多租户） ---------------- */
.tree-switch { display: flex; align-items: center; gap: 6px; }
.tree-select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 5px 8px;
  font-size: 12.5px;
  height: 34px;
  font-family: inherit;
  color: var(--ink);
  max-width: 176px;
}
.tree-select:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }

/* ---------------- 人员卡片头像 ---------------- */
.phead { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.phead .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pavatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line-soft);
  background: #f3efe6;
}
/* 没有头像就用男女剪影（不再留空白框）：同一个人在树、名单、族系里长得一样 */
.pavatar-none {
  display: flex; align-items: center; justify-content: center;
  background: #f1f4f8; border: 1px solid rgba(0, 0, 0, .06);
  overflow: hidden;
}
.pavatar-none svg { width: 100%; height: 100%; display: block; }
.pavatar-none.m { background: #dce9f7; }
.pavatar-none.m svg { fill: #5b8bbf; }
.pavatar-none.f { background: #f9e4ec; }
.pavatar-none.f svg { fill: #c2728f; }
.pavatar-none.u { background: #f2f0ea; }
.pavatar-none.u svg { fill: #b3aa9a; }
.prow.sub { color: var(--muted); font-size: 11.5px; margin-top: -1px; }
.prow.sub .k { visibility: hidden; }

/* ---------------- 表单：头像 ---------------- */
.avatar-edit {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 2px 0 12px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--line-soft);
}
.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #f3efe6;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  flex: none;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-none { color: var(--muted); font-size: 12px; }
.avatar-actions { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.avatar-btns { display: flex; gap: 6px; flex-wrap: wrap; }
label.btn { cursor: pointer; }

/* ---------------- 表单：历法 + 日期三格 + 时辰 ---------------- */
/* 栅格而非 flex：历法 / 年 / 月 / 日 宽度固定成比例，不会再出现 185-115-8 那种挤法 */
/* 年框原来是 minmax(58px,1fr)，桌面端会把剩余空间全吃掉（宽到 200px+），
   看着像个大输入框；现在年固定 92px，多出来的空间留给末尾的空列。 */
.cal-row {
  display: grid;
  grid-template-columns: 76px 92px 62px 62px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
/* 窄屏再收一档：320px 手机上 292+24 会顶到边，这里压到 262 左右 */
@media (max-width: 420px) {
  .cal-row {
    grid-template-columns: 64px 74px 52px 52px minmax(0, 1fr);
    gap: 6px;
  }
}
.cal-row .cal-select {
  width: 100%;
  height: 38px;
  border: 1px solid #d9c9ab;
  border-radius: 9px;
  background: #f7f1e4;
  padding: 0 4px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
}
/* 关键：.field input 有 width:100%，这里必须收回来，否则日期框会被挤成一条 */
.cal-row input { width: 100%; min-width: 0; text-align: center; }
.cal-row input::placeholder { color: #c2b8a6; font-size: 12.5px; }
.cal-row .dt-req { border-color: #d9c39f; background: #fffdf6; }
/* 闰月独占一行，避免和年月日抢宽度 */
.dt-leap {
  grid-column: 1 / -1;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--ink-soft); white-space: nowrap;
  padding: 2px 0 0 2px;
  cursor: pointer;
}
.dt-leap input { width: 15px; height: 15px; margin: 0; }
.dt-leap[hidden] { display: none !important; }

/* 出生 / 去世并排两列：把表单压到一屏内 */
.bio-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.bio-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (max-width: 700px) {
  .bio-cols { grid-template-columns: 1fr; gap: 12px; }
}

/* 历法换算预览：通栏一条，不挤在半列里换行 */
.preview-line {
  display: block;
  font-size: 12px;
  color: #8d7f6b;
  background: #faf6ee;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 7px 10px;
  line-height: 1.5;
  margin-top: -2px;
}
.hint-line.bad { color: var(--danger); }
.field .hint-line { display: block; margin-top: 3px; }
input[type="time"] { font-family: inherit; padding: 8px 11px; line-height: 18px; }

@media (max-width: 720px) {
  .tree-switch { order: -1; width: 100%; }
  .tree-select { flex: 1; max-width: none; }
  .pavatar { width: 28px; height: 28px; }
  .avatar-edit { align-items: flex-start; }
  .avatar-preview { width: 56px; height: 56px; }
}


/* ---------------- 家族成员（同谱互看） ---------------- */

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 14px;
}

.member-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px 13px;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.member-card:hover {
  transform: translateY(-2px);
  border-color: #cdbfa8;
  box-shadow: 0 3px 6px rgba(60,45,25,.07), 0 10px 22px rgba(60,45,25,.09);
}
.member-card.is-self { border-color: #cbb48f; background: #fffdf8; }

.mc-head { display: flex; align-items: center; gap: 11px; }

.mc-avatar {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #a5815d, #7d5c3c);
  color: #fff;
  font-size: 16px; font-weight: 600;
  letter-spacing: .5px;
  user-select: none;
}
.mc-avatar.big { width: 56px; height: 56px; font-size: 22px; }

.mc-name-wrap { min-width: 0; flex: 1 1 auto; }
.mc-name {
  font-size: 15px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-me {
  font-style: normal; font-size: 10px; font-weight: 600;
  color: var(--accent-dark); background: #f2e8da;
  border-radius: 20px; padding: 1px 7px; letter-spacing: .5px;
}
.mc-sub { margin-top: 3px; }
.mc-role {
  font-size: 10.5px; color: #8a7a62;
  background: #f5efe4; border: 1px solid #e8dfcd;
  border-radius: 20px; padding: 1px 7px; letter-spacing: .5px;
}

.mc-rows { margin-top: 12px; border-top: 1px dashed var(--line-soft); padding-top: 9px; }
.mrow {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 12.5px; line-height: 1.95; color: var(--ink-soft);
}
.mrow .k {
  flex: 0 0 34px; color: var(--muted); font-size: 11.5px; letter-spacing: .5px;
}
.mrow > span:last-child {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mrow .muted { color: var(--muted); font-size: 12px; }

.mc-foot {
  margin-top: 11px; padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
  display: flex; justify-content: flex-end;
}
/* 「个人资料」入口：比默认按钮高一点、字号大一档，本人卡片上一眼能找到 */
.mc-self-btn { font-size: 13.5px; padding: 9px 22px; }

.member-hero {
  display: flex; align-items: center; gap: 13px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.mh-name { font-size: 17px; font-weight: 600; color: var(--ink); }
.mh-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.kv {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px dashed var(--line-soft);
  font-size: 13px;
}
.kv > span { color: var(--muted); font-size: 12px; letter-spacing: .5px; flex: 0 0 auto; }
.kv > b { font-weight: 500; color: var(--ink); text-align: right; word-break: break-all; }

@media (max-width: 720px) {
  .member-grid { grid-template-columns: 1fr; gap: 11px; }
  .mrow { font-size: 12px; }
  .kv { font-size: 12.5px; }
}

/* ---- 生平（已故人员，500 字上限） ---- */
.prow.bio-flag { color: #8a6d4a; }
.prow.bio-flag .k { color: #b09c7d; }
#bioBlock textarea { min-height: 96px; line-height: 1.7; resize: vertical; }
#bioCount { font-variant-numeric: tabular-nums; }
#bioCount.over { color: var(--danger); }

/* ---- 已去世开关（默认在世，关掉时隐藏去世字段与生平） ---- */
.deceased-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 12px 0 14px; padding: 10px 12px;
  background: #fdfbf6; border: 1px solid var(--line-soft); border-radius: 10px;
}
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 44px; height: 25px; border-radius: 999px; background: #d6cdbe;
  position: relative; transition: background .18s ease; flex: 0 0 auto;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(60,45,25,.25); transition: transform .18s ease;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(19px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.switch-text::after { content: ""; }

/* 在世时只显示出生一栏，占满整行，右侧不空一块 */
.bio-cols.single { grid-template-columns: 1fr; }

/* ---- 个人资料「公开范围」：两个选项各占一行 ---- */
.privacy-box {
  margin: 14px 0 4px; padding: 12px 14px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: #fdfbf6;
}
.privacy-title { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; letter-spacing: .5px; }
.privacy-box .check {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  padding: 8px 0; font-size: 13px; line-height: 1.55; color: var(--ink-soft); cursor: pointer;
}
.privacy-box .check + .check { border-top: 1px dashed var(--line-soft); }
.privacy-box .check input {
  flex: 0 0 auto; margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--green);
}
.privacy-box .check span { display: block; }
.privacy-box .hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }


/* ---------------- 新建人员：疑似重复提醒 ---------------- */
.dup-warn {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid #e2c98f;
  border-radius: 12px;
  background: #fdf6e6;
}
.dup-title { font-size: 14px; font-weight: 600; color: #7a5a1e; margin-bottom: 8px; }
.dup-list { margin: 0 0 10px; padding-left: 18px; }
.dup-list li { margin: 6px 0; font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.dup-list li b { font-weight: 600; }
.dup-meta { color: var(--ink-soft); margin-left: 6px; }
.dup-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f3e4c0;
  color: #7a5a1e;
  font-size: 12px;
  font-style: normal;
}
.dup-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- 聊天：已去世成员不可选 ---------------- */
.chat-pick-item.is-deceased { opacity: .55; cursor: not-allowed; }
.chat-pick-item.is-deceased input { cursor: not-allowed; }
.dead-tag {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #efe7dc;
  color: var(--muted);
  font-size: 11.5px;
  font-style: normal;
  white-space: nowrap;
}


/* v1.6.1：表单流畅度（输入框字号 / 弹窗滚动隔离 / 已故标签不被压缩） */
.phead .dead-tag { flex: 0 0 auto; }
.row-card .rp-name .dead-tag { margin-left: 7px; font-size: 11px; }

.modal-body { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* iOS 输入框字号 <16px 会自动放大页面，逐格输入来回缩放，看起来"卡" */
@media (max-width: 720px) {
  .modal-body input, .modal-body select, .modal-body textarea { font-size: 16px; }
  /* 例外：绑定家谱人员的两个下拉（成员资料里的 mBindPerson、个人资料里的 pPerson）。
     候选写成「姓名（父亲 X、母亲 Y）（已故）」，16px 下最长一条 330px 而下拉只有 324px，
     尾巴会被切掉 6px。15px 刚好放下（≈309px），比截断强；只降这一处，别的输入框仍 16px
     以免 iOS 聚焦缩放。Boss 2026-10-27：候选要带父母，且不能被切。 */
  #mBindPerson, #pPerson { font-size: 15px; }
}

/* ---------------- 表单顶部「以他为中心」 ---------------- */
/* 放在页面上方：原来在底部按钮行里，要滑到最下面才看得见 */
.form-focus-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 9px 12px;
  background: var(--green-soft);
  border: 1px solid #d8e3d9;
  border-radius: 10px;
}
.form-focus-bar .btn { flex: 0 0 auto; }
.form-focus-bar .hint-line { color: var(--muted); font-size: 12px; margin: 0; }

/* ---------------- 个人页的子女区块 ---------------- */
.child-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.child-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.child-chip:hover { border-color: var(--green); box-shadow: var(--shadow); }
.child-chip:active { transform: scale(.98); }
.child-chip .cc-name { font-weight: 600; font-size: 14px; }
.child-chip .cc-meta { color: var(--muted); font-size: 12px; }
.child-chip .dead-tag { font-style: normal; }
.child-empty {
  padding: 10px 2px 14px;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 720px) {
  .form-focus-bar { padding: 8px 10px; }
  .child-chip { padding: 7px 10px; }
}

/* 地址候选浮层（自绘，替代原生 datalist）：fixed 定位 + 按 visualViewport 翻转，
   手机上不会再被输入法挡住、也不会被弹窗的 overflow 裁掉 */
.addr-suggest {
  position: fixed;
  z-index: 900;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(60, 45, 25, .18);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.addr-suggest .as-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
}
.addr-suggest .as-item.active,
.addr-suggest .as-item:hover { background: rgba(138, 103, 70, .10); }
.addr-suggest .as-txt {
  flex: 1 1 auto;
  min-width: 0;
  /* 地址必须完整显示：允许折行，不做省略号截断 */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
}
.addr-suggest .as-cnt { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .addr-suggest .as-item { padding: 11px 12px; }
}

/* ---------------- 整个家谱（世代总览） ---------------- */
/* 「查看全谱」按钮推到中心栏右侧；手机上提示让位，按钮仍留在右边 */
.focus-all { margin-left: auto; }

.oft-mask { padding: 14px; }
.oft-panel { max-width: 940px; max-height: 92vh; }
.oft-panel .modal-head { align-items: center; gap: 10px; }
.oft-sum { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.oft-fixed { padding: 12px 18px 0; flex: 0 0 auto; }
.oft-body { overflow: auto; padding: 0 18px 20px; touch-action: pan-x pan-y; flex: 1 1 auto; min-height: 0; }
/* 搜索框里要能正常选字、光标定位，手势交还系统 */
.oft-body input { touch-action: auto; }
.oft-zoom { flex: 0 0 auto; margin-right: 4px; }
.oft-tip { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

/* 连线层压在卡片下面，坐标以 .oft-canvas 为基准（它不滚动，滚动的是 .oft-body） */
.oft-canvas { position: relative; }
.oft-lines { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; }

/* 标签 + 这一代内容整体居中：小谱时标签紧贴卡片，不会飘到面板最左边 */
/* 底部留够 34px：同代换行时，亲子横梁要从这一代最后一排卡片下方穿过去，
   只留 22px 会贴到卡片底边，看着像从旁边那家人引出来的 */
.oft-gen { position: relative; display: flex; justify-content: flex-start; gap: 10px; align-items: flex-start; padding: 6px 0 34px; }
.oft-gen-label {
  flex: 0 0 auto; padding-top: 24px;
  font-size: 11.5px; color: var(--accent); letter-spacing: .08em; white-space: nowrap;
}
.oft-row {
  position: relative; z-index: 1; flex: 0 1 auto;
  /* 一代一行、不换行：换行会让「子女对齐父母」失效（跨行无法对齐，连线横穿整幅）。
     人多了就横向滚动 / 缩小 / 切横屏，这才是家谱该有的样子。
     ★ 2026-10-27：align-items 从 flex-start 改成 stretch——卡片按内容自适应后，
       有人多一行「生卒」、有人少一行，同一代的底边就参差不齐（实测 121px / 138px 混排），
       看上去不像同一层。拉伸到行高后一代的底边齐线。 */
  display: flex; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start;
  gap: 10px 12px;
}
/* 夫妻链整体不可断行：一夫多妻时 A ⚭ B ⚭ C 一起换行 */
.oft-group { display: inline-flex; align-items: stretch; gap: 5px; }
.oft-group .oft-card { align-self: stretch; }
.oft-marry {
  align-self: center; width: 22px; height: 0; flex: 0 0 22px;
  border-top: 3px double var(--accent);
}

.oft-card {
  width: 126px; background: var(--card);
  border: 1px solid #d9cdb9; border-radius: 12px;
  padding: 8px 9px 9px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.oft-card:hover { transform: translateY(-2px); border-color: #cbbfa9; box-shadow: 0 6px 18px rgba(60,45,25,.12); }
/* 全谱卡片男女底色（JS 已按性别挂 .m/.f）。先写性别色，再写已故覆盖，
   保证已故的人仍看得出男女，只是整体压灰 */
.oft-card.m { background: #eef5fd; border-color: #cfe0f2; }
.oft-card.f { background: #fdf1f5; border-color: #f2d3de; }
.oft-card.m.is-dead,
.oft-card.f.is-dead,
.oft-card.is-dead { background: linear-gradient(180deg,var(--dead-1),var(--dead-2)); border-color: var(--dead-line); }
.oft-card.is-dead .oft-name { color: var(--dead-ink); }
.oft-card.is-dead .oft-face { filter: grayscale(1); }
.oft-card.is-dead .oft-meta { color: var(--dead-soft); }
.oft-card.is-dead .oft-dead { background: #cdcabf; color: #43423b; }
.oft-card.is-dead .oft-sex { background: #cdcabf; color: #43423b; }

.oft-face {
  width: 26px; height: 26px; border-radius: 50%;
  background: #eef1ec; color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; overflow: hidden; margin-bottom: 5px;
}
.oft-face img { width: 100%; height: 100%; object-fit: cover; }
/* 没照片：男女剪影（与家庭树、族系同一套） */
.oft-face svg { width: 100%; height: 100%; display: block; fill: #93b2d4; }
.oft-card.m .oft-face { background: #e9f1fa; }
.oft-card.f .oft-face { background: #fbeef3; }
.oft-card.f .oft-face svg { fill: #d6a0b2; }
.oft-card.m .oft-face svg { fill: #93b2d4; }
.oft-name { font-size: 14px; font-weight: 620; letter-spacing: .3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; row-gap: 3px; }
.oft-dead {
  font-style: normal; font-size: 10px; color: #8b7f6d;
  background: #f1ece2; border-radius: 5px; padding: 1px 4px; flex: 0 0 auto; }
/* 姓名可省略、性别紧跟其后不被挤走 */
.oft-nm { flex: 0 0 auto; min-width: 0; overflow: visible; text-overflow: clip; white-space: nowrap; }
.oft-sex {
  font-style: normal; font-size: 10px; color: #5f7560;
  background: #edf1ea; border-radius: 5px; padding: 1px 4px; flex: 0 0 auto; }
.oft-meta { margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.45;
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 3px; row-gap: 0; }
/* 一个信息片整体不折行，「生 1951.10」不会被拆成两行 */
.oft-kv { white-space: nowrap; }
.oft-dot { font-style: normal; color: #c8bca8; margin: 0 3px; }

@media (max-width: 700px) {
  .oft-mask { padding: 8px; }
  .oft-panel { max-height: 94vh; }
  .oft-body { padding: 10px 12px 16px; }
  .oft-gen { gap: 6px; padding-bottom: 28px; }
  .oft-gen-label { flex: 0 0 auto; font-size: 10.5px; padding-top: 20px; }
  /* 手机卡片加宽：姓名 + 性别 + 已故 一行放得下，不再缩成「李…」 */
  .oft-card { width: 122px; padding: 7px 8px; }
  .oft-name { font-size: 13.5px; gap: 4px; }
  .oft-meta { font-size: 10.5px; }
  .focus-hint { display: none; }
}


/* ============ 人员名单：辈分排序条 + 计数 + 辈分标签（1.7.4） ============ */
.list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.list-count {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .02em;
}
/* ★ 2026-10-31 Boss 第 2 条：名单页右上角「中心人物」下拉 + 排序，收在一组里靠右。 */
.list-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.list-focus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  padding: 3px 10px 3px 12px;
  font-size: 13px;
  color: var(--muted);
}
.list-focus .lf-label { flex: none; white-space: nowrap; }
.list-focus select {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  max-width: 190px;
  padding: 3px 0;
  cursor: pointer;
}
.list-focus select:focus { outline: none; }
.list-focus:focus-within { border-color: #cdb894; background: #fdf8ef; }
/* ★ 2026-11-01 Boss 第 2 条：原生 <select> 的弹层由浏览器自己画，页面缩放或嵌在滚动容器里
   时框和列表会错位；这里换成自绘按钮 + 弹层，位置由 JS 贴着按钮算，左右不出屏。 */
.lf-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: transparent; font: inherit; font-size: 13px;
  color: var(--ink); padding: 3px 0; cursor: pointer; max-width: 190px; min-width: 0;
}
.lf-btn #listFocusName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-btn:focus-visible { outline: 2px solid #cdb894; outline-offset: 2px; border-radius: 6px; }
.lf-pop {
  position: fixed; left: 0; top: 0; z-index: 95;
  width: min(320px, calc(100vw - 24px));
}
.lf-pop .pick-list { max-height: min(320px, 46vh); }
.list-sort {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}
.list-sort .sort-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 5px 13px;
  cursor: pointer;
  line-height: 1.6;
  font-family: inherit;
  transition: background .15s ease, color .15s ease;
}
.list-sort .sort-btn + .sort-btn { border-left: 1px solid var(--line-soft); }
.list-sort .sort-btn:hover { background: var(--bg); }
.list-sort .sort-btn.active {
  background: var(--accent);
  color: #fff;
}
.gen-tag {
  font-style: normal;
  font-size: 11px;
  color: var(--accent);
  background: #f3ece1;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ============ 查看全谱：顶部搜索条（1.7.4） ============ */
.oft-search-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0 0 8px;
  background: var(--card);
}
.oft-search-bar .search {
  width: 100%;
  box-sizing: border-box;
}


/* ============ 1.8.0 手机端：顶栏主操作行对齐页面宽度 + 中心人物行收缩放 ============ */
@media (max-width: 720px) {
  /* 顶栏改栅格：家谱切换、搜索各占整行；「新增人员」「个人设置」各占一半，左右都贴到页面边距 */
  /* 1.8.4 用 grid-template-areas 固定每一行的归属，不再靠 grid-column/grid-row 硬指。
     1.8.3 把 tree-switch 压在 1fr 格里（211px），里面 select + ＋家谱 + 加入 + 改名 需要 315px，
     于是「加入」「改名」溢出到格子外面、正好被后面的「新增人员」盖住 → 页头看着就乱了。
     现在 row1 整行给家谱切换那一组，row2 = 个人设置 + 新增人员，row3 = 搜索（树页收起）。 */
  .top-actions {
    display: grid !important;
    /* 2.7.1 Boss：新增人员常驻页头，手机端排在家谱下拉框右边（同一排）。
       家谱下拉框收窄（见 .tree-select），个人设置在行尾对齐。 */
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "switch add user"
      "search search search";
    gap: 8px;
    width: 100%;
    align-items: stretch;
  }
  .top-actions .greet-row { justify-self: end; }
  .top-actions .tree-switch { grid-area: switch; width: 100%; min-width: 0; }
  .top-actions .tree-select { flex: 1 1 auto; min-width: 0; max-width: none; }
  .top-actions #btnNewTree,
  .top-actions #btnJoinTree,
  .top-actions #btnRenameTree { flex: 0 0 auto; white-space: nowrap; }
  .top-actions #btnAdd { grid-area: add; width: 100%; flex: none; height: 42px; }
  .top-actions .search { grid-area: search; width: 100%; min-width: 0; }
  /* 欢迎语 + 菜单占 grid 的 user 格；两件在一格里并排，所以手机上也是同一行 */
  .top-actions .greet-row { grid-area: user; width: 100%; min-width: 0; gap: 8px; }
  .top-actions .greet { flex: 1 1 auto; min-width: 0; max-width: none; font-size: 12.5px; }
  .top-actions .greet-name { font-size: 13px; }
  .top-actions .user-menu { width: auto; flex: 0 0 auto; min-width: 0; }
  .top-actions #btnUser { width: auto; justify-content: center; height: 42px; }
  /* 树页不需要搜索框（它是人员名单的过滤器，输入会自动跳到名单页）：收掉这一行，高度全给树 */
  body.tree-tab .top-actions { grid-template-areas: "switch add user"; }
  body.tree-tab .top-actions .search { display: none; }

  /* 标签页：一律单行不换行、不压缩，放不下就横向滑。
     原来 6 个标签在 375px 下会被 flex 压窄，文字折成两行（高度 35 → 50），
     一有角标/改名，标签高度就变，下面的树跟着上下跳 —— 这就是「按钮一交互 UI 就跳」。 */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* body.tree-tab 是 flex 列，标签栏是它的子项：不加这个会被压扁（实测 35 → 25），
       下面的树高度跟着变，也是「UI 一跳一跳」的来源之一 */
    flex: 0 0 auto;
    min-height: 35px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    height: 35px;
    padding: 0 10px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
  }
  .tab-spacer { display: none; }
  /* 「导出备份」钉在标签栏右端：标签可以横向滑，它始终露在外面，不会被挤出屏幕只剩一个「导」字 */
  #btnExport {
    flex: 0 0 auto;
    position: sticky;
    right: 0;
    margin-left: auto;
    background: #fffdf9;
    padding-left: 8px;
    box-shadow: -10px 0 10px -10px rgba(0, 0, 0, .28);
  }

  /* 中心人物那一行：缩放控件移到同行后收紧尺寸，保证 375px 不换行 */
  .focus-row { gap: 6px; margin-bottom: 10px; }
  /* 360px 这类窄屏上「中心人物：xxx + 查看全谱」本来会折成两行，行高一变树就往下跳：
     这里锁成单行，名字过长就省略，按钮不参与压缩 */
  #treeFocusBar {
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap; overflow: hidden;
  }
  #treeFocusBar strong { overflow: hidden; text-overflow: ellipsis; }
  #treeFocusBar #btnFullTree { flex: 0 0 auto; }
  /* 「· 单击卡片编辑，双击卡片以他为中心…」这行说明文字在手机上会把中心人物那行顶成两行，
     行高一变树就往下跳，窄屏上直接收起（交互提示由首次拖动那颗气泡承担） */
  .focus-row .focus-hint { display: none; }
  #treeFocusBar { flex-wrap: nowrap; }
  .focus-row .focus-bar { gap: 6px; font-size: 12px; }
  .focus-row .focus-bar strong { font-size: 13px; }
  #btnFullTree { padding: 0 8px; height: 28px; font-size: 12px; }
  .zoom-bar { padding: 2px; }
  .zoom-bar button { height: 28px; min-width: 26px; font-size: 14px; padding: 0 4px; }
  .zoom-bar [data-z="reset"] { min-width: 38px; font-size: 10.5px; }
  .zoom-bar [data-z="fit"] { min-width: 34px; font-size: 11px; }
}

/* ============ 1.8.2 手机端：顶栏瘦身 + 家庭树占满剩余屏幕 + 全屏看树 ============ */
@media (max-width: 720px) {
  /* 顶栏省一行一行抠出来的高度，全给树（原来树只分到半屏，拖起来像被卡住） */
  .topbar { padding: 9px 12px 7px; gap: 6px; }
  .app-name { font-size: 10px; margin-bottom: 0; letter-spacing: 1.5px; }
  .brand { gap: 8px; }
  .brand h1 { font-size: 17px; }
  .stats { margin-top: 0; font-size: 11px; }
  .tabs { padding: 0 8px; }
  .tab { padding: 8px 9px; font-size: 12.5px; }
  .view { padding: 8px 12px 0; }

  /* 家庭树这一屏：顶栏以下整屏都归树，页面本身不再滚（底部不会多出一段空滚动） */
  body.tree-tab {
    height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
    padding-bottom: 0;
  }
  body.tree-tab main {
    flex: 1 1 auto; min-height: 0; overflow: hidden;
    display: flex; flex-direction: column;
  }
  body.tree-tab #viewTree.active {
    display: flex; flex-direction: column;
    flex: 1 1 auto; min-height: 0; padding-bottom: 6px;
  }
  body.tree-tab #viewTree .focus-row { flex: 0 0 auto; }
  body.tree-tab #viewTree .tree-wrap { flex: 1 1 auto; min-height: 0; }
  /* 1.8.3 树页把底部页脚（版本号那一行，63px）收起来：它吃掉的高度直接给树，
     否则树块只有半屏，看着像「怎么拖都到不了底」。其他页签照旧显示。 */
  body.tree-tab .foot { display: none; }
  body.tree-tab #viewTree .tree { height: 100%; max-height: none; min-height: 0; }
}

/* 全屏看树：顶栏和标签收起，树吃满整屏；退出按钮就在缩放条上 */
body.tree-focus { overflow: hidden; }
body.tree-focus .topbar,
body.tree-focus .tabs { display: none; }
body.tree-focus #viewTree.active { height: 100dvh; padding: 6px 10px 8px; }
body.tree-focus #viewTree .focus-row { margin-bottom: 6px; }
body.tree-focus #btnTreeFull { background: var(--green); color: #fff; }
body.tree-focus #btnTreeFull:hover { background: #3b5541; color: #fff; }

/* 树块右下角提示：内容超出时能拖（首次进树出现，拖一下就淡出） */
.tree-drag-hint {
  position: absolute; right: 12px; bottom: 10px; z-index: 5;
  padding: 5px 9px; border-radius: 999px;
  background: rgba(70, 102, 79, .88); color: #fff;
  font-size: 11.5px; pointer-events: none;
  opacity: 0; transition: opacity .25s ease;
}
.tree-drag-hint.show { opacity: 1; }
.tree-wrap { position: relative; }


/* ---------------- 亲属称谓与排行 ---------------- */
/* 树卡片、人员名单里跟在姓名后的称谓（三姐 / 五外甥女） */
.kin-tag {
  flex: 0 0 auto;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(138, 103, 70, .12);
  color: #6d5138;
  font-size: 11px;
  font-style: normal;
  line-height: 17px;
  white-space: nowrap;
}
.row-card .kin-tag { font-size: 12px; line-height: 18px; }
.phead .kin-tag { align-self: center; }
/* 编辑弹窗顶部：与中心人物的关系 */
.kin-line {
  font-size: 13px;
  color: #6d5138;
  background: rgba(138, 103, 70, .09);
  border-radius: 7px;
  padding: 3px 8px;
}

/* ============ 1.9.3 树卡片精简 + 中心行收紧 ============ */
/* 手机端「查看全谱」缩成「全谱」，把宽度让给中心人物姓名和缩放条 */
.lbl-narrow { display: none; }

@media (max-width: 720px) {
  /* 树卡片只显示生卒年月后，姓名是第一位信息：
     卡片略微加宽、头像缩小、小标签字号收小，避免「已故 / 四姐」把姓名挤成省略号 */
  .pcard { width: 176px; }
  .phead { gap: 6px; }
  .phead .pavatar { width: 30px; height: 30px; }
  .phead .pname { font-size: 15.5px; letter-spacing: 0; }
  .phead .dead-tag { font-size: 9.5px; padding: 0 3px; }
  .phead .kin-tag { font-size: 10px; padding: 0 4px; margin-left: 2px; }
}

@media (max-width: 430px) {
  /* 窄屏（320~430）：缩放条整体收紧。实测 320px 下原尺寸让「查看全谱」与缩放条
     重叠 42px，压住中心人物姓名——根因是 focus-bar 需要的宽度大于分到的宽度 */
  .lbl-wide { display: none; }
  .lbl-narrow { display: inline; }
  .focus-row { gap: 5px; }
  #treeFocusBar { gap: 4px; }
  #btnFullTree { padding: 0 6px; height: 27px; font-size: 11.5px; }
  .zoom-bar { padding: 1px; gap: 1px; }
  .zoom-bar button { height: 26px; min-width: 22px; font-size: 13px; padding: 0 2px; }
  .zoom-bar [data-z="reset"] { min-width: 30px; font-size: 10px; font-weight: 600; }
  .zoom-bar [data-z="fit"] { min-width: 27px; font-size: 10px; }
  .zoom-bar .zoom-full { min-width: auto; padding: 0 5px; font-size: 11.5px; }

  /* 全谱头部：加了「全屏」按钮后，320px 一行的宽度不够，
     标题会被压成 28px（实测「整个家谱」只剩一个字的宽度）。
     改成两行：标题 + 关闭一行，缩放条整行居中放下。 */
  .oft-panel .modal-head { flex-wrap: wrap; row-gap: 6px; }
  .oft-panel .modal-head h2 { flex: 0 0 auto; }
  .oft-panel .modal-head > #oftClose { flex: 0 0 auto; }
  .oft-panel .oft-zoom { flex: 1 0 100%; order: 3; justify-content: center; }
  .oft-panel .modal-head .oft-sum:empty { display: none; }
}

/* ============ 横屏查看（1.9.4）：整体旋转 90°，手机上等于一整屏横屏 ============ */
/* 旋转的是面板本身：宽高交换后按竖屏尺寸铺满，视觉上就是横着的一整屏。
   拖动/缩放的坐标换算在 makeZoomable 里做（rotate 选项），这里只管版式。 */
.land-rot {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  width: 100vh !important;
  width: 100dvh !important;
  height: 100vw !important;
  height: 100dvw !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transform: translate(-50%, -50%) rotate(90deg) !important;
  transform-origin: center center !important;
  z-index: 950 !important;
  background: var(--bg);
}
/* 横屏后树区、全谱画布都要吃满旋转后的高度 */
.tree-wrap.land-rot { padding: 0 !important; }
.tree-wrap.land-rot #treeCanvas,
.tree-wrap.land-rot .tree { height: 100% !important; max-height: none !important; }
.land-rot .oft-fixed { padding: 8px 16px 0; }
.land-rot .oft-body { padding: 0 16px 12px; }

/* 横屏退出按钮：容器旋转成 fixed 盖满屏（z-index 950）后，顶栏的退出键点不到，
   这个按钮不参与旋转、层级在旋转容器之上，固定在屏幕右上角。 */
.land-exit {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: rgba(38, 34, 30, .88);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  -webkit-tap-highlight-color: transparent;
}
.land-exit.show { display: inline-flex; }
.land-exit:active { background: rgba(38, 34, 30, .98); }

.zoom-bar .zoom-land { min-width: 24px; font-size: 13px; }
.zoom-bar .zoom-land.on { background: var(--green); color: #fff; }

/* ============ 全谱全屏（2.0.9）：去掉浮层留白，画布吃满整屏 ============ */
/* 原来全谱最外圈有 14px 留白 + 940px 限宽 + 92vh 限高，手机上等于四面各让一截，
   人多时一屏看到的更少。全屏就是把这些让位全收掉。 */
.oft-mask.fs { padding: 0; backdrop-filter: none; }
.oft-panel.fs {
  max-width: none !important;
  max-height: none !important;
  width: 100vw;
  height: 100dvh;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}
/* 全屏状态没有外圈留白可点，说明行收掉，把这一行还给画布 */
.oft-panel.fs .oft-tip { display: none; }
.oft-panel.fs .modal-head { padding: 10px 12px 8px; }
.oft-panel.fs .oft-fixed { padding: 6px 12px 0; }
.oft-panel.fs .oft-body { padding: 0 12px 10px; }
.zoom-bar .zoom-full.on { background: var(--green); color: #fff; }


/* ---------------- 系统状态条（试用 / 到期 / 新版本） ---------------- */
.sys-bars { display: flex; flex-direction: column; }
.sys-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; font-size: 13px; line-height: 1.4;
  border-bottom: 1px solid var(--line-soft);
}
.sys-bar .sb-txt { flex: 1; min-width: 0; }
.sys-bar.lic-trial { background: #fdf6e7; color: #7a5316; }
.sys-bar.lic-expired, .sys-bar.lic-tampered { background: #fbeee9; color: #8f3a22; }
.sys-bar.upd { background: var(--green-soft); color: #2f5040; }
.sys-bar .sb-link { color: var(--green); text-decoration: none; font-weight: 600; white-space: nowrap; }
.sys-bar .sb-x {
  border: 0; background: transparent; color: inherit; opacity: .55;
  font-size: 14px; cursor: pointer; padding: 2px 4px; border-radius: 6px;
}
.sys-bar .sb-x:hover { opacity: 1; background: rgba(0,0,0,.06); }
.btn-xs { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }

/* ---------------- 授权面板 ---------------- */
.lic-card {
  border: 1px solid var(--line-soft); border-radius: 12px;
  background: #fcfaf6; padding: 4px 12px; margin-bottom: 12px;
}
.lic-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft);
  font-size: 13.5px;
}
.lic-row:last-child { border-bottom: 0; }
.lic-row > span { color: var(--muted); flex: none; }
.lic-row > b { text-align: right; word-break: break-all; }
.lic-st.lic-active { color: var(--green); }
.lic-st.lic-trial { color: #a5761d; }
.lic-st.lic-expired, .lic-st.lic-tampered { color: var(--danger); }
.lic-mc {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; letter-spacing: .3px; cursor: copy;
  background: #fff; border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 3px 7px;
}
.lic-mc-sm { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
/* 机器码要能一键复制：标签 + 复制按钮占一行，机器码整行铺开，手机上点得到也看得全 */
.lic-row-mc { flex-wrap: wrap; row-gap: 6px; }
.lic-row-mc > .btn { margin-left: auto; }
.lic-row-mc > .lic-mc { flex: 1 0 100%; text-align: center; padding: 7px 9px; font-size: 13px; }
.lic-mc:hover { background: #fbf7ef; }
.lic-mc:active { background: var(--line-soft); }
.lic-note { color: var(--muted); font-size: 12.5px; line-height: 1.65; margin: 10px 0 0; }
/* 授权申请时效说明 + 作者联系方式（写明多久处理、找不到人往哪找） */
.lic-contact {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lic-contact-t {
  margin: 0;
  padding: 9px 12px;
  background: #fffaf0;
  border: 1px solid #f0e2c4;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.7;
}
.lic-contact-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lic-contact-q { font-size: 13px; color: var(--ink-soft); }
.lic-contact-q b { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; color: var(--ink); }
.lic-contact-qr[hidden] { display: none !important; }
.lic-contact-qr { padding: 10px; gap: 6px; }
.lic-contact-qr img { width: min(52vw, 168px); max-height: 26vh; }
.lic-sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.lic-manual { display: flex; gap: 8px; }
.lic-manual input {
  flex: 1; min-width: 0; padding: 9px 10px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.lic-done { text-align: center; padding: 18px 6px; }
.lic-done b { font-size: 17px; color: var(--green); }

/* ---------------- 扫码付款 ---------------- */
.pay-wrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.pay-qr {
  width: 210px; height: auto; border-radius: 12px;
  border: 1px solid var(--line-soft); background: #fff; flex: none;
}
.pay-side { flex: 1; min-width: 220px; }
.pay-amt { font-size: 26px; font-weight: 700; color: var(--danger); margin-bottom: 8px; }
.pay-line { font-size: 13.5px; margin-bottom: 6px; color: var(--ink-soft); }
.pay-oid {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px; letter-spacing: 2px; color: var(--ink);
}
.pay-steps { margin: 12px 0 8px; padding-left: 20px; font-size: 13px; line-height: 1.85; color: var(--ink-soft); }
.pay-steps em { font-style: normal; color: var(--danger); font-weight: 600; }
.pay-status {
  font-size: 13px; padding: 8px 10px; border-radius: 8px;
  background: #f4f1ea; color: var(--ink-soft); margin-bottom: 10px;
}
.pay-status.wait { background: #fdf6e7; color: #7a5316; }
.pay-status.ok { background: var(--green-soft); color: #2f5040; font-weight: 600; }
.pay-status.bad { background: #fbeee9; color: #8f3a22; }
.pay-banner {
  font-size: 13px; line-height: 1.65; padding: 9px 11px; border-radius: 8px;
  background: #fdf6e7; color: #7a5316; border: 1px solid #f0dfb8; margin-bottom: 10px;
}

@media (max-width: 560px) {
  .pay-wrap { gap: 12px; }
  .pay-qr { width: 100%; max-width: 260px; margin: 0 auto; display: block; }
  .pay-side { min-width: 0; }
  .sys-bar { padding: 7px 12px; font-size: 12.5px; gap: 8px; }
}


/* ============ 直系世代树（家庭树只画直系：上2代·本人·下2代） ============
   行之间的连线由 SVG 按「卡片自报的父母 id」画，所以这里的行间距只要留白，
   不能再用 .gen-gap 那条装饰竖线+圆点，否则会多出一条跟关系无关的线。 */
.gen-lvl + .gen-gap {
  background: none;
  height: 46px;
}
.gen-lvl + .gen-gap::before,
.gen-lvl + .gen-gap::after {
  display: none;
}
/* 行内卡片不换行，多了靠整块滚动（树本来就是可拖动可缩放的画布） */
.gen-lvl .group-cards {
  flex-wrap: nowrap;
}
/* 直系树里「本人」这一行要突出，但不能靠变大挤压别人 */
.gen-lvl.gen-self .pcard.is-focus {
  box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(120, 90, 50, .18);
}
/* 直系树卡片：头像略小、间距略紧，给「姓名 + 已故」腾地方。
   实测 375px 下 176px 卡片里姓名只剩 45px，而「李友乐」+已故标签需要 47px，
   差 2px 就被压成省略号（不是卡片窄，是同排的已故标签挤的）。 */
.gen-lvl .phead { gap: 5px; }
.gen-lvl .phead .pavatar { width: 24px; height: 24px; }
.gen-lvl .phead .dead-tag { margin-left: 2px; }


/* ==================== 版本与更新面板 ====================
   之前这个面板的 .upd-* 类**一条样式都没有**（只有 .sys-bar.upd 那条横幅），
   于是「获取新版」里那张 QQ 群码按图片原始尺寸渲染：
   源图 1217x2164 的海报在 375px 手机上直接把面板撑爆 —— 这就是
   「Q 群码在移动端没适配」的真因。这里补齐整套样式，并把图限制在容器内。 */
.upd-box { display: flex; flex-direction: column; gap: 10px; }

.upd-head {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.upd-head.is-new { background: #fdf3e6; color: #7d5220; border: 1px solid #f0dcc0; }
.upd-head.is-latest { background: var(--green-soft); color: #2f5040; border: 1px solid #d9e4da; }

.upd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line-soft);
}
.upd-row b { color: var(--ink); font-weight: 650; }

.upd-notes { padding: 4px 2px 0; }
.upd-lbl { font-size: 12px; color: var(--muted); letter-spacing: .5px; margin-bottom: 5px; }
.upd-note-txt { font-size: 13px; line-height: 1.72; color: var(--ink-soft); white-space: pre-wrap; }

/* 群码卡片：图永远不超出面板宽度与屏高 */
.upd-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin: 2px 0 0;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.upd-qr img {
  display: block;
  width: min(58vw, 210px);
  max-width: 100%;
  max-height: 32vh;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.upd-qr-t { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.55; }
.upd-qr-g { font-size: 14px; font-weight: 650; letter-spacing: .6px; color: var(--ink); }

.upd-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }

@media (max-width: 430px) {
  .upd-qr { padding: 10px; gap: 6px; }
  .upd-qr img { width: min(54vw, 176px); max-height: 28vh; }
  .upd-qr-t { font-size: 11.5px; }
  .upd-row { font-size: 13px; }
  .upd-actions .btn { width: 100%; }
}


/* ================= 别名（小名） ================= */

.alias-field { margin-top: 2px; }
.alias-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 2px 0 6px;
}
.alias-chips:empty { margin: 0; }
.alias-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 10px;
  background: var(--green-soft);
  border: 1px solid #cfdccf;
  border-radius: 999px;
  font-size: 13px; color: var(--green);
  line-height: 1.5;
}
.alias-x {
  border: 0; background: transparent; color: var(--green);
  font-size: 15px; line-height: 1; cursor: pointer;
  padding: 2px 5px; border-radius: 999px; opacity: .7;
}
.alias-x:hover { background: #d8e4d8; opacity: 1; }
.alias-field input { width: 100%; }

/* 名单里的小名标：跟姓名同一行，弱化处理，不抢姓名 */
.row-card .rp-name .alias-tag {
  display: inline-block; margin-left: 7px;
  padding: 0 7px; border-radius: 999px;
  background: #f3ecdd; border: 1px solid #e3d7c0;
  color: #8a6746; font-size: 11.5px; font-style: normal;
  font-weight: 500; line-height: 18px; vertical-align: 1px;
}

/* 名单里的字辈标：跟代数标并排，绿调弱化，不压过姓名 */
.row-card .rp-name .genchar-tag {
  display: inline-block; margin-left: 5px;
  padding: 0 6px; border-radius: 999px;
  background: var(--green-soft); border: 1px solid #cfdccf;
  color: var(--green); font-size: 11px; font-style: normal;
  font-weight: 500; line-height: 18px; vertical-align: 1px;
  white-space: nowrap;
}

/* 排行 / 字辈 / 号：表单里一行三列，窄屏叠成两列、号独占一行 */
.rank-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.7fr;
  gap: 12px;
  margin-top: 6px;
  align-items: start;
}
.rank-row input { width: 100%; box-sizing: border-box; }
/* 排行的即时回显：填 2 → 「＝ 二哥」，就在输入框下面一行小字，不占额外高度 */
.rank-row .rank-hint {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-style: normal;
  color: var(--accent-dark, #6b5b45);
  font-weight: 600;
  line-height: 1.4;
}
.rank-row .rank-hint[hidden] { display: none; }
@media (max-width: 640px) {
  .rank-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .rank-row .field:last-child { grid-column: 1 / -1; }
}

/* ================= 人员名单分组（在世 / 已故） ================= */

.list-group { margin-bottom: 14px; }
.list-group:last-child { margin-bottom: 0; }

.group-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 12px; margin-bottom: 10px;
  background: #fffdf8; border: 1px solid var(--line);
  border-radius: 11px; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--ink);
  transition: background .15s, border-color .15s;
}
.group-head:hover { background: #f8f3e9; border-color: #cbbfa9; }
.gh-caret {
  display: inline-block; width: 14px; color: var(--muted);
  transition: transform .18s ease; transform: rotate(0deg);
}
.list-group.closed .gh-caret { transform: rotate(-90deg); }
.gh-title { font-size: 15px; font-weight: 650; letter-spacing: .5px; }
.list-group.dead .gh-title { color: #7d5a4a; }
.gh-count {
  font-size: 12px; color: var(--ink-soft);
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 1px 9px;
}
.gh-hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.list-group.closed .gh-hint::after { content: "（已收起）"; }
.empty-state.slim { padding: 14px 12px; font-size: 13px; }

/* 人员名单左右分列：已故在左、在世在右。
   老版两组是上下排的整幅网格（每行 auto-fill 到三四张卡），人一多页面就长得看不到底。
   现在外层两列并排、列内竖排单列——同样的人数，页面高度直接减一半；
   窄屏（≤880px）自动叠回一列，已故仍在前面。 */
.roster-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 22px;
  align-items: start;
  padding-bottom: 30px;
}
.roster-col { min-width: 0; }
.roster-col .list-group { margin-bottom: 10px; }
.roster-col .group-body {
  /* 列内自适应分列：屏幕够宽就自动多排，40 位在世族人不再排成一条 3000px 的长柱。
     最少 260px 一列，人多时自动 2~3 排；手机宽只剩一列，不会挤。 */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding-bottom: 0;
  align-content: start;
}
.roster-col .row-card { padding: 11px 13px; }
.roster-col .row-card .rp-sub { line-height: 1.55; }
@media (max-width: 880px) {
  .roster-cols { grid-template-columns: 1fr; gap: 4px; }
}

/* ================= 祠堂 ================= */

.shrine {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 26px 26px 22px;
  background:
    radial-gradient(1000px 380px at 50% -120px, rgba(255, 194, 118, .20), rgba(255, 194, 118, 0) 72%),
    radial-gradient(130% 105% at 50% 0%, #4a2117 0%, #2a100b 56%, #140706 100%);
  box-shadow: inset 0 0 0 1px rgba(212, 176, 110, .32),
              inset 0 -70px 110px rgba(0, 0, 0, .52),
              0 18px 46px rgba(40, 18, 8, .30);
  color: #efe2c8;
}

/* 神龛帷幔：垂下的暗金织锦 */
.shrine::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 214, 150, .05) 0 1px,
      rgba(0, 0, 0, 0) 1px 18px,
      rgba(255, 214, 150, .028) 18px 19px,
      rgba(0, 0, 0, 0) 19px 42px),
    radial-gradient(120% 60% at 50% -6%, rgba(255, 196, 120, .10), rgba(0, 0, 0, 0) 72%);
}
/* 龛顶横梁的压暗 */
.shrine::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 96px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
}
.shrine > * { position: relative; z-index: 1; }

/* ---------- 龛额（匾）---------- */
.shrine-head { text-align: center; padding: 0 0 2px; }
.shrine-name {
  display: inline-flex; align-items: center; gap: 18px;
  margin: 0; font-weight: 500; letter-spacing: 14px; text-indent: 14px;
  font-size: 26px; line-height: 1.2;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  color: #f3dda6;
  text-shadow: 0 1px 0 rgba(60, 26, 12, .9), 0 0 22px rgba(255, 198, 116, .26);
}
.shrine-name::before, .shrine-name::after {
  content: ""; width: 46px; height: 1px; flex: none;
  background: linear-gradient(90deg, rgba(212, 176, 110, 0), rgba(226, 190, 124, .72));
}
.shrine-name::after { transform: scaleX(-1); }
.shrine-sub {
  margin: 9px 0 0; font-size: 12.5px; color: #b19b7c;
  letter-spacing: 1.2px; text-indent: 1.2px;
}

.shrine-meters { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
/* 祖先堂右上角的外姓牌位开关（Boss 2026-10-28 第 4 条）。
   祠堂是深色金漆底，开关也走金色系，不另起一套配色。 */
.shrine-head { position: relative; }
.shrine-toggle {
  position: absolute; right: 0; top: 4px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .6px; color: #c8b28c;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.shrine-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shrine-toggle .st-track {
  width: 34px; height: 18px; border-radius: 9px; flex: none;
  background: rgba(255, 238, 200, .14);
  border: 1px solid rgba(208, 172, 106, .38);
  display: inline-flex; align-items: center; padding: 2px;
  transition: background .18s ease, border-color .18s ease;
}
.shrine-toggle .st-knob {
  width: 12px; height: 12px; border-radius: 50%;
  background: #9c8a6c; transition: transform .18s ease, background .18s ease;
}
.shrine-toggle input:checked + .st-track {
  background: rgba(214, 168, 92, .34); border-color: rgba(240, 208, 140, .72);
}
.shrine-toggle input:checked + .st-track .st-knob {
  transform: translateX(16px); background: #f5dfa8;
  box-shadow: 0 0 8px rgba(255, 205, 120, .55);
}
.shrine-toggle input:focus-visible + .st-track { outline: 2px solid rgba(240, 208, 140, .8); outline-offset: 2px; }
.shrine-toggle .st-label { line-height: 1; }
@media (max-width: 640px) {
  .shrine-toggle { position: static; margin: 10px auto 0; justify-content: center; }
}
.meter {
  min-width: 92px; padding: 8px 14px; border-radius: 9px; text-align: center;
  background: linear-gradient(180deg, rgba(255, 238, 200, .075), rgba(255, 238, 200, .025));
  border: 1px solid rgba(208, 172, 106, .26);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, .10);
}
.meter .m-val {
  display: block; font-size: 16px; font-weight: 600; color: #f0d69f;
  font-variant-numeric: tabular-nums; letter-spacing: .6px;
}
.meter .m-lab { display: block; margin-top: 3px; font-size: 11px; color: #9b8a6d; letter-spacing: 1.5px; text-indent: 1.5px; }

/* ---------- 神龛层（每代一排）---------- */
/* ★ 2026-11-04 Boss 第 2 条：祠堂牌位整页缩放。
   --tb-scale 由 renderShrine 按「缩放条 / 适屏」写在 #shrineBody 上，默认 1（观感与改动前完全一致）：
   牌位本体、须弥座、牌前香炉、生卒行、行间距全部按同一系数乘算，等比缩小/放大，
   不会只缩宽不缩高、也不会走形。 */
.shrine-body { margin-top: 12px; --tb-scale: 1; }
.gen-row { padding: 0 0 24px; }
.gen-row + .gen-row { margin-top: 6px; }
.gen-row:last-child { padding-bottom: 0; }
.gen-label {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 0 0 12px;
  font-size: 11.5px; letter-spacing: 6px; text-indent: 6px; color: #a08a63;
}
.gen-label::before, .gen-label::after {
  content: ""; width: 54px; height: 1px; flex: none;
  background: linear-gradient(90deg, rgba(212, 176, 110, 0), rgba(212, 176, 110, .46));
}
.gen-label::after { transform: scaleX(-1); }
.tablet-row {
  display: flex; flex-wrap: wrap;
  gap: calc(34px * var(--tb-scale, 1)) calc(30px * var(--tb-scale, 1));
  justify-content: center; align-items: flex-start;
}

/* ---------- 牌位 ---------- */
/* 形制照实物神主牌：通体雕花外框（云纹冠 + 两侧立柱回纹）、内嵌牌心、
   描金双线、雕花牙板 + 三级须弥座。雕花由一层内联 SVG 画出（tabletArtSvg），
   材质只覆盖 CSS 变量，所以换款式不动版式，也不破坏「已敬香」的微亮状态。
   三款材质：红木描金 / 红木色 / 原木色。 */
.tablet {
  position: relative; width: calc(232px * var(--tb-scale, 1));
  display: flex; flex-direction: column; align-items: center;

  /* 牌身（外框木料） */
  --tb-board-radius: 92px 92px 4px 4px;
  --tb-frame-grad:
    repeating-linear-gradient(90deg,
      rgba(255, 226, 178, .05) 0 1px, rgba(0, 0, 0, 0) 1px 6px,
      rgba(0, 0, 0, .13) 6px 7px, rgba(0, 0, 0, 0) 7px 15px),
    linear-gradient(176deg, #6d2b1d 0%, #4a170f 34%, #2c0c07 70%, #190504 100%);
  --tb-board-shadow:
    inset 0 1px 0 rgba(255, 220, 168, .30),
    inset 0 0 0 1px rgba(255, 206, 140, .10),
    inset 0 -26px 38px rgba(0, 0, 0, .46),
    0 16px 30px rgba(0, 0, 0, .48),
    0 3px 0 rgba(0, 0, 0, .32);

  /* 牌心（内嵌面） */
  --tb-panel-radius: 46px 46px 2px 2px;
  --tb-panel-grad:
    repeating-linear-gradient(90deg,
      rgba(255, 214, 150, .028) 0 1px, rgba(0, 0, 0, 0) 1px 4px,
      rgba(0, 0, 0, .10) 4px 5px, rgba(0, 0, 0, 0) 5px 12px),
    radial-gradient(120% 46% at 50% -8%, rgba(255, 196, 120, .18), rgba(255, 196, 120, 0) 72%),
    linear-gradient(180deg, #40130c 0%, #260907 52%, #150404 100%);
  --tb-panel-lit-grad:
    radial-gradient(120% 46% at 50% -8%, rgba(255, 208, 136, .26), rgba(255, 196, 120, 0) 72%),
    linear-gradient(180deg, #47160d 0%, #2a0a07 52%, #170505 100%);
  --tb-panel-shadow:
    inset 0 0 0 1px rgba(198, 150, 86, .32),
    inset 0 2px 4px rgba(0, 0, 0, .70),
    inset 0 0 26px rgba(0, 0, 0, .60),
    0 1px 0 rgba(255, 226, 176, .12);

  /* 雕花描线：三款材质只换这一段 */
  --tb-gold: rgba(224, 184, 118, .88);
  --tb-gold-soft: rgba(206, 170, 108, .34);
  --tb-gold-w: 1.5px;
  --tb-relief: rgba(255, 226, 180, .17);
  --tb-carve-shadow: rgba(0, 0, 0, .52);

  /* 题字 */
  --tb-ink: #f7e3b4;
  --tb-ink-shadow:
    0 1px 0 rgba(46, 18, 8, .95),
    0 3px 5px rgba(0, 0, 0, .50),
    0 0 20px rgba(255, 200, 120, .26);

  /* 须弥座 */
  --tb-base-h: 38px;
  --tb-base-grad: linear-gradient(180deg, #a87a3a, #6a451c 55%, #331d0a);
  --tb-base-shadow:
    inset 0 2px 0 rgba(255, 236, 190, .55),
    inset 0 8px 10px rgba(255, 232, 186, .12),
    inset 0 -10px 12px rgba(0, 0, 0, .45),
    0 8px 16px rgba(0, 0, 0, .52);
  --tb-base-top-grad: linear-gradient(180deg, #c69a54, #7d5222);
  --tb-base-bot-grad: linear-gradient(180deg, #6b4519, #2a1608);

  /* 2026-10-25 Boss：牌位取消「香火光晕」。
     原来牌位背后挂着一层 radial-gradient 圆形柔光（延伸到牌位左右各 22px、
     顶部再高 20px），手机端牌位只有 114px 宽，这层光会糊到牌面上、也压到底栏
     按钮，看着像「敬香/样式侵入牌位」。整个 ::before 光晕层一并去掉，
     牌位只保留木料本身的浮雕与投影。 */
}
/* 牌位内的子元素仍各自建立层叠上下文：牌心、雕花、题字要靠 z-index 叠放 */
.tablet > * { position: relative; z-index: 1; }

.tablet-board {
  position: relative; box-sizing: border-box;
  width: 100%; height: calc(552px * var(--tb-scale, 1));
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--tb-board-radius);
  background: var(--tb-frame-grad);
  box-shadow: var(--tb-board-shadow);
  cursor: pointer; outline: none;
  transition: transform .22s ease, box-shadow .22s ease;
}
/* 内嵌牌心：与外框之间留一道缝，显出牌位厚度 */
.tb-panel {
  position: absolute;
  inset: calc(58px * var(--tb-scale, 1)) calc(26px * var(--tb-scale, 1)) calc(56px * var(--tb-scale, 1));
  pointer-events: none;
  border-radius: var(--tb-panel-radius);
  background: var(--tb-panel-grad);
  box-shadow: var(--tb-panel-shadow);
}

/* 雕花层：云纹冠、两侧立柱回纹、牌心双线、四角花牙、下牙板。
   几何由 tabletArtSvg() 生成，视图框与牌面等比，横竖缩放都不走形。 */
.tb-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 2; overflow: visible;
  /* 浮雕感：每个图元先落一道暗影再挑一道高光，看起来是刻进去的，不是画上去的 */
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .60)) drop-shadow(0 -1px 0 rgba(255, 232, 192, .13));
}
.tb-art path, .tb-art circle, .tb-art rect, .tb-art line, .tb-art ellipse {
  vector-effect: non-scaling-stroke;
}
.art-gold { fill: none; stroke: var(--tb-gold); stroke-width: var(--tb-gold-w); stroke-linecap: round; stroke-linejoin: round; }
.art-soft { fill: none; stroke: var(--tb-gold-soft); stroke-width: 1px; }
.art-relief { fill: var(--tb-relief); stroke: var(--tb-carve-shadow); stroke-width: .7px; }
.art-solid { fill: var(--tb-gold); stroke: none; }

.tb-ins {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  padding: calc(74px * var(--tb-scale, 1)) calc(34px * var(--tb-scale, 1)) calc(72px * var(--tb-scale, 1));
}
.ins-main {
  writing-mode: vertical-rl; text-orientation: upright;
  white-space: nowrap;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  line-height: 1.06;
  color: var(--tb-ink);
  text-shadow: var(--tb-ink-shadow);
}
/* 字号由 renderShrine 按全页最长题字统一设定，牌位之间不会一大一小；
   窄屏按 --ins-scale 等比缩小，保证最长的那条也不溢出牌面 */
.ins-main {
  font-size: calc(var(--ins-size, 21px) * var(--ins-scale, 1) * var(--tb-scale, 1));
  letter-spacing: calc(var(--ins-size, 21px) * var(--ins-scale, 1) * var(--tb-scale, 1) * .16);
}

.tablet-board:hover, .tablet-board:focus-visible {
  transform: translateY(-5px);
  box-shadow:
    inset 0 1px 0 rgba(255, 224, 176, .38),
    inset 0 0 0 1px rgba(255, 206, 140, .16),
    inset 0 0 34px rgba(0, 0, 0, .50),
    inset 0 -26px 38px rgba(0, 0, 0, .42),
    0 20px 34px rgba(0, 0, 0, .52);
}
.tablet.lit .tablet-board {
  box-shadow:
    inset 0 1px 0 rgba(255, 224, 176, .36),
    inset 0 0 0 1px rgba(255, 206, 140, .14),
    inset 0 0 34px rgba(0, 0, 0, .48),
    inset 0 -26px 38px rgba(0, 0, 0, .40),
    0 16px 30px rgba(0, 0, 0, .46);
}

.tablet.lit .tb-panel { background: var(--tb-panel-lit-grad); }

/* 须弥座：上枭 + 束腰 + 下枋，牙板带雕花 */
.tablet-base {
  position: relative; width: 96%; height: calc(var(--tb-base-h) * var(--tb-scale, 1));
  margin-top: calc(-3px * var(--tb-scale, 1));
  border-radius: 2px;
  background: var(--tb-base-grad);
  box-shadow: var(--tb-base-shadow);
  border-top: 1px solid rgba(255, 240, 205, .22);
}
.tablet-base::before {
  content: ""; position: absolute; left: -6%; right: -6%; top: calc(-7px * var(--tb-scale, 1)); height: calc(8px * var(--tb-scale, 1));
  border-radius: 3px 3px 0 0;
  background: var(--tb-base-top-grad);
  box-shadow: inset 0 1px 0 rgba(255, 238, 196, .46);
}
/* 束腰：一道内凹的竖槽带，上枋与下枋之间才立得住 */
.tablet-base::after {
  content: ""; position: absolute; left: 4%; right: 4%; top: 33%; height: 30%;
  background:
    repeating-linear-gradient(90deg,
      rgba(0, 0, 0, .40) 0 2px,
      rgba(255, 244, 210, .16) 2px 4px,
      rgba(0, 0, 0, 0) 4px 11px);
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, .55), inset 0 -2px 3px rgba(0, 0, 0, .40);
  opacity: .9;
}
.tablet-base i {
  position: absolute; left: -9%; right: -9%; bottom: calc(-7px * var(--tb-scale, 1)); height: calc(8px * var(--tb-scale, 1));
  border-radius: 0 0 3px 3px;
  background: var(--tb-base-bot-grad);
  box-shadow: inset 0 1px 0 rgba(255, 240, 205, .28), 0 6px 14px rgba(0, 0, 0, .50);
}

/* ---------- 牌位材质：三款，可整祠统一，也可单座另换 ---------- */
/* 参考实物：红木描金（深红木底 + 通体描金雕花）、红木色（同一木色、不描金）、
   原木色（浅木本色 + 阴刻淡金）。三款只覆盖变量，形制共用一套。 */

/* 一、红木描金 */
.tablet[data-tablet-style="hmmy"] {
  --tb-frame-grad:
    repeating-linear-gradient(90deg,
      rgba(255, 226, 178, .05) 0 1px, rgba(0, 0, 0, 0) 1px 6px,
      rgba(0, 0, 0, .13) 6px 7px, rgba(0, 0, 0, 0) 7px 15px),
    linear-gradient(176deg, #6d2b1d 0%, #4a170f 34%, #2c0c07 70%, #190504 100%);
  --tb-gold: rgba(245, 211, 134, .98);
  --tb-gold-soft: rgba(250, 226, 164, .64);
  --tb-gold-w: 1.9px;
  --tb-relief: rgba(255, 231, 188, .30);
  --tb-carve-shadow: rgba(0, 0, 0, .55);
  --tb-ink: #f7e3b4;
}

/* 二、红木色：通体一色红木，雕花不描金，只靠阴阳面显浮雕 */
.tablet[data-tablet-style="hongmu"] {
  --tb-frame-grad:
    repeating-linear-gradient(90deg,
      rgba(255, 210, 168, .035) 0 1px, rgba(0, 0, 0, 0) 1px 7px,
      rgba(0, 0, 0, .10) 7px 8px, rgba(0, 0, 0, 0) 8px 17px),
    linear-gradient(176deg, #7b3526 0%, #5a2116 38%, #3a120c 74%, #240a07 100%);
  --tb-panel-grad:
    repeating-linear-gradient(90deg,
      rgba(255, 214, 150, .03) 0 1px, rgba(0, 0, 0, 0) 1px 4px,
      rgba(0, 0, 0, .10) 4px 5px, rgba(0, 0, 0, 0) 5px 12px),
    radial-gradient(120% 46% at 50% -8%, rgba(255, 200, 130, .16), rgba(255, 196, 120, 0) 72%),
    linear-gradient(180deg, #3d120b 0%, #250806 56%, #140404 100%);
  --tb-panel-lit-grad:
    radial-gradient(120% 46% at 50% -8%, rgba(255, 210, 140, .24), rgba(255, 196, 120, 0) 72%),
    linear-gradient(180deg, #45160e 0%, #2a0a07 56%, #170505 100%);
  --tb-panel-shadow:
    inset 0 0 0 1px rgba(206, 156, 96, .34),
    inset 0 2px 5px rgba(0, 0, 0, .72),
    inset 0 0 28px rgba(0, 0, 0, .62),
    0 1px 0 rgba(255, 226, 176, .14);
  --tb-gold: rgba(255, 206, 166, .30);
  --tb-gold-soft: rgba(24, 6, 4, .42);
  --tb-gold-w: 1.3px;
  --tb-relief: rgba(255, 220, 182, .32);
  --tb-carve-shadow: rgba(0, 0, 0, .60);
  --tb-ink: #f8e3b0;
  --tb-base-grad: linear-gradient(180deg, #7d3a27, #4d1a11 58%, #2a0c07);
  --tb-base-top-grad: linear-gradient(180deg, #94482f, #5c2216);
  --tb-base-bot-grad: linear-gradient(180deg, #522015, #240a06);
}

/* 三、原木色：浅木本色 + 阴刻淡金，最素净的一款 */
.tablet[data-tablet-style="yuanmu"] {
  --tb-frame-grad:
    repeating-linear-gradient(90deg,
      rgba(255, 244, 214, .10) 0 1px, rgba(0, 0, 0, 0) 1px 7px,
      rgba(120, 70, 22, .10) 7px 8px, rgba(0, 0, 0, 0) 8px 19px,
      rgba(150, 96, 40, .07) 19px 20px, rgba(0, 0, 0, 0) 20px 31px),
    radial-gradient(90% 60% at 50% 6%, rgba(255, 246, 214, .28), rgba(255, 246, 214, 0) 70%),
    linear-gradient(176deg, #ddb073 0%, #c99a58 38%, #ad7835 74%, #8f5f24 100%);
  --tb-board-shadow:
    inset 0 1px 0 rgba(255, 246, 214, .60),
    inset 0 0 0 1px rgba(122, 74, 24, .20),
    inset 0 -22px 34px rgba(112, 62, 18, .26),
    0 16px 30px rgba(0, 0, 0, .40),
    0 3px 0 rgba(0, 0, 0, .22);
  --tb-panel-grad:
    radial-gradient(120% 46% at 50% -8%, rgba(255, 240, 200, .28), rgba(255, 236, 190, 0) 72%),
    linear-gradient(180deg, #d9a765 0%, #c8944f 52%, #b27f3c 100%);
  --tb-panel-lit-grad:
    radial-gradient(120% 46% at 50% -8%, rgba(255, 246, 214, .38), rgba(255, 236, 190, 0) 72%),
    linear-gradient(180deg, #e0af6e 0%, #cd9a55 52%, #b6833f 100%);
  --tb-panel-shadow:
    inset 0 0 0 1px rgba(104, 62, 20, .40),
    inset 0 2px 5px rgba(74, 42, 10, .45),
    inset 0 0 24px rgba(84, 48, 12, .22),
    0 1px 0 rgba(255, 248, 218, .40);
  --tb-gold: rgba(88, 50, 12, .88);
  --tb-gold-soft: rgba(104, 60, 16, .52);
  --tb-gold-w: 1.3px;
  --tb-relief: rgba(255, 244, 206, .40);
  --tb-carve-shadow: rgba(92, 52, 14, .55);
  --tb-ink: #6d4413;
  --tb-ink-shadow: 0 1px 0 rgba(255, 240, 200, .60), 0 2px 4px rgba(84, 46, 8, .30);
  --tb-base-grad: linear-gradient(180deg, #c6924d, #a3702f 58%, #7d521f);
  --tb-base-top-grad: linear-gradient(180deg, #d6a55f, #b07c37);
  --tb-base-bot-grad: linear-gradient(180deg, #9b6a2a, #6d451a);
  --tb-base-shadow: inset 0 1px 0 rgba(255, 250, 222, .60), 0 8px 16px rgba(0, 0, 0, .34);
}

/* ---------- 牌位样式选择条 ---------- */
.shrine-style {
  display: flex; align-items: center; justify-content: center;
  gap: 11px; flex-wrap: wrap;
  margin: 20px 0 2px;
}
.ss-label { font-size: 12.5px; color: #d6c096; letter-spacing: 2px; }
.ss-hint { font-size: 11.5px; color: #a89168; letter-spacing: .5px; }
.ss-list { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ss-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 16px 8px 9px; border-radius: 999px;
  border: 1px solid rgba(212, 176, 110, .28);
  background: rgba(255, 240, 208, .05);
  color: #e3cda6; font-family: inherit; font-size: 13.5px;
  cursor: pointer; transition: background .16s, border-color .16s, color .16s;
}
.ss-btn:hover { background: rgba(255, 240, 208, .13); }
.ss-btn:focus-visible { outline: 2px solid rgba(246, 216, 150, .70); outline-offset: 2px; }
.ss-btn.active {
  border-color: rgba(246, 216, 150, .88);
  background: rgba(255, 236, 190, .20);
  color: #fff4d8;
}
/* 按钮里的迷你牌位：直接复用各款变量，所见即所得 */
.ss-sw {
  position: relative; width: 15px; height: 19px; flex: none;
  border-radius: 5px 5px 2px 2px;
  background: var(--sw-frame, linear-gradient(176deg, #6d2b1d, #2c0c07));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .38), 0 1px 3px rgba(0, 0, 0, .42);
}
.ss-sw::after {
  content: ""; position: absolute; inset: 3px 3px 4px;
  border-radius: 2px;
  background: var(--sw-panel, rgba(0, 0, 0, .45));
  box-shadow: inset 0 0 0 1px var(--sw-rim, rgba(230, 196, 132, .6));
}
.ss-btn[data-style="hmmy"]  .ss-sw { --sw-frame: linear-gradient(174deg, #6d2b1d, #2c0c07); --sw-panel: #3f120c; --sw-rim: rgba(240,208,146,.9); }
.ss-btn[data-style="hongmu"] .ss-sw { --sw-frame: linear-gradient(174deg, #7b3526, #3a120c); --sw-panel: #521e14; --sw-rim: rgba(150,74,52,.85); }
.ss-btn[data-style="yuanmu"] .ss-sw { --sw-frame: linear-gradient(174deg, #e3b878, #b9843f); --sw-panel: #d9a765; --sw-rim: rgba(106,62,18,.7); }

/* ---------- 牌位缩放条（Boss 2026-11-04 第 2 条） ---------- */
/* 目的：一屏能完整看到整座牌位（含敬香/样式按钮），同时在宽屏上一排多摆几座。
   档位与「适屏」都存在本机 localStorage，换页面/刷新不丢。 */
.shrine-zoom {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap; margin: 8px 0 0;
}
.shrine-zoom .sz-label { font-size: 12.5px; color: #d6c096; letter-spacing: 2px; }
.shrine-zoom .sz-val {
  min-width: 54px; text-align: center; font-size: 12.5px; color: #f4e6c6;
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
}
.shrine-zoom button {
  min-height: 36px; min-width: 42px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(212, 176, 110, .28);
  background: rgba(255, 240, 208, .05);
  color: #e3cda6; font-family: inherit; font-size: 13px; cursor: pointer;
}
.shrine-zoom button:hover { background: rgba(255, 240, 208, .13); }
.shrine-zoom button:focus-visible { outline: 2px solid rgba(246, 216, 150, .70); outline-offset: 2px; }
.shrine-zoom button.active {
  border-color: rgba(255, 226, 158, .95);
  background: linear-gradient(180deg, rgba(255, 232, 176, .40), rgba(255, 214, 132, .24));
  color: #fff8e6; font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255, 226, 158, .28), 0 2px 10px rgba(255, 196, 96, .20);
}
@media (max-width: 720px) {
  .shrine-zoom { margin: 6px 0 0; gap: 5px; }
  .shrine-zoom .sz-label { font-size: 10.5px; letter-spacing: .5px; }
  .shrine-zoom .sz-val { min-width: 46px; font-size: 11.5px; }
  .shrine-zoom button { min-height: 34px; min-width: 38px; padding: 5px 9px; font-size: 12px; }
}

/* ---------- 单座牌位换式：牌下小按钮 + 三款气泡 ---------- */
.tablet-style-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 12px 6px 8px; margin-left: 6px;
  border-radius: 999px; border: 1px solid rgba(212, 176, 110, .26);
  background: rgba(255, 240, 208, .05);
  color: #cbb488; font-family: inherit; font-size: 12px; letter-spacing: 1px;
  cursor: pointer; white-space: nowrap; flex: 0 0 auto;
}
.tablet-style-btn:hover { background: rgba(255, 240, 208, .14); color: #f2e2c2; }
.tablet-style-btn .tsw {
  width: 11px; height: 14px; flex: none; border-radius: 4px 4px 1px 1px;
  background: var(--tw-frame, linear-gradient(174deg, #6d2b1d, #2c0c07));
  box-shadow: inset 0 0 0 1px var(--tw-rim, rgba(240, 208, 146, .8));
}
.tsw[data-sw="hongmu"] { --tw-frame: linear-gradient(174deg, #7b3526, #3a120c); --tw-rim: rgba(150, 74, 52, .85); }
.tsw[data-sw="yuanmu"] { --tw-frame: linear-gradient(174deg, #e3b878, #b9843f); --tw-rim: rgba(106, 62, 18, .7); }

.ts-pop {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 40;
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px; border-radius: 12px;
  background: rgba(38, 24, 16, .97);
  border: 1px solid rgba(212, 176, 110, .34);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .58);
  min-width: 132px;
}
.ts-pop[hidden] { display: none; }
.ts-pop button {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; color: #e6d2ac;
  font-family: inherit; font-size: 13.5px; letter-spacing: 1px;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.ts-pop button:hover { background: rgba(255, 240, 208, .12); color: #fff4d8; }
.ts-pop button.active { background: rgba(255, 236, 190, .18); color: #fff6e0; }
.ts-pop .pop-sep { height: 1px; margin: 3px 4px; background: rgba(212, 176, 110, .22); }

/* 牌前小香炉：未敬是空炉，已敬插三柱燃香 */
.tablet-altar {
  position: relative; width: 100%; height: calc(70px * var(--tb-scale, 1)); margin-top: calc(3px * var(--tb-scale, 1));
  display: flex; justify-content: center; align-items: flex-end;
}
.tablet-altar .bowl {
  position: absolute; bottom: 0;
  width: calc(92px * var(--tb-scale, 1)); height: calc(31px * var(--tb-scale, 1));
  border-radius: 6px 6px 31px 31px / 6px 6px 33px 33px;
  background: linear-gradient(180deg, #b58e4e, #6a4a22 60%, #40270e);
  box-shadow: inset 0 1px 1px rgba(255, 240, 200, .48),
              inset 0 -5px 8px rgba(0, 0, 0, .38),
              0 4px 10px rgba(0, 0, 0, .46);
}
.tablet-altar .bowl::before {
  content: ""; position: absolute; left: 50%; top: calc(-5px * var(--tb-scale, 1)); width: calc(58px * var(--tb-scale, 1)); height: calc(10px * var(--tb-scale, 1));
  margin-left: calc(-29px * var(--tb-scale, 1)); border-radius: 50%;
  background: linear-gradient(180deg, #d9b471, #855d27);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .38);
}
.sticks {
  position: absolute; bottom: calc(14px * var(--tb-scale, 1)); height: calc(34px * var(--tb-scale, 1));
  display: flex; align-items: flex-end; gap: calc(5px * var(--tb-scale, 1));
}
.sticks i {
  display: block; width: 2px; height: calc(29px * var(--tb-scale, 1)); border-radius: 1px;
  background: linear-gradient(180deg, #d0a373, #7d5230);
  position: relative;
}
.sticks i:nth-child(2) { height: calc(34px * var(--tb-scale, 1)); }
.sticks i::before {
  content: ""; position: absolute; left: -1.5px; top: -4px;
  width: 5px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle, #fff2c0, #ff9a3c 55%, rgba(255, 120, 40, 0) 78%);
  box-shadow: 0 0 8px 2px rgba(255, 150, 60, .40);
  animation: emberPulse 2.6s ease-in-out infinite;
}
.sticks .smoke {
  position: absolute; left: 50%; bottom: 26px;
  width: 36px; height: 52px; margin-left: -18px; pointer-events: none;
  background:
    radial-gradient(8px 17px at 42% 88%, rgba(255, 255, 255, .18), transparent 70%),
    radial-gradient(9px 19px at 62% 50%, rgba(255, 255, 255, .14), transparent 72%);
  filter: blur(3px);
  animation: smokeRise 4.6s ease-in-out infinite;
}
@keyframes emberPulse {
  0%, 100% { opacity: .82; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.12); }
}
@keyframes smokeRise {
  0% { opacity: 0; transform: translateY(6px) scaleX(.9); }
  30% { opacity: .8; }
  70% { opacity: .26; transform: translateY(-18px) scaleX(1.1); }
  100% { opacity: 0; transform: translateY(-28px) scaleX(1.2); }
}
.tablet.just-lit .tablet-board { animation: litFlash 1.8s ease-out 1; }
/* 刚敬过香的反馈：只让牌面「从里亮一下」，不再往外炸一圈光环
   （2026-10-25 Boss：牌位取消光晕，外环一并去掉）。 */
@keyframes litFlash {
  0%   { box-shadow: inset 0 0 0 0 rgba(255, 205, 120, 0), inset 0 0 34px rgba(0, 0, 0, .52); }
  55%  { box-shadow: inset 0 0 22px rgba(255, 205, 130, .30), inset 0 0 34px rgba(0, 0, 0, .44); }
  100% { box-shadow: inset 0 0 0 0 rgba(255, 205, 120, 0), inset 0 0 34px rgba(0, 0, 0, .46); }
}

/* 生卒：两行，短促对齐，不挤在牌位里 */
.tablet-meta {
  margin-top: calc(11px * var(--tb-scale, 1)); min-height: calc(40px * var(--tb-scale, 1));
  font-size: calc(12px * var(--tb-scale, 1)); line-height: 1.6; letter-spacing: .3px;
  color: #cfba92; text-align: center;
  font-variant-numeric: tabular-nums;
}
.tablet-meta i {
  font-style: normal; display: inline-block; width: 12px;
  color: #97835f; margin-right: 3px;
}

.tablet-foot { min-height: calc(32px * var(--tb-scale, 1)); display: flex; align-items: center; justify-content: center; gap: 6px; }
.tablet-btn {
  border: 1px solid rgba(226, 190, 124, .62);
  background: linear-gradient(180deg, rgba(226, 190, 124, .20), rgba(226, 190, 124, .06));
  color: #f6e6c0; border-radius: 999px;
  padding: 6px 22px; font-size: 12.5px; letter-spacing: 2px; text-indent: 2px;
  cursor: pointer; font-family: inherit;
  /* 2026-10-25：牌位窄的时候「敬香」两个字会被挤成上下两行（实测按钮被撑到 50px 高，
     比旁边的「样式」高 6px，看起来像压进了牌面）。按钮文字一律不换行。 */
  white-space: nowrap; flex: 0 0 auto;
  /* 与旁边「样式」按钮等高（原来 29 vs 34，看着一高一低） */
  min-height: 34px;
  transition: background .16s, border-color .16s, box-shadow .16s, color .16s;
}
.tablet-btn:hover {
  background: linear-gradient(180deg, rgba(226, 190, 124, .34), rgba(226, 190, 124, .12));
  border-color: #e6c98c; color: #fff3d4;
  box-shadow: 0 0 16px rgba(255, 196, 110, .26);
}
.lit-note {
  font-size: 10.5px; color: #a9c8a4; line-height: 1.4;
  letter-spacing: .2px; text-align: center;
}

/* ---------- 供桌：在牌位之前（画面下方）---------- */
.shrine-altar {
  position: relative; margin-top: 12px; padding: 18px 18px 24px;
  border-radius: 14px;
  text-align: center;
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 226, 178, .05) 0 1px, rgba(0, 0, 0, 0) 1px 9px,
      rgba(0, 0, 0, .10) 9px 10px, rgba(0, 0, 0, 0) 10px 23px),
    linear-gradient(180deg, #5d3218 0%, #3d1e0d 58%, #241108 100%);
  border: 1px solid rgba(212, 176, 110, .30);
  box-shadow: inset 0 2px 0 rgba(255, 232, 186, .16),
              inset 0 -18px 30px rgba(0, 0, 0, .40),
              0 -10px 26px rgba(0, 0, 0, .28);
}
.shrine-altar::after {
  content: ""; position: absolute; left: 12px; right: 12px; top: 5px; height: 1px;
  background: linear-gradient(90deg, rgba(226, 190, 124, 0), rgba(226, 190, 124, .34), rgba(226, 190, 124, 0));
}
/* 供桌前檐：桌面一道亮边 + 檐下一道暗影，桌子的厚度就出来了 */
.shrine-altar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, rgba(226, 190, 124, .10), rgba(246, 214, 158, .55), rgba(226, 190, 124, .10));
}
/* 香案上只留一格「今日敬香」统计：不写操作提示（Boss 2026-10-25）。
   数字跟着香炉走，一眼看到今天还差几座，不用读句子。 */
.desk-stat {
  display: inline-flex; align-items: baseline; gap: 8px;
  margin: 0 auto 16px; padding: 4px 13px 5px;
  border-radius: 999px;
  background: rgba(255, 231, 185, .10);
  border: 1px solid rgba(226, 190, 124, .26);
  line-height: 1;
}
.desk-stat .at-val {
  font-size: 15px; font-weight: 700; color: #f3e0b6;
  letter-spacing: .6px; font-variant-numeric: tabular-nums;
}
.desk-stat .at-lab { font-size: 11.5px; letter-spacing: 1.6px; color: #bda87f; }
.desk-stat.is-done { background: rgba(150, 200, 150, .12); border-color: rgba(157, 195, 154, .34); }
.desk-stat.is-done .at-val { color: #b6d6ae; }
.desk-top { display: flex; align-items: flex-end; justify-content: center; gap: 46px; position: relative; }
/* 供桌前沿的暗影：★ 这里只能用 ::after 一处。
   旧版把「果盘」也写在 .desk-top::before, .desk-top::after 上，两条规则撞在同一个
   ::after 上——后一条的 width/height/圆角把前一条的全宽暗影改成了 46×11 的椭圆，
   却继承了 left:-18px / right:-18px，于是那个金椭圆被钉在左边缘、压在左侧果盘上，
   右侧果盘整个不见，桌沿暗影也消失。这就是「一键敬香那里错位」的根因。
   现在果盘改用真实元素 .desk-fruit，伪元素只留暗影。 */
.desk-top::after {
  content: ""; position: absolute; left: -18px; right: -18px; bottom: -7px; height: 9px;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .38), rgba(0, 0, 0, 0));
  pointer-events: none;
}
/* 供桌上的果盘，左右各一（真实元素，数量与位置都跟 HTML 一一对应） */
.desk-fruit {
  width: 46px; height: 11px; flex: none;
  align-self: flex-end; margin-bottom: 6px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: linear-gradient(180deg, #e9b96f, #b4742f 55%, #7c471a);
  box-shadow: inset 0 3px 6px rgba(255, 228, 172, .52),
              inset 0 -3px 5px rgba(80, 42, 12, .45),
              0 6px 12px rgba(0, 0, 0, .45);
}

.candle {
  position: relative; width: 13px; height: 58px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #cf4636, #95291c 60%, #6b1a11);
  box-shadow: 0 0 26px 8px rgba(255, 170, 80, .14),
              inset -3px 0 6px rgba(0, 0, 0, .35),
              inset 3px 0 5px rgba(255, 190, 150, .26);
}
.candle::before {
  content: ""; position: absolute; left: 50%; top: -12px;
  width: 7px; height: 13px; margin-left: -3.5px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 65%, #fff6cc, #ffb54a 55%, rgba(255, 140, 40, 0) 74%);
  box-shadow: 0 0 14px 4px rgba(255, 170, 70, .30);
  animation: candleFlicker 2.4s ease-in-out infinite;
}
.candle::after {
  content: ""; position: absolute; left: -5px; right: -5px; bottom: -8px; height: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #a07a44, #4a2f14);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .42);
}
@keyframes candleFlicker {
  0%, 100% { opacity: .85; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.12); }
}

.censer {
  border: 0; background: transparent; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center;
  position: relative;
  padding: 0 4px; color: #dcc794;
}
.censer:disabled { cursor: default; }
.censer-body {
  position: relative; width: 96px; height: 52px;
  border-radius: 7px 7px 34px 34px / 9px 9px 38px 38px;
  background: linear-gradient(180deg, #a37f47, #63431f 55%, #3d2613);
  box-shadow: inset 0 2px 2px rgba(255, 236, 190, .42),
              inset 0 -8px 14px rgba(0, 0, 0, .38),
              0 8px 18px rgba(0, 0, 0, .42);
}
.censer-body::before {
  content: ""; position: absolute; left: 50%; top: -6px; width: 96px; height: 12px;
  margin-left: -48px; border-radius: 50%;
  background: linear-gradient(180deg, #d0ab68, #7a5628);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .35);
}
.censer-body::after {
  content: ""; position: absolute; left: 12px; right: 12px; top: 8px; height: 2px;
  border-radius: 2px; background: rgba(255, 236, 190, .18);
}
/* 香炉下的「全敬」二字脱离文档流：这样炉体底部和左右两支蜡烛的底
   落在同一条桌面上，不再被这行字顶高 20 多像素（那就是「香炉飘着」的观感）。 */
.censer-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 6px; padding-left: 3px; white-space: nowrap;
  font-size: 12px; color: #c9b489; letter-spacing: 3px;
}
.censer:hover:not(:disabled) .censer-label { color: #f6e5b8; }
.censer.done .censer-label { color: #9dc39a; }
.censer:disabled .censer-body { filter: saturate(.65) brightness(.92); }

/* ★ 提示句（.desk-hint）已删除：香案上只留今日敬香统计，不写「点这里一次敬全」这类
   操作提示。但香炉下的「全敬」二字是绝对定位（top:100%）、不占流，删掉提示句后它
   会顶出供桌底边 ⇒ 底部内边距要按「6px 间距 + 14px 字高」留够，见各断点的 padding。 */

/* 牌位分页条：家族大、已故人多时按页翻，不用横滑几十座 */
.shrine-pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 6px 0 16px;
}
.shrine-pager .pg-btn {
  appearance: none; cursor: pointer;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid rgba(198, 158, 96, .55);
  background: linear-gradient(180deg, #fdf6e6, #f2e3c6);
  color: #6d4a1e; font-size: 13px; letter-spacing: .5px;
  box-shadow: 0 2px 6px rgba(120, 84, 36, .16);
  transition: transform .18s ease, box-shadow .18s ease;
}
.shrine-pager .pg-btn:hover:not(:disabled) {
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(120, 84, 36, .24);
}
.shrine-pager .pg-btn:disabled { opacity: .38; cursor: default; box-shadow: none; }
.shrine-pager .pg-info {
  font-size: 13px; color: #8a6a3c; letter-spacing: .5px;
  display: inline-flex; align-items: baseline; gap: 8px;
}
.shrine-pager .pg-info b { color: #6d4a1e; font-size: 15px; }
.shrine-pager .pg-sub { color: #b09367; font-size: 12px; }
/* 「第 N / M 页」整体必须是一个不可拆的行盒：原来是散在 flex 容器里的
   文本节点 + <b>，「第」「1」「/ 2 页」各自成了 flex item，窄屏列排后
   变成四行（第／1／/ 2 页／共 8 座牌位），看着像文字叠在一起。 */
.shrine-pager .pg-now { white-space: nowrap; }

/* ---- 牌位单座「移出 / 移回」（仅家谱管理员，2026-10-31 Boss 第 3 条） ----
   Boss 追加：移出按钮从牌位右上角撤掉（太抢眼、压题字），挪进档案卡按钮区，
   且只在祠堂里打开的档案卡出现。这里只留「已移出」清单的样式。 */
.shrine-out-list {
  margin: 14px auto 4px; max-width: 720px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 252, 244, .72);
  border: 1px dashed rgba(186, 156, 106, .55);
  text-align: left;
}
.shrine-out-list .sol-head {
  font-size: 12.5px; color: #8a7554; font-weight: 600;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.shrine-out-list .sol-hint { font-weight: 400; color: #a8977a; font-size: 11.5px; }
.shrine-out-list .sol-body {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.shrine-out-list .sol-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 10px; border-radius: 999px;
  background: #fff; border: 1px solid rgba(200, 172, 126, .55);
  font-size: 12.5px; color: #4a412f;
}
.shrine-out-list .sol-chip i {
  font-style: normal; font-size: 11px; color: #a08a66;
}
.shrine-out-list .sol-chip button {
  border: 0; border-radius: 999px; padding: 2px 9px; min-height: 0 !important;
  background: #f1ece0; color: #6b5732; font: inherit; font-size: 11.5px; cursor: pointer;
}
.shrine-out-list .sol-chip button:hover { background: #e6dcc6; color: #4c3a1c; }

.shrine-empty { padding: 46px 12px; text-align: center; color: #b9a684; }
.shrine-empty p { margin: 0 0 8px; font-size: 14px; }
.shrine-empty .hint-line { color: #96876c; font-size: 12.5px; }

@media (max-width: 700px) {
  .shrine { padding: 18px 12px 14px; border-radius: 16px; }
  .shrine-name { font-size: 20px; letter-spacing: 8px; text-indent: 8px; gap: 10px; }
  .shrine-name::before, .shrine-name::after { width: 24px; }
  .shrine-sub { font-size: 11.5px; letter-spacing: .6px; }
  .shrine-meters { width: 100%; gap: 7px; margin-top: 12px; }
  .meter { flex: 1; min-width: 0; padding: 6px 4px; }
  .meter .m-val { font-size: 14px; }
  .meter .m-lab { font-size: 10px; letter-spacing: 1px; text-indent: 1px; }
  .shrine-body { margin-top: 14px; }
  .gen-label { margin-bottom: 13px; font-size: 10.5px; letter-spacing: 4px; text-indent: 4px; gap: 9px; }
  .gen-label::before, .gen-label::after { width: 26px; }
  .tablet-row { gap: calc(26px * var(--tb-scale, 1)) calc(14px * var(--tb-scale, 1)); }
  /* 牌面缩小后题字也要跟着收，否则最长的题字会顶出牌面 */
  .shrine-body { --ins-scale: .68; }
  .tb-ins { padding: calc(30px * var(--tb-scale, 1)) calc(10px * var(--tb-scale, 1)) calc(26px * var(--tb-scale, 1)); }
  .tablet { width: calc(146px * var(--tb-scale, 1)); }
  /* 手机上牌面按 1:2.3 的传统比例收，不能拉成一根细长条 */
  .tablet-board { height: calc(336px * var(--tb-scale, 1)); border-radius: calc(56px * var(--tb-scale, 1)) calc(56px * var(--tb-scale, 1)) 4px 4px; }
  /* 窄屏：牌心与雕花一起按比例收（牌面 146×336，约当大屏的 0.63 倍） */
  .tb-panel { inset: calc(37px * var(--tb-scale, 1)) calc(17px * var(--tb-scale, 1)) calc(36px * var(--tb-scale, 1)); }
  .tb-ins { padding: calc(6px * var(--tb-scale, 1)) calc(14px * var(--tb-scale, 1)) calc(6px * var(--tb-scale, 1)); }
  .tablet-base { height: calc(19px * var(--tb-scale, 1)); }
  .tablet-base::before { height: calc(5px * var(--tb-scale, 1)); top: calc(-5px * var(--tb-scale, 1)); }
  .tablet-base::after { height: calc(4px * var(--tb-scale, 1)); top: calc(2px * var(--tb-scale, 1)); }
  .tablet-base i { height: calc(5px * var(--tb-scale, 1)); bottom: calc(-5px * var(--tb-scale, 1)); }
  .tablet-style-btn { margin-left: 3px; padding: 7px 10px 7px 7px; font-size: 11px; letter-spacing: .5px; min-height: 30px; }
  .tablet-style-btn .tsw { width: 9px; height: 12px; }
  .ts-pop { bottom: 26px; min-width: 118px; padding: 5px; }
  .ts-pop button { padding: 6px 8px; font-size: 12px; letter-spacing: .5px; }
  .tb-panel { inset: 10px; border-radius: 38px 38px 3px 3px; }
  .tb-rim { inset: 15px; border-radius: 33px 33px 2px 2px; }
  .tb-rim::before, .tb-rim::after { left: 12px; right: 12px; height: 3px; }
  .tb-cap { width: 50px; height: 13px; margin-left: -25px; top: 4px; }
  .tb-cap::before, .tb-cap::after { width: 7px; height: 7px; top: 4px; }
  .tb-cap::before { left: -4px; }
  .tb-cap::after { right: -4px; }
  .tb-foot-orn { width: 8px; height: 8px; margin-left: -4px; bottom: 12px; }
  .tb-ins { padding: 38px 9px 36px; }
  .tablet-meta { font-size: calc(10.5px * var(--tb-scale, 1)); margin-top: calc(9px * var(--tb-scale, 1)); min-height: calc(35px * var(--tb-scale, 1)); }
  .tablet-meta i { width: calc(10px * var(--tb-scale, 1)); margin-right: 2px; }
  .tablet-base { height: calc(13px * var(--tb-scale, 1)); }
  .tablet-altar { height: calc(46px * var(--tb-scale, 1)); }
  .tablet-altar .bowl { width: calc(56px * var(--tb-scale, 1)); height: calc(20px * var(--tb-scale, 1)); }
  .tablet-altar .bowl::before { width: calc(56px * var(--tb-scale, 1)); margin-left: calc(-28px * var(--tb-scale, 1)); }
  .sticks { bottom: calc(9px * var(--tb-scale, 1)); }
  .sticks i { height: calc(21px * var(--tb-scale, 1)); }
  .sticks i:nth-child(2) { height: calc(24px * var(--tb-scale, 1)); }
  .tablet-btn { padding: 7px 14px; font-size: 11px; letter-spacing: 1px; text-indent: 1px; min-height: 30px; }
  .lit-note { font-size: 9.5px; }
  .shrine-altar { margin-top: 18px; padding: 14px 12px 26px; border-radius: 12px; }
  .desk-stat { margin-bottom: 12px; padding: 3px 11px 4px; }
  .desk-stat .at-val { font-size: 14px; }
  .desk-top { gap: 24px; }
  .desk-fruit { width: 34px; height: 9px; }
  .candle { height: 48px; }
  .censer-body { width: 78px; height: 44px; }
  .censer-body::before { width: 78px; margin-left: -39px; }
  .desk-hint { font-size: 11.5px; margin-top: 8px; }
  /* 分页条：窄屏把「共 N 座」折到第二行，别挤成一团折行 */
  .shrine-pager { gap: 8px; margin: 4px 0 12px; }
  .shrine-pager .pg-btn { padding: 6px 10px; font-size: 12px; letter-spacing: 0; }
  .shrine-pager .pg-info {
    flex-direction: column; align-items: center; gap: 2px;
    font-size: 12px; line-height: 1.45; white-space: nowrap;
  }
  /* 页码数字跟正文同档，避免 15px 的行盒（20px）压住上下两行 */
  .shrine-pager .pg-info b { font-size: 12.5px; }
  .shrine-pager .pg-sub { font-size: 10.5px; }
  .gh-hint { display: none; }
}

/* ---------------- 族系：父系 / 母系 / 近亲 / 关系网 ---------------- */

.lineage-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px 0;
}
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: #f2ede4; border: 1px solid var(--line-soft); border-radius: 10px;
}
.seg-btn {
  border: 0; background: transparent; font: inherit; font-size: 13px;
  color: var(--ink-soft); padding: 6px 13px; border-radius: 8px; cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: #fff; color: var(--accent-dark); font-weight: 600;
  box-shadow: 0 1px 2px rgba(60, 45, 25, .08);
}
.lineage-focus { font-size: 13px; color: var(--muted); }

/* 「以谁为中心」：按钮 + 换人面板。以前这里没有任何样式，渲染成浏览器原生按钮，
   标签也一直是「以 — 为中心」，点了还没反应。 */
.lc-wrap { position: relative; display: inline-flex; }
.lin-center {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-soft); background: #fff; border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 13px; color: var(--ink);
  cursor: pointer; white-space: nowrap; max-width: 46vw;
}
.lin-center > #linCenterName { overflow: hidden; text-overflow: ellipsis; }
.lin-center:hover { border-color: #c9b79a; background: #fdfaf4; }
.lin-center:focus-visible { outline: 2px solid #b9924f; outline-offset: 2px; }
.lin-center[aria-expanded="true"] { border-color: #b9924f; }
.lc-ico { color: #b9924f; font-size: 11px; line-height: 1; }
.lc-caret { color: var(--muted); font-size: 10px; line-height: 1; }

.pick-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: min(320px, 86vw); background: #fff; border: 1px solid var(--line-soft);
  border-radius: 12px; box-shadow: 0 14px 34px rgba(50, 38, 20, .16);
  padding: 8px;
}
.pick-search {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 13px;
  border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 7px 10px; margin-bottom: 6px; background: #fdfbf7; color: var(--ink);
}
.pick-search:focus { outline: 2px solid #d9c39a; outline-offset: 0; }
.pick-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.pick-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; border: 0; background: none; font: inherit;
  font-size: 13px; color: var(--ink); padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.pick-item:hover { background: #f6f1e7; }
.pick-item.on { background: #f3ead8; font-weight: 600; }
.pick-item .pi-meta { color: var(--muted); font-size: 11px; flex: none; }
.pick-empty { padding: 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* 横滚只发生在世系图内层：整页不再被撑宽，顶栏与切换按钮不会被裁 */
.lineage-scroll {
  /* ★ 必须有 position:relative：缩放占位块 .zoom-spacer 是 absolute，
     它一旦找不到定位祖先就会相对整页定位，把 documentElement.scrollWidth
     撑到内容宽度（手机上报 innerWidth 从 390 变成 1148），真机上整页被缩小 */
  position: relative;
  overflow-x: auto; overflow-y: hidden; max-width: 100%;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.lineage-scroll::-webkit-scrollbar { height: 8px; }
.lineage-scroll::-webkit-scrollbar-thumb { background: rgba(150, 112, 62, .28); border-radius: 4px; }

.lineage-body {
  padding: 14px 16px 40px; max-width: 1100px; margin: 0 auto;
  position: relative;
}

/* 父子连线层：垫在卡片下面，视口变化时由 JS 重画 */
.ln-links {
  position: absolute; left: 0; top: 0;
  pointer-events: none; z-index: 0; overflow: visible;
}
/* 连线：加深到能和卡片边框区分开，但仍比文字轻，不抢卡片 */
.ln-link { fill: none; stroke: #8a744f; stroke-width: 2; stroke-linejoin: round; }
/* 叶节点连线：只用稍微浅一档，不再用虚线——
   女性卡片本身已经是虚框，线再用虚线两套语义会打架 */
.ln-link.leaf { stroke: #a2906f; stroke-width: 1.8; stroke-dasharray: none; }

/* 始祖抬头：外面套一层定宽容器，好把「一世」标签定位到代际轴上 */
.lgen-hero { position: relative; }
.lgen-hero .lgen-label { top: 2px; }
.lineage-hero {
  display: grid; gap: 4px; padding: 16px 22px 14px;
  margin: 0 auto 22px; width: fit-content; min-width: 240px; max-width: 420px;
  text-align: center; justify-items: center;
  background: linear-gradient(180deg, #fff, #faf6ef);
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 12px; box-shadow: var(--shadow); cursor: pointer;
  position: relative; z-index: 1;
}
.lineage-hero.m { background: linear-gradient(180deg, #f8fbff, #ebf3fc); border-color: #cddff1; border-top-color: var(--accent); }
.lineage-hero.f { background: linear-gradient(180deg, #fffafc, #fdeff4); border-color: #f0d2dd; border-top-color: var(--accent); }
/* ★ 已故的始祖：原来 .lineage-hero 根本没有 is-dead 这一档，始祖一走
   就退回在世的浅蓝/浅粉，跟下面各世的灰卡完全脱节（Boss 2026-10-25 报的
   「已故人员作为始祖时显示有问题」就是指这个）。必须写在 .m/.f 之后，
   并把 border-top 显式写回 accent：简写 border 会把「始祖」那条金线一起盖掉。 */
.lineage-hero.is-dead,
.lineage-hero.is-dead.m,
.lineage-hero.is-dead.f {
  background: linear-gradient(180deg,var(--dead-1),var(--dead-2));
  border: 1px solid var(--dead-line);
  border-top: 3px solid var(--accent);
}
.lineage-hero.is-dead .lh-name { color: var(--dead-ink); }
.lineage-hero.is-dead .lh-meta { color: var(--dead-soft); }
.lineage-hero.is-dead .lh-count { color: #5b594f; }
.lineage-hero.is-dead .lh-face { filter: grayscale(1); }
.lineage-hero.is-dead .dead-tag { background: #cdcabf; color: #43423b; }
.lh-label { font-size: 12px; letter-spacing: .1em; color: var(--accent); }
.lh-name { font-size: 24px; font-weight: 700; letter-spacing: .04em; }
.lh-meta { font-size: 13px; color: var(--ink-soft); }
.lh-count { font-size: 12px; color: var(--muted); }

/* 每一世 */
.lgen { margin-bottom: 0; position: relative; }
/* 代与代之间留出主干线的走线空间（标签改成绝对定位后不再占位） */
.lgen + .lgen { margin-top: 34px; }
#viewLineage { overflow-x: auto; }
/* 世代标签：贴在整棵树的左侧留白里（RAIL 宽），不压主干线也不压卡片。
   ★ 不能再用竖排（writing-mode: vertical-rl）：竖排时「三世」＋「男4 女5」
     两列字被挤进一个 64×33 的框里（实测 scrollWidth 62 > clientWidth 33），
     文字直接溢出框外，看着像「1女1男世」糊成一团；而且每格宽窄不一
     （一世 24px、其余 54px），整条标尺左右参差。改成固定宽的横排两行：
     第一行世数、第二行男女数，宽度一致就能对齐成一条真正的刻度轴。 */
.lgen-label {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 52px; box-sizing: border-box; text-align: left;
  font-size: 12px; font-weight: 700; line-height: 1.15; letter-spacing: .02em;
  color: #7a5527; padding: 4px 3px 4px 5px;
  border-left: 2px solid rgba(150, 112, 62, .34);
  border-radius: 0 4px 4px 0;
  background: var(--bg);
}
.lgen-sex {
  display: block; margin-top: 1px;
  font-size: 9.5px; font-weight: 500; letter-spacing: 0;
  color: #a3805a; white-space: nowrap;
}
/* 代际轴：贯穿各世标签的一条淡竖线 */
.lin-axis {
  position: absolute; width: 2px; border-radius: 1px;
  background: linear-gradient(180deg, rgba(150, 112, 62, .32), rgba(150, 112, 62, .10));
  pointer-events: none; z-index: 0;
}
/* 卡片位置由 JS 按「子代对齐父代」的树形排版给出（transform），
   所以这里不能 wrap，也不能靠 justify-content 居中，否则两套定位打架。 */
.lgen-row { display: flex; flex-wrap: nowrap; gap: 10px; position: relative; z-index: 1;
  justify-content: flex-start; }

/* 世系节点 */
.lnode {
  min-width: 132px; max-width: 200px; padding: 9px 11px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); cursor: pointer;
  position: relative; z-index: 1;
}
.lnode.m { background: linear-gradient(180deg, #f8fbff, #ebf3fc); border-color: #cddff1; }
.lnode.f { background: linear-gradient(180deg, #fffafc, #fdeff4); border-color: #f0d2dd; }
/* 族系/近亲的已故卡：跟在世的浅蓝/浅粉分开（与家庭树同一套灰） */
.lnode.is-dead { background: linear-gradient(180deg,var(--dead-1),var(--dead-2)); border-color: var(--dead-line); }
.lnode.is-dead .ln-name { color: var(--dead-ink); }
.lnode.is-dead .ln-meta { color: var(--dead-soft); }
.lnode.is-dead .ln-face { filter: grayscale(1); }
.lnode.leaf { border-style: dashed; opacity: .82; }
/* 本人这张卡要一眼认出来：原来只有 2px 细描边，缩到 27% 全览时几乎看不见 */
.lnode.me {
  outline: 2px solid var(--accent); outline-offset: 1px;
  box-shadow: 0 0 0 5px rgba(176, 127, 62, .22), 0 2px 8px rgba(80, 60, 30, .16);
}
.lnode.root { border-left: 3px solid var(--accent); }
.ln-name {
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.ln-me {
  font-size: 10px; font-weight: 400; color: #fff;
  background: var(--accent); border-radius: 4px; padding: 1px 4px;
}
.ln-alias { font-size: 12px; color: var(--ink-soft); }
.ln-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.ln-tag {
  font-size: 11.5px; color: var(--ink-soft);
  background: #f4efe6; border-radius: 4px; padding: 1px 5px;
}
.ln-tag-gen { color: #6d4f34; background: #f6ecdc; }
/* 近亲页的称谓标签：这张卡最重要的一条信息，用主色压住 */
.ln-tag-term { color: #fff; background: var(--accent-dark, #7a5527); font-weight: 600; }
.ln-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.ln-sp { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.ln-note { font-size: 11px; color: var(--muted); margin-top: 2px; font-style: italic; }
/* 说明文字原来用 --muted（3.39:1），12px 小字在手机上读不清，也不达 WCAG AA。
   实测换 --ink-soft 后 5.9:1，既压得住又读得清。 */
.lineage-note { font-size: 12px; color: var(--ink-soft); margin-top: 18px; line-height: 1.6; }
/* 族系说明移到滚动区外后：贴着图谱下方、按屏宽正常折行，
   不再跟着图谱的宽度一起被撑到屏幕外。 */
.lin-note-out {
  margin: 8px 14px 0; padding: 0; max-width: none;
  font-size: 12px; line-height: 1.6;
  color: var(--ink-soft); word-break: break-word;
}

/* 近亲 */
.kin-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.kin-center { font-size: 19px; font-weight: 700; }
.kin-total { font-size: 13px; color: var(--muted); }
.kin-group {
  margin-bottom: 10px; border: 1px solid var(--line-soft);
  border-radius: 10px; background: #fff; overflow: hidden;
}
.kin-sum {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  cursor: pointer; list-style: none; background: #faf7f1;
}
.kin-sum::-webkit-details-marker { display: none; }
.kin-sum::before { content: "▸"; color: var(--muted); font-size: 11px; }
.kin-group[open] .kin-sum::before { content: "▾"; }
.kin-label { font-size: 14px; font-weight: 600; }
.kin-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.kin-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 13px 13px; }
.kin-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 13px; cursor: pointer;
}
.kin-chip.m { background: #eef5fd; border-color: #cfe0f2; }
.kin-chip.f { background: #fdf1f5; border-color: #f2d3de; }
.kc-term { color: var(--accent-dark); }
.kc-name { font-weight: 600; }
.kc-dead { font-size: 11px; color: var(--muted); }

/* ---------------- 近亲：中心人 + 按称呼分组的卡片墙 ----------------
   手机屏宽只有 370，父辈 19 人横排要 2100px，画成树得横滑十几屏，
   谁也看不全（实测近亲树 4130px / 11 屏）。分组墙的宽度永远受屏宽约束：
   组内卡片自动换行，左侧一条竖线把每一组接回中心人。 */
.kin-hero {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin: 0 0 16px;
  background: linear-gradient(180deg, #fff, #faf6ef);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
  position: relative; z-index: 1;
}
.kin-hero-face .ln-face { width: 46px; height: 46px; }
.kin-hero-info { flex: 1 1 auto; min-width: 0; }
.kh-name {
  font-size: 19px; font-weight: 700; line-height: 1.2;
  display: flex; align-items: center; gap: 7px;
}
.kh-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kh-total { flex: 0 0 auto; text-align: right; line-height: 1.15; }
.kh-num { display: block; font-size: 23px; font-weight: 700; color: var(--accent-dark); }
.kh-unit { font-size: 11.5px; color: var(--muted); }

.kin-wall {
  position: relative;
  margin-left: 23px; padding-left: 19px;
  border-left: 2px solid rgba(150, 112, 62, .30);
}
.kin-sec { position: relative; padding-bottom: 15px; }
.kin-sec:last-child { padding-bottom: 2px; }
/* 每一组往左伸一条横线接上主干竖线 */
.kin-sec::before {
  content: ""; position: absolute; left: -19px; top: 12px;
  width: 15px; height: 2px; background: rgba(150, 112, 62, .30);
}
.kin-sec-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.kin-sec-label { font-size: 14.5px; font-weight: 650; letter-spacing: .01em; }
.kin-sec-count {
  font-size: 11.5px; color: #7a5527; font-weight: 600;
  background: rgba(150, 112, 62, .12); border-radius: 999px; padding: 1px 7px;
}
.kin-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.kin-chip { max-width: 100%; }
.kin-chip .kc-name, .kin-chip .kc-term { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kin-chip:active { transform: scale(.97); }
.kin-chip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* 关系网 */
.rel-picker {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.rel-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-soft); }
.rel-field select {
  min-width: 140px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font: inherit; font-size: 13px;
  color: var(--ink);
}
.rel-arrow { color: var(--muted); padding-bottom: 8px; }
.rel-result { min-height: 60px; }
.rel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.rel-term { font-size: 20px; font-weight: 700; color: var(--accent-dark); }
.rel-dist { font-size: 12px; color: var(--muted); }
.rel-path { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rel-node {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 600;
}
.rel-node.m { background: #eef5fd; border-color: #cfe0f2; }
.rel-node.f { background: #fdf1f5; border-color: #f2d3de; }
.rel-step { font-size: 12px; color: var(--muted); }
.rel-none { color: var(--muted); font-size: 14px; padding: 12px 0; }


/* 一人一组：本人主卡 + 配偶小卡并排。
   现实族谱里媳妇、女婿都上谱，父系图里得看见自己的母亲，
   母系图里得看见外公，所以配偶不能缩成卡片里一行小字。 */
/* 夫妻之间的间距留够，中间那条横线才看得出来（8px 太窄，线几乎看不见） */
.lnw { display: flex; align-items: flex-start; gap: 18px; position: relative; z-index: 1; }
/* 始祖这一组必须按内容收缩：.lgen-hero 是块级容器，
   不写 width:max-content 时这层 flex 会被拉到整行宽（实测 1810px），
   始祖和配偶就被居中到画布右侧，外公直接落在可视区外。 */
.lnw.lw-hero { width: max-content; justify-content: flex-start; }
.lnw.lw-hero .lineage-hero { margin: 0 0 22px; }
.lnode.sp { min-width: 96px; max-width: 152px; padding: 8px 10px; opacity: .96; }
.lnode.sp .ln-name { font-size: 13.5px; }
.lnode.sp .ln-meta { font-size: 11.5px; }
.ln-tag-sp { color: #7a5a2f; background: #f7efe0; }

@media (max-width: 640px) {
  .lineage-body { padding: 12px 12px 36px; }
  .lnode { min-width: 112px; }

  /* 始祖抬头在手机上要收一档：原来的 16/22 内边距 + 24px 姓名 + 三行小字
     让它在 85% 缩放下还占 186px 高（普通卡 40px），第一、二世之间的
     行距被它拉得特别大，整条左侧标尺看着头重脚轻、节奏乱。
     收紧到 190px 宽、11/19/10.5px 字号后高度降到约 120px，节奏整齐。 */
  .lineage-hero { padding: 10px 14px 9px; gap: 2px; min-width: 190px; max-width: 260px; }
  .lh-label { font-size: 11px; }
  .lh-name { font-size: 19px; }
  .lh-meta { font-size: 11px; }
  .lh-count { font-size: 10.5px; }
  .rel-field select { min-width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .sticks i::before, .sticks .smoke, .candle::before,
  .tablet.just-lit .tablet-board { animation: none; }
}

/* ---------------- 菜单里的分组标题（新增人员 / 数据 / 个人设置） ---------------- */
.menu-sec {
  margin: 8px 10px 3px; font-size: 11px; letter-spacing: .08em;
  color: var(--muted); text-transform: none;
}
.menu-pop .menu-sec:first-of-type { margin-top: 2px; }
.menu-item-main { color: var(--accent-dark); font-weight: 600; }

/* ---------------- 族系缩放条 ---------------- */
.lin-zoom { margin-left: auto; }

/* ---------------- 近亲关系图 ---------------- */
.kin-chart { position: relative; }
.kin-lgen { margin-bottom: 0; }
.kin-node {
  min-width: 108px; max-width: 168px; text-align: center;
  display: grid; gap: 2px; justify-items: center;
}
.kin-node .kn-term {
  font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 999px;
  background: rgba(150, 112, 62, .12); color: var(--accent-dark); font-weight: 600;
}
.kin-node .ln-name { font-size: 14px; }
.kin-node .ln-meta { font-size: 11px; }
.kin-terms {
  margin: 18px 0 8px; border: 1px solid var(--line-soft); border-radius: 12px;
  background: #fffdf8; padding: 4px 6px;
}
.kin-terms-sum {
  cursor: pointer; padding: 9px 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  list-style: none;
}
.kin-terms-sum::-webkit-details-marker { display: none; }
.kin-terms-sum::before { content: "▸"; margin-right: 7px; color: var(--muted); font-size: 11px; }
.kin-terms[open] .kin-terms-sum::before { content: "▾"; }
.kin-group-open { padding: 2px 0 6px; }
.kin-group-open .kin-sum { padding: 7px 8px; display: flex; align-items: baseline; gap: 8px; }
.kin-group-open .kin-sum::before { content: none; }

/* ---------------- 关系网：一条链，从上往下读 ---------------- */
.rel-picker { align-items: flex-end; }
.rf-tag {
  display: inline-block; min-width: 18px; padding: 1px 5px; margin-right: 5px;
  border-radius: 6px; background: rgba(150, 112, 62, .13); color: var(--accent-dark);
  font-weight: 700; font-size: 11px;
}
.rel-say { margin: 0; font-size: 15px; line-height: 1.6; }
.rel-say .rel-term { font-size: 19px; margin: 0 2px; }
.rel-chain { list-style: none; margin: 6px 0 10px; padding: 0; }
.rel-card {
  display: flex; align-items: center; gap: 8px; width: fit-content;
  min-width: 132px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-soft); background: #fffdf8;
  box-shadow: 0 1px 2px rgba(60, 45, 25, .05);
}
.rel-card.m { background: linear-gradient(180deg, #f8fbff, #eef5fd); border-color: #cfe0f2; }
.rel-card.f { background: linear-gradient(180deg, #fffafc, #fdf1f5); border-color: #f2d3de; }
.rel-card .rc-name { font-weight: 700; font-size: 15px; }
.rc-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700;
}
.rc-tag-b { background: #6b7f9e; }
/* 两段之间的连接：一段竖线 + 这一步的称谓 */
.rel-hop { display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 26px; }
.rh-line {
  width: 2px; height: 26px; background: #c9b48c; border-radius: 1px; position: relative;
}
.rh-line::after {
  content: ""; position: absolute; left: -3px; bottom: -1px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 6px solid #c9b48c;
}
.rh-rel {
  font-size: 12px; color: var(--accent-dark); background: rgba(150, 112, 62, .1);
  padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.rel-hint { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin: 8px 0 0; }

/* 关系网改成「一步一句」：每跨一层写清谁是谁的什么，不用读者自己拼。
   原来的做法是把关系词飘在两个名字之间，字面上省了，读起来费劲。 */
.rel-answer {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 12px 14px; margin: 0 0 12px; border-radius: 12px;
  background: linear-gradient(180deg, #fffdf7, #fdf6e9);
  border: 1px solid #e8d9b8;
}
.rel-answer .rel-term {
  font-size: 20px; font-weight: 800; color: var(--accent-dark);
  padding: 0 3px;
}
.rel-answer .rel-dist { font-size: 12.5px; color: var(--muted); }
.rel-steps { list-style: none; margin: 0 0 4px; padding: 0; }
.rel-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px; border-radius: 10px; background: #fffdf8;
  border: 1px solid var(--line-soft); margin-bottom: 7px;
}
.rel-step:last-child { margin-bottom: 0; }
.rs-no {
  flex: 0 0 auto; width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 999px; background: rgba(150, 112, 62, .12);
  color: var(--accent-dark); font-size: 11.5px; font-weight: 700; margin-top: 1px;
}
.rs-say { font-size: 14.5px; line-height: 1.75; }
.rs-say b { font-weight: 700; }
.rs-rel {
  color: var(--accent-dark); font-weight: 700;
  padding: 0 4px; border-radius: 5px; background: rgba(150, 112, 62, .1);
}

/* ===== 参照成熟谱牒 App 的信息密度改造 =====
   1) 谱名楷体大字压在族谱顶上；2) 卡片贴人像；3) 世标签报男女人数；
   4) 夫妻之间连横线；5) 底部常驻「人数/男/女」统计条。 */
.lin-title {
  font-family: "KaiTi", "STKaiti", "Kaiti SC", "AR PL UKai CN", "楷体", serif;
  font-size: 27px; line-height: 1.25; letter-spacing: .3em; text-indent: .3em;
  text-align: center; color: #6d4a22; margin: 6px 0 14px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .75);
}
.lin-title:empty { display: none; }

.ln-face {
  display: block; width: 40px; height: 40px; margin: 0 auto 7px;
  border-radius: 50%; overflow: hidden; background: #eef3f9;
  border: 1px solid rgba(0, 0, 0, .07);
}
.ln-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ln-face-none svg { width: 100%; height: 100%; display: block; }
.ln-face-none.m { background: #dce9f7; }
.ln-face-none.m svg { fill: #5b8bbf; }
.ln-face-none.f { background: #f9e4ec; }
.ln-face-none.f svg { fill: #c2728f; }
.lnode.sp .ln-face { width: 30px; height: 30px; margin-bottom: 5px; }
.lh-face { width: 56px; height: 56px; margin-bottom: 9px; }

.lgen-sex {
  display: block; margin-top: 8px; font-size: 12px; font-weight: 600;
  letter-spacing: .04em; color: #6d4a22;
}

.ln-link.ln-wed { stroke: #b07f3e; stroke-width: 2.6; }

/* 统计条放在图谱下方作为正常一行：
   原来是 position:fixed 浮在左下角，族系页里正好压住最下面一代的卡片
   （实测同辈那一行只有上半截露出来）。改成正常流，图谱多高都不会被盖。 */
.lin-foot {
  display: flex; align-items: center; gap: 8px;
  margin: 0 16px 10px; width: fit-content;
  padding: 6px 13px; font-size: 12.5px; color: #5d4a33;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(252, 249, 243, .95);
  box-shadow: 0 2px 8px rgba(80, 60, 30, .08);
}
.lf-pie {
  width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(#8fb3d9 0deg 180deg, #e3aabb 180deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}

/* ===== 手机端底部导航 =====
   参照成熟谱牒 App：主入口放在拇指可及处，图标在上、文字在下。
   桌面端保持原样（顶部横向标签），不影响大屏的信息密度。 */
@media (max-width: 720px) {
  .tabs {
    position: fixed !important;
    /* ★ 不能用 bottom:0：这个页面在手机模拟（以及部分真机浏览器）里，
       内容比一屏长时 innerHeight 会被报成内容高度（实测 844 → 2494），
       fixed 元素按 bottom 定位就跑到页面最底下、屏幕上根本看不到。
       用 dvh 明确按视口高度定位，innerHeight 怎么变都不影响。 */
    top: calc(100dvh - 60px); bottom: auto;
    left: 0; right: auto;
    /* 族系页里这个 fixed 容器的包含块会被页面撑大（实测 right:0 失效、
       宽度变 1152px，屏幕上只露出前两个 tab）。宽度直接按视口写死。 */
    width: 100vw; max-width: 100vw;
    z-index: 70;
    display: flex; align-items: stretch; justify-content: space-between;
    gap: 0;
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line-soft);
    border-bottom: none;
    background: rgba(255, 253, 249, .98);
    box-shadow: 0 -2px 14px rgba(80, 60, 30, .08);
    overflow-x: auto; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 1 1 0; min-width: 46px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 1px 5px;
    height: auto; min-height: 0;
    font-size: 11.2px; line-height: 1.25; letter-spacing: 0;
    color: #6b5c46;
    border: none; border-bottom: none; border-radius: 9px; margin: 0;
    white-space: nowrap;
  }
  .tab .ico { width: 21px; height: 21px; margin: 0; vertical-align: 0; }
  .tab.active { color: var(--green); background: rgba(94, 140, 94, .10); font-weight: 600; }
  .tab-badge { position: absolute; top: 1px; right: 50%; transform: translateX(22px); }

  /* 底部栏占位：不让页面内容和最后一张卡被导航盖住。
     必须同时写 body.tree-tab（那条旧规则是类选择器，权重比裸 body 高，
     只写 body 会被 padding-bottom:0 盖掉，实测底部卡片仍被导航压住 50px）。 */
  body, body.tree-tab { padding-bottom: 84px; }
  .view { padding-bottom: 24px; }
  /* 族系统计条上移到导航之上，避免两块浮层叠在一起 */
  .lin-foot { bottom: 78px; }
}

/* ================= 2.4.11 族系四页重做 =================
   实测到的两处硬伤：
   1) 手机上只有「家庭树」那一屏有 overflow 锁（body.tree-tab）。切到族系后
      body/main 的 overflow 变回 visible，族谱 1152px 的 min-width 直接把
      「布局视口」撑到 1152（innerWidth 1152 / visualViewport 390），
      整页被按 0.34 倍缩小、fixed 底栏按 1152 摆位——看着就是一堆错位。
   2) 族系头部从 y=0 一直排到 y=443（顶栏 63 + 动作区 128 + 切换栏 132 +
      大标题 34），844 高的屏上图谱只剩 340px，还得横向拖。
   做法：族系页照家庭树的办法锁成一整屏（body.pane-tab），头部压成两行，
   横竖滚动都收在 .lineage-scroll 内部。 */
@media (max-width: 720px) {
  body.pane-tab {
    height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
    /* 底部导航是 fixed（高 60 + 安全区），族系页锁了整屏，
       不留这条占位，最后一行的说明文字会被导航压住 60px（实测） */
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }
  /* 族系页专注看图：顶部只留「家谱名 + 聊天 + 菜单」一行。
     原来顶栏（含统计、切家谱、新建/加入/改名、搜索）叠了 4 层，
     844 高的屏上图谱只剩 340px，还得横向拖。 */
  body.pane-tab .topbar {
    padding: 6px 10px 5px; gap: 8px; flex-wrap: nowrap;
    align-items: center;
  }
  body.pane-tab .topbar .app-name,
  body.pane-tab .topbar #appStats,
  body.pane-tab .topbar .tree-switch,
  body.pane-tab .topbar .search { display: none; }
  body.pane-tab .topbar .logo { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  body.pane-tab .topbar .brand { gap: 8px; flex: 1 1 auto; min-width: 0; }
  body.pane-tab .topbar .brand-text h1 {
    font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  body.pane-tab .topbar .top-actions { flex: 0 0 auto; gap: 6px; width: auto; flex-wrap: nowrap; }
  /* 族系页顶栏只有一行：欢迎语压到最短，和菜单仍并排（不折行、不撑爆家谱名） */
  body.pane-tab .topbar .greet-row { gap: 6px; min-width: 0; }
  body.pane-tab .topbar .greet { max-width: 7em; font-size: 11.5px; }
  body.pane-tab .topbar .greet-name { font-size: 12px; }
  body.pane-tab .topbar .user-btn { padding: 0 10px 0 5px; height: 38px; }
  /* 构图标题与顶栏的家谱名重复，手机上省掉这 30px 给图谱 */
  body.pane-tab .lin-title { display: none; }
  body.pane-tab main {
    flex: 1 1 auto; min-height: 0; overflow: hidden;
    display: flex; flex-direction: column;
  }
  body.pane-tab .foot { display: none; }
  body.pane-tab #viewLineage.active {
    display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
    padding: 4px 10px 0; overflow: hidden;
  }
  /* 头部两行：第一行四个视图等分，第二行「以谁为中心 + 缩放」 */
  body.pane-tab .lineage-bar {
    flex: 0 0 auto; display: flex; flex-wrap: wrap;
    gap: 6px; padding: 2px 0 6px;
  }
  body.pane-tab .lineage-bar .seg {
    flex: 1 1 100%; display: flex; gap: 2px; padding: 2px;
  }
  body.pane-tab .seg-btn {
    flex: 1 1 0; text-align: center; padding: 7px 2px;
    font-size: 12.5px; letter-spacing: .2px; white-space: nowrap;
  }
  body.pane-tab .lc-wrap { flex: 0 1 auto; min-width: 0; }
  body.pane-tab .lin-center { max-width: 52vw; padding: 5px 10px; font-size: 12.5px; }
  body.pane-tab .lin-zoom { flex: 0 0 auto; margin-left: auto; }
  body.pane-tab .lin-zoom button { padding: 4px 8px; font-size: 12px; }
  body.pane-tab .lineage-focus { display: none; }
  /* 大标题在手机上让位给图谱：只留一行小字 */
  body.pane-tab .lin-title {
    flex: 0 0 auto; font-size: 14px; margin: 0 0 4px; line-height: 1.2;
  }
  body.pane-tab .lin-title .lt-sub { display: none; }
  body.pane-tab .lineage-scroll {
    flex: 1 1 auto; min-height: 0; overflow: auto;
    border-radius: 10px;
  }
  body.pane-tab .lineage-body { padding: 10px 10px 28px; }
  /* 底部统计条改为贴在图谱下沿的一条（原来是 absolute 浮层，压在图上） */
  body.pane-tab .lin-foot {
    position: static; flex: 0 0 auto; margin: 4px 0 2px; bottom: auto;
    padding: 6px 10px; border-radius: 10px;
  }
  /* 关系网是表单，始终按屏宽排，不跟着族谱横向撑开 */
  body.pane-tab .lineage-body.rel-on { min-width: 0 !important; transform: none !important; }
}

/* 桌面端：两行头部同样生效，只是不锁屏 */
@media (min-width: 721px) {
  .lineage-bar { padding: 10px 16px 0; }
  .lin-title { margin-top: 8px; }
}

/* ---------------- 关系网（2.4.11 重做） ----------------
   原来是两个原生下拉：48 人的谱就是 48 个选项，手机滚轮里翻不到人，
   结果又是「甲 → 乙」的术语串。现在改成两个可搜索的选择按钮 + 一句人话 + 一条链。 */
.rel-panel {
  max-width: 520px; margin: 0 auto; padding: 14px;
  background: #fffdf8; border: 1px solid var(--line-soft); border-radius: 14px;
  box-shadow: 0 2px 8px rgba(90, 74, 44, .05);
}
.rel-lead { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.rel-top { display: flex; align-items: center; gap: 8px; }
/* ★ 2026-10-31 Boss 第 1 条：甲/乙改成原生下拉（候选写法同其他选人下拉）。
   外框仍保留虚线感，圆徽标「甲 / 乙」当前缀，一眼分得清哪个是哪个。 */
.rel-field {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px;
  border: 1px solid #d8c9ae; background: #fff; border-radius: 10px;
  padding: 4px 8px;
}
.rel-field:focus-within { border-color: #c8a668; box-shadow: 0 0 0 2px rgba(200, 166, 104, .15); }
.rel-field .rp-tag {
  flex: none; width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 50%; background: #f0e7d6; color: #8a6a35; font-size: 12px; font-weight: 700;
}
.rel-select {
  flex: 1 1 auto; min-width: 0; width: 100%; border: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink); padding: 5px 2px;
  text-overflow: ellipsis; cursor: pointer; appearance: auto;
}
.rel-select:focus { outline: none; }
.rel-swap {
  flex: none; width: 30px; height: 30px; line-height: 28px; text-align: center;
  border-radius: 50%; border: 1px solid var(--line-soft); background: #fff;
  color: #9a8355; font-size: 14px; cursor: pointer; user-select: none;
}
.rel-go { width: 100%; margin-top: 10px; }
/* 乙还没选时按钮是禁用态，必须一眼看出「还不能点」，
   否则用户点了没反应会以为功能坏了。 */
.rel-go:disabled {
  background: #e7e0d3; color: #9c8b74; border-color: #ded4c3;
  box-shadow: none; cursor: not-allowed;
}
/* 候选名单就地展开（不用浮层）：滚动容器里绝对定位的浮层会被裁掉 */
.rel-pop {
  position: static; width: 100%; margin-top: 10px;
  box-shadow: none; border-radius: 10px;
}
.rel-pop .pick-list { max-height: 240px; overflow-y: auto; }
.rel-pop .pick-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rel-result { min-height: 60px; margin-top: 12px; }
/* ★ 关系网一步一句（2026-10-24 定稿）：「A 的 X 是 B」逐行列出。
   不要恢复成「A › X › B」的链式——关系词飘在两个名字中间，Boss 原话「看不明白」。 */
.rel-steps {
  list-style: none; margin: 10px 0 8px; padding: 0;
  counter-reset: relstep;
  display: flex; flex-direction: column; gap: 6px;
}
.rel-step {
  counter-increment: relstep;
  position: relative; padding: 7px 12px 7px 34px;
  background: #f7f3ea; border-left: 2px solid #d8c9ae; border-radius: 6px;
  font-size: 13.5px; line-height: 1.5;
}
.rel-step::before {
  content: counter(relstep);
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  background: #b07f3e; color: #fff; font-size: 10.5px; line-height: 16px;
  text-align: center;
}
.rel-step b { color: var(--ink); }
.rel-step-rel { font-style: normal; color: #8a6b32; border-bottom: 1px dotted #cbb996; margin: 0 2px; }
/* 直系速查：表单下方的常用查询，把原来那一大片空白填成能直接点的入口 */
.rel-quick { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.rq-title { font-size: 12.5px; color: var(--muted); margin: 0 0 9px; }
.rq-chips { display: flex; flex-direction: column; gap: 10px; }
.rq-group { display: flex; align-items: baseline; gap: 8px; }
.rq-glabel {
  /* ★ 2026-10-31 Boss 第 1 条：「祖父母 · 外祖父母」原来被 max-width:88px 挤成两行，
     称谓一断行就被读成两个人。改成按内容占宽、绝不折行。 */
  flex: 0 0 auto; min-width: 62px; max-width: none; white-space: nowrap;
  font-size: 12px; color: var(--muted); line-height: 1.9;
}
.rq-gchips { display: flex; flex-wrap: wrap; gap: 7px; flex: 1 1 auto; min-width: 0; }
.rq-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font: inherit; font-size: 13px; color: var(--ink);
  cursor: pointer;
}
.rq-chip:hover { border-color: var(--green); background: var(--green-soft); }
.rq-chip .rq-term { color: var(--accent-dark); font-size: 12px; }
.rq-chip .rq-name { font-weight: 600; }
@media (max-width: 720px) {
  body.pane-tab .rel-panel { padding: 12px; border-radius: 12px; }
  .rel-field { padding: 3px 6px; gap: 4px; }
  .rel-select { font-size: 13.5px; padding: 6px 2px; }
  /* ★ 2026-10-31 Boss 第 1 条：手机端「中心人物」和「按辈分/按姓名」必须排成一行。
     原来 .list-tools 是 flex-wrap:wrap，360px 的机器上「中心人物 + 下拉」占 206px、
     排序段 129px，加起来超过可用宽，于是各占一行（截图上就是上下两条）。
     现在整条工具行不换行：下拉框可伸缩（min-width:0 + flex:1），排序段固定宽，
     390/360/320 三档实测同排且不重叠。 */
  .list-bar { gap: 8px; }
  .list-tools { flex-wrap: nowrap; width: 100%; justify-content: space-between; gap: 6px; }
  .list-focus { flex: 1 1 auto; min-width: 0; padding: 2px 6px 2px 9px; gap: 5px; }
  .list-focus .lf-label { font-size: 12px; }
  .list-focus select { max-width: none; flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
  /* ★ 2026-11-01：自绘按钮在手机端也要撑满药丸框（原来是 select 才有的弹性） */
  .lf-btn { flex: 1 1 auto; min-width: 0; max-width: none; font-size: 12.5px; }
  .list-sort { flex: 0 0 auto; }
  .list-sort .sort-btn { font-size: 12.5px; padding: 0 10px; }
}
@media (max-width: 380px) {
  .list-focus .lf-label { font-size: 11.5px; }
  .list-focus select { font-size: 12px; }
  .list-sort .sort-btn { padding: 0 8px; font-size: 12px; }
}

/* 族系页顶栏收一行：搜索框是人员名单的过滤器，族系页用不上，
   留着白占 42px（switch 行 + user/add 行 + search 行 → 两行）。 */
@media (max-width: 720px) {
  body.pane-tab .top-actions { grid-template-areas: "add user"; grid-template-columns: auto minmax(0, 1fr); }
  body.pane-tab .top-actions .search { display: none; }
}

/* 收起旁支 / 展开全部：状态一目了然（收起后按钮变成高亮「展开全部」） */
.lin-fold-btn.on { background: #f4e6cd; border-color: #d9c7a6; color: #7a5a2c; font-weight: 600; }

/* ===== 族系「按房收起」徽标（2026-10-28 补） =====
   ★ 这里原来只有 JS 没有 CSS：.ln-badge 当成普通 <button> 落在 .lnw 这个 flex
   容器里，变成卡片右边多出来的一块白方块（Boss 截图里「每张卡边上都带一个模块」），
   还把 .lnw 的 offsetWidth 撑宽 29px＋18px 间距，父卡居中、母线端点全跟着偏。
   定稿：绝对定位挂在卡片组的右下角外侧，不参与 flex 布局、不占宽度、不影响量测。
   .lnw 的 gap 是 18px（紧凑档 10px），右侧溢出 10px 正好落在空档里，压不到邻卡。
   ★ 2026-10-28 第二轮：Boss 说「每张卡边上都带一个模块」——即使是小圆点，
   一百多张卡每张挂一个也像贴纸。改成「默认不显示，鼠标移到这张卡上才出现」，
   触屏没有 hover 就压到 8% 面积、半透明；已收起的那张始终显示「＋N」，
   否则收起来的人找不到展开入口。 */
.ln-badge {
  position: absolute;
  right: -10px;
  bottom: 4px;
  z-index: 4;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #d9c7a6;
  border-radius: 50%;
  background: #fffdf7;
  color: #8b6a3c;
  font: 12px/16px "PingFang SC", "Microsoft YaHei", sans-serif;
  text-align: center;
  cursor: pointer;
  opacity: .78;
  box-shadow: 0 1px 2px rgba(120, 90, 40, .12);
  transition: opacity .12s ease, background .12s ease;
  opacity: 0;
  pointer-events: none;
}
/* 鼠标进到这一组卡片（本人 + 配偶）上才露面 */
.lnw:hover > .ln-badge,
.lnw:focus-within > .ln-badge { opacity: .78; pointer-events: auto; }
/* ★ 2026-10-28 第三轮 Boss：「每个卡片边上都带着一个模块」——
   即使是半透明小圆点，一百多张卡每张挂一个也像贴纸。定稿：任何设备
   （含手机 hover:none）都默认**完全不显示**，只有「已被收起」的那张卡
   显示「＋N」药丸（那是展开入口，必须有）。收起/展开改由缩放条上的
   一个统一按钮操作，不再往每张卡上贴东西。 */
@media (hover: none) {
  .ln-badge { opacity: 0; pointer-events: none; width: 13px; height: 13px; font-size: 9px; }
}
.ln-badge:hover,
.ln-badge:focus-visible { opacity: 1; background: #f7ecd9; outline: none; }
/* 收起态：显示「＋N」，药丸形，宽度自适应。收起后必须一直露着，
   否则被收起来的这一房连个展开入口都找不到。 */
.ln-badge.on {
  width: auto;
  min-width: 24px;
  padding: 0 5px;
  border-radius: 9px;
  background: #f4e6cd;
  opacity: .95;
  pointer-events: auto;
  font-size: 10.5px;
}
/* 被收起的人整组不显示；整代都收起来的那一行也不留空壳 */
.lnw.lin-folded { display: none !important; }
.lgen.lin-fold-empty { display: none; }
/* 紧凑档卡片只有 52px 宽，徽标跟着缩一点，别糊住姓名 */
#lineageBody.lin-compact .ln-badge { width: 14px; height: 14px; font: 10px/12px sans-serif; right: -8px; bottom: 2px; }

/* ===== 族系「紧凑档」：缩到看全整支时启用（JS 加 .lin-compact） =====
   手机 390px 上，父系 21 人的完整卡（132px、头像+别名+标签+生卒）整幅 1148px，
   一屏装不下只能自动缩到 27%——这时姓名只剩 3px，等于把人物缩成了色块。
   成熟谱牒 App 的做法是「缩小时卡片只留姓名」：卡片压到 52px，整幅宽度掉掉一半，
   同样一屏里名字反而能看清。放大回 85% 以上自动切回完整卡（带迟滞，避免抖动）。 */
#lineageBody.lin-compact .lgen + .lgen { margin-top: 22px; }
#lineageBody.lin-compact .lgen-row { gap: 6px; }
#lineageBody.lin-compact .lnw { gap: 10px; }
#lineageBody.lin-compact .lnode {
  min-width: 52px; max-width: 52px; padding: 5px 3px; border-radius: 6px;
}
#lineageBody.lin-compact .lnode .ln-alias,
#lineageBody.lin-compact .lnode .ln-meta,
#lineageBody.lin-compact .lnode .ln-note,
#lineageBody.lin-compact .lnode .ln-me { display: none; }
/* ★ 称谓标签（岳父/婆婆/五姨父…）在紧凑档必须留着——它就是「近亲」这一屏的正文。
   2026-10-26 Boss 报「姻亲算不出来」，实测算法早就算出岳父/岳母，是紧凑档把
   .ln-tags 整块 display:none 掉了：48 人谱默认进紧凑档，屏幕上只剩名字，
   等于功能没做。辈分标签（ln-tag-gen）与姓名重复，仍隐藏。 */
#lineageBody.lin-compact .lnode .ln-tags {
  display: flex; justify-content: center; margin-top: 1px; gap: 0;
  max-width: 100%; overflow: hidden;
}
#lineageBody.lin-compact .lnode .ln-tag-gen { display: none; }
#lineageBody.lin-compact .lnode .ln-tag-term,
#lineageBody.lin-compact .lnode .ln-tag-sp {
  font-size: 8.5px; font-weight: 600; line-height: 1.35; padding: 0 2px;
  border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; letter-spacing: 0;
}
#lineageBody.lin-compact .lnode .ln-name {
  font-size: 11.5px; font-weight: 600; line-height: 1.18;
  display: block; word-break: break-all; letter-spacing: 0;
}
#lineageBody.lin-compact .lnode.sp { min-width: 46px; max-width: 46px; }
#lineageBody.lin-compact .lnode.sp .ln-name { font-size: 11px; }
#lineageBody.lin-compact .lgen-label {
  font-size: 11px; padding: 5px 3px; letter-spacing: .08em;
}
#lineageBody.lin-compact .lnode.me { outline-width: 2px; box-shadow: 0 0 0 3px rgba(176,127,62,.28); }
/* 紧凑档卡片统一高度：52px 宽度下 3 字名一行、5 字名两行，
   不定高就会「同一代有的 17px 有的 27px」，底边参差，看着像卡片错位。
   定高 + 居中后整代是一条齐线，连线也齐。 */
#lineageBody.lin-compact .lnode {
  min-height: 40px; display: flex; flex-direction: column; gap: 1px;
  align-items: center; justify-content: center;
}
#lineageBody.lin-compact .lnode .ln-name { text-align: center; }
/* 紧凑卡再收一档：40px 宽、10px 字号、间距 4px。
   实测依据：父系 21 人最宽一代 9 张，9×(40+4)+34(世代标签) = 430px，
   手机 370px 屏按 85% 就能完整装下——参考成熟谱牒 App 的密度（卡 40px、字 9~10px）。
   52px 宽时同样一代要 602px，只能看到 61%，横向还要拖。 */
#lineageBody.lin-compact .lgen-row { gap: 4px; }
#lineageBody.lin-compact .lnw { gap: 10px; }
#lineageBody.lin-compact .lnode { min-width: 40px; max-width: 48px; padding: 4px 2px; min-height: 34px; }
/* 紧凑档姓名一律不折行：40px 卡内容区 36px，而四字名（周赵嫣然、二伯前任）
   10px 要 40px，必被挤成两行，整代卡片底边就参差。
   上限放到 48px（内容 42px）：2~3 字仍是 40px（min-width 兜着），
   四字才长到 46px，整幅只宽几像素；再长的用省略号，不让它顶起行高。 */
#lineageBody.lin-compact .lnode .ln-name {
  font-size: 10px; line-height: 1.15; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; word-break: keep-all;
}
#lineageBody.lin-compact .lnode.sp { min-width: 44px; max-width: 48px; padding: 4px 2px; }
/* ★ 紧凑档也保留头像：以前紧凑档把头像整块隐藏，结果「人多的家谱」（正是最常见的）
   在族系里一个头像都看不到，男女只能靠卡底色分辨，用户直接问「头像到底引没引用」。
   现在留 15px 小剪影压在姓名上方：卡宽仍是 40~48px（不加宽、不破坏一屏全览），
   卡高统一 38px。有照片的人这里显示照片缩略，没照片就是男女剪影。 */
#lineageBody.lin-compact .lnode { flex-direction: column; gap: 2px; min-height: 38px; }
#lineageBody.lin-compact .lnode .ln-face {
  display: block; width: 15px; height: 15px; margin: 0 auto; border-radius: 50%;
  overflow: hidden; flex: 0 0 auto;
}
#lineageBody.lin-compact .lnode.sp .ln-face { width: 15px; height: 15px; margin-bottom: 0; }
#lineageBody.lin-compact .lnode .ln-face img { width: 100%; height: 100%; object-fit: cover; }
/* 配偶小卡放宽到 44px 且姓名不折行：38px 时内容区只剩 34px，
   「二伯前任」「肖雷妻子」这种四字名 9.5px 也要 38px，必被挤成两行，
   一整代卡片底边因此参差。44px 内容 40px 刚好放得下一行四字；
   再长的（如「二伯妈1氏」）宁可省略号，也不让它单独把行高顶起来。 */
#lineageBody.lin-compact .lnode.sp .ln-name {
  font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  word-break: keep-all;
}
#lineageBody.lin-compact .lgen-label { font-size: 10px; padding: 4px 2px; width: 42px; letter-spacing: 0; }
#lineageBody.lin-compact .lgen-sex { font-size: 8.5px; }
/* 紧凑档没有「本人」徽标（10px 下放不下），改用金框 + 暖底把本人点出来，
   否则 40px 的小卡里认不出哪个是自己。 */
#lineageBody.lin-compact .lnode.me {
  background: #fdf1dc; border-color: var(--accent);
  outline: 2px solid var(--accent); outline-offset: 0;
}
#lineageBody.lin-compact .lnode.me .ln-name { font-weight: 700; }
/* ★ 称谓标签在紧凑档不能被 flex 挤没：卡是竖排（头像 15 + 姓名 + 称谓），
   min-height 38px 装不下三行，标签会被压成 0 高（textContent 还在，屏幕上没有）。
   定稿：卡高统一 62px（整行齐线），称谓允许两行——6 字的长称谓（丈夫的曾祖父、
   姐夫的哥的妻子）在 42px 卡宽里一行放不下，只给一行就成「丈夫的…」，等于没写。 */
#lineageBody.lin-compact .lnode { min-height: 62px; }
#lineageBody.lin-compact .lnode .ln-tags {
  flex: 0 0 auto; display: block; text-align: center;
  max-height: 24px; overflow: hidden; margin-top: 0;
}
#lineageBody.lin-compact .lnode .ln-tag-term,
#lineageBody.lin-compact .lnode .ln-tag-sp {
  display: inline-block; white-space: normal; word-break: break-all;
  text-overflow: clip; line-height: 1.32; max-width: 100%;
}
/* ★ 2.7.4（Boss 报「卡片没有姓名，只剩属相和称谓」）：
   卡高原来写死 62px。2.7.3 把「生肖·状态」这一行加进紧凑卡后，头像 15 + 姓名 12
   + 生肖 22 + 称谓 24 + 间距 6 + 内边距 8 = 87px，超出定高，姓名行被 flex 压成 0 高
   ——textContent 还在（所以旧的「三行齐全」断言全绿），屏幕上一个字都没有。
   定稿：不再写死高度，改成「同一代取最高那张卡的高度」——
   .lnw 与 .lnode 一起 stretch，底边照样齐线，内容多的卡不会被挤掉任何一行。 */
#lineageBody.lin-compact .lnw { align-items: stretch; }
#lineageBody.lin-compact .lnode {
  height: auto; min-height: 62px; align-self: stretch; justify-content: flex-start;
}
#lineageBody.lin-compact .lnode .ln-name,
#lineageBody.lin-compact .lnode .ln-life { flex: 0 0 auto; }
/* ★ 2026-10-31 Boss 第 2 条（族系三页仍差的这一处）：配偶卡要跟本家卡齐平。
   根因：主规则 `#lineageBody .lnode, #lineageBody .lnode.sp {justify-content:center}`
   给两者都设了居中，而紧凑档那条 `#lineageBody.lin-compact .lnode{justify-content:flex-start}`
   权重与主规则的 `.sp` 那半完全相同（都是 id + 2 class），主规则写在文件更后面 ⇒
   `.lnode` 拿 flex-start、`.lnode.sp` 仍是 center。实测后果：同一代卡高一致（41.8px），
   但配偶卡正文整体下移 1.9px（母系完整档 3px），本家卡字顶在上、配偶卡字沉在中间，
   Boss 就是照这个说「男女卡内容高度不一致」。
   下面这条多带一个 `.sp`，权重 (1,3,0) 高过两者的 (1,2,0)，不再依赖书写顺序。 */
#lineageBody.lin-compact .lnode.sp { justify-content: flex-start; }

/* ============ 族系全屏（2.4.19）============
   Boss 的要求：族系页要有全屏按钮，父系/母系/近亲在全屏里能缩放、放大，
   而且这个缩放只在全屏内可用 —— 不做整页缩放，不动 viewport。 */
.lin-tools { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.lin-fs-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.lin-fs-btn:hover { background: #f6f1e8; }
.lin-fs-btn.on { background: var(--green, #2f7a4f); border-color: var(--green, #2f7a4f); color: #fff; }

/* ★ 2026-10-26 Boss 定稿：父系/母系/近亲在**非全屏**也要有这排缩放套件。
   原来默认整条 display:none，只能先进全屏才能放大。现在常显、右对齐一行，
   全屏时才浮到画布右上角（下面的规则）。「退出」按钮由 JS 按全屏状态显示。 */
#linZoomBar { display: flex !important; width: fit-content; margin: 1px 12px 0 auto; }
/* hidden 属性必须压得住下面那条 !important：关系网不给缩放条 */
#linZoomBar[hidden], .lin-fs-btn[hidden] { display: none !important; }
#viewLineage.active.lin-fs #linZoomBar {
  display: inline-flex !important;
  position: absolute; right: 12px; top: 8px; z-index: 6;
}
#viewLineage.lin-fs .lineage-bar { position: relative; }

/* 全屏：整屏让给族系画布。只在 active 时生效，切走标签页自动失效，
   不会出现「隐藏的族系页盖住别的页」。 */
#viewLineage.active.lin-fs {
  position: fixed; inset: 0; z-index: 960;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding: 0; margin: 0; max-width: none; width: auto;
}
#viewLineage.active.lin-fs .lineage-bar { flex: 0 0 auto; padding: 8px 12px; }
#viewLineage.active.lin-fs .lin-title { flex: 0 0 auto; padding: 2px 14px 4px; }
#viewLineage.active.lin-fs .lineage-scroll {
  flex: 1 1 auto; min-height: 0; max-width: none;
  overflow: auto; overscroll-behavior: contain;
}
#viewLineage.active.lin-fs .lin-note-out { flex: 0 0 auto; margin: 4px 14px 0; }
#viewLineage.active.lin-fs .lin-foot { flex: 0 0 auto; }
/* 全屏时画布满宽：默认 .lineage-body 是 max-width:1100 + margin:auto 居中，
   母系这种窄树会整块缩到中间，缩放原点（transform-origin:0 0）就落在画布盒左缘
   而不是面板左缘，放大后整幅往右偏、世代标签也跟着漂。满宽后两者重合。 */
#viewLineage.active.lin-fs .lineage-body { margin: 0; max-width: none; }
/* 全屏时画布上的过渡去掉：缩放/拖动时不要有动画延迟，手感才跟得上 */
#viewLineage.active.lin-fs .lineage-body { transition: none; }
#linZoomBar .zoom-val {
  font-size: 11.5px; font-weight: 650; min-width: 42px; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums;
}

/* ============ 2.4.20：全谱全屏缩放条 / 关系网放大 / 称谓叫法面板 ============ */

/* 全谱缩放条：只在全屏里出现（Boss 定稿：缩放属于全屏，不是整页缩放） */
.oft-zoom-ctl { display: inline-flex; align-items: center; gap: 2px; }
.oft-zoom-ctl[hidden] { display: none !important; }
.oft-zoom-ctl .zoom-val {
  font-size: 11.5px; font-weight: 650; min-width: 42px; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums;
}

/* 关系网：原先整块 520px 宽、结果区最小 60px，读起来小气。
   放宽到 900px，字号与留白一起提上来；手机端仍按屏宽铺满。 */
.lineage-body .rel-panel {
  max-width: 900px; padding: 20px 22px 22px; border-radius: 16px;
}
.rel-panel .rel-lead { font-size: 14px; margin-bottom: 14px; }
.rel-panel .rel-result { min-height: 180px; margin-top: 18px; }
.rel-panel .rel-say { font-size: 17px; line-height: 1.75; }
.rel-panel .rel-term { font-size: 22px; }
.rel-panel .rel-steps { margin: 14px 0 10px; }
/* ★ 序号是 ::before 绝对定位（left:10px，16px 宽）。原来这里写 padding: 12px 15px
   把左侧 34px 的内边距一起覆盖掉了 ⇒ 徽标压住每条开头的姓名字（手机端尤其明显）。 */
.rel-panel .rel-step {
  font-size: 15px; padding: 12px 15px 12px 42px; margin-bottom: 9px;
  display: block; line-height: 1.6;
}
.rel-panel .rel-step-rel { font-size: 15px; }
.rel-panel .rel-dist { font-size: 13px; margin-top: 10px; }
.rel-panel .rel-hint { font-size: 13.5px; }
.rel-panel .rq-chip { font-size: 13.5px; padding: 7px 11px; }

/* 称谓叫法面板：官方词一行一个输入框，窄屏自动减列 */
.kt-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 12px; margin: 0 0 8px;
}
.kt-cell span { font-size: 12px; color: var(--muted); }
.kt-cell input { padding: 6px 8px; font-size: 13.5px; }

@media (max-width: 720px) {
  .lineage-body .rel-panel { padding: 14px 14px 16px; }
  .rel-panel .rel-result { min-height: 140px; }
  .rel-panel .rel-say { font-size: 16px; }
  .rel-panel .rel-term { font-size: 20px; }
  .kt-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}


/* ============ 2.4.25 手机端版式整体修正（375x760 实测驱动）============
   实测基线（改前）：非族系页顶栏 199px（占 760 屏的 26%）、
   欢迎语名字被压到 32px 截断、底栏 700 起但内容 padding 只留 84px、
   族系视图按钮高 29px / 中心人物下拉 27px / 全谱按钮 27px（都不到 44px）、
   7 个 tab 各 53px 内挤着 21px 图标 + 11.2px 三字。 */

/* 只在手机出现／只在桌面出现的菜单项 */
.only-mobile { display: none !important; }

@media (max-width: 720px) {
  .only-mobile { display: block !important; }
  button.menu-item.only-mobile { display: flex !important; }

  /* ---- 1. 顶栏：三行压成两行 ---- */
  /* 家谱三件事（新建/加入/改名）已收进菜单，页头只留选择器 */
  .top-actions #btnNewTree,
  .top-actions #btnJoinTree,
  .top-actions #btnRenameTree { display: none !important; }
  .top-actions {
    grid-template-columns: auto auto minmax(0, 1fr) !important;
    grid-template-areas: "switch add user" !important;
    gap: 8px !important;
    align-items: center !important;
  }
  /* 手机上「我的家谱」下拉框原来 flex:1 拉满整行（375 屏占 252px），
     看着像一整条横杠。改成按内容给宽：最宽 56vw / 208px，
     右边留出空白，家谱全名照旧由上面的 h1 显示，不会丢信息。 */
  .top-actions .tree-switch { grid-area: switch; width: auto; max-width: 100%; min-width: 0; }
  .top-actions .tree-select {
    height: 34px; font-size: 12.5px; padding: 4px 7px;
    width: min(56vw, 208px); max-width: min(56vw, 208px);
  }
  .top-actions .search {
    grid-column: 1 / -1; grid-row: 2;
    height: 40px; margin-top: 2px;
  }
  /* 「云家谱」这行小字在手机上纯占高度，家谱名 h1 已经说明了身份 */
  .topbar .app-name { display: none; }
  .topbar { padding: 7px 12px 6px; }

  /* ---- 2. 登录者姓名直接写在菜单按钮上（原来那一行「您好，某某」已撤掉）---- */
  /* 姓名完整显示、不截断；家谱下拉框让出宽度并缩小一档。 */
  .top-actions .greet-row { grid-area: user; width: auto; gap: 6px; }
  .top-actions #btnUser { height: 34px; padding: 0 9px 0 5px; gap: 6px; }
  .top-actions #btnUser .avatar { width: 25px; height: 25px; font-size: 13px; border-radius: 7px; }
  .top-actions .user-btn .user-name { font-size: 13px; }
  .top-actions #btnUser .caret { font-size: 10px; }

  /* ---- 3. 点按尺寸：一律不小于 38px（族系四按钮一行放不下 44）---- */
  body.pane-tab .seg-btn { padding: 11px 2px; font-size: 12.5px; min-height: 40px; }
  body.pane-tab .lin-center { height: 40px; padding: 0 10px; font-size: 12.5px; }
  body.pane-tab .lin-zoom button { min-height: 36px; padding: 6px 9px; }
  .lin-fs-btn { height: 38px; padding: 0 12px; font-size: 13px; }
  #btnFullTree { height: 36px; padding: 0 10px; font-size: 12.5px; }
  .zoom-bar button { height: 36px; min-width: 32px; }
  .zoom-bar [data-z="reset"], .zoom-bar [data-z="fit"] { min-width: 42px; height: 36px; }
  .menu-item { min-height: 44px; }
  .tab { min-height: 52px; }

  /* ---- 4. 底栏安全区：内容不再被 60px 导航压住 ---- */
  /* 底栏高 60 + 上下 padding 10 + 安全区，留 96 才真正含住阴影 */
  body, body.tree-tab { padding-bottom: 96px; }
  body.pane-tab { padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .view { padding-bottom: 28px; }
  .lin-foot { bottom: 88px; }

  /* ---- 5. 底部 tab：53px 格子里不再塞 21px 图标 + 三字 ---- */
  .tab { font-size: 10.5px; gap: 2px; padding: 6px 1px 5px; }
  .tab .ico { width: 19px; height: 19px; }
  .tab-badge { transform: translateX(18px); }
}

/* 更窄的机器（360/320）再收一档，名字仍然完整 */
@media (max-width: 380px) {
  .top-actions .greet-name { font-size: 13px; }
  .top-actions #btnUser { padding: 0 8px 0 5px; }
  .tab { font-size: 10px; }
}

/* ---- 2.4.25 收尾：点按尺寸补齐 + 顶栏再压一档 ---- */
@media (max-width: 720px) {
  /* 牌位下的「敬香／样式」、名单排序、个人资料、关系网换算与候选词：
     实测分别是 30/31/37/30/33px，都补到 38px 以上 */
  .tablet-btn { min-height: 38px !important; padding: 9px 14px !important; font-size: 12px !important; }
  .list-sort .sort-btn { min-height: 38px; padding: 9px 12px; }
  .mc-self-btn { min-height: 40px; padding: 10px 22px; }
  .rel-swap { width: 38px; height: 38px; line-height: 36px; }
  .rq-chip { min-height: 38px; padding: 9px 12px; }
  .zoom-bar button { min-width: 32px; }
  .zoom-bar .zoom-full { min-width: auto; padding: 0 7px; white-space: nowrap; }
  .zoom-bar .zoom-land { min-width: 34px; }

  /* 兜底：手机上没有比 34px 更小的按钮可点 */
  button:not(.tab):not(.rel-pick) { min-height: 34px; }

  /* 顶栏再压一档：家谱名与人数并成一行（原来各占一行，白吃 15px）。
     改后顶栏 156 → 约 140，家庭树页 106 → 约 92。 */
  .topbar .brand-text {
    display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: nowrap;
  }
  .topbar .brand-text h1 { font-size: 16px; line-height: 1.25; }
  .topbar .stats { margin: 0; font-size: 11px; white-space: nowrap; flex: 0 0 auto; }
  .top-actions .search { height: 36px; margin-top: 0; }
}

/* ---- 2.4.25 收尾二：搜索行只在名单页 + 兜底 36px ---- */
@media (max-width: 720px) {
  /* 搜索是名单页的过滤器，其他页收起来（顶栏 150 → 106px） */
  body:not(.list-tab) .top-actions .search { display: none !important; }
  body:not(.list-tab) .top-actions { grid-template-areas: "switch add user" !important; }
  /* 兜底抬到 36px：原 34px 仍低于密集布局下限 */
  button:not(.tab):not(.rel-pick) { min-height: 36px; }
  body.pane-tab .seg-btn { min-height: 38px; }
  .tablet-btn, .rel-swap, .rq-chip { min-height: 38px !important; }
}

/* 菜单项行高：手机上必须一屏放得下（16 项 + 5 个分区标题）。
   2026-10-25 实测：36px 时内容高 802 > 可用 726，「退出登录」掉到屏外；
   32px 在 375×812 够用，但 360×740 仍差 1px、要滚。
   定稿：30px 行 + 分区标题 15px + 手机端不再重复显示「谁·什么角色」
   （姓名已经写在菜单按钮上），矮屏（≤700）再收一档到 28px。 */
@media (max-width: 720px) {
  .menu-pop .menu-item {
    display: flex !important; align-items: center;
    height: 30px !important; min-height: 30px !important;
    padding: 0 11px !important; font-size: 12.5px; line-height: 1;
    box-sizing: border-box;
  }
  .menu-pop .menu-sec {
    min-height: 0 !important; height: auto; padding: 3px 2px 1px;
    font-size: 10.5px; line-height: 1.25;
  }
  .menu-pop .menu-who { display: none; }
  .menu-pop { max-height: calc(100vh - 92px); }
  .menu-pop .menu-sep { margin: 3px 4px; }
}
@media (max-width: 720px) and (max-height: 700px) {
  .menu-pop .menu-item { height: 28px !important; min-height: 28px !important; }
}

/* ---- 2.4.25：手机端牌位再收一档 ----
   实测：手机可用高度 602px（760 - 顶栏106 - 底栏52），而祠堂页首屏还有
   祖先堂标题、三项统计、香案、样式条、第一代标签，共占约 340px，
   146×336 的牌位只能露出上半身，敬香/样式按钮全被推到底栏下面。
   收到 118×272（仍是 1:2.3 传统比例）后，两座牌位并排能完整入屏。 */
@media (max-width: 700px) {
  .shrine-body { --ins-scale: .56; }
  .tablet { width: calc(118px * var(--tb-scale, 1)); }
  .tablet-board { height: calc(272px * var(--tb-scale, 1)); border-radius: calc(46px * var(--tb-scale, 1)) calc(46px * var(--tb-scale, 1)) 3px 3px; }
  .tb-panel { inset: calc(8px * var(--tb-scale, 1)); border-radius: calc(31px * var(--tb-scale, 1)) calc(31px * var(--tb-scale, 1)) 2px 2px; }
  .tb-rim { inset: 12px; border-radius: 27px 27px 2px 2px; }
  .tb-cap { width: 42px; height: 11px; margin-left: -21px; top: 3px; }
  .tb-foot-orn { bottom: 10px; }
  .tb-ins { padding: calc(30px * var(--tb-scale, 1)) calc(8px * var(--tb-scale, 1)) calc(28px * var(--tb-scale, 1)); }
  .tablet-base { height: calc(12px * var(--tb-scale, 1)); }
  .tablet-base::before { height: calc(4px * var(--tb-scale, 1)); top: calc(-4px * var(--tb-scale, 1)); }
  .tablet-base::after { height: calc(3px * var(--tb-scale, 1)); top: calc(2px * var(--tb-scale, 1)); }
  .tablet-meta { font-size: calc(10px * var(--tb-scale, 1)); margin-top: calc(7px * var(--tb-scale, 1)); min-height: calc(30px * var(--tb-scale, 1)); }
  .tablet-row { gap: calc(20px * var(--tb-scale, 1)) calc(10px * var(--tb-scale, 1)); }
}

/* ---- 2.4.25：手机端祠堂首屏腾地方 ----
   实测首屏被这些吃掉：祖先堂说明 22 + 香案 150 + 样式区说明 18 + 统计条 60
   + 第一代标签 30 + 页面 padding 36 = 316px，留给牌位只剩 184px，
   272px 的牌位必然被底栏切断。这里逐项压缩，共腾出约 104px。 */
@media (max-width: 700px) {
  /* 「在世者不入祠…」礼制说明：手机上优先保证牌位完整，说明收进礼制页 */
  .shrine-sub { display: none; }
  .shrine { padding: 12px 10px 10px; }
  .shrine-meters { margin-top: 8px; gap: 6px; }
  .meter { padding: 4px 3px; }
  .meter .m-val { font-size: 13px; }
  .meter .m-lab { font-size: 9.5px; }
  /* 香案收一档：炉、烛、供碟按比例一起收，不能只压容器 */
  .shrine-altar { margin-top: 12px; padding: 12px 10px 24px; }
  .desk-stat { margin-bottom: 10px; gap: 6px; }
  .desk-stat .at-val { font-size: 13.5px; }
  .desk-stat .at-lab { font-size: 10.5px; letter-spacing: 1.1px; }
  .tablet-altar { height: calc(34px * var(--tb-scale, 1)); }
  .candle { height: 36px; }
  .censer-body { width: 62px; height: 34px; }
  .censer-body::before { width: 62px; margin-left: -31px; }
  .desk-fruit { width: 28px; height: 7px; }
  .sticks { bottom: calc(7px * var(--tb-scale, 1)); }
  .sticks i { height: calc(16px * var(--tb-scale, 1)); }
  .sticks i:nth-child(2) { height: calc(19px * var(--tb-scale, 1)); }
  .desk-hint { font-size: 11px; margin-top: 6px; }
  /* 「整祠统一；单座可在牌位下点样式另换」——按钮旁边已经有「样式」二字，说明可省 */
  .ts-hint { display: none; }
  .tablet-styles { margin: 6px 0 8px; }
  .gen-label { margin-bottom: 8px; }
  /* 牌位落在 272，与压缩后的上方内容相加刚好在一屏内 */
  .shrine-body { --ins-scale: .56; }
}

/* 修正上一段的两个选择器：真实类名是 .ss-hint / .shrine-style
   （上一条写成 .ts-hint / .tablet-styles，是猜的，没有生效）。 */
@media (max-width: 700px) {
  .shrine-style { margin: 4px 0 8px; padding: 6px 8px; gap: 6px; flex-wrap: nowrap; }
  .shrine-style .ss-label { font-size: 10.5px; letter-spacing: .5px; flex: 0 0 auto; }
  /* 「整祠统一；单座可在牌位下点样式另换」：按钮旁已有「样式」二字，这句在手机上省掉 */
  .shrine-style .ss-hint { display: none; }
  .shrine-style .ss-list { gap: 5px; }
  .shrine-style .ss-list button { padding: 6px 9px; font-size: 11px; min-height: 36px; }
}

/* ---- 2.4.25：手机端祠堂首屏装下整座牌位（含敬香/样式按钮）----
   实测（375×760）：顶栏 106 + 标题 24 + 统计 42 + 香案 88 + 样式条 48
   + 第一代标签 11 = 从 y=388 才开始排牌位，而底栏 700 就压上来（312px 可用）；
   整座牌位 board272+base12+牌前小香炉34+生卒48+按钮38 = 411px，差 99px，
   所以「敬香／样式」永远在首屏之外。
   做法：牌前小香炉与生卒行让位（生卒点牌位可看资料），牌面收到 264。 */
@media (max-width: 700px) {
  .shrine-body .tablet-altar { display: none; }
  .shrine-body .tablet-meta { display: none; }
  .tablet { width: calc(114px * var(--tb-scale, 1)); }
  .tablet-board { height: calc(264px * var(--tb-scale, 1)); }
  .shrine { padding: 8px 10px 8px; }
  .shrine-body .gen-label { margin-bottom: 4px; }
  .shrine-altar { margin-top: 10px; padding: 12px 10px 24px; }
  .desk-hint { font-size: 10.5px; margin-top: 4px; line-height: 1.35; }
  .shrine-style { margin: 2px 0 6px; padding: 5px 8px; }
  .shrine-body { --ins-scale: .55; }
  /* 牌位脚下留一点空，不然按钮贴着底栏边缘 */
  .shrine-body { padding-bottom: 4px; }

  /* 2026-10-25 底栏收口：114px 宽的牌位要同时放进「敬香」和「样式」。
     原来敬香按钮 padding 9/14 + 字距 2px，一行放不下两个字，文字折成两行，
     按钮被撑到 50px 高（旁边样式只有 44px），看上去就是「按钮压进了牌面」。
     这里去掉字距、收内边距、两枚按钮等高 36px，与牌面之间再留 6px。 */
  .tablet-foot { gap: 4px; margin-top: 6px; }
  .tablet-btn {
    padding: 6px 9px !important; min-height: 36px !important;
    font-size: 12px !important; letter-spacing: 0 !important;
    text-indent: 0 !important; line-height: 1 !important;
  }
  .tablet-style-btn {
    margin-left: 0 !important; padding: 6px 8px 6px 6px !important;
    min-height: 36px !important; font-size: 11px !important;
    letter-spacing: 0 !important; line-height: 1 !important;
    gap: 4px;
  }
}

/* ================= 2026-10-25：删除家谱确认 + 使用说明弹窗 ================= */

/* 删除家谱：把后果写清楚，危险色只用在标题与按钮上 */
.danger-box {
  background: #fdf4f2; border: 1px solid #f0cfc8;
  border-radius: 10px; padding: 11px 13px;
}
.danger-box .danger-title { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: #a8382c; }
.danger-box .danger-line { margin: 2px 0; font-size: 12.5px; color: #7d5b52; line-height: 1.62; }
.danger-name { color: #a8382c; }
.panel-actions .btn-danger:disabled { opacity: .45; cursor: not-allowed; }

/* 使用说明：手机上一屏要放得下（四步流程 + 三条注意事项） */
.guide-modal { max-width: 460px; }
.guide-body { gap: 10px; padding: 14px 18px 4px; }
.guide-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.guide-steps li { font-size: 13.5px; line-height: 1.62; color: var(--ink-soft); }
.guide-steps li b { color: var(--ink); font-weight: 650; }
.guide-tips {
  margin: 2px 0 0; padding: 10px 13px 10px 26px;
  background: #f6f3ec; border-radius: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.guide-tips li { font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.guide-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; }
.guide-foot .spacer { flex: 1; }

@media (max-width: 430px) {
  .guide-modal { max-height: 88vh; }
  .guide-body { padding: 12px 14px 2px; gap: 8px; }
  .guide-steps { padding-left: 18px; gap: 6px; }
  .guide-steps li { font-size: 13px; line-height: 1.55; }
  .guide-tips { padding: 8px 11px 8px 22px; }
  .guide-tips li { font-size: 12px; line-height: 1.5; }
  .guide-foot { padding: 10px 14px 14px; }
  .guide-foot .btn { font-size: 12.5px; padding: 8px 12px; }
}


/* 2026-10-25 Boss 定：全屏工具条窄屏也不换行（只保留「关闭」二字）。
   不要在这加 max-width 断点去 wrap .focus-row —— 那会让顶部长出第二行。 */

/* ---------------- 族事：记事 / 纪念日 / 人情往来 ---------------- */
/* ★ 2026-10-27 Boss 三条改动：家族回忆的入口放在「族事描述那一排右边」，
   所以标题块与描述在左、入口按钮在右，同一排。 */
.clan-head {
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.clan-head-l { min-width: 0; }
.clan-mem-btn { flex: 0 0 auto; white-space: nowrap; }
.clan-title { margin: 0 0 2px; font-size: 19px; letter-spacing: 4px; font-weight: 620; }
.clan-sub { margin: 0; font-size: 12.5px; color: var(--muted); }

/* 概览统计：事项件数 / 日子人数 / 人情往来 */
.clan-stats { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.clan-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; box-shadow: var(--shadow);
}
.cs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.cs-title { font-size: 13px; font-weight: 620; letter-spacing: 1px; }
.cs-hint { font-size: 11.5px; color: var(--muted); }
.cs-nums { display: flex; gap: 8px; }
.cs-num {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: 9px; padding: 6px 10px;
}
.cs-num b { font-size: 20px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.cs-num span { font-size: 11.5px; color: var(--muted); }
.cs-line { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.clan-stat .fav-cards { margin-bottom: 0; }

/* 三个模块入口卡 */
.clan-mods { display: flex; flex-direction: column; gap: 10px; padding-bottom: 30px; }
.clan-mod {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.clan-mod .cm-act { margin-top: auto; padding-top: 9px; }
/* 合并卡里的统计块（原独立「事项 / 日子」那两张卡） */
.clan-mod .cs-nums { margin-top: 8px; }
.clan-mod .fav-cards { margin: 8px 0 0; }
/* 人情往来跨整行：里面装着「我送出 / 我收到 / 全谱人情」三张卡，挤在 1/2 列会看不清 */
.clan-mod-wide { grid-column: 1 / -1; }
/* 家族相册入口：单独一块，紧贴家族动态下面 */
.mem-entry { margin-bottom: 10px; }
.mem-entry:empty { display: none; }
.cm-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cm-name { font-size: 15px; font-weight: 620; }
.cm-num { font-size: 12px; color: var(--muted); }
.cm-desc { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.cm-line { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.cm-act { display: flex; gap: 8px; margin-top: 9px; }
.cm-act .btn { flex: 0 0 auto; }

/* 记事列表 */
.clan-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 30px; }
.ev-item {
  display: flex; align-items: stretch; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.ev-main {
  flex: 1 1 auto; min-width: 0; border: none; background: transparent; text-align: left;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  padding: 11px 13px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.ev-main.is-readonly { cursor: default; }
.ev-line1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-host { font-weight: 620; font-size: 15px; }
.ev-tag { font-size: 11.5px; color: var(--accent-dark); background: #f6efe3; border-radius: 999px; padding: 1px 8px; }
.ev-sub { font-size: 12px; color: var(--muted); }
.ev-note { font-size: 12.5px; color: var(--ink-soft); }
.ev-del {
  flex: 0 0 auto; width: 38px; border: none; border-left: 1px solid var(--line-soft);
  background: transparent; color: var(--muted); font-size: 14px; cursor: pointer;
}
.ev-del:hover { color: var(--danger); background: #fbeeea; }

/* 纪念日清单 */
.day-block {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}
.db-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 10px 13px; background: var(--bg); border-bottom: 1px solid var(--line-soft);
}
.db-name { font-size: 13.5px; font-weight: 620; letter-spacing: 1px; }
.db-range { font-size: 11.5px; color: var(--muted); }
.day-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; padding: 10px 13px; text-align: left;
  font-family: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.day-row + .day-row { border-top: 1px dashed var(--line-soft); }
.dr-date { flex: 0 0 auto; min-width: 48px; font-size: 12px; color: var(--accent-dark); font-weight: 600; font-variant-numeric: tabular-nums; }
.dr-name { font-weight: 600; }
.dr-kind { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
/* 生日 / 诞辰那几行要同时放两套历法：上行「九月十七」+「吴婉」+「农历生日 · 31 岁」，
   下行的「阳历10月26日」贴在名字底下。用 grid 排，日子竖着居中，手机 375px 也不挤。 */
.day-row.is-both {
  display: grid; grid-template-columns: auto 1fr auto;
  grid-template-areas: "d n k" "d s k";
  column-gap: 10px; row-gap: 1px; align-items: center;
}
.day-row.is-both .dr-date { grid-area: d; align-self: center; }
.day-row.is-both .dr-name { grid-area: n; }
.day-row.is-both .dr-kind { grid-area: k; }
.dr-sub { grid-area: s; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 「农历 / 阳历」小标：各家各过各的，这两个字要一眼看得见 */
.cal-tag {
  display: inline-block; margin-right: 4px; padding: 0 4px; border-radius: 5px;
  font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 15px; vertical-align: 1px;
  border: 1px solid transparent;
}
.cal-tag.is-lunar { color: #8a5a1e; background: rgba(176, 120, 40, .12); border-color: rgba(176, 120, 40, .34); }
.cal-tag.is-solar { color: #3f5d73; background: rgba(70, 110, 140, .10); border-color: rgba(70, 110, 140, .26); }
/* 家庭树 / 全谱 / 牌位那种窄卡片：放不下两个字，只给单字「农」「阳」 */
.cal-mini {
  display: inline-block; margin-right: 3px; padding: 0 3px; border-radius: 4px;
  font-style: normal; font-size: 9.5px; font-weight: 700; line-height: 14px; vertical-align: 1px;
  border: 1px solid transparent;
}
.cal-mini.is-lunar { color: #8a5a1e; background: rgba(176, 120, 40, .14); border-color: rgba(176, 120, 40, .34); }
.cal-mini.is-solar { color: #3f5d73; background: rgba(70, 110, 140, .10); border-color: rgba(70, 110, 140, .26); }
/* 农历的日子要写全「农历九月十七」+「阳历10-26」，手机上放不下时整串折到第二行，
   不要让右边那截被裁掉——提醒里最要紧的正是这几个字。 */
.dr-date { white-space: nowrap; }
.dr-kind { min-width: 0; }
@media (max-width: 560px) {
  .day-row:not(.is-both) { flex-wrap: wrap; row-gap: 2px; }
  .day-row:not(.is-both) .dr-name { flex: 1 1 auto; }
  .day-row:not(.is-both) .dr-kind { margin-left: auto; }
  .day-row.is-both { column-gap: 8px; }
}
.day-none { margin: 0; padding: 12px 13px; font-size: 12.5px; color: var(--muted); }

.fav-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.fav-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px;
}
.fc-lab { font-size: 11.5px; color: var(--muted); letter-spacing: 1px; }
.fav-card strong { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fav-card strong.out { color: var(--danger); }
.fav-card strong.in { color: var(--green); }
.fc-sub { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.fav-per { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.fav-per > summary { padding: 10px 12px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.fav-per-list { padding: 0 12px 10px; }
.fp-row { display: flex; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line-soft); font-size: 13px; }
.fp-name { font-weight: 600; min-width: 4em; }
.fp-num { margin-left: auto; color: var(--muted); font-size: 12.5px; text-align: right; }

.fav-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 30px; }
.fav-item {
  display: flex; align-items: stretch; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.fi-main {
  flex: 1 1 auto; min-width: 0; border: none; background: transparent; text-align: left;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  padding: 11px 13px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.fi-line1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fi-name { font-weight: 620; font-size: 15px; }
.fi-tag { font-size: 11.5px; color: var(--accent-dark); background: #f6efe3; border-radius: 999px; padding: 1px 8px; }
.fi-amt { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
.fi-amt.out { color: var(--danger); }
.fi-amt.in { color: var(--green); }
.fi-sub { font-size: 12px; color: var(--muted); }
.fi-note { font-size: 12.5px; color: var(--ink-soft); }
.fi-del {
  flex: 0 0 auto; width: 38px; border: none; border-left: 1px solid var(--line-soft);
  background: transparent; color: var(--muted); font-size: 14px; cursor: pointer;
}
.fi-del:hover { color: var(--danger); background: #fbeeea; }

.fav-dir { display: flex; gap: 8px; }
.dir-btn {
  flex: 1 1 0; padding: 9px 0; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; font-family: inherit; font-size: 13.5px; color: var(--muted); cursor: pointer;
}
.dir-btn.active { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 600; }

/* 桌面：统计与模块卡排成多列，单列在宽屏下会被拉成一条长带、显得空 */
@media (min-width: 960px) {
  /* 事项、日子并排；人情三卡跨整行，保持原来「三张并排」的观感 */
  .clan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
  .clan-stats .clan-stat:nth-child(3) { grid-column: 1 / -1; }
  /* 2026-10-27 第 2 条合并后只剩三块卡：记事 / 纪念日 并排，人情往来跨整行 */
  .clan-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
}

@media (max-width: 720px) {
  .fav-cards { grid-template-columns: 1fr 1fr; }
  .fav-cards .fav-card:last-child { grid-column: 1 / -1; }
  .clan-title { font-size: 17px; letter-spacing: 3px; }
  .cs-nums { gap: 6px; }
  .cs-num { padding: 6px 8px; }
  .cs-num b { font-size: 19px; }
  .cm-act .btn { flex: 1 1 0; }
  .day-row { min-height: 44px; }
}

/* ================================================================
   2.7.1 本轮新增：右键菜单 / 别名+已去世同排 / 页头新增人员
   ================================================================ */

/* ---- 1. 别名与「已去世」同一排（别名输入框收窄，开关靠右） ---- */
.alias-dead-row {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
}
.alias-dead-row .alias-field {
  flex: 1 1 240px; min-width: 0; max-width: 460px;
}
.alias-dead-row .alias-field input { width: 100%; }
.dead-switch {
  flex: 0 0 auto; align-self: flex-end;
  padding: 9px 14px; margin-bottom: 2px;
  background: #fdfbf6; border: 1px solid var(--line-soft); border-radius: 10px;
}
.dead-switch .switch-text { font-size: 13.5px; }

/* 手机：别名与「已去世」也保持同一排（原来 flex-basis 240px 会在 390 屏上把开关挤下一行） */
@media (max-width: 720px) {
  .alias-dead-row { flex-wrap: nowrap; gap: 10px; }
  .alias-dead-row .alias-field { flex: 1 1 auto; max-width: none; }
  .dead-switch { padding: 7px 10px; }
}

/* ---- 2. 页头「新增人员」（从个人设置菜单剥出来，常驻页头） ---- */
.add-top {
  height: 34px; padding: 0 14px; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 3px;
  flex: 0 0 auto; white-space: nowrap;
}
.add-top .at-plus { font-size: 15px; line-height: 1; }

/* ---- 3. 人员卡片右键菜单 ---- */
.ctx-menu {
  position: fixed; z-index: 120; min-width: 168px;
  padding: 6px; border-radius: 12px;
  background: #fffdf9; border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(60,45,25,.22), 0 2px 6px rgba(60,45,25,.10);
}
.ctx-menu[hidden] { display: none !important; }
.ctx-who {
  padding: 6px 10px 7px; margin-bottom: 4px;
  border-bottom: 1px dotted var(--line-soft);
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctx-item {
  display: block; width: 100%; box-sizing: border-box;
  padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  white-space: nowrap;
}
.ctx-item:hover, .ctx-item:focus-visible { background: var(--green-soft); outline: none; }
/* 「新增父亲/母亲」与「子女/配偶」之间给一道细线，五条不至于连成一片 */
.ctx-item[data-ctx="son"] { margin-top: 4px; border-top: 1px dotted var(--line-soft); border-radius: 0 0 8px 8px; padding-top: 11px; }

/* ---- 4. 手机端页头：新增人员排在家谱下拉框右边，下拉框收窄 ---- */
@media (max-width: 720px) {
  .top-actions {
    grid-template-columns: auto auto minmax(0, 1fr) !important;
    grid-template-areas: "switch add user" !important;
  }
  .top-actions .tree-switch { grid-area: switch; min-width: 0; }
  /* Boss 要求「缩短下拉框」：56vw/208 → 40vw/150，把右边让给新增按钮 */
  .top-actions .tree-select {
    width: min(40vw, 150px); max-width: min(40vw, 150px);
    padding: 4px 6px;
  }
  .top-actions #btnAddTop {
    grid-area: add; height: 34px; padding: 0 11px; font-size: 13px;
  }
  /* 手机只留「＋」：三个控件同排时，四个字会把家谱名和姓名挤到看不见 */
  .top-actions #btnAddTop .at-text { display: none; }
  .top-actions #btnAddTop .at-plus { font-size: 18px; }
  /* 搜索框仍独占一行（只有名单页显示） */
  .top-actions .search { grid-column: 1 / -1; grid-row: 2; }
  /* 族系页没有家谱下拉框：让「＋」和菜单并排 */
  body.pane-tab .top-actions {
    grid-template-columns: auto auto !important;
    grid-template-areas: "add user" !important;
  }
  /* 右键菜单在手机上改用长按，条目高度按可点尺寸给足 */
  .ctx-menu { min-width: 176px; }
  .ctx-item { min-height: 42px; font-size: 14px; }
}

@media (max-width: 380px) {
  .top-actions .tree-select { width: min(36vw, 132px); max-width: min(36vw, 132px); }
  .top-actions #btnAddTop { padding: 0 9px; }
}

/* ================================================================
   2.7.3
   ① 手机页头「新增人员」不能只剩一个加号
   ② 缩放条不再压住「以谁为中心 / 查看全谱」：缩放条独占一排靠左，
      中心人物条降一排，「查看全谱」排到这一排最左
   ③ 人物卡三行：姓名+性别 / 生肖·状态（在世显示年龄，已故显示享年或已故）/ 关系称谓
   ================================================================ */

/* ---- ① 新增人员按钮：窄屏给「＋ 新增」，不再只剩一个加号 ---- */
.add-top .at-text-s { display: none; }
@media (max-width: 900px) {
  .top-actions #btnAddTop .at-text { display: none; }
  .top-actions #btnAddTop .at-text-s { display: inline; font-size: 12.5px; letter-spacing: 0; }
  .top-actions #btnAddTop { padding: 0 9px; gap: 2px; }
  .top-actions #btnAddTop .at-plus { font-size: 14px; }
}

/* ---- ② 缩放条与中心人物条分行（家庭树 / 族系三视图同一口径） ---- */
@media (max-width: 900px) {
  .focus-row { flex-wrap: wrap; row-gap: 6px; }
  .focus-row #treeZoomBar {
    order: -1; flex: 1 1 100%; width: 100%; margin: 0;
    justify-content: flex-start; flex-wrap: wrap; row-gap: 4px;
  }
  .focus-row .focus-bar { flex: 1 1 100%; margin: 0; }
  /* 「查看全谱」放到这一排最左，缩放条不再盖住它。
     ★ 基础规则 `.focus-all{margin-left:auto}` 会把它推到行尾，必须显式归零，
       光写 margin-right:auto 不管用（两个属性互不覆盖）。 */
  .focus-row .focus-bar #btnFullTree {
    order: -1; margin-left: 0; margin-right: auto;
  }

  #linZoomBar {
    width: 100% !important; margin: 0 0 6px !important;
    justify-content: flex-start; flex-wrap: wrap;
  }
  /* 全屏时原本绝对定位浮在标签栏上（会盖住父系/母系/近亲标签和中心人物），
     窄屏改成正常占位的一行，宁占一点高度也不遮按钮 */
  #viewLineage.active.lin-fs #linZoomBar {
    position: static !important; right: auto !important; top: auto !important;
  }
}

/* ---- ③ 卡片三行 ---- */
.c-sex {
  display: inline-block; margin-left: 4px; padding: 0 4px;
  font-size: 10px; font-style: normal; line-height: 15px;
  border-radius: 4px; background: rgba(120,100,70,.10); color: #7a6a52;
  vertical-align: 1px; font-weight: 600;
}
.pcard .pmeta { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.pcard .prel { font-size: 12.5px; color: #8a6432; font-weight: 600; margin-top: 1px; }
.pcard.deceased .prel { color: var(--dead-soft); }

.ln-life { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.lnode.is-dead .ln-life { color: var(--dead-soft); }
/* 始祖大卡同样走三行规范：姓名+性别 / 生肖·状态 / 称谓 */
.lineage-hero .lh-life { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.lineage-hero.is-dead .lh-life { color: var(--dead-soft); }

.oft-life, .oft-rel { font-size: 11px; line-height: 1.35; margin-top: 2px; }
.oft-rel { color: #8a6432; font-weight: 600; }
.oft-card.is-dead .oft-rel, .oft-card.is-dead .oft-life { color: var(--dead-soft); }

.rp-life { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.rp-rel { font-size: 13px; color: #8a6432; font-weight: 600; margin-top: 2px; }
.row-card.is-dead .rp-life, .row-card.is-dead .rp-rel { color: var(--dead-soft); }
/* 代/字辈标签从姓名行挪到副信息行，别跟前面那段粘在一起 */
.rp-sub .gen-tag, .rp-sub .genchar-tag { margin-left: 6px; }

/* 第一排必须是一行：姓名 + 性别小标，不能把「男」「女」挤到第二行去 */
.oft-name { white-space: nowrap; }
.oft-name .oft-nm { overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.pcard .pname { white-space: nowrap; }
.lnode .ln-name { white-space: nowrap; }
.row-card .rp-name { white-space: nowrap; }

/* 紧凑档：三行照留（曾把标签整块藏掉，被 Boss 判成「功能没做」），
   只把字号收到还能读的下限，不删信息 */
#lineageBody.lin-compact .ln-life { font-size: 9.5px; margin-top: 0; }
#lineageBody.lin-compact .ln-name .c-sex {
  font-size: 8.5px; line-height: 12px; margin-left: 2px; padding: 0 2px;
}

/* ---------------- 人员档案（单击卡片先看已填内容，Boss 2026-10-27 第 4 条） ----------------
   五张图（家庭树/全谱/父系/母系/近亲）单击卡片都弹这里：
   只列填过的项，底部一个「修改信息」按钮，改动仍走原来的编辑表单。 */
.pf-head {
  padding: 2px 2px 12px;
  border-bottom: 1px solid rgba(120, 96, 64, .14);
  margin-bottom: 12px;
}
.pf-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; font-weight: 700; color: #2f2a22; letter-spacing: .5px;
}
.pf-name .c-state {
  font-style: normal; font-size: 11.5px; font-weight: 600;
  color: #7a6a52; background: rgba(120, 96, 64, .10);
  padding: 1px 7px; border-radius: 8px;
}
/* 姓名同排右侧的「跟中心人怎么称呼」——Boss 2026-10-28 第 3 条。
   口径与树上卡片第三行完全一致（同一份 kinship），一眼对上。 */
.pf-name .pf-rel {
  margin-left: auto; flex: 0 0 auto;
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  color: #7a5a2f; background: rgba(176, 127, 62, .14);
  border: 1px solid rgba(176, 127, 62, .22);
  padding: 2px 10px; border-radius: 10px; white-space: nowrap;
}
@media (max-width: 640px) {
  .pf-name { flex-wrap: wrap; row-gap: 4px; }
  .pf-name .pf-rel { font-size: 12px; padding: 1px 8px; }
}
.pf-sub { margin-top: 5px; font-size: 12.5px; color: #7d715f; line-height: 1.7; display: flex; flex-wrap: wrap; align-items: baseline; }
/* ★ 2026-10-27 Boss 第 3 条：手机上「小名 阿念」被拆成两行（小名 / 阿念），
   因为整串是一段文本，遇到窄屏就从空格处断。改成一段一个 span 且 nowrap，
   只在两段之间换行，一项不会被劈开。 */
.pf-sub .pf-bit { white-space: nowrap; }
.pf-sub .pf-bit + .pf-bit::before { content: " · "; white-space: pre; color: var(--ink-soft); }
.pf-sec { margin-bottom: 14px; }
.pf-st {
  font-size: 12px; font-weight: 700; color: #8a7a60;
  letter-spacing: 1px; margin-bottom: 7px;
}
.pf-rows { display: flex; flex-direction: column; gap: 6px; }
.pf-row {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 14px; line-height: 1.6;
}
.pf-k {
  flex: 0 0 62px; color: #8b7f6b; font-size: 12.5px;
}
.pf-v { flex: 1 1 auto; color: #3b3529; word-break: break-word; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(120, 96, 64, .22); background: #fffdf8;
  border-radius: 10px; padding: 7px 11px; cursor: pointer;
  font-family: inherit; font-size: 13.5px; color: #3b3529;
}
.pf-chip:active { background: #f4ecdd; }
.pf-ct { font-size: 11.5px; color: #8b7f6b; }
.pf-cn { font-weight: 650; }
.pf-bio {
  font-size: 13.5px; line-height: 1.85; color: #4a4335;
  white-space: pre-wrap; background: #fffdf8;
  border: 1px solid rgba(120, 96, 64, .14); border-radius: 10px; padding: 11px 13px;
}
.pf-empty {
  font-size: 13.5px; line-height: 1.8; color: #8b7f6b;
  background: #fdf8ee; border-radius: 10px; padding: 12px 14px; margin: 0 0 14px;
}
.pf-actions {
  display: flex; gap: 10px; padding-top: 4px;
  border-top: 1px solid rgba(120, 96, 64, .14);
}
.pf-actions .btn { flex: 1 1 0; }
/* ★ 2026-10-31 Boss 追加：祠堂档案卡专用的「移出祠堂」（其他页面的档案卡不渲染）。
   刻意不做成主按钮：撤牌位是低频操作，不该抢「修改信息」的视线；
   窄屏三个按钮一行挤不下，让它单独占一行。 */
.pf-actions .pf-shrine-out {
  flex: 0 0 auto;
  color: #8a4a34; background: #fff;
  border: 1px solid rgba(160, 96, 68, .5); box-shadow: none;
}
.pf-actions .pf-shrine-out:hover,
.pf-actions .pf-shrine-out:focus-visible {
  background: #fdf2ec; border-color: #a05a3c; color: #7d2f1c;
}
@media (max-width: 460px) {
  .pf-actions { flex-wrap: wrap; }
  .pf-actions .pf-shrine-out { flex: 1 1 100%; }
}
/* 只读档案（别人录入的人）：不给修改入口，只留一句说明 */
.pf-lock {
  margin: 0; padding: 11px 2px 3px; font-size: 13px; line-height: 1.7; color: #8a7c68;
}
/* 「新增直系亲属」的关系选择（Boss 三条改动第 2 条） */
.pf-hint { font-size: 13px; line-height: 1.8; color: #7d715f; margin: 0 0 12px; }
.pf-kins { display: flex; flex-wrap: wrap; gap: 9px; }
.pf-kins .pf-kin { flex: 1 1 88px; font-size: 14px; padding: 11px 8px; }

/* ★ 2026-10-27 Boss 三条改动第 2 条：关闭按钮做成「窗口关闭」样式，钉在弹窗右上角。
   原来它是标题行里的一个文字 ✕，看着像普通图标；现在做成右上角的圆形按钮，
   标题行右侧留出位置，窄屏也不会压住标题。 */
.modal { position: relative; }
.modal-head { padding-right: 56px; }
/* 手机上有一条全局规则「button:not(.tab):not(.rel-pick){min-height:36px}」，
   这里顺着它做成 36×36 的正圆，既保住触摸热区，也不会被撑成 28×36 的椭圆。 */
.modal-head .icon-btn {
  position: absolute; top: 8px; right: 8px;
  width: 36px; height: 36px; min-height: 36px; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line-soft);
  background: #f4eee3; color: var(--ink-soft);
  font-size: 14px; line-height: 1; z-index: 3;
  box-sizing: border-box;
}
.modal-head .icon-btn:hover {
  background: #e6ad9b; border-color: #d79b88; color: #7a2f1c;
}

/* ★★★ 2026-10-27 Boss 第 1 条：除始祖外，同一张图里所有卡片大小必须完全一致。 ★★★
   族系（父系/母系/近亲）原来是 min-width/max-width + 内容撑高：
   四字名、长称谓（「丈夫的曾祖父」）会把卡片顶高一两行，同一代底边参差，
   看着像卡片错位。定稿：宽度写死，姓名与关系各占一行、超长用省略号。
   始祖是 .lineage-hero，独立大卡，不在这条规则里。

   ★★★ 2026-10-27 修（Boss：母系卡片只显示一半、字体全被压扁）★★★
   上一版这里把高度写死成 60px + overflow:hidden。而这一档卡片里装的是
   「头像 40 + 头像下边距 7 + 姓名 18 + 称谓 14 + 间隙 6 + 内边距 14 ≈ 100px」，
   60px 根本装不下：flex 于是硬压子元素——实测头像被压成 16px、姓名行盒只剩 8px，
   屏幕上就是「卡片只露上半截、字糊成一团」。父系/近亲走紧凑档（50×58，内容刚好）
   所以看不出问题，只有装得下、走完整档的视图（这份谱里的母系）中招。
   改法照紧凑档那套已验证的做法：高度不再写死，用 min-height 兜住，
   子元素一律 flex:0 0 auto 不给压——同一代内容一致，底边照样齐线。 */
#lineageBody .lnode,
#lineageBody .lnode.sp {
  width: 132px; min-width: 132px; max-width: 132px;
  height: auto; min-height: 100px;
  padding: 7px 9px; box-sizing: border-box; overflow: hidden;
  display: flex; flex-direction: column; align-items: stretch;
  justify-content: center; gap: 3px;
}
/* 不许压：头像、姓名、称谓各自保住自己的行高（少一条就会被 flex 挤成半截） */
#lineageBody .lnode .ln-face,
#lineageBody .lnode.sp .ln-face { flex: 0 0 auto; width: 40px; height: 40px; margin: 0 auto 4px; }
#lineageBody .lnode .ln-name,
#lineageBody .lnode.sp .ln-name,
#lineageBody .lnode .ln-rel,
#lineageBody .lnode.sp .ln-rel { flex: 0 0 auto; }
#lineageBody .lnode .ln-name,
#lineageBody .lnode.sp .ln-name {
  display: block; width: 100%; text-align: center;
  font-size: 15px; line-height: 1.25; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#lineageBody .lnode .ln-name .c-state { font-size: 10.5px; margin-left: 3px; }
#lineageBody .lnode .ln-rel,
#lineageBody .lnode.sp .ln-rel {
  display: block; width: 100%; text-align: center; margin: 0;
  /* ★ 2026-10-31 Boss 第 2 条：行高用「固定 px」，不用 em。
     fitRelTexts() 会为了放下长称谓把字号收到 7px；em 行高跟着缩，
     同一代里「五字称谓的卡」比「两字称谓的卡」矮 2~4px，卡片又是居中排，
     姓名基线就上下错开（实测 16.1 / 18.1 两档）。固定 14px 后行高不随字号变。 */
  font-size: 11.5px; line-height: 14px; min-height: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft);
}
/* 紧凑档（人多时自动缩小）：同样固定尺寸——头像剪影 + 姓名（含状态）+ 关系·子女数。
   ★ 2026-10-27 Boss 明令：所有人物卡片的剪影必须保留，紧凑档也不例外。
     所以卡高从 44px 放到 58px，给 15px 剪影留位置；一代之内仍然张张齐平。 */
#lineageBody.lin-compact .lnode,
#lineageBody.lin-compact .lnode.sp {
  width: 50px; min-width: 50px; max-width: 50px;
  height: 58px; min-height: 58px; max-height: 58px;
  padding: 4px 3px; gap: 2px;
}
#lineageBody.lin-compact .lnode .ln-name,
#lineageBody.lin-compact .lnode.sp .ln-name {
  font-size: 10px; line-height: 1.2; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-align: center;
}
#lineageBody.lin-compact .lnode .ln-rel,
#lineageBody.lin-compact .lnode.sp .ln-rel {
  font-size: 9px; line-height: 11px; min-height: 11px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-align: center;
}
#lineageBody.lin-compact .lnode .ln-tags,
#lineageBody.lin-compact .lnode .ln-meta,
#lineageBody.lin-compact .lnode .ln-me { display: none; }

/* 称谓收到最小字号仍放不下时：改成横向滑动，不再用省略号把称谓切掉。
   Boss 2026-10-28 第 2 条 —— 称谓是这三张图的正文，「大外甥…」等于没算出来。
   缩字由 fitRelTexts() 负责（逐 0.5px 收到 7px），这里兜底给滑动：
   卡片宽度不变、版式不塌，手机上可以直接划着看全称，桌面端悬停有 title。 */
#lineageBody .lnode .ln-rel.rel-tight,
#lineageBody .lnode.sp .ln-rel.rel-tight,
#lineageBody.lin-compact .lnode .ln-rel.rel-tight,
#lineageBody.lin-compact .lnode.sp .ln-rel.rel-tight {
  text-overflow: clip; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
}
#lineageBody .lnode .ln-rel.rel-tight::-webkit-scrollbar,
#lineageBody.lin-compact .lnode .ln-rel.rel-tight::-webkit-scrollbar { display: none; height: 0; }

/* ★ 2026-10-31 Boss 第 2 条（真凶）：主卡与配偶小卡的头像下边距不一致。
   上面几段规则叠在一起时，`.lin-compact .lnode.sp .ln-face { margin-bottom: 0 }` 被
   后面 `#lineageBody .lnode.sp .ln-face { margin: 0 auto 4px }` 盖掉，于是同一排里
   主卡头像贴着姓名、配偶卡头像多出 4px，卡又是 justify-center 居中，
   姓名基线就差出 2~5px（实测紧凑档 16.1 / 18.0，完整档 22 / 25）。
   配偶卡多发生在女性（媳妇/女婿一侧），所以看起来就是「男女卡片内容高度不一致」。
   这里在最后统一钉死两档的下边距，主卡、配偶卡、男女一律相同。 */
#lineageBody .lnode .ln-face,
#lineageBody .lnode.sp .ln-face { margin: 0 auto 4px; }
#lineageBody.lin-compact .lnode .ln-face,
#lineageBody.lin-compact .lnode.sp .ln-face { margin: 0 auto; }

/* ============ 家族回忆（照片 / 视频） ============ */
/* 人情明细独立后的范围说明：一行灰字，别做成醒目的警告条 */
.fav-scope-note {
  margin: 0 0 8px; font-size: 12px; color: var(--muted);
  padding: 6px 9px; background: var(--green-soft); border-radius: 8px;
}
.fav-scope { margin-bottom: 10px; }

.mem-wrap { padding-bottom: 30px; }
.mem-note { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.mem-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.mem-card {
  margin: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.mem-thumb {
  background: #efe9dc; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; overflow: hidden;
}
.mem-thumb img, .mem-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.mem-card figcaption { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; }
.mem-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mem-meta { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.mem-act { display: flex; gap: 6px; margin-top: 4px; }
.mem-act .btn { flex: 0 0 auto; padding: 2px 9px; font-size: 12px; }

/* ---------- 家族回忆：上传队列（文件列表 + 进度条 + 完成提示） ----------
   原来上传只在 toast 里闪一行，手机上选完大视频看不出在动。
   这块面板常驻在回忆列表上方：整体进度、每个文件的百分比、成功 / 失败原因。 */
.mem-up {
  margin: 0 0 14px; padding: 12px 12px 10px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.mem-up.is-done { border-left-color: var(--green); background: #f8faf7; }
.mem-up.is-err { border-left-color: var(--danger); background: #fdf7f4; }
.mem-up-head { display: flex; align-items: center; gap: 8px; }
.mem-up-mark { font-size: 15px; line-height: 1; }
.mem-up-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.mem-up-pct {
  margin-left: auto; font-size: 13px; color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}
.mem-up.is-done .mem-up-pct { color: var(--green); }
.mem-up.is-err .mem-up-pct { color: var(--danger); }
.mem-up-close {
  width: 26px; height: 26px; flex: 0 0 26px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.mem-up-close:hover { background: var(--line-soft); color: var(--ink); }
.mem-up-bar {
  margin: 8px 0 10px; height: 6px; border-radius: 999px;
  background: var(--line-soft); overflow: hidden;
}
.mem-up-bar > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #c39a6b, var(--accent));
  transition: width .25s ease;
}
.mem-up.is-done .mem-up-bar > i { background: var(--green); }
.mem-up.is-err .mem-up-bar > i { background: var(--danger); }
.mem-up-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mem-up-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; background: var(--bg); border-radius: 10px;
}
.mem-up-thumb {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px;
  object-fit: cover; background: var(--line-soft);
}
.mem-up-ico { display: grid; place-items: center; font-size: 18px; }
.mem-up-main { flex: 1; min-width: 0; }
.mem-up-name {
  font-size: 13px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mem-up-track {
  margin: 5px 0 3px; height: 4px; border-radius: 999px;
  background: var(--line-soft); overflow: hidden;
}
.mem-up-track > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--accent); transition: width .2s linear;
}
.mem-up-item.is-done .mem-up-track > i { background: var(--green); }
.mem-up-item.is-err .mem-up-track > i { background: var(--danger); }
.mem-up-state { font-size: 11.5px; color: var(--muted); }
.mem-up-item.is-done .mem-up-state { color: var(--green); }
.mem-up-item.is-err .mem-up-state { color: var(--danger); }
.mem-up-retry { flex: 0 0 auto; }
.mem-up-foot { margin: 9px 0 0; font-size: 11.5px; color: var(--muted); }

@media (max-width: 720px) {
  .mem-up { padding: 10px; }
  .mem-up-thumb { width: 34px; height: 34px; flex-basis: 34px; }
  .mem-up-title { font-size: 13.5px; }
}

@media (max-width: 720px) {
  .mem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .mem-card figcaption { padding: 6px 8px 8px; }
}

/* ---- 系统设置：家族回忆存储位置（2026-10-27 新增）---- */
.mem-path {
  width: 100%; box-sizing: border-box; margin-top: 8px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-family: inherit; font-size: 13.5px; color: inherit;
}
.mem-path:focus { outline: none; border-color: var(--green); }

/* ================================================================
   2.9.0 家族动态（文章 / 朋友圈 / 点赞 / 评论）+ 族事页紧凑排版
   ================================================================ */

/* ---- 族事首页第一块：家族动态入口 ---- */
.feed-entry {
  background: linear-gradient(180deg, #fffdf8, #fdf8ef);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 13px 15px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.fe-head { display: flex; align-items: center; gap: 8px; }
/* 「写一条」靠右：.fe-head 里的 .spacer 之前没有 flex 规则，按钮只能紧跟在标题后面
   （375px 手机实测：按钮右边离标题行右边还剩 151px，2026-10-27 Boss 第 1 条） */
.fe-head .spacer { flex: 1 1 auto; }
.fe-mark { font-size: 15px; line-height: 1; }
.fe-name { font-size: 15px; font-weight: 620; letter-spacing: 1px; }
.fe-num {
  min-width: 19px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff;
  font-size: 11.5px; line-height: 19px; text-align: center;
}
.fe-line {
  margin: 8px 0 10px; font-size: 13px; color: var(--ink-soft);
  line-height: 1.55; overflow-wrap: anywhere;
}
.fe-line.is-new { color: var(--ink); }
.fe-line .fe-who { color: var(--accent-dark); }
.fe-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.fe-act {
  flex: 0 0 auto; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink-soft);
  font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.fe-act:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---- 动态列表 ---- */
.feed-list { display: flex; flex-direction: column; gap: 11px; padding-bottom: 8px; }
.feed-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 15px 11px;
}
.fc-head { display: flex; align-items: center; gap: 9px; }
.fc-ava {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: #f1e7d8; color: var(--accent-dark);
  font-size: 15px; font-weight: 600;
}
.fc-who { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.fc-who b { font-size: 13.5px; font-weight: 620; }
.fc-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.fc-tag {
  font-style: normal; padding: 1px 6px; border-radius: 6px;
  background: #f3eee4; color: var(--accent-dark); font-size: 10.5px;
}
.fc-tag.article { background: #eaf0ea; color: var(--green); }
.fc-more {
  flex: 0 0 auto; border: none; background: none; padding: 4px 2px;
  color: var(--muted); font-family: inherit; font-size: 12px; cursor: pointer;
}
.fc-more:hover { color: var(--danger); }

.fc-title {
  margin: 10px 0 6px; font-size: 16.5px; font-weight: 640;
  line-height: 1.45; letter-spacing: .5px;
}
.fc-body {
  margin: 8px 0 0; font-size: 14.5px; line-height: 1.72;
  color: var(--ink); overflow-wrap: anywhere;
}
.fc-body.is-clamp {
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical;
  overflow: hidden;
}
.fc-expand {
  margin-top: 5px; border: none; background: none; padding: 0;
  color: var(--accent); font-family: inherit; font-size: 12.5px; cursor: pointer;
}

/* 照片 / 视频九宫格 */
.fc-media { margin-top: 10px; display: grid; gap: 5px; }
.fc-media.n1 { grid-template-columns: minmax(0, 1fr); }
.fc-media.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fc-media.n3, .fc-media.n4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fc-media.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fc-mi { display: block; border-radius: 10px; overflow: hidden; background: #f4efe6; }
.fc-mi img {
  display: block; width: 100%; height: 100%; max-height: 260px;
  object-fit: cover; aspect-ratio: 1 / 1;
}
.fc-media.n1 .fc-mi img { aspect-ratio: auto; max-height: 460px; object-fit: contain; background: #f7f3ec; }
.fc-mv { margin: 0; grid-column: 1 / -1; }
.fc-mv video {
  display: block; width: 100%; max-height: 420px; border-radius: 10px;
  background: #1d1a16;
}
.fc-mv figcaption { margin-top: 4px; font-size: 11.5px; color: var(--muted); }

.fc-likers {
  margin: 9px 0 0; padding: 6px 9px;
  background: #f8f5ee; border-radius: 9px;
  font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere;
}
.fc-bar { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.fc-btn {
  border: 1px solid var(--line-soft); border-radius: 9px;
  background: #fff; padding: 6px 12px;
  font-family: inherit; font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
}
.fc-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.fc-like.on { border-color: var(--accent); background: #fdf3e6; color: var(--accent-dark); font-weight: 600; }

/* 评论 */
.fc-cmts { margin-top: 9px; border-top: 1px dashed var(--line-soft); padding-top: 8px; }
.fc-cmt {
  position: relative; padding: 4px 18px 4px 0;
  font-size: 13px; line-height: 1.6; color: var(--ink-soft); overflow-wrap: anywhere;
}
.fc-cmt b { font-weight: 600; color: var(--accent-dark); margin-right: 5px; }
.fc-cmt-del {
  position: absolute; right: 0; top: 5px;
  border: none; background: none; color: var(--muted);
  font-size: 11px; cursor: pointer; padding: 0 2px;
}
.fc-allcmt {
  border: none; background: none; padding: 4px 0;
  color: var(--accent); font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.fc-write { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.fc-write input {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 13px; background: #fff;
}
.fc-write input:focus { outline: none; border-color: var(--accent); }
.fc-mic {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px;
}
.fc-mic.is-rec { border-color: var(--danger); background: #fdeceb; animation: recPulse 1.1s infinite; }
.fc-send {
  flex: 0 0 auto; padding: 8px 13px; border-radius: 9px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.fc-send:disabled { opacity: .6; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(165,70,47,.32); } 50% { box-shadow: 0 0 0 6px rgba(165,70,47,0); } }

.feed-empty {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 26px 18px; text-align: center;
}
.fe-empty-t { margin: 0 0 6px; font-size: 15px; font-weight: 620; }
.fe-empty-acts { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.feed-more { display: flex; justify-content: center; padding: 12px 0 4px; }
.feed-foot { margin: 10px 0 24px; text-align: center; }

/* ---- 写动态弹窗 ---- */
.feed-modal .modal-body { gap: 12px; }
.feed-kind { display: flex; gap: 8px; }
.fk-btn {
  flex: 1 1 0; padding: 9px 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--muted);
  font-family: inherit; font-size: 13.5px; cursor: pointer;
}
.fk-btn.active { border-color: var(--accent); background: #fdf3e6; color: var(--accent-dark); font-weight: 600; }
.feed-writer textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  font-family: inherit; font-size: 14.5px; line-height: 1.7; background: #fff;
}
.feed-writer textarea:focus { outline: none; border-color: var(--accent); }
.feed-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.feed-tools .hint-line { margin: 0; }
.hint-line.is-warn { color: var(--danger); }
.feed-pick { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.feed-thumbs { display: flex; gap: 7px; flex-wrap: wrap; }
.ft-item {
  position: relative; width: 66px; height: 66px; border-radius: 9px;
  overflow: hidden; background: #f4efe6; border: 1px solid var(--line-soft);
  display: grid; place-items: center;
}
.ft-item img { width: 100%; height: 100%; object-fit: cover; }
.ft-ico { font-size: 20px; }
.ft-x {
  position: absolute; right: 2px; top: 2px;
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(30,25,18,.62); color: #fff; font-size: 11px;
  line-height: 18px; cursor: pointer; padding: 0;
}
.btn.is-rec { border-color: var(--danger); background: #fdeceb; color: var(--danger); }

/* ================================================================
   移动端：族事页要短。统计压成两列、模块卡两列、长描述收起来
   ================================================================ */
@media (max-width: 720px) {
  .feed-entry { padding: 11px 12px 10px; margin-bottom: 10px; }
  .fe-name { font-size: 14px; }
  .fe-line { font-size: 12.5px; margin: 7px 0 9px; }
  .fe-acts { gap: 6px; }
  .fe-act { flex: 1 1 0; text-align: center; padding: 8px 6px; font-size: 12px; }
  .fe-head .btn { padding: 6px 10px; }

  .clan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
  .clan-stats .clan-stat:nth-child(3) { grid-column: 1 / -1; }
  .clan-stat { padding: 10px 11px; }
  .clan-stat .cs-hint { display: none; }
  .clan-stat .cs-line { display: none; }
  .clan-stat .cs-nums, .clan-mod .cs-nums { margin-top: 6px; gap: 5px; }
  .clan-stat .cs-num, .clan-mod .cs-num { padding: 5px 6px; }
  .clan-stat .cs-num b, .clan-mod .cs-num b { font-size: 17px; }
  .clan-stat .cs-num span, .clan-mod .cs-num span { font-size: 10.5px; }
  /* 人情三卡在手机上压成一行三个数字，别让这块占掉半屏 */
  /* 人情三格：「我送出 / 我收到」各占一半，两格合计刚好铺满整行，
     与下面「全谱人情」那条整行框左右对齐（原来硬编成三列，两格只占 2/3 宽，
     右边空一截，Boss 第 4 条） */
  .clan-mod .fav-cards {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 6px 0 0;
  }
  .clan-mod .fav-cards .fav-card:last-child { grid-column: 1 / -1; }
  .clan-stats .fav-card, .clan-mod .fav-card { padding: 7px 8px; }
  .clan-stats .fav-card .fc-lab, .clan-mod .fav-card .fc-lab { font-size: 10.5px; }
  .clan-stats .fav-card strong, .clan-mod .fav-card strong { font-size: 14px; }
  .clan-stats .fav-card .fc-sub, .clan-mod .fav-card .fc-sub { display: none; }

  /* 记事的三格：手机上一排塞三个只剩 54px 宽，字挤到看不清，
     所以把「本年」下移到第二排（做成一条横排，不再占一整格高度）；
     两卡宽度也不再由内容撑开 —— 原来记事 197 / 纪念日 145 不等宽，
     现在都是 171px，框内每格同宽（Boss 第 2、3 条） */
  .clan-mod .cs-nums-3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .clan-mod .cs-nums-3 .cs-num:nth-child(3) {
    grid-column: 1 / -1; flex-direction: row-reverse; align-items: baseline;
    justify-content: space-between; gap: 6px; padding: 4px 8px;
  }
  .clan-mod .cs-nums-3 .cs-num:nth-child(3) b { font-size: 15px; }
  .clan-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding-bottom: 22px; }
  /* 人情往来（含三张金额卡）和家族相册在手机上各占整行 */
  .clan-mod-wide { grid-column: 1 / -1; }
  .mem-entry .clan-mod { width: 100%; }
  .clan-mod { padding: 10px 11px; }
  .clan-mod .cm-desc { display: none; }
  .clan-mod .cm-top { gap: 6px; }
  .clan-mod .cm-name { font-size: 14px; }
  .clan-mod .cm-num { font-size: 11px; }
  .clan-mod .cm-line { font-size: 11.5px; margin: 4px 0 0; }
  /* 手机上「生日/诞辰/忌日」那两行明细收进详情页，卡片只留最近一个日子，
     否则合并后比原来四排入口还长（2026-10-27 实测 +65px，已收回） */
  .clan-mod .cm-mix { display: none; }
  .clan-mod .cm-line.is-one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* 按钮并排，不再竖着堆两行 */
  .clan-mod .cm-act { flex-direction: row; gap: 6px; padding-top: 8px; }
  .clan-mod .cm-act .btn { width: auto; flex: 1 1 0; padding-left: 6px; padding-right: 6px; }

  /* 动态卡片：字号略收，头像小一点，视频高度收住 */
  .feed-card { padding: 11px 12px 10px; }
  .fc-ava { width: 30px; height: 30px; font-size: 13.5px; }
  .fc-title { font-size: 15.5px; margin: 8px 0 4px; }
  .fc-body { font-size: 14px; line-height: 1.7; }
  .fc-mi img { max-height: 200px; }
  .fc-media.n1 .fc-mi img { max-height: 320px; }
  .fc-mv video { max-height: 260px; }
  .fc-btn { padding: 7px 11px; }
  .fc-write input { font-size: 13.5px; }

  /* 写动态：手机上做成整屏，键盘弹起来也看得见正文 */
  .feed-modal { max-height: 100vh; height: 100dvh; border-radius: 0; max-width: 100%; }
  .feed-modal .modal-body { padding: 12px 14px 16px; }
  .feed-writer textarea { min-height: 140px; }
  .ft-item { width: 60px; height: 60px; }
}


/* ==================================================================
   2.11.3（2026-10-27，Boss 五条 + 一个 BUG）
   ================================================================== */

/* ---- 第 2 条：设置菜单「又臭又长」——同样的项改成两列排，长度砍掉近一半 ---- */
.menu-pop { min-width: 236px; }
.menu-pop .menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 4px;
  padding: 0 2px;
}
.menu-pop .menu-grid .menu-item {
  width: auto;
  text-align: center;
  padding: 7px 6px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-pop .menu-item.wide { width: 100%; text-align: center; }
/* 「导出备份」原来有一条老规则（2258 行）：手机端钉在标签栏最右端防被挤掉。
   现在它进了两列网格，那条规则会让它只剩 72px 并右缩（实测 left=144 vs 其它 66），
   在网格里必须复位，否则整行看起来歪的。 */
.menu-pop .menu-grid #btnExport {
  position: static;
  right: auto;
  margin-left: 0;
  flex: 0 1 auto;
  width: auto;
  text-align: center;
  padding-left: 6px;
  background: transparent;
  box-shadow: none;
}

/* ---- 第 3 条：手机底部导航对齐 ----
   根因：导航条按 60px 定位，但 .tab 被另一条规则撑到 min-height:52px 再加 padding，
   实际高度 63px ⇒ 整条沉到屏幕外 3px；页面内容多少不同还会让观感「有的页面错位」。
   定稿：高度由一个变量统一定义，定位/占位/内部行高全部引用它。 */
@media (max-width: 720px) {
  :root { --tabbar-h: calc(58px + env(safe-area-inset-bottom, 0px)); }

  .tabs {
    top: calc(100dvh - var(--tabbar-h)) !important;
    height: var(--tabbar-h) !important;
    box-sizing: border-box;
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px)) !important;
    align-items: stretch;
    overflow-x: hidden;
  }
  .tab {
    min-height: 0 !important;
    height: auto !important;
    max-height: 100%;
    padding: 3px 1px 2px !important;
    justify-content: center;
    gap: 2px;
    overflow: visible;
  }
  .tab .ico { width: 20px; height: 20px; flex: 0 0 auto; }
  .tab-badge { top: 0; transform: translateX(16px); }

  body, body.tree-tab { padding-bottom: calc(var(--tabbar-h) + 34px); }
  body.pane-tab { padding-bottom: calc(var(--tabbar-h) + 10px); }
  .lin-foot { bottom: calc(var(--tabbar-h) + 10px); }
  .menu-pop.menu-sheet { width: min(86vw, 320px); }
}

/* ---- 第 4 条：档案卡右侧放人物头像 ---- */
.pf-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 208px;
  gap: 20px;
  align-items: start;
}
.pf-main { min-width: 0; }
.pf-aside {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
.pf-photo,
.pf-photo-none {
  width: 100%;
  max-width: 208px;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  background: #f6f1e7;
  border: 1px solid var(--line-soft);
  box-shadow: 0 3px 12px rgba(80, 60, 30, .07);
}
.pf-photo-none {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-style: dashed;
}
.pf-photo-none.m { background: linear-gradient(180deg, #f2f8fc, #e6f0f8); }
.pf-photo-none.f { background: linear-gradient(180deg, #fdf3f6, #f8e6ec); }
.pf-photo-none span {
  font-size: 54px;
  font-weight: 700;
  color: #9db4c9;
  line-height: 1;
}
.pf-photo-none.f span { color: #d3a3b2; }
.pf-photo-none i { font-size: 11.5px; font-style: normal; color: var(--muted); }

/* ---- 2026-10-28 Boss：头像的上传 / 更换 / 删除就放在档案卡的照片上 ----
   照片本身仍可点开放大；两个按钮压在照片下面一排。
   只有后端判定 can_avatar 的人（管理员 / 谱主·家谱管理员 / 录入人 / 绑定本人）才有。 */
.pf-photo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.pf-photo-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  width: 100%;
}
.pf-photo-btn {
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 8px 10px;
  min-height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line-soft);
  background: #fffdf8;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.pf-photo-btn:hover { background: #f6f0e3; border-color: var(--line); }
.pf-photo-btn:disabled { opacity: .6; cursor: default; }
.pf-photo-del { color: var(--danger); border-color: #e8cfc6; background: #fdf7f4; }
.pf-photo-del:hover { background: #f9ede8; border-color: #dcb9ac; }

@media (max-width: 720px) {
  .pf-cols { grid-template-columns: 1fr; gap: 12px; }
  .pf-aside { order: -1; position: static; }
  .pf-photo, .pf-photo-none { max-width: 128px; aspect-ratio: 1 / 1; }
  .pf-photo-none span { font-size: 40px; }
}

/* ---- 2026-10-28 Boss 第 2 条：档案卡资料区自己滚，弹窗外框和底部按钮钉住 ----
   原来整块 .modal-body 一起滚，手机上「修改信息 / 新增直系亲属」要滑到最底下才露出来。
   现在只让 .pf-cols（照片 + 资料）内部滚，头部和按钮不动，版式与原来一模一样。 */
#panelBody.pf-open {
  overflow: hidden;
  padding-bottom: 0;
  min-height: 0;
}
#panelBody.pf-open > .pf {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#panelBody.pf-open .pf-head { flex: 0 0 auto; }
#panelBody.pf-open .pf-cols {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
  padding-bottom: 4px;
}
#panelBody.pf-open .pf-actions {
  flex: 0 0 auto;
  padding: 10px 0 12px;
  background: #fffdfa;
  box-shadow: 0 -6px 12px -8px rgba(120, 96, 64, .30);
}

/* ---- 2026-10-28 Boss 第 1 条：档案卡照片点一下放大、再点一下缩小 ---- */
.pf-photo { cursor: zoom-in; }
.pf-zoom {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(18, 14, 8, .93);
  cursor: zoom-out;
}
.pf-zoom[hidden] { display: none; }
.pf-zoom img {
  max-width: 96vw; max-height: 92vh; width: auto; height: auto;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}

/* ---- 第 5 条：聊天头像（自己与对方各显示各的）---- */
.chat-msgs { text-align: left; }
.chat-msg { align-items: flex-start; gap: 8px; }
.chat-av {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: #efe8db;
  margin-top: 2px;
}
.chat-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-av-letter {
  font-style: normal;
  font-size: 14px; font-weight: 600;
  color: hsl(var(--h, 30deg) 42% 34%);
  background: hsl(var(--h, 30deg) 62% 92%);
  width: 100%; height: 100%;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-head-av {
  flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: #efe8db;
  font-size: 12px; font-weight: 600; color: var(--accent-dark);
}
.chat-head-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-head-av.group { background: var(--green); color: #fff; }
.chat-title-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: none; padding: 0; margin: 0;
  font-family: inherit; cursor: pointer; max-width: 100%;
}
.chat-title-btn strong {
  overflow: hidden; font-size: 14.5px; white-space: nowrap; text-overflow: ellipsis;
}
.chat-title-btn .chat-pen { font-style: normal; font-size: 12px; color: var(--muted); }
.chat-title-btn:hover .chat-pen { color: var(--green); }
.chat-room-icon img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 9px; }
.chat-room-icon .chat-av-letter { border-radius: 9px; font-size: 14px; }

/* ---- BUG：族系说明文字被图谱的横向滚动推出左边界 ----
   说明和统计条挂在滚动区外，但 #viewLineage 自己是横向滚动容器，
   图谱比屏幕宽时一向右滑，左下角那段说明就被裁掉前半句（Boss 截图）。
   用 sticky 钉在滚动视口的左沿：滑多远都完整可读。 */
#linNote,
.lin-foot {
  position: sticky;
  left: 14px;
  z-index: 3;
}
@media (max-width: 720px) {
  #linNote, .lin-foot { position: static; left: auto; }
}

/* ---- 第 3 条：取消上下左右的拖动线条（滚动条），按住空白区域跟手拖动 ----
   Boss 2026-10-27：「家庭树、全谱、父系、母系、近亲等取消上下左右的拖动线条，
   考虑按住空白区域实现跟手拖动」。滚动条那条细线一律不画，改用鼠标按住空白拖
   （JS enableDragPan），触摸设备仍是原生惯性滑动。 */
.tree,
.lineage-scroll,
#viewLineage,
.oft-body {
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* 旧 Edge */
}
.tree::-webkit-scrollbar,
.lineage-scroll::-webkit-scrollbar,
#viewLineage::-webkit-scrollbar,
.oft-body::-webkit-scrollbar {
  width: 0; height: 0; display: none;   /* 覆盖上面那条 8px 的旧规则 */
}
/* 能拖的地方给个抓手，拖起来是握拳——不用文字提示也知道能拖 */
.tree,
.lineage-scroll,
.oft-body { cursor: grab; }
.tree.is-panning,
.lineage-scroll.is-panning,
.oft-body.is-panning {
  cursor: grabbing;
  user-select: none; -webkit-user-select: none;
}

/* ---- 第 2 条：世代称谓（设置 → 家谱 → 世代称谓） ---- */
.gr-box { display: flex; flex-direction: column; gap: 10px; }
.gr-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gr-input {
  flex: 1 1 150px; min-width: 130px; max-width: 260px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.gr-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.gr-prev { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gr-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.gr-chip {
  font-style: normal; font-size: 12.5px; padding: 2px 8px; border-radius: 6px;
  background: #f6ecdc; color: #6d4f34; border: 1px solid #e6d4b8;
}

/* 世代称谓面板：输入框前面给个固定标签，不用回头读说明 */
.gr-lab { flex: 0 0 auto; font-size: 13px; color: var(--ink-soft); }

/* ---- 2026-10-28：族事/牌位点人 → 档案卡；资料从家谱同步 ---- */
/* 可点的人名：只加一层虚线下划线，不做成按钮（避免像操作项） */
.fi-name.is-link, .fp-name.is-link, .ev-host.is-link {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.fp-name.is-link {
  border: 0; background: none; padding: 0; font: inherit; color: inherit;
  font-weight: 600; min-width: 4em; text-align: left;
}
.fp-name.is-link:hover, .fi-name.is-link:hover, .ev-host.is-link:hover { color: var(--accent); }

/* 资料页「从家谱同步」块 */
.pf-sync {
  border: 1px solid #e3e8f0; border-radius: 12px; padding: 12px 14px;
  background: #f7f9fc; margin: 0 0 14px;
}
.pf-sync-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pf-sync-t { font-size: 14px; font-weight: 640; color: #2b3a4a; }
.pf-sync-hint { margin: 6px 0 0; font-size: 12.5px; color: #6b7a8c; line-height: 1.55; }
.pf-sync-list { margin-top: 10px; }
.pf-sync-empty { margin: 8px 0 0; font-size: 13px; color: #6b7a8c; }
.pf-sync-rows { display: flex; flex-direction: column; gap: 6px; }
.pf-sync-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; padding: 6px 8px; border-radius: 8px; background: #fff;
  border: 1px solid #e8edf4;
}
.pf-sync-row.is-diff { border-color: #f0dcc0; background: #fffaf2; }
.pf-sync-row input[type="checkbox"] { flex: 0 0 auto; }
.pf-sync-k { flex: 0 0 auto; color: #55627a; min-width: 4.2em; }
.pf-sync-v { font-weight: 620; color: #22303f; word-break: break-all; }
.pf-sync-now { margin-left: auto; font-style: normal; font-size: 12px; color: #8a97a8; }
.pf-sync-row.is-diff .pf-sync-now { color: #b7791f; }
.pf-sync-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pf-sync-count { font-size: 12.5px; color: #6b7a8c; }

/* ---------------- 排行规则（设置 → 排行规则） ----------------
   2026-10-28 Boss 第 4 条：男女分排 / 男女混排可切换。
   沿用站内卡片风格：暖白底、细线框、选中描边加粗。 */
.rr-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 10px; }
.rr-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.rr-item:hover { border-color: var(--accent); }
.rr-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
  background: #fffdf9;
}
.rr-item input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.rr-text { display: flex; flex-direction: column; gap: 3px; }
.rr-name { font-weight: 600; color: var(--ink); font-size: 15px; }
.rr-hint { font-style: normal; color: var(--muted); font-size: 13px; line-height: 1.5; }
/* 2026-11-04 第 1 条：排行规则分成「男女」「大小」两组，各两个选项 */
.rr-group + .rr-group { margin-top: 6px; }
.rr-gt {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 16px 0 0; font-size: 13.5px; font-weight: 650; color: var(--ink);
}
.rr-gt i { font-style: normal; font-weight: 400; font-size: 12.5px; color: var(--muted); }

/* ---------------- 近亲左侧层级名：不可改、不许折行（Boss 2026-10-31 第 2 条） ----------------
   近亲页左边是「祖辈 / 父辈 / 高祖以上」这类距本人几代的层级名，
   它不是世代序号，没有改名的余地：去掉点击手感，并按内容撑开宽度。
   原来固定 52px，「高祖以上」四个字会被折成两行，整条标尺看着错位；
   nowrap + min-width 后既保持刻度轴对齐，又绝不折行（绝对定位，不占位、不推歪卡片）。 */
#lineageBody .lgen[data-level] .lgen-label {
  width: auto; min-width: 52px; max-width: none;
  white-space: nowrap;
  pointer-events: none;      /* 取消修改：不可点、不弹改名框 */
  cursor: default;
  user-select: none;
}
#lineageBody .lgen[data-level] .lgen-label .lgen-sex { white-space: nowrap; }

/* ---------------- 简版谱树（设置 → 简版谱树，Boss 2026-10-31 第 3 条） ----------------
   只列姓名的一张族谱表：男浅蓝、女浅粉；已故压暗 + 虚线框 + 「故」角标，
   但色相保留，不会糊成一片灰。竖向按代成行，横向按代成列，随时切换。
   ★ 2026-10-31 追加：改成整屏显示（原来 1120×86vh 的弹窗看不全一棵树），
     右上角给缩放套件与「关闭」按钮；Esc 仍可关。 */
.st-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: #fffdf8;
  display: flex; padding: 0;
}
.st-card {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: #fffdf8; border: 0; border-radius: 0; box-shadow: none;
  overflow: hidden;
}
.st-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line, #ece3d3);
  background: linear-gradient(180deg, #fffaf1, #fffdf8);
}
.st-title { font-size: 16px; font-weight: 700; color: #6b4c22; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.st-sub { font-size: 12px; font-weight: 500; color: #a3805a; }
.st-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-seg { display: inline-flex; border: 1px solid #e0d2bb; border-radius: 9px; overflow: hidden; background: #fff; }
.st-seg button {
  border: 0; background: transparent; padding: 6px 13px; cursor: pointer;
  font-size: 13px; color: #8a6b45;
}
.st-seg button.on { background: #8a6b45; color: #fff; }
/* 缩放套件：沿用 .zoom-bar 的底子，只补百分比读数的排版 */
.st-zoom { flex: 0 0 auto; }
.st-zoom .zoom-val {
  font-size: 11.5px; font-weight: 650; min-width: 42px; text-align: center;
  color: var(--muted, #8a7a63); font-variant-numeric: tabular-nums;
}
.st-zoom[hidden] { display: none !important; }
/* 关闭：一个 × 看不出是干什么的，写成「✕ 关闭」的实体按钮 */
.st-close {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid #e0d2bb; border-radius: 9px; background: #fff;
  font-family: inherit; font-size: 13px; line-height: 1.3;
  color: #8a6b45; cursor: pointer; padding: 5px 11px; white-space: nowrap;
}
.st-close:hover { background: #f7efe2; color: #6b4c22; border-color: #d8c3a4; }
.st-close .st-close-x { font-size: 14px; line-height: 1; }
.st-body { flex: 1; overflow: auto; padding: 12px 14px; background: #fffdf8; }
/* ★ 2026-11-01 Boss 第 1 条：按住空白处拖动平移（桌面鼠标），拖的时候不要选中文字 */
.st-body { cursor: grab; }
.st-body.is-panning { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.st-body.is-panning .st-chip { pointer-events: none; }

/* 谱树按真树排版：卡片绝对定位，连线是底层 SVG，称谓栏贴着滚动边固定。
   竖向 = 一代一行（称谓在左），横向 = 整棵树转 90°（称谓在每列上方）。 */
/* ★ 2026-11-01：容器必须按内容撑开（max-content）。
   原来 .st-wrap 作为 flex 容器只占视口宽（实测 1332px），而舞台宽 6829px 溢出在外，
   sticky 的世代标签被「包含块只有视口宽」卡住 —— 横滑过 1332px 后标签就跟着滚出屏幕
   （实测 scrollLeft=4444 时 rail.left=-3170）。让容器跟内容一样宽，标签全程贴边固定。 */
.st-wrap { display: flex; width: max-content; }
.st-wrap-v { flex-direction: row; align-items: flex-start; }
.st-wrap-h { flex-direction: column; align-items: flex-start; height: max-content; }
.st-stage { position: relative; flex: none; }
.st-lines { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; }
.st-rail { flex: none; z-index: 3; }
.st-wrap-v .st-rail {
  position: sticky; left: 0; width: 72px;
  /* ★ 2026-11-01 Boss 第 3 条：原来这里铺了一条 72px 的白色渐变带，
     手机上看着就是「世代标签带着一块底色」。现在只留一层极窄的淡出遮罩，
     让线从标签后面穿过去时不糊字，不再是一整条色带。 */
  background: linear-gradient(90deg, #fffdf8 92%, rgba(255, 253, 248, 0));
}
.st-wrap-h .st-rail { position: sticky; top: 0; background: #fffdf8; }
.st-glab {
  position: absolute; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: #a08a68;
  letter-spacing: .04em;
}
.st-wrap-v .st-glab { right: 10px; text-align: right; }

/* 「未挂靠」：没有任何关系可连的人，用虚线框和标签说明是数据缺口，不是谱树漏画 */
.st-loose {
  position: absolute; z-index: 0;
  border: 1.5px dashed #ddc9a6; border-radius: 10px;
  background: rgba(255, 250, 240, .55);
  pointer-events: none;
}
.st-loose-tag {
  position: absolute; left: 8px; top: -9px;
  font-style: normal; font-size: 10.5px; line-height: 1;
  color: #a08a68; background: #fffdf8; padding: 0 5px;
  letter-spacing: .06em;
}

/* 页脚「未挂靠 N 人」点开后的名单：一行一人，说明原因，可直接去看档案 */
.st-more {
  margin-left: 8px; padding: 0 2px; border: 0; background: none;
  color: #8a6b45; font: inherit; text-decoration: underline; cursor: pointer;
}
.st-more:hover { color: #6f5535; }
.st-more-box .st-more-list { list-style: none; margin: 10px 0 0; padding: 0; }
.st-more-box .st-more-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 2px; border-bottom: 1px dashed #e6d8c2;
}
.st-more-box .st-more-list li:last-child { border-bottom: 0; }
.st-more-box li b { font-weight: 600; color: #3d3126; }
.st-more-box li i { flex: 1; font-style: normal; font-size: 12.5px; color: #8b7a63; }
.st-more-open {
  flex: none; padding: 4px 10px; border: 1px solid #ddc9a6; border-radius: 8px;
  background: #fffdf8; color: #8a6b45; font-size: 12.5px; cursor: pointer;
}

.st-chip {
  position: absolute; z-index: 1;
  display: inline-block; padding: 5px 11px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.35; letter-spacing: .02em;
  cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; background: #f4efe5; color: #4c4438;
  transition: transform .12s, box-shadow .12s;
}
.st-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 9px rgba(90, 60, 25, .14); }
.st-chip.m { background: #dcebf9; border-color: #b9d6ef; color: #1f4a72; }
.st-chip.f { background: #fbe1ec; border-color: #f2c6d8; color: #8c3455; }
.st-chip.u { background: #eef0f2; border-color: #dde2e7; color: #55606b; }
/* 已故：压暗 + 虚线框 + 角标；色相仍在（男蓝女粉可辨） */
.st-chip.dead {
  opacity: .82; border-style: dashed;
  filter: saturate(.62) brightness(.97);
}
.st-chip.dead.m { background: #e6edf4; border-color: #9fb4c6; color: #3d556b; }
.st-chip.dead.f { background: #f2e6eb; border-color: #cba9b8; color: #6f4053; }
.st-chip .st-dead {
  position: absolute; top: -5px; right: -5px;
  font-style: normal; font-size: 9.5px; line-height: 1;
  padding: 2px 4px; border-radius: 5px;
  background: #6b757e; color: #fff; letter-spacing: 0;
  box-shadow: 0 1px 3px rgba(60, 45, 25, .22);
}
.st-foot {
  padding: 10px 16px; border-top: 1px solid var(--line, #ece3d3);
  font-size: 12.5px; color: #8a6b45; background: #fffaf1;
}
@media (max-width: 640px) {
  /* 整屏铺满：手机上一行工具栏放不下时自动折行，不再留白边 */
  .st-head { padding: 8px 10px; gap: 8px; }
  .st-title { font-size: 15px; }
  .st-sub { display: none; }
  .st-tools { gap: 6px; }
  .st-seg button { padding: 5px 10px; font-size: 12.5px; }
  .st-zoom { padding: 2px; }
  .st-zoom button { height: 26px; min-width: 24px; font-size: 14px; padding: 0 4px; }
  .st-zoom .zoom-val { min-width: 36px; font-size: 11px; }
  .st-zoom [data-stz="fit"], .st-zoom [data-stz="reset"] { min-width: 34px; font-size: 10.5px; }
  .st-close { padding: 5px 9px; font-size: 12.5px; }
  .st-body { padding: 10px 8px; }
  .st-wrap-v .st-rail { width: 44px; }
  .st-wrap-v .st-glab { right: 7px; font-size: 10.5px; font-weight: 600; }
  .st-chip { font-size: 12.5px; padding: 4px 8px; }
}
