/* 何家人宗亲网 — 公共样式 */
/* 楷体网页字体包（霞鹜文楷 LXGW WenKai · SIL OFL 1.1 · 自托管）
   由 ops/install-kai-font.sh 安装到 backend/public/fonts/lxgw/；按 unicode-range 分片，浏览器只下载页面用到的字。
   ⚠️ 这里**不再 @import**：@import 是链式阻塞资源，会让**全部页面**都多等一次请求，而该字体只有祠堂牌位用得到。
   现改为只由 digital_hall.html / home.html 两页以 `media="print" + onload` 异步引入（RULES §22.3）；
   新增使用牌位楷体的页面时，记得同样加那两行 link。 */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; } /* rem 基准；字号调节仅改变此值（16px/18.4px/20.8px） */

body {
  font-family: "Noto Serif SC", "Songti SC", SimSun, "Microsoft YaHei", serif;
  color: #3a2a1a;
  min-height: 100vh;
  /* 全站淡化背景图：暖米色半透明罩 + 居中铺满背景（图片不存在时回退纯色）
     ★ 2026-09-11 由 bg.png（1280×1280，1.95MB）改为 bg.jpg（同尺寸，321KB）—— 全站每个页面都要下这张图，
       原先冷缓存首屏要多下 ~2MB，是"加载太慢"的主因；图片本身不透明，转 JPEG 无副作用。 */
  background-color: #f5efe4;
  background-image: linear-gradient(rgba(247, 242, 232, .82), rgba(247, 242, 232, .82)), url('/images/bg.jpg');
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  background-position: center center, center center;
}

/* ---- 认证卡片 ---- */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  /* 透明让淡化背景透出，仅保留顶部暖色光晕 */
  background: radial-gradient(ellipse at top, rgba(139, 37, 0, .10), transparent 55%);
}
.auth-card {
  width: 380px; max-width: 92vw;
  background: #fffdf7;
  border: 1px solid #e3d5bd;
  border-radius: 10px;
  padding: 36px 32px;
  box-shadow: 0 8px 30px rgba(90, 60, 20, .10);
}
.auth-card h1 {
  text-align: center;
  font-size: 1.625rem;
  color: #8b2500;
  letter-spacing: 4px;
}
.auth-card .subtitle {
  text-align: center; color: #9a8a72; font-size: 0.8125rem; margin: 6px 0 24px;
}
.auth-card label {
  display: block; font-size: 0.875rem; color: #6b5636; margin-bottom: 14px;
}
.auth-card input {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; font-size: 0.9375rem;
  border: 1px solid #d8c8ac; border-radius: 6px;
  background: #fdfbf4; color: #3a2a1a;
}
.auth-card input:focus { outline: none; border-color: #8b2500; }
.auth-card button {
  width: 100%; margin-top: 10px; padding: 12px;
  font-size: 1rem; letter-spacing: 8px;
  background: #8b2500; color: #fff9ec; border: none; border-radius: 6px;
  cursor: pointer;
}
.auth-card button:hover { background: #a13008; }
.auth-card .error { color: #c0392b; font-size: 0.8125rem; min-height: 18px; margin-top: 8px; text-align: center; }
.auth-card .ok { color: #2e7d32; font-size: 0.8125rem; text-align: center; margin-top: 8px; }
.auth-card .switch { text-align: center; font-size: 0.8125rem; margin-top: 18px; color: #9a8a72; }
.auth-card .switch a { color: #8b2500; text-decoration: none; }
.auth-card .switch a:hover { text-decoration: underline; }

/* ---- 主布局（后续页面用） ---- */
.topbar {
  background: #8b2500; color: #fff9ec;
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 8px rgba(60, 30, 5, .25);
}
.topbar h1 { font-size: 1.25rem; letter-spacing: 3px; font-weight: normal; }
.topbar .nav a { color: #ffe9c7; text-decoration: none; margin-left: 18px; font-size: 0.875rem; }
.topbar .nav a:hover { text-decoration: underline; }

/* ---- 吸顶操作/搜索栏（固定在 topbar 下方，滚动不消失） ---- */
.sticky-bar {
  position: sticky; top: var(--topbar-h, 56px); z-index: 900;
  background: #fffdf7; border: 1px solid #e3d5bd; border-radius: 8px;
  padding: 14px 18px; margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(60, 30, 5, .18);
}
.container { width: auto; max-width: none; margin: 24px 24px; padding: 0; }
.card {
  background: #fffdf7; border: 1px solid #e3d5bd; border-radius: 8px;
  padding: 20px; margin-bottom: 18px;
}
.card h2 { font-size: 1.0625rem; color: #8b2500; margin-bottom: 12px; }

/* ---- 影像资料（族谱延伸：里程碑照片/视频 + 地理定位） ---- */
.m-head { display: flex; align-items: center; gap: 8px; margin-top: 12px; border-top: 1px dashed #e8dcc4; padding-top: 10px; }
.m-head b { color: #8b2500; }
.m-add { margin-left: auto; padding: 5px 12px; font-size: 0.8125rem; border: 1px solid #d8c8ac; border-radius: 6px; background: #fdfbf4; color: #8b2500; cursor: pointer; }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.m-item { border: 1px solid #e8dcc4; border-radius: 8px; overflow: hidden; background: #fffdf7; }
.m-img { max-height: 360px; overflow-y: auto; overflow-x: hidden; background: #f4ead6; }
.m-img img { width: 100%; height: auto; cursor: pointer; display: block; }
.m-file { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 0.8125rem; color: #6b5636; padding: 8px; text-align: center; }
.m-meta { padding: 6px 8px; font-size: 0.75rem; color: #9a8a72; }
.m-cat { display: inline-block; font-size: 0.6875rem; padding: 0 5px; border-radius: 7px; background: #efe3cb; color: #6b5636; margin-right: 4px; }
.m-pending { display: inline-block; font-size: 0.6875rem; padding: 0 5px; border-radius: 7px; background: #fff3cd; color: #9a6b00; margin-right: 4px; }
.m-title { color: #3a2a1a; font-size: 0.8125rem; margin: 2px 0; }
.m-desc { color: #9a8a72; line-height: 1.5; }
.m-addr { color: #5a4a30; }
.m-geo { color: #3a6ea5; text-decoration: none; }
.m-year { color: #9a8a72; }
.m-empty { color: #9a8a72; font-size: 0.8125rem; padding: 8px 0; }
.m-frow { display: flex; gap: 8px; margin-bottom: 8px; }
.m-frow input, .m-frow select, .m-frow textarea { flex: 1; padding: 8px 10px; font-size: 0.8125rem; border: 1px solid #d8c8ac; border-radius: 6px; background: #fffdf7; color: #3a2a1a; }
.m-frow textarea { resize: vertical; }
.m-frow .m-ok { flex: 0 0 auto; padding: 8px 18px; font-size: 0.8125rem; border: none; border-radius: 6px; background: #8b2500; color: #fff; cursor: pointer; }
.m-frow .m-cancel { flex: 0 0 auto; padding: 8px 14px; font-size: 0.8125rem; border: 1px solid #d8c8ac; border-radius: 6px; background: #fdfbf4; color: #6b5636; cursor: pointer; }
.m-frow .m-pick { flex: 0 0 auto; padding: 8px 12px; font-size: 0.8125rem; border: 1px solid #3a6ea5; border-radius: 6px; background: #fff; color: #3a6ea5; cursor: pointer; white-space: nowrap; }
.m-frow .m-file-btn { flex: 0 0 auto; padding: 8px 16px; font-size: 0.8125rem; border: 1px solid #d8c8ac; border-radius: 6px; background: #fdfbf4; color: #6b5636; cursor: pointer; }
.m-frow .m-file-name { flex: 1; display: flex; align-items: center; font-size: 0.8125rem; color: #9a8a72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-msg { font-size: 0.8125rem; }
.m-act { font-size: 0.6875rem; padding: 2px 8px; border-radius: 4px; border: 1px solid #3a6ea5; background: #fff; color: #3a6ea5; cursor: pointer; }
.m-act-del { border-color: #c0392b; color: #c0392b; }

/* ---- 地图选点弹窗 / 编辑弹窗 ---- */
.map-modal { position: fixed; inset: 0; z-index: 5000; }
.map-modal-mask { position: absolute; inset: 0; background: rgba(40,25,8,.45); }
.map-modal-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(720px, 94vw);
  /* ★ 手机端可操作性（RULES §48）：原来只有宽度限制 + overflow:hidden ——
     横屏/小屏时"头 + 380px 地图 + 脚"超过视口，底部「确定」被裁掉且遮罩不可滚。 */
  max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: #fffdf7; border-radius: 10px; box-shadow: 0 12px 50px rgba(0,0,0,.4); }
.map-modal-head { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #e8dcc4; }
.map-search-row { flex: 1; display: flex; gap: 8px; }
.map-search-row input { flex: 1; padding: 8px 12px; font-size: 0.875rem; border: 1px solid #d8c8ac; border-radius: 6px; background: #fff; }
.map-search-row button { padding: 8px 16px; font-size: 0.8125rem; border: 1px solid #8b2500; border-radius: 6px; background: #8b2500; color: #fff; cursor: pointer; }
#map-close { border: none; background: none; font-size: 1.125rem; color: #9a8a72; cursor: pointer; padding: 4px 8px; }
#map-container { width: 100%; height: 380px; }
.map-modal-foot { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid #e8dcc4; }
.map-modal-foot span { flex: 1; font-size: 0.8125rem; color: #6b5636; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-modal-foot button { padding: 8px 22px; font-size: 0.875rem; border: none; border-radius: 6px; background: #8b2500; color: #fff; cursor: pointer; }
.map-modal-box input, .map-modal-box textarea, .map-modal-box select { width: 100%; padding: 8px 10px; font-size: 0.8125rem; border: 1px solid #d8c8ac; border-radius: 6px; background: #fffdf7; color: #3a2a1a; box-sizing: border-box; }
.map-modal-box textarea { resize: vertical; }

/* ================= 首页（软件主页 home.html） ================= */
.home-container { width: auto; max-width: 1120px; margin: 24px auto; padding: 0 16px; }
.home-hero {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid #e3d5bd; box-shadow: 0 8px 26px rgba(90, 60, 20, .20);
  background: #efe3cb;
}
.hero-track { display: flex; transition: transform .65s ease; }
.hero-slide { flex: 0 0 100%; }
.hero-slide img { width: 100%; height: clamp(210px, 44vw, 430px); object-fit: cover; display: block; }
.hero-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(255, 249, 236, .82); color: #8b2500;
  font-size: 1.375rem; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(60, 30, 5, .25); z-index: 5;
}
.hero-nav:hover { background: #fff; }
.hero-prev { left: 12px; }
.hero-next { right: 12px; }
.hero-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fffdf7; border: 1px solid #e3d5bd; border-top: none;
  border-radius: 0 0 12px 12px; padding: 10px 18px;
}
.hero-cap { flex: 1; font-size: 0.9375rem; color: #8b2500; letter-spacing: 2px; min-width: 200px; }
.hero-cap small { display: block; font-size: 0.75rem; color: #9a8a72; letter-spacing: 1px; margin-top: 2px; }
.hero-dots { display: flex; gap: 8px; }
.hero-dots span {
  width: 9px; height: 9px; border-radius: 50%; background: #d9cbb2; cursor: pointer; transition: .25s;
}
.hero-dots span.on { background: #8b2500; width: 22px; border-radius: 5px; }

/* 功能简介卡片 */
.section-title { font-size: 1.1875rem; color: #8b2500; letter-spacing: 3px; margin: 6px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #d8c8ac, transparent); }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 16px; }
.mod-card {
  background: #fffdf7; border: 1px solid #e3d5bd; border-radius: 12px;
  padding: 20px 20px 16px; display: flex; flex-direction: column;
  box-shadow: 0 4px 14px rgba(90, 60, 20, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}
.mod-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(90, 60, 20, .16); }
.mod-card .ic { font-size: 1.75rem; line-height: 1; }
.mod-card h3 { margin: 12px 0 6px; color: #8b2500; font-size: 1.0625rem; letter-spacing: 1px; font-weight: 600; }
.mod-card p { font-size: 0.8125rem; line-height: 1.75; color: #6b5636; flex: 1; }
.mod-card .go {
  align-self: flex-end; margin-top: 14px; display: inline-block;
  padding: 6px 18px; font-size: 0.8125rem; letter-spacing: 2px;
  background: #8b2500; color: #fff9ec; border-radius: 20px; text-decoration: none;
}
.mod-card .go:hover { background: #a13008; }
.mod-card .go.alt { background: #fff; color: #8b2500; border: 1px solid #8b2500; }
.mod-card .go.alt:hover { background: #fdf3e3; }

/* 家族概况数据瓦片 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: linear-gradient(160deg, #8b2500, #6d1d00); color: #ffe9c7;
  border-radius: 12px; padding: 18px 16px; text-align: center;
  box-shadow: 0 6px 16px rgba(90, 37, 5, .25);
}
.stat .num { font-size: 1.875rem; line-height: 1.2; letter-spacing: 1px; }
.stat .num small { font-size: 0.9375rem; }
.stat .lb { font-size: 0.75rem; opacity: .85; letter-spacing: 2px; margin-top: 4px; }
.stat .sub { font-size: 0.6875rem; opacity: .7; margin-top: 2px; }

/* 世代速览 pill */
.gen-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-chip {
  padding: 5px 12px; font-size: 0.75rem; border-radius: 14px; cursor: pointer;
  border: 1px solid #d8c8ac; background: #fffdf7; color: #6b5636;
}
.gen-chip b { color: #8b2500; }
.gen-chip:hover, .gen-chip.on { background: #8b2500; border-color: #8b2500; color: #fff; }
.gen-chip:hover b, .gen-chip.on b { color: #ffd9b3; }

/* 首页页脚 */
.home-foot { text-align: center; color: #9a8a72; font-size: 0.75rem; margin: 28px 0 10px; letter-spacing: 1px; }

/* 实名/待审提示条 */
.verify-banner { background: #fdf3e3; border: 1px solid #e6c88a; color: #8a6d2f; padding: 8px 16px; font-size: 0.8125rem; margin-bottom: 12px; border-radius: 6px; }
.verify-banner a { color: #8b2500; font-weight: bold; }

/* ---- 全站页脚（common.js 自动注入每页底部） ---- */
.site-footer {
  margin-top: 34px; padding: 22px 16px 30px;
  text-align: center; border-top: 1px dashed #d8c8ac;
  background: rgba(255, 253, 247, .55);
}
.site-footer .sf-line { font-size: 0.8125rem; color: #5a4a30; margin-top: 6px; letter-spacing: 1px; }
.site-footer .sf-sub { font-size: 0.6875rem; color: #9a8a72; margin-top: 4px; letter-spacing: 1px; }

/* 首页欢迎/提示条 */
.home-tip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff8ec; border: 1px solid #ecd9b4; color: #8a6d2f;
  border-radius: 10px; padding: 12px 18px; font-size: 0.875rem; margin-bottom: 18px;
}
.home-tip b { color: #8b2500; }
.home-tip a { color: #8b2500; font-weight: bold; }

/* ================= 移动端（手机）适配 =================
   ★ 维护要点（改页面时请遵守）：
   1) 字体楷体优先：华文楷体 STKaiti / 楷体 KaiTi / Kaiti SC；安卓无内置楷体时回退宋体，
      如需安卓也显示楷体，需另做「楷体网页字体包」（子集化 woff2 + font-display: swap）；
   2) 页面里的双列栅格请加 class="ft-2col"（不要只写内联 style），窄屏会自动降为单列；
   3) 手机上输入控件字号固定 16px，避免 iOS 聚焦时自动放大；
   4) 宽表格 / 卡片允许横向滑动，宁可横滑也不要裁掉内容。 */
:root {
  /* 楷体优先，顺序即优先级（★ 2026-09-10 站长复核后调整）：
     ① 华文楷体 STKaiti —— 苹果设备上站长认可的楷体（原先排第一的 "Kaiti SC" 在 iOS 上是另一种偏细的楷体，观感"怪");
     ② Kaiti SC（iOS 备用名）；
     ③ Windows 楷体 KaiTi / KaiTi_GB2312（= PC 端看到的那种楷体）；
     ④ 楷体 / Kaiti TC 等其它别名；
     ⑤ LXGW WenKai —— 自托管网页楷体（霞鹜文楷，ops/install-kai-font.sh 安装），
        安卓无系统楷体时才会用到；iPhone/PC 命中前面任一系统楷体则不会下载字体文件；
     ⑥ 兜底：宋体族。 */
  --font-kai: "STKaiti", "Kaiti SC", "KaiTi", "KaiTi_GB2312", "楷体", "Kaiti TC",
              "LXGW WenKai", "Noto Serif SC", "Songti SC", SimSun, serif;
  --tap-min: 40px;   /* 手机端最小可点高度 */
  /* 正文（全站）字体栈：**宋体族优先**（★ 2026-09-11 站长反馈恢复）。
     楷体笔画细、字号看起来更小，全站正文用楷体会显得字小，故正文恢复为宋体；
     楷体只保留在**祠堂牌位**（见 --font-plaque）。 */
  --font-song: "Noto Serif SC", "Songti SC", SimSun, "Microsoft YaHei", serif;
  /* 牌位（竖排）文字专用字体栈：**系统楷体优先**（★ 祠堂牌位上的字必须保持楷体）。
     ⚠️ 2026-09-11 修正：曾把网页楷体 "LXGW WenKai" 排到第一位，导致祠堂页**冷缓存时要下载字体分片**——
     表现为"加载慢"且"字体到达后替换系统字体、牌位文字跳一下（先居中后偏右）"。
     现改回：① 华文楷体 STKaiti（苹果）② Kaiti SC ③ Windows KaiTi/KaiTi_GB2312 ④ 楷体等别名
     ⑤ **LXGW WenKai 仅作兜底**（安卓无系统楷体时才下载，且此时文字已由 .sname-col 绝对居中，不会跳位）
     ⑥ 宋体族兜底。
     ★ 2026-09-11 再修正：改用**复合字体族 FT-Plaque**（@font-face 内 local() 依次尝试系统楷体），
     这样"有系统楷体就用系统的、没有才下载网页楷体"只需一个族名即可表达，且不会误下载字体。 */
  --font-plaque: "FT-Plaque", "LXGW WenKai", "Noto Serif SC", "Songti SC", SimSun, serif;
}

/* 牌位字体（复合族）：按顺序尝试本机系统楷体（local 不产生任何网络请求）；
   若本机都没有（典型：安卓），该族失败 → 自动落到 --font-plaque 里的下一个 "LXGW WenKai"（网页楷体，
   由祠堂页/首页异步引入）。这样保证"牌位上的字始终是楷体"，又不会让苹果/电脑白下载字体。 */
@font-face {
  font-family: "FT-Plaque";
  src: local("STKaiti"), local("Kaiti SC"), local("Kaiti TC"),
       local("KaiTi"), local("KaiTi_GB2312"), local("楷体");
  font-display: swap;
}html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: var(--font-song); }   /* 全站正文＝宋体（楷体只用于祠堂牌位） */
img, video, canvas, svg { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }
/* 双列栅格：手机端自动单列（!important 用于覆盖内联 style） */
.ft-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }

/* ================= 全站黑白配色（公祭/灾难日 · RULES §24.1）=================
   管理员在「管理后台 → 网站内容 → 全站黑白配色」一键开启；由 common.js 给 <html> 加 .ft-mono。
   实现：用一整屏的 backdrop-filter 覆盖层做**去色**（而不是给 html/body 加 filter）——
   给 html/body 加 filter 会让 position:fixed 的子孙元素改以文档为定位基准（置顶按钮/弹窗会跑位），
   覆盖层方案不影响任何元素的定位，且能连图片一起变灰。 */
html.ft-mono::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  -webkit-backdrop-filter: grayscale(100%);
  backdrop-filter: grayscale(100%);
}
@supports not ((backdrop-filter: grayscale(1)) or (-webkit-backdrop-filter: grayscale(1))) {
  /* 老浏览器兜底：整体去色（此时接受 fixed 元素定位基准变化的代价） */
  html.ft-mono { filter: grayscale(1); }
}

/* ================= 触屏基础（RULES §22.5 · 手机端专项）=================
   1) touch-action: manipulation —— 去掉移动浏览器双击缩放的 300ms 点击延迟，点击更跟手；
   2) 统一点击高亮色，避免不同浏览器默认的蓝色/灰色高亮；
   3) 可点控件禁止选中文字：长按不再选中文字、不再弹出复制菜单（牌位/节点/按钮）。 */
a, button, label, select, summary, [onclick], [role="button"],
.seat, .hseat, .node, .bubble, .fold, .plus, .gen-chip, .dh-tab, .niche-tab, .hall-btn,
.m-add, .m-act, .dh-totop, .pg-btns button, .m-pick, .m-file-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(139, 37, 0, .12);
}
button, .seat, .hseat, .node, .bubble, .fold, .plus, .gen-chip, .topbar .nav a,
.dh-tab, .niche-tab, .m-act, .dh-totop {
  -webkit-user-select: none; user-select: none;
}

@media (max-width: 760px) {
  :root { --tap-min: 44px; }   /* ★ 触屏可点区域提升到 44px（移动端推荐下限） */
  .container { margin: 12px 10px; }
  .card { padding: 14px 12px; }
  .card, #list { overflow-x: auto; -webkit-overflow-scrolling: touch; }  /* 宽表格横滑，不裁切 */
  /* ---- 手机端顶部栏：品牌一行 →（用户信息 + 字号）一行 → 导航按需分行；
         关键：「字号」文字与它的下拉框必须始终在一起，不能被换行拆开（曾出现"字号"在行尾、选择器掉到下一行）---- */
  .topbar { padding: 8px 12px 10px; flex-direction: column; align-items: stretch; gap: 2px; }
  .topbar h1 { font-size: 1rem; letter-spacing: 1px; line-height: 1.4; }
  .topbar h1 span { font-size: 0.625rem !important; }
  .topbar .nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; width: 100%; }
  .topbar .nav #whoami,
  .topbar .nav > span:not([style*="flex:1"]) { flex: 1 1 auto; min-width: 0; font-size: 0.75rem !important; opacity: .92;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .nav label { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
    white-space: nowrap; font-size: 0.75rem !important; }
  .topbar .nav a { margin-left: 0; padding: 10px 0; font-size: 0.8125rem; line-height: 1.35; }
  .sticky-bar { padding: 10px 12px; margin-bottom: 12px;
    /* ★ 手机端吸顶栏必须**限高 + 内部可滚**（RULES §48）：
       站长反馈管理后台「实名审核」的固定内容占满手机屏、待审核列表看不见。
       原因之一就是这条吸顶栏在窄屏没有任何高度上限，里面东西一多就整块常驻。
       这里给全局兜底（单个页面若确有需要，可在页面内自己覆盖，如 tree.html 的 42vh）。 */
    max-height: 30vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .home-container { margin: 12px auto; padding: 0 10px; }
  .hero-bar { padding: 10px 12px; gap: 10px; }
  .hero-cap { min-width: 0; letter-spacing: 1px; font-size: 0.875rem; }
  .hero-slide img { height: clamp(170px, 52vw, 300px); }
  .hero-nav { width: 32px; height: 32px; font-size: 1.125rem; }
  .hero-prev { left: 6px; } .hero-next { right: 6px; }
  .mod-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .num { font-size: 1.5rem; }
  .m-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .map-modal-box { width: 96vw; }
  /* ★ 手机端（RULES §48）：高度改用视口比例，横屏（如 844×390）时才不会把底部「确定」挤出屏幕 */
  #map-container { height: 300px; height: 44dvh; }
  .map-modal-foot { flex-wrap: wrap; }
  .auth-card { padding: 26px 20px; }
  .auth-card h1 { font-size: 1.375rem; letter-spacing: 3px; }
  .site-footer { padding: 18px 12px 24px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
  #fontsize { font-size: 0.8125rem !important; }   /* 字号选择器：保持与导航一致，避免比周围字明显更大 */
  .auth-card input, .auth-card button, .m-frow input, .m-frow select, .m-frow textarea,
  .card button:not(.fold):not(.plus), .foot button, .btn, .mod-card .go, .m-add, .gen-chip, .m-act { min-height: var(--tap-min); }
  /* ★ 圆形/方形小控件必须保持原宽高比：不要被上面的「最小可点高度」拉成椭圆
     （节点折叠角标 .fold 是 22×22 圆形，曾被拉成 22×40 椭圆；缩放按钮同理） */
  .card .fold, .card .plus, .zoom-ctl button, .dh-view-switch button, .pg-btns button { min-height: 0; }
  .card .fold { width: 22px; height: 22px; border-radius: 50%; }
  .zoom-ctl button { width: 34px; height: 34px; }   /* 手机上略放大便于点按，仍是正方形 */
  .zoom-ctl .zv { width: 34px; }
  .ft-2col { grid-template-columns: 1fr !important; }
  .grid2 { grid-template-columns: 1fr !important; }
}
@media (max-width: 420px) {
  .stat-row { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 1rem; letter-spacing: 1px; }
  .card { padding: 12px 10px; }
}
/* 触屏设备没有「悬停」：原本靠 :hover 才出现的按钮（牌位「拜谒/统计」、首页牌位「拜谒」）
   在手机上永远点不到，这里改为常显。桌面端仍保持悬停显示，不受影响。 */
@media (hover: none) {
  .seat .acts { display: flex; }
  .hseat .hb { display: block; }
  .seat .acts button { padding: 3px 6px; font-size: 0.6875rem; }
  /* ★ 触屏没有悬停：世系树节点的四向「＋」改为「长按节点」后显示（JS 给节点加 .act 类） */
  .node.act .plus { opacity: 1; }
  /* ★ 头像提示：触屏下点击头像显示（页面给 .avatar 切换 .open 类） */
  .avatar.open .tip { display: flex; }
  /* ★ 世系树自己处理双指缩放，禁止浏览器原生手势抢走（否则页面整体缩放，树反而看不全） */
  .tree-wrap { touch-action: pan-x pan-y; }
}

/* ================= ★ 尊重系统"减少动态效果"（RULES §35.2）=================
   用户在系统里开启"减少动态效果"（iOS：设置→辅助功能→动态效果；Android：开发者选项/辅助功能）时，
   关闭全站动画与过渡：牌位的描金光晕、加载旋转、按钮过渡等一律静止（省电、防眩晕）。
   说明：用通配符一处覆盖，新增页面/组件自动生效，无需逐个改。 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* 无限循环的装饰动画直接不播放（避免"每帧重绘"耗电） */
  .seat.notable img, .hseat.notable img,
  [class*="fxGold"], [class*="hGold"], [class*="fx-spin"], [class*="fxContour"], [class*="hContour"] {
    animation: none !important;
  }
}