/* ============================================================
   晋明斋档案馆 - 全局样式
   主题：移星换斗星空 + 复古古籍皮革藏书
   ============================================================ */
:root {
  --bg-deep: #0a0618;
  --bg-mid: #191040;
  --bg-top: #251a56;
  --gold: #c9a44a;
  --gold-bright: #ecd48a;
  --gold-dim: #9c7b3f;
  --gold-deep: #7a5c22;
  --silver: #9fb2cc;
  --paper: #efe3c4;
  --paper-2: #e7d7ae;
  --paper-edge: #d6c294;
  --ink: #43371f;
  --ink-light: #6f5d3a;
  --ink-faint: #8a7a56;
  --leather-1: #5e3a22;
  --leather-2: #3f2614;
  --leather-3: #291709;
  --seal-red: #8e3b2f;
  --nav-1: #342c62;
  --nav-2: #221c48;
  --err: #93342a;
  /* 内页装饰双线与纸边距离、内容左右留白（断点中联动调整，保证内容永远在框线内侧） */
  --frame-in-1: 12px;
  --frame-in-2: 17px;
  --frame-px: 42px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(120, 90, 200, .28), transparent 60%),
    radial-gradient(900px 600px at 12% 108%, rgba(90, 60, 160, .22), transparent 55%),
    linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 46%, var(--bg-deep) 100%);
  overflow-x: hidden;
}
#app { position: relative; z-index: 1; min-height: 100vh; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(120, 95, 50, .12); }
::-webkit-scrollbar-thumb { background: rgba(122, 92, 34, .45); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(122, 92, 34, .7); }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; outline: none; }

/* 防溢出：任何控件/媒体不得撑破纸页边框 */
img, canvas, svg, video { max-width: 100%; }
.main-area { min-width: 0; }
.book, .book-inner { min-width: 0; }
.arch-card, .tech-card, .modal-paper { min-width: 0; }
input.inp, textarea.inp, select.inp { max-width: 100%; }
/* 表单/详情容器统一收束在纸页内容宽内 */
.form-row, .form-grid, .img-grid, .info-grid,
.plain-text, .chart-text, .detail-head, .toolbar,
.arch-list, .tech-grid, .cate-tabs, .cate-filter-tabs, .visit-item { max-width: 100%; }

/* 触控设备：图片删除钮常驻（hover 在触屏不存在） */
@media (hover: none) {
  .img-cell .img-del { display: block; opacity: .85; }
}

/* ================= 星空画布 ================= */
.star-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ================= 侧边仿古导航 ================= */
.app-shell { display: flex; min-height: 100vh; }
.side-nav {
  position: fixed; left: 14px; top: 50%; transform: translateY(-50%);
  z-index: 20; display: flex; flex-direction: column; gap: 12px; width: 132px;
}
.side-logo {
  text-align: center; padding: 10px 4px 12px; margin-bottom: 6px;
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSongti-SC", "SimSun", serif;
  color: var(--gold-bright); font-size: 19px; letter-spacing: 5px;
  text-shadow: 0 0 14px rgba(212, 175, 55, .45);
  border-bottom: 1px solid rgba(201, 164, 74, .35);
}
.side-logo small { display: block; font-size: 10px; letter-spacing: 3px; color: var(--silver); margin-top: 4px; opacity: .75; }
.nav-btn {
  padding: 10px 8px; font-size: 15px; letter-spacing: 4px; text-indent: 4px;
  color: #e4d7ab; text-align: center;
  background: linear-gradient(180deg, var(--nav-1), var(--nav-2));
  border: 1px solid #6f6396; border-radius: 4px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: all .2s ease;
}
.nav-btn:hover { border-color: var(--gold); color: var(--gold-bright); box-shadow: 3px 3px 0 rgba(0,0,0,.4), 0 0 12px rgba(212,175,55,.35); }
.nav-btn.active { border-color: var(--gold-bright); color: var(--gold-bright); background: linear-gradient(180deg, #453a7a, #2b2456); box-shadow: 3px 3px 0 rgba(0,0,0,.4), 0 0 14px rgba(212,175,55,.4); }
.nav-btn.nav-exit { color: #d9a49a; border-color: #7c5a58; }
.nav-btn.nav-exit:hover { border-color: var(--seal-red); color: #f0b3a6; box-shadow: 3px 3px 0 rgba(0,0,0,.4), 0 0 12px rgba(142,59,47,.45); }
.nav-role { text-align: center; font-size: 11px; color: var(--silver); letter-spacing: 2px; opacity: .7; margin-top: 2px; }

/* ================= 古书容器 ================= */
.main-area { flex: 1; margin-left: 162px; padding: 26px 30px; display: flex; }
.book {
  position: relative; width: 100%; max-width: 1560px; margin: 0 auto;
  min-height: calc(100vh - 52px);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.018' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.32 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(155deg, var(--leather-1) 0%, var(--leather-2) 55%, var(--leather-3) 100%);
  border-radius: 14px;
  padding: 30px 40px 36px 52px;
  box-shadow:
    0 34px 90px rgba(0, 0, 0, .65),
    0 6px 22px rgba(0, 0, 0, .5),
    inset 0 2px 5px rgba(255, 220, 160, .14),
    inset -3px 0 10px rgba(0, 0, 0, .45);
}
/* 书脊 */
.book::before {
  content: ""; position: absolute; left: 16px; top: 10px; bottom: 10px; width: 20px;
  background: linear-gradient(90deg, rgba(0,0,0,.5), rgba(0,0,0,.12) 60%, rgba(255,215,150,.08));
  border-radius: 8px 2px 2px 8px;
  border-right: 1px solid rgba(255, 220, 160, .12);
}
/* 书脊装订纹 */
.book-spine-stitch {
  position: absolute; left: 24px; top: 26px; bottom: 26px; width: 2px;
  background: repeating-linear-gradient(180deg, rgba(222,186,110,.5) 0 8px, transparent 8px 18px);
  border-radius: 2px;
}
.book-inner {
  position: relative; min-height: calc(100vh - 120px); height: calc(100vh - 120px);
  overflow: hidden; border-radius: 5px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.36 0 0 0 0 0.2 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)'/%3E%3C/svg%3E"),
    linear-gradient(115deg, #f2e7c9 0%, var(--paper) 42%, #eadcba 100%);
  /* 纸页堆叠毛边 */
  box-shadow:
    4px 4px 0 #e3d4a9,
    8px 8px 0 #d8c79a,
    12px 12px 0 #c9b789,
    16px 16px 0 #b7a476,
    inset 0 0 70px rgba(120, 88, 38, .22),
    inset 0 0 6px rgba(90, 62, 22, .28);
  /* 做旧毛边 */
  clip-path: polygon(0.4% 0%, 99.6% 0.2%, 100% 1.2%, 99.8% 50%, 100% 98.8%, 99.5% 100%, 0.5% 99.9%, 0% 98.6%, 0.2% 46%, 0% 1.4%);
}
/* 中式古籍细线双边框 */
.book-inner::before {
  content: ""; position: absolute; inset: var(--frame-in-1); pointer-events: none;
  border: 1.6px solid rgba(140, 106, 48, .55); border-radius: 3px;
}
.book-inner::after {
  content: ""; position: absolute; inset: var(--frame-in-2); pointer-events: none;
  border: 1px solid rgba(140, 106, 48, .3); border-radius: 2px;
}
/* 内容滚动层：桌面端纸面与装饰框线固定，仅内容在其中滚动 */
.book-scroll {
  position: absolute; inset: 0; min-width: 0;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 30px var(--frame-px) 48px;
  scrollbar-width: thin; scrollbar-color: rgba(140,106,48,.45) transparent;
}
.book-scroll::-webkit-scrollbar { width: 8px; }
.book-scroll::-webkit-scrollbar-thumb { background: rgba(140,106,48,.4); border-radius: 4px; }
.book-scroll::-webkit-scrollbar-thumb:hover { background: rgba(140,106,48,.65); }
.book-scroll::-webkit-scrollbar-track { background: transparent; }
/* 四角饰点 */
.corner-mark { position: absolute; width: 14px; height: 14px; pointer-events: none; z-index: 2; }
.corner-mark::before { content: "◆"; position: absolute; color: rgba(140,106,48,.6); font-size: 10px; }
.cm-tl { top: 19px; left: 21px; } .cm-tr { top: 19px; right: 21px; }
.cm-bl { bottom: 19px; left: 21px; } .cm-br { bottom: 19px; right: 21px; }

/* ================= 页面标题（仿样图题字） ================= */
.page-title {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 6px 0 26px;
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSongti-SC", "SimSun", serif;
  font-size: 27px; font-weight: 700; letter-spacing: 7px; text-indent: 7px;
  color: #57431f;
}
.page-title::before, .page-title::after {
  content: ""; flex: 1; max-width: 300px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(122, 92, 34, .75));
  position: relative;
}
.page-title::after { background: linear-gradient(90deg, rgba(122, 92, 34, .75), transparent); }
.page-title .dot { color: rgba(122, 92, 34, .85); font-size: 15px; letter-spacing: 0; text-indent: 0; }

.sec-title {
  display: flex; align-items: center; gap: 10px;
  font-family: "Noto Serif SC", "SimSun", serif; font-size: 19px; font-weight: 700;
  letter-spacing: 4px; color: #5a4426; margin: 26px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(140, 106, 48, .4);
}
.sec-title::before {
  content: ""; width: 10px; height: 10px; background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  transform: rotate(45deg); box-shadow: 0 0 6px rgba(201, 164, 74, .6); flex: none;
}
.sec-title small { font-size: 12px; letter-spacing: 1px; color: var(--ink-faint); font-weight: 400; margin-left: auto; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; font-size: 14px; letter-spacing: 2px; text-indent: 2px;
  color: #e6d9a8; background: linear-gradient(180deg, var(--nav-1), var(--nav-2));
  border: 1px solid #6f6396; border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.07);
  transition: all .18s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold-bright); box-shadow: 2px 2px 0 rgba(0,0,0,.35), 0 0 10px rgba(212,175,55,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background: linear-gradient(180deg, #97742e, #6e5220);
  border-color: #c9a44a; color: #f7ead0;
}
.btn-primary:hover { background: linear-gradient(180deg, #ab8434, #7d5e25); box-shadow: 2px 2px 0 rgba(0,0,0,.35), 0 0 12px rgba(212,175,55,.5); }
.btn-danger { background: linear-gradient(180deg, #7e3527, #5e2419); border-color: #a4543f; color: #f2cfc4; }
.btn-danger:hover { box-shadow: 2px 2px 0 rgba(0,0,0,.35), 0 0 10px rgba(142,59,47,.5); }
.btn-sm { padding: 4px 12px; font-size: 12.5px; }
.btn-link { background: none; border: none; box-shadow: none; color: var(--gold-deep); padding: 2px 4px; letter-spacing: 1px; text-indent: 0; }
.btn-link:hover { color: var(--gold); text-decoration: underline; box-shadow: none; }

/* ================= 表单 ================= */
.form-row { margin-bottom: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 26px; }
.lbl { display: block; font-size: 13.5px; color: var(--ink-light); letter-spacing: 2px; margin-bottom: 6px; }
.lbl .req { color: var(--seal-red); margin-right: 2px; }
.inp, textarea.inp, select.inp {
  width: 100%; padding: 9px 12px; font-size: 14.5px; color: var(--ink);
  background: rgba(255, 251, 238, .65); border: 1px solid #b49a63; border-radius: 3px;
  box-shadow: inset 1px 1px 3px rgba(120, 90, 40, .14);
  transition: border-color .18s, box-shadow .18s;
}
.inp:focus { border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(201, 164, 74, .22), inset 1px 1px 3px rgba(120,90,40,.12); }
textarea.inp { resize: vertical; min-height: 90px; line-height: 1.7; }
.inp:disabled, .inp[readonly] { background: rgba(210, 195, 160, .35); color: var(--ink-light); cursor: not-allowed; }
.radio-line { display: flex; gap: 22px; align-items: center; padding: 8px 2px; }
.radio-line label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14.5px; color: var(--ink); }
.radio-line input[type="radio"] { accent-color: var(--gold-deep); width: 15px; height: 15px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.toolbar .inp { width: auto; min-width: 150px; }
.flex1 { flex: 1; }

/* ================= 档案列表卡片 ================= */
.arch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.arch-card {
  position: relative; padding: 15px 18px 13px; cursor: pointer;
  background: linear-gradient(150deg, rgba(255, 250, 235, .6), rgba(250, 240, 214, .45));
  border: 1px solid #c2ab77; border-radius: 4px;
  box-shadow: 2px 3px 8px rgba(90, 62, 22, .14);
  transition: all .2s ease;
}
.arch-card:hover { transform: translateY(-3px); border-color: var(--gold-deep); box-shadow: 3px 8px 18px rgba(90, 62, 22, .3); }
.arch-code { font-family: "Noto Serif SC", "SimSun", serif; font-weight: 700; color: #8a6524; letter-spacing: 1px; font-size: 15.5px; }
.arch-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 7px 0 8px; font-size: 12.5px; color: var(--ink-faint); }
.arch-meta .tag-mini { color: #6e5220; border: 1px solid rgba(140,106,48,.4); border-radius: 3px; padding: 0 7px; }
.arch-snippet { font-size: 13.5px; color: var(--ink-light); line-height: 1.65; max-height: 44px; overflow: hidden; word-break: break-all; }
.arch-foot { margin-top: 9px; padding-top: 7px; border-top: 1px dashed rgba(140,106,48,.35); font-size: 12px; color: var(--ink-faint); display: flex; justify-content: space-between; }
.empty { text-align: center; padding: 60px 0 40px; color: var(--ink-faint); letter-spacing: 3px; font-size: 15px; }
.empty::before { content: "❋"; display: block; font-size: 26px; margin-bottom: 10px; color: rgba(140,106,48,.5); }

/* ================= 详情展示 ================= */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 6px; }
.detail-code { font-family: "Noto Serif SC", "SimSun", serif; font-size: 21px; font-weight: 700; color: #7a5c22; letter-spacing: 1.5px; }
.detail-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 30px; }
.info-item { font-size: 14.5px; line-height: 1.7; }
.info-item b { color: var(--ink-faint); font-weight: 400; font-size: 12.5px; letter-spacing: 2px; margin-right: 8px; }
.plain-text { white-space: pre-wrap; word-break: break-word; line-height: 1.85; font-size: 14.5px; color: var(--ink); background: rgba(255, 251, 238, .4); border: 1px dashed rgba(140,106,48,.35); border-radius: 4px; padding: 13px 16px; }
.visit-item { position: relative; padding: 10px 14px 10px 30px; border-left: 2px solid rgba(140,106,48,.45); margin: 0 0 12px 6px; }
.visit-item::before { content: "◉"; position: absolute; left: -8px; top: 10px; color: var(--gold-deep); font-size: 12px; background: var(--paper); }
.visit-time { font-size: 12.5px; color: var(--ink-faint); letter-spacing: 1px; margin-bottom: 4px; }
.visit-content { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

/* ================= 用法方案 / 标签 ================= */
.plan-entry { display: flex; gap: 12px; margin-bottom: 10px; }
.plan-kind {
  flex: none; align-self: flex-start; min-width: 76px; text-align: center;
  font-size: 12.5px; letter-spacing: 2px; color: #6e5220;
  background: rgba(201, 164, 74, .16); border: 1px solid rgba(140,106,48,.45); border-radius: 3px; padding: 4px 8px;
}
.plan-body { flex: 1; font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; padding-top: 3px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 8px 0;
  padding: 6px 14px; font-size: 13.5px; letter-spacing: 2px; color: var(--gold-bright);
  background: linear-gradient(180deg, #4c3c1d, #332810);
  border: 1px solid var(--gold-dim); border-radius: 3px; cursor: pointer;
  box-shadow: 1px 2px 4px rgba(40, 26, 6, .4), inset 0 1px 0 rgba(255, 225, 150, .12);
  transition: all .18s ease;
}
.tag-chip:hover { border-color: var(--gold-bright); box-shadow: 0 0 12px rgba(212, 175, 55, .5), 1px 2px 4px rgba(40,26,6,.4); transform: translateY(-1px); }
.tag-chip .cat { font-size: 10.5px; opacity: .75; letter-spacing: 1px; }
.tag-add-chip { background: rgba(201, 164, 74, .12); color: #6e5220; border: 1px dashed var(--gold-dim); box-shadow: none; }
.tag-add-chip:hover { color: var(--gold-deep); border-color: var(--gold-deep); box-shadow: none; }

/* ================= 图片组件 ================= */
.img-grid { display: flex; flex-wrap: wrap; gap: 11px; }
.img-cell { position: relative; width: 108px; height: 108px; border: 2px solid #b49a63; border-radius: 3px; overflow: hidden; background: rgba(255,251,238,.5); box-shadow: 2px 2px 5px rgba(90,62,22,.2); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; transition: transform .25s ease; }
.img-cell img:hover { transform: scale(1.06); }
.img-del {
  position: absolute; top: 0; right: 0; width: 22px; height: 22px; line-height: 19px; text-align: center;
  background: rgba(142, 59, 47, .88); color: #ffe9dd; font-size: 15px; cursor: pointer; border-radius: 0 0 0 4px; display: none;
}
.img-cell:hover .img-del { display: block; }
.img-add {
  width: 108px; height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed #b49a63; border-radius: 3px; cursor: pointer; color: #96804f;
  font-size: 12px; letter-spacing: 2px; line-height: 1.7; text-align: center; transition: all .2s ease; user-select: none;
}
.img-add:hover { border-color: var(--gold-deep); color: var(--gold-deep); background: rgba(201,164,74,.09); }
.img-add .plus { font-size: 26px; line-height: 1; }

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: rgba(6, 3, 16, .62); backdrop-filter: blur(3px); animation: fadeIn .22s ease;
  padding:
    max(16px, env(safe-area-inset-top, 0px)) 16px
    calc(16px + env(safe-area-inset-bottom, 0px) + var(--kb-inset, 0px));
}
.modal-paper {
  position: relative; width: 720px; max-width: 94vw;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin: auto; /* flex 容器中自动居中；内容超高时退回顶部并可滚动，不会被顶栏/键盘遮盖 */
  overflow-y: auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.36 0 0 0 0 0.2 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)'/%3E%3C/svg%3E"), linear-gradient(115deg, #f2e7c9, var(--paper) 45%, #eadcba);
  border-radius: 5px; padding: 24px 30px 28px;
  box-shadow: 4px 4px 0 #d8c79a, 8px 8px 0 #c4b184, 0 24px 60px rgba(0,0,0,.55), inset 0 0 40px rgba(120,88,38,.18);
  animation: popIn .26s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-paper::before { content: ""; position: absolute; inset: 9px; border: 1.4px solid rgba(140,106,48,.5); border-radius: 3px; pointer-events: none; }
.modal-title {
  font-family: "Noto Serif SC", "SimSun", serif; font-size: 19px; font-weight: 700; letter-spacing: 4px;
  color: #5a4426; text-align: center; margin-bottom: 4px;
}
.modal-sub { text-align: center; font-size: 12px; color: var(--ink-faint); letter-spacing: 2px; margin-bottom: 16px; }
.modal-close { position: absolute; top: 12px; right: 14px; z-index: 3; width: 30px; height: 30px; border: 1px solid rgba(140,106,48,.5); border-radius: 50%; background: rgba(255,251,238,.6); color: #6e5220; font-size: 15px; line-height: 1; }
.modal-close:hover { background: var(--seal-red); border-color: var(--seal-red); color: #fff; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(18px) scale(.94); } }

/* ================= 灯箱 ================= */
.lightbox { position: fixed; inset: 0; z-index: 1100; background: rgba(4, 2, 12, .88); display: flex; align-items: center; justify-content: center; animation: fadeIn .2s ease; }
.lightbox img { max-width: 88vw; max-height: 88vh; border-radius: 4px; box-shadow: 0 10px 50px rgba(0,0,0,.8); }
.lb-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(212,175,55,.5); background: rgba(20,14,40,.7); color: var(--gold-bright); font-size: 20px; transition: all .2s; }
.lb-btn:hover { background: rgba(60,44,110,.85); border-color: var(--gold-bright); }
.lb-prev { left: 26px; } .lb-next { right: 26px; }
.lb-close { position: absolute; top: 20px; right: 24px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(212,175,55,.5); background: rgba(20,14,40,.7); color: var(--gold-bright); font-size: 17px; }
.lb-close:hover { background: var(--seal-red); border-color: var(--seal-red); color: #fff; }
.lb-del { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); }
.lb-count { position: absolute; top: 26px; left: 30px; color: rgba(230, 217, 168, .85); letter-spacing: 2px; font-size: 14px; }

/* ================= 分页 ================= */
.page-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; font-size: 13.5px; color: var(--ink-light); letter-spacing: 1px; }
.page-nav .pg-btn { min-width: 34px; height: 32px; padding: 0 10px; border: 1px solid #b49a63; background: rgba(255,251,238,.55); color: #6e5220; border-radius: 3px; font-size: 13px; }
.page-nav .pg-btn.on { background: linear-gradient(180deg, #97742e, #6e5220); color: #f7ead0; border-color: #c9a44a; }
.page-nav .pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ================= 提示 & 确认 ================= */
.toast {
  position: fixed; top: 30px; left: 50%; transform: translateX(-50%); z-index: 1200;
  background: linear-gradient(180deg, #342c62, #221c48); color: var(--gold-bright);
  border: 1px solid var(--gold-dim); border-radius: 4px; padding: 11px 26px;
  letter-spacing: 2px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 14px rgba(212,175,55,.3);
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -14px); } }
.confirm-box { width: 400px; text-align: center; }
.confirm-box .confirm-msg { font-size: 15px; line-height: 1.8; letter-spacing: 1px; margin: 12px 0 22px; color: var(--ink); }
.confirm-box .confirm-btns { display: flex; gap: 14px; justify-content: center; }

/* ================= 登录页 ================= */
.login-stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  position: relative; width: 420px; max-width: 94vw;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.36 0 0 0 0 0.2 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)'/%3E%3C/svg%3E"), linear-gradient(115deg, #f2e7c9, var(--paper) 45%, #eadcba);
  border-radius: 6px; padding: 36px 40px 34px;
  box-shadow: 4px 4px 0 #e3d4a9, 8px 8px 0 #d8c79a, 0 26px 70px rgba(0,0,0,.65), inset 0 0 40px rgba(120,88,38,.18);
  animation: loginIn .55s cubic-bezier(.2, .8, .3, 1.1);
}
.login-card::before { content: ""; position: absolute; inset: 11px; border: 1.6px solid rgba(140,106,48,.55); border-radius: 3px; pointer-events: none; }
.login-card::after { content: ""; position: absolute; inset: 15px; border: 1px solid rgba(140,106,48,.3); border-radius: 2px; pointer-events: none; }
@keyframes loginIn { from { opacity: 0; transform: translateY(26px) scale(.96); } }
.login-title {
  text-align: center; font-family: "Noto Serif SC", "SimSun", serif; font-size: 29px; font-weight: 700;
  letter-spacing: 8px; text-indent: 8px; color: #57431f; text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.login-sub { text-align: center; font-size: 12px; letter-spacing: 4px; color: var(--ink-faint); margin: 8px 0 24px; }
.login-sub::before, .login-sub::after { content: "·"; color: var(--gold-deep); margin: 0 10px; }
.login-tabs { display: flex; border: 1px solid #b49a63; border-radius: 4px; overflow: hidden; margin-bottom: 22px; }
.login-tabs button { flex: 1; padding: 9px 0; font-size: 15px; letter-spacing: 4px; text-indent: 4px; border: none; background: rgba(255,251,238,.5); color: var(--ink-light); transition: all .2s; }
.login-tabs button.on { background: linear-gradient(180deg, #97742e, #6e5220); color: #f7ead0; }
.login-err { color: var(--err); font-size: 13px; text-align: center; letter-spacing: 1px; margin-bottom: 12px; min-height: 18px; }
.login-btn { width: 100%; padding: 11px 0; font-size: 16px; letter-spacing: 8px; text-indent: 8px; margin-top: 6px; }
.login-tip { margin-top: 16px; text-align: center; font-size: 11.5px; color: var(--ink-faint); letter-spacing: 1px; }

/* ================= 首页 ================= */
.home-hero { text-align: center; margin: 4px 0 30px; }
.home-hero .hero-seal {
  display: inline-block; padding: 8px 22px; margin-bottom: 14px;
  border: 2px solid var(--seal-red); border-radius: 4px; color: var(--seal-red);
  font-family: "Noto Serif SC", "SimSun", serif; font-size: 14px; letter-spacing: 6px; text-indent: 6px;
  transform: rotate(-2deg); opacity: .85; box-shadow: inset 0 0 10px rgba(142,59,47,.15);
}
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; max-width: 980px; margin: 0 auto; }
.home-card {
  position: relative; padding: 36px 30px 28px; text-align: center; cursor: pointer;
  background: linear-gradient(155deg, rgba(255,250,235,.62), rgba(248,236,205,.42));
  border: 1.6px solid rgba(140,106,48,.55); border-radius: 5px;
  box-shadow: 3px 5px 14px rgba(90,62,22,.18), inset 0 0 24px rgba(120,88,38,.08);
  transition: all .25s ease; overflow: hidden;
}
.home-card::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(140,106,48,.3); border-radius: 3px; pointer-events: none; }
.home-card:hover { transform: translateY(-5px); border-color: var(--gold-deep); box-shadow: 4px 12px 26px rgba(90,62,22,.32), 0 0 18px rgba(201,164,74,.25); }
.home-card h3 { font-family: "Noto Serif SC", "SimSun", serif; font-size: 23px; letter-spacing: 6px; text-indent: 6px; color: #57431f; margin-bottom: 12px; }
.home-card p { font-size: 13.5px; color: var(--ink-faint); line-height: 1.8; letter-spacing: 1px; margin-bottom: 18px; }
.home-card .hc-num { font-family: "Noto Serif SC", "SimSun", serif; font-size: 30px; color: var(--gold-deep); font-weight: 700; }
.home-card .hc-num small { font-size: 12px; color: var(--ink-faint); font-weight: 400; letter-spacing: 2px; margin-left: 6px; }
.home-links { display: flex; justify-content: center; gap: 18px; margin-top: 34px; flex-wrap: wrap; }
.home-stats { display: flex; justify-content: center; gap: 40px; margin: 18px 0 30px; flex-wrap: wrap; }
.home-stat { text-align: center; }
.home-stat b { display: block; font-family: "Noto Serif SC","SimSun",serif; font-size: 26px; color: var(--gold-deep); }
.home-stat span { font-size: 12px; color: var(--ink-faint); letter-spacing: 2px; }

/* ================= 技术库 ================= */
.cate-tabs { display: flex; gap: 12px; justify-content: center; margin-bottom: 22px; }
.cate-tab {
  padding: 9px 34px; font-size: 16px; letter-spacing: 5px; text-indent: 5px; font-family: "Noto Serif SC","SimSun",serif;
  color: #6e5220; background: rgba(255,251,238,.5); border: 1.4px solid rgba(140,106,48,.55); border-radius: 4px;
  transition: all .2s ease;
}
.cate-tab.on { background: linear-gradient(180deg, #97742e, #6e5220); color: #f7ead0; border-color: #c9a44a; box-shadow: 0 0 14px rgba(212,175,55,.35); }
.cate-tab:hover:not(.on) { border-color: var(--gold-deep); color: var(--gold-deep); }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tech-card { padding: 15px 18px; background: linear-gradient(150deg, rgba(255,250,235,.6), rgba(250,240,214,.45)); border: 1px solid #c2ab77; border-radius: 4px; cursor: pointer; transition: all .2s ease; }
.tech-card:hover { transform: translateY(-3px); border-color: var(--gold-deep); box-shadow: 3px 8px 18px rgba(90,62,22,.28); }
.tech-card h4 { font-family: "Noto Serif SC","SimSun",serif; font-size: 17px; letter-spacing: 3px; color: #57431f; display: flex; align-items: center; gap: 10px; }
.cate-badge { font-size: 11px; letter-spacing: 2px; text-indent: 2px; padding: 2px 9px; border-radius: 3px; font-family: "PingFang SC","Microsoft YaHei",sans-serif; }
.cate-badge.huazi { background: rgba(142, 90, 40, .16); color: #7a4c14; border: 1px solid rgba(142,90,40,.4); }
.cate-badge.lingfu { background: rgba(70, 60, 140, .14); color: #4a3c8e; border: 1px solid rgba(70,60,140,.4); }
.cate-badge.custom { background: rgba(46, 110, 86, .13); color: #2e6e56; border: 1px solid rgba(46,110,86,.42); }
/* 分类页签上的删除叉（仅管理员可见） */
.cate-tab { position: relative; }
.cate-tab .cate-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; margin-left: 7px; font-size: 10px;
  border: 1px solid rgba(142, 59, 47, .55); color: #8e3b2f; border-radius: 50%;
  vertical-align: 1px; transition: all .18s ease;
}
.cate-tab .cate-del:hover { background: var(--seal-red); color: #fff; border-color: var(--seal-red); }
.cate-tab.cate-add {
  background: none; border-style: dashed; color: #6e5220;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 3px; font-size: 14.5px;
}
.cate-tab.cate-add:hover { background: rgba(201,164,74,.12); border-color: var(--gold-deep); color: var(--gold-deep); }

/* 分类来源角标：公 / 私 */
.cate-scope {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  font-size: 10.5px; line-height: 1.7; letter-spacing: 0; vertical-align: middle;
  border-radius: 3px; border: 1px solid;
}
.cate-scope.public { color: #6b4a17; border-color: rgba(155,116,44,.55); background: rgba(201,164,74,.16); }
.cate-scope.private { color: #5d3a1a; border-color: rgba(139,90,43,.5); background: rgba(176,120,66,.14); }
.cate-hint {
  margin: -4px 2px 14px; font-size: 12px; color: #8a7550; letter-spacing: 1px;
}
.cate-hint .hint-public { color: #8a6313; font-weight: 600; }
.cate-hint .hint-private { color: #8a5322; font-weight: 600; }
.modal-sub .hint-public { color: #8a6313; font-weight: 600; }
.modal-sub .hint-private { color: #8a5322; font-weight: 600; }

/* 模块卡片来源小标 */
.mod-scope {
  display: inline-block; margin-right: 7px; padding: 0 6px;
  font-size: 10.5px; line-height: 1.7; letter-spacing: 1px;
  border-radius: 3px; vertical-align: 1px;
}
.mod-scope.mine { color: #3f6145; background: rgba(96,140,101,.16); border: 1px solid rgba(96,140,101,.45); }
.mod-scope.private { color: #5d3a1a; background: rgba(176,120,66,.14); border: 1px solid rgba(139,90,43,.5); }

/* 文字排盘（纯文本盘局，等宽保留空格，便于后期 AI 数据集化） */
.chart-text {
  margin-top: 0;
  font-family: "Cascadia Mono", "Consolas", "Courier New", "Noto Sans Mono CJK SC", monospace;
  font-size: 13.5px; line-height: 1.9; color: #3f3318;
  white-space: pre; overflow-x: auto; tab-size: 4;
  background: rgba(255, 251, 238, .55);
  border: 1px dashed rgba(140,106,48,.4); border-radius: 4px;
  padding: 14px 18px;
}
.chart-input {
  font-family: "Cascadia Mono", "Consolas", "Courier New", "Noto Sans Mono CJK SC", monospace;
  font-size: 13.5px; line-height: 1.85; tab-size: 4; white-space: pre;
}
.tech-card p { margin-top: 9px; font-size: 13px; color: var(--ink-light); line-height: 1.65; max-height: 42px; overflow: hidden; }
.tech-card .tech-foot { margin-top: 9px; padding-top: 7px; border-top: 1px dashed rgba(140,106,48,.35); font-size: 11.5px; color: var(--ink-faint); display: flex; justify-content: space-between; align-items: center; }
.tech-thumbs { display: flex; gap: 6px; margin-top: 10px; }
.tech-thumbs img { width: 52px; height: 52px; object-fit: cover; border: 1px solid #b49a63; border-radius: 2px; }

/* 技术详情弹窗内容 */
.td-row { margin-bottom: 12px; font-size: 14.5px; line-height: 1.8; }
.td-row b { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-faint); letter-spacing: 3px; margin-bottom: 3px; }
.td-row b::before { content: "❖ "; color: var(--gold-deep); }
.td-text { white-space: pre-wrap; word-break: break-word; }
.cate-filter-tabs { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

/* ================= 管理端 ================= */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { font-family: "Noto Serif SC","SimSun",serif; font-size: 14.5px; letter-spacing: 2px; color: #5a4426; font-weight: 700; text-align: left; padding: 10px 12px; border-bottom: 2px solid rgba(140,106,48,.5); }
.tbl td { padding: 11px 12px; border-bottom: 1px dashed rgba(140,106,48,.35); color: var(--ink); }
.tbl tr:hover td { background: rgba(255,251,238,.5); }
.role-sel { padding: 5px 8px; border: 1px solid #b49a63; border-radius: 3px; background: rgba(255,251,238,.65); color: var(--ink); }

/* ================= 善信库 ================= */
.blist-row-actions { display: flex; gap: 8px; }
.bind-list { margin-bottom: 8px; }
.bind-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border: 1px solid rgba(140,106,48,.35); border-radius: 4px; margin-bottom: 8px; background: rgba(255,251,238,.4); cursor: pointer; transition: all .18s; }
.bind-item:hover { border-color: var(--gold-deep); background: rgba(255,251,238,.7); }
.bind-item .bi-code { font-weight: 700; color: #8a6524; letter-spacing: 1px; }
.bind-item .bi-meta { font-size: 12px; color: var(--ink-faint); margin-left: auto; }

/* ================= 页面翻页动画 ================= */
.page-turn-enter-active { animation: turnIn .45s ease; }
.page-turn-leave-active { animation: turnOut .28s ease forwards; }
@keyframes turnIn {
  from { opacity: 0; transform: perspective(1400px) rotateY(-5deg) translateX(30px); }
  to { opacity: 1; transform: none; }
}
@keyframes turnOut {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: perspective(1400px) rotateY(4deg) translateX(-22px); }
}

/* 弹窗过渡 */
.pop-enter-active { animation: popIn .28s cubic-bezier(.2,.9,.3,1.15); }
.pop-leave-active { animation: fadeIn .18s ease reverse; }

/* ================= 手机端顶栏 & 抽屉导航（桌面端隐藏） ================= */
.m-topbar { display: none; }
.nav-backdrop { display: none; }

/* ================= 响应式适配（平板 / 手机 / 窄屏桌面） ================= */

/* ---- 窄屏桌面 / 横屏平板 ---- */
@media (max-width: 1180px) {
  .side-nav { left: 8px; width: 108px; gap: 9px; }
  .nav-btn { font-size: 13px; letter-spacing: 2px; padding: 9px 4px; }
  .main-area { margin-left: 124px; padding: 18px 16px; }
  .book { padding: 22px 22px 26px 34px; }
  .book-inner { height: auto; min-height: calc(100vh - 96px); overflow: visible; }
  .book-scroll { position: static; overflow: visible; padding: 22px var(--frame-px) 36px; }
  .home-cards { grid-template-columns: 1fr; gap: 18px; }
}

/* ---- 平板 / 大屏手机：侧栏变抽屉 ---- */
@media (max-width: 860px) {
  /* 顶栏 */
  .m-topbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 54px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    background: linear-gradient(180deg, rgba(40,32,82,.96), rgba(28,22,60,.94));
    border-bottom: 1px solid rgba(201,164,74,.4);
    box-shadow: 0 3px 16px rgba(0,0,0,.45);
    padding-top: env(safe-area-inset-top);
    height: calc(54px + env(safe-area-inset-top));
  }
  .m-topbar-title {
    font-family: "Noto Serif SC", "SimSun", serif; color: var(--gold-bright);
    font-size: 18px; letter-spacing: 4px; text-shadow: 0 0 12px rgba(212,175,55,.4);
  }
  .m-topbar-title small { font-size: 10px; letter-spacing: 2px; color: var(--silver); margin-left: 7px; }
  .m-topbar-role { margin-left: auto; font-size: 11px; color: var(--silver); letter-spacing: 1px; opacity: .8; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 汉堡按钮（三条线 → X） */
  .m-menu-btn {
    position: relative; width: 42px; height: 42px; flex: none;
    background: rgba(255,255,255,.06); border: 1px solid rgba(201,164,74,.45); border-radius: 6px;
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  }
  .m-menu-btn span { display: block; width: 20px; height: 2px; background: var(--gold-bright); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
  .m-menu-btn.on span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .m-menu-btn.on span:nth-child(2) { opacity: 0; }
  .m-menu-btn.on span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* 遮罩 */
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(5,3,14,.55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  .nav-backdrop.show { opacity: 1; pointer-events: auto; }

  /* 抽屉侧栏（高于遮罩 70 与顶栏 100，否则列表变暗、点击被拦截） */
  .side-nav {
    left: 0; top: 0; transform: translateX(-108%);
    z-index: 110;
    width: 238px; height: 100vh; height: 100dvh;
    gap: 10px; padding: max(18px, env(safe-area-inset-top)) 16px 18px;
    background: linear-gradient(180deg, rgba(36,28,74,.985), rgba(20,15,46,.985));
    border-right: 1px solid rgba(201,164,74,.35);
    box-shadow: 8px 0 40px rgba(0,0,0,.55);
    transition: transform .28s cubic-bezier(.3,.8,.3,1);
    overflow-y: auto;
  }
  .side-nav.open { transform: translateX(0); }
  .nav-btn { min-height: 46px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
  .nav-role { padding: 4px 0; }

  /* 主区域 */
  .app-shell { display: block; }
  .main-area { margin-left: 0; padding: calc(62px + env(safe-area-inset-top)) 10px calc(16px + env(safe-area-inset-bottom)); }
  .book {
    padding: 14px 10px 16px; border-radius: 10px;
    min-height: calc(100dvh - 82px);
  }
  .book::before, .book-spine-stitch { display: none; }   /* 手机端去掉书脊，让出宽度 */
  .book-inner {
    height: auto; min-height: calc(100dvh - 112px);
    border-radius: 4px;
    clip-path: none;
    box-shadow:
      3px 3px 0 #d8c79a, 6px 6px 0 #c2b084,
      inset 0 0 60px rgba(120, 88, 38, .18);
  }
  .book-scroll { position: static; overflow: visible; padding: 22px var(--frame-px) 30px; }
  .book-inner::before { inset: var(--frame-in-1); }
  .book-inner::after { inset: var(--frame-in-2); }
  .cm-tl, .cm-tr { top: 13px; } .cm-bl, .cm-br { bottom: 13px; }
  .cm-tl, .cm-bl { left: 13px; } .cm-tr, .cm-br { right: 13px; }

  /* 标题 */
  .page-title { font-size: 22px; letter-spacing: 4px; text-indent: 4px; margin: 2px 0 20px; gap: 10px; }
  .page-title::before, .page-title::after { display: none; }
  .sec-title { font-size: 17px; letter-spacing: 3px; }
  .sec-title small { display: block; margin-left: 0; width: 100%; }

  /* 卡片栅格 */
  .arch-list { grid-template-columns: 1fr; gap: 12px; }
  .tech-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid { grid-template-columns: 1fr; gap: 4px; }
  .info-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; }

  /* 分类页签 */
  .cate-tabs { flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }
  .cate-tab { padding: 9px 18px; font-size: 15px; letter-spacing: 3px; text-indent: 3px; min-height: 42px; }
  .cate-tab .cate-del { width: 24px; height: 24px; font-size: 12px; margin-left: 8px; }  /* 触控热区 */
  .cate-hint { font-size: 11px; line-height: 1.7; letter-spacing: 0; }

  /* 工具栏 */
  .toolbar { gap: 9px; }
  .toolbar .inp { min-width: 0; }

  /* 详情头部操作区换行 */
  .detail-head { gap: 8px; }
  .detail-code { font-size: 18px; }
  .detail-actions { margin-left: 0; width: 100%; }
  .detail-actions .btn { flex: 1; min-height: 40px; }

  /* 方案条目竖排 */
  .plan-entry { flex-direction: column; gap: 5px; }
  .plan-kind { align-self: flex-start; }

  /* 善信绑定条目 */
  .bind-item { flex-wrap: wrap; row-gap: 4px; }
  .bind-item .bi-meta { margin-left: 0; width: 100%; }

  /* 表格横向滚动（不撑破纸页） */
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 100%; border-spacing: 0; }
  .tbl thead, .tbl tbody { width: 100%; }
  .tbl th, .tbl td { white-space: nowrap; }
  .tbl td:last-child, .tbl th:last-child { white-space: normal; }
  .role-sel { min-height: 38px; }

  /* 弹窗：近全屏纸张，避开顶栏与软键盘（--kb-inset 由 visualViewport 实时计算） */
  .modal-mask {
    align-items: flex-end;
    padding:
      max(10px, env(safe-area-inset-top, 0px)) 10px
      calc(10px + env(safe-area-inset-bottom, 0px) + var(--kb-inset, 0px));
  }
  .modal-paper {
    width: 100%; max-width: min(640px, calc(100vw - 20px));
    max-height: calc(100dvh - var(--kb-inset, 0px) - 64px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    padding: 22px 18px 24px; border-radius: 8px 8px 4px 4px;
    animation: popInM .28s cubic-bezier(.2,.9,.3,1.15);
  }
  @keyframes popInM { from { opacity: 0; transform: translateY(40px); } }
  .confirm-box { width: 100%; }

  /* 灯箱按钮收小、避让 */
  .lb-prev { left: 10px; } .lb-next { right: 10px; }
  .lb-btn { width: 42px; height: 42px; }
  .lb-close { top: max(12px, env(safe-area-inset-top)); right: 12px; }
  .lb-count { top: max(16px, env(safe-area-inset-top)); left: 14px; }

  /* 分页 */
  .page-nav { flex-wrap: wrap; gap: 7px; }
  .page-nav .pg-btn { min-height: 38px; min-width: 40px; }

  /* 图片格 */
  .img-cell, .img-add { width: 92px; height: 92px; }

  /* 首页 */
  .home-card { padding: 26px 20px 22px; }
  .home-stats { gap: 18px 26px; }
  .home-links { gap: 12px; }

  /* 触控热区：通用按钮不低于 38px */
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; padding: 6px 14px; }
  .tag-chip { min-height: 36px; }
  .radio-line { flex-wrap: wrap; row-gap: 8px; }
}

/* ---- 手机竖屏精修 ---- */
@media (max-width: 560px) {
  .main-area { padding-left: 8px; padding-right: 8px; }
  .book { padding: 10px 8px 12px; }
  .book-scroll { padding: 20px var(--frame-px) 26px; }
  .page-title { font-size: 20px; letter-spacing: 3px; }

  /* 搜索栏占整行，按钮并排 */
  .toolbar .inp:first-child { flex: 1 1 100%; }
  .toolbar .btn-primary:first-of-type { flex: 1; }
  .toolbar .flex1 { display: none; }
  .toolbar .btn-primary:last-of-type { flex: 1 1 100%; }  /* 新增模块单独一行 */

  .sec-title { font-size: 16px; letter-spacing: 2px; }
  .modal-paper { padding: 20px 14px 22px; }
  .modal-title { letter-spacing: 3px; font-size: 18px; }
  .modal-close { width: 34px; height: 34px; }

  .arch-foot, .tech-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .blist-row-actions { width: 100%; }
  .blist-row-actions .btn { flex: 1; }

  .home-stat b { font-size: 22px; }
  .home-card h3 { font-size: 20px; letter-spacing: 4px; }
  .login-card { padding: 30px 24px 28px; }
  .login-title { font-size: 25px; letter-spacing: 6px; text-indent: 6px; }

  .toast { max-width: 92vw; text-align: center; letter-spacing: 1px; padding: 10px 18px; }
  .img-cell, .img-add { width: calc((100vw - 84px) / 3); height: calc((100vw - 84px) / 3); max-width: 104px; max-height: 104px; }
}

/* ---- 超窄屏（<=360px） ---- */
@media (max-width: 360px) {
  .m-topbar-title { font-size: 16px; letter-spacing: 2px; }
  .cate-tab { padding: 8px 13px; letter-spacing: 2px; }
  .detail-actions .btn { padding-left: 8px; padding-right: 8px; letter-spacing: 1px; }
}

/* ============================================================
   讨论大厅（聊天室） · 斋中贴吧
   ============================================================ */

/* ---------- 聊天室房间条 ---------- */
.room-bar {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin: -6px 0 18px;
}
.room-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 18px;
  font-size: 15px; letter-spacing: 2px; color: var(--ink-light);
  background: rgba(255, 248, 228, .55);
  border: 1px solid var(--paper-edge); border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}
.room-chip:hover { border-color: var(--gold-deep); color: var(--gold-deep); }
.room-chip.on {
  background: linear-gradient(180deg, #8a6629, #6e5220);
  color: #f7ead0; border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201, 164, 74, .35);
}
.rc-count {
  min-width: 20px; padding: 0 6px; text-align: center;
  font-size: 12px; line-height: 18px; border-radius: 9px;
  background: rgba(142, 59, 47, .12); color: var(--seal-red);
}
.room-chip.on .rc-count { background: rgba(0,0,0,.22); color: #ffe9c2; }
.rc-del {
  display: none; width: 18px; height: 18px; line-height: 16px;
  text-align: center; font-size: 11px; border-radius: 50%;
  color: var(--seal-red); border: 1px solid transparent;
}
.room-chip:hover .rc-del { display: inline-block; }
.rc-del:hover { background: var(--seal-red); color: #fff; }
.room-chip.room-add {
  border-style: dashed; color: var(--gold-deep);
  background: rgba(201, 164, 74, .08);
}

/* ---------- 聊天面板 ---------- */
.chat-panel {
  border: 1px solid var(--paper-edge); border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 250, 236, .6), rgba(238, 224, 190, .55));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 22px rgba(60, 40, 10, .12);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.chat-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--paper-edge);
  background: linear-gradient(180deg, rgba(201,164,74,.16), rgba(201,164,74,.05));
}
.chat-head-title { font-size: 17px; font-weight: 700; letter-spacing: 3px; color: var(--gold-deep); }
.chat-head-tip { font-size: 12.5px; color: var(--ink-faint); letter-spacing: 1px; }

.chat-msgs {
  height: clamp(280px, 56dvh, 620px); min-height: 280px;
  overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.chat-date {
  align-self: center;
  font-size: 12px; letter-spacing: 1px; color: var(--ink-faint);
  padding: 2px 12px; border-radius: 10px;
  background: rgba(120, 92, 34, .08);
}
.chat-row { display: flex; align-items: flex-start; gap: 10px; }
.chat-row.mine { flex-direction: row-reverse; }
.chat-ava {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #f6e7c6;
  border: 1px solid rgba(0,0,0,.18);
  box-shadow: 0 2px 6px rgba(60,40,10,.25);
}
.ava-admin { background: radial-gradient(circle at 32% 28%, #b15644, var(--seal-red) 70%); }
.ava-mage { background: radial-gradient(circle at 32% 28%, #6a5596, var(--nav-1) 72%); }

.chat-bubble-wrap { max-width: min(72%, 560px); }
.chat-row.mine .chat-bubble-wrap { display: flex; flex-direction: column; align-items: flex-end; }
.chat-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-faint); margin: 0 4px 4px;
}
.chat-user { font-weight: 700; color: var(--ink-light); }
.chat-role {
  font-size: 11px; padding: 0 7px; border-radius: 8px; line-height: 17px;
  border: 1px solid currentColor;
}
.role-admin { color: var(--seal-red); background: rgba(142,59,47,.08); }
.role-mage { color: var(--gold-deep); background: rgba(122,92,34,.08); }
.chat-time { color: var(--ink-faint); }

.chat-bubble {
  position: relative;
  padding: 9px 13px; border-radius: 12px;
  background: #fdf6e2;
  border: 1px solid var(--paper-edge);
  box-shadow: 0 2px 7px rgba(80, 55, 20, .1);
}
.chat-row.mine .chat-bubble {
  background: linear-gradient(180deg, #d8b96f, #bd9744);
  border-color: #a8832f; color: #33260d;
}
.chat-text {
  white-space: pre-wrap; word-break: break-word;
  font-size: 15px; line-height: 1.72;
}
.chat-img {
  display: block; margin-top: 7px;
  max-width: 240px; max-height: 240px;
  border-radius: 8px; cursor: zoom-in;
  border: 1px solid rgba(122,92,34,.25);
}
.chat-video {
  display: block; margin-top: 7px;
  max-width: 300px; width: 100%;
  border-radius: 8px; background: #000;
  border: 1px solid rgba(122,92,34,.25);
}
/* ---------- 引用块 / 撤回 / 已修改 / 高亮 ---------- */
.chat-quote {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px; padding: 6px 10px;
  border-radius: 7px; cursor: pointer;
  background: rgba(122, 92, 34, .1);
  border-left: 3px solid var(--gold-dim);
  max-width: 320px;
}
.chat-quote:hover { background: rgba(122, 92, 34, .18); }
.cq-thumb { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 5px; object-fit: cover; }
.cq-body { display: flex; flex-direction: column; min-width: 0; font-size: 12.5px; line-height: 1.45; }
.cq-user { color: var(--gold-deep); font-weight: 700; }
.cq-text { color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row.mine .cq-user { color: #5e4413; }
.chat-edited { font-size: 11.5px; color: inherit; opacity: .55; margin-left: 4px; }
.chat-recall {
  align-self: flex-start;
  font-size: 12.5px; color: var(--ink-faint);
  padding: 5px 12px; border-radius: 10px;
  background: rgba(120, 92, 34, .07);
}
.chat-row.mine .chat-recall { align-self: flex-end; }
.msg-row.hl .chat-bubble {
  animation: msgHl 2.2s ease;
}
@keyframes msgHl {
  0%, 60% { box-shadow: 0 0 0 3px rgba(201,164,74,.75), 0 2px 7px rgba(80,55,20,.1); }
  100% { box-shadow: 0 2px 7px rgba(80, 55, 20, .1); }
}

/* ---------- 消息操作菜单（手机可点，不依赖 hover） ---------- */
.msg-act-wrap { position: relative; margin: 2px 2px 0; display: flex; }
.chat-row.mine .msg-act-wrap { justify-content: flex-end; }
.chat-act {
  width: 24px; height: 22px; padding: 0;
  border: none; background: none; cursor: pointer;
  color: var(--ink-faint); font-size: 15px; line-height: 1;
  border-radius: 6px;
}
.chat-act:hover { color: var(--gold-deep); background: rgba(201,164,74,.15); }
.msg-menu {
  position: absolute; top: 24px; left: 0; z-index: 30;
  display: flex; flex-direction: column; min-width: 138px;
  padding: 5px; border-radius: 9px;
  background: #fdf6e2; border: 1px solid var(--gold-dim);
  box-shadow: 0 10px 28px rgba(60,40,10,.3);
}
.msg-menu.mm-mine { left: auto; right: 0; }
.msg-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; color: var(--ink-light); border-radius: 6px;
  white-space: nowrap; text-align: left;
}
.msg-menu button:hover { background: rgba(201,164,74,.18); }
.msg-menu .mm-danger { color: var(--seal-red); }
.msg-menu .mm-time { font-size: 11px; color: var(--ink-faint); }

/* ---------- 输入栏 ---------- */
.chat-composer {
  position: sticky;
  bottom: calc(var(--kb-inset, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  border-top: 1px solid var(--paper-edge);
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(244,232,202,.92), rgba(238,224,190,.96));
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-btn {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 10px;
  font-size: 19px; line-height: 1;
  background: rgba(255, 248, 228, .7);
  border: 1px solid var(--paper-edge);
  cursor: pointer; transition: all .15s ease;
}
.composer-btn:hover, .composer-btn.on { border-color: var(--gold-deep); background: rgba(201,164,74,.18); }
.chat-input { flex: 1; min-width: 0; min-height: 40px; max-height: 120px; padding: 8px 12px; line-height: 1.6; }
.chat-send { flex: 0 0 auto; height: 40px; padding: 0 22px; letter-spacing: 4px; }

/* 引用 / 编辑 预览条 */
.composer-bar {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 8px; padding: 7px 11px;
  border-radius: 8px; font-size: 13px;
  background: rgba(255,248,228,.92);
  border: 1px solid var(--gold-dim);
}
.composer-bar .cb-tag { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 8px; color: #f6e7c6; background: var(--gold-deep); }
.composer-bar.edit-bar .cb-tag { background: var(--seal-red); }
.composer-bar .cb-text { flex: 1; min-width: 0; color: var(--ink-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-bar .cb-cancel {
  flex: 0 0 auto; width: 22px; height: 22px; border: none; background: none;
  color: var(--ink-faint); cursor: pointer; font-size: 12px; border-radius: 50%;
}
.composer-bar .cb-cancel:hover { color: var(--seal-red); background: rgba(142,59,47,.1); }

/* ---------- 表情面板（双 tab，锚定输入栏） ---------- */
.emoji-panel {
  position: absolute; left: 12px; right: 12px; bottom: 100%;
  margin-bottom: 6px;
  display: flex; flex-direction: column;
  border-radius: 10px; overflow: hidden;
  background: #fdf6e2; border: 1px solid var(--gold-dim);
  box-shadow: 0 10px 30px rgba(60,40,10,.28);
  z-index: 28;
}
.ep-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 9px 0;
}
.ep-tabs button {
  border: 1px solid transparent; background: none; cursor: pointer;
  font-size: 13px; padding: 5px 13px; border-radius: 8px 8px 0 0;
  color: var(--ink-faint); letter-spacing: 1px;
}
.ep-tabs button.on { color: var(--gold-deep); font-weight: 700; background: rgba(201,164,74,.14); border-color: var(--gold-dim); border-bottom-color: transparent; }
.ep-tabs .ep-manage { margin-left: auto; font-size: 12px; color: var(--seal-red); }
.ep-tabs .ep-manage.on { background: rgba(142,59,47,.12); border-color: rgba(142,59,47,.4); color: var(--seal-red); }
.ep-grid {
  display: grid; gap: 2px; padding: 10px;
  max-height: 200px; overflow-y: auto;
}
.ep-grid-sys { grid-template-columns: repeat(10, 1fr); }
.ep-grid-mine { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-item {
  text-align: center; font-size: 20px; padding: 4px 0;
  border-radius: 6px; cursor: pointer;
}
.emoji-item:hover { background: rgba(201,164,74,.22); }
.sticker-cell {
  position: relative; aspect-ratio: 1;
  border-radius: 8px; cursor: pointer; overflow: hidden;
  border: 1px solid var(--paper-edge); background: rgba(122,92,34,.06);
  display: flex; align-items: center; justify-content: center;
}
.sticker-cell img { width: 100%; height: 100%; object-fit: contain; }
.sticker-cell:hover { border-color: var(--gold-deep); background: rgba(201,164,74,.14); }
.sticker-del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; line-height: 16px; text-align: center;
  border-radius: 50%; font-size: 10px; color: #fff;
  background: rgba(142,59,47,.92); cursor: pointer;
}
.sticker-add {
  aspect-ratio: 1; border-radius: 8px; cursor: pointer;
  border: 1px dashed var(--gold-dim); background: rgba(201,164,74,.07);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--gold-deep);
}
.sticker-add .sa-plus { font-size: 22px; line-height: 1; }
.sticker-add .sa-tip { font-size: 11px; }
.sticker-add.busy { opacity: .6; pointer-events: none; }
.ep-empty { grid-column: 1 / -1; padding: 18px 8px; text-align: center; font-size: 12.5px; color: var(--ink-faint); line-height: 1.7; }

.attach-preview {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; padding: 7px 10px;
  background: rgba(255,248,228,.8); border: 1px dashed var(--gold-dim);
  border-radius: 8px; font-size: 13px; color: var(--ink-light);
}
.attach-preview img, .attach-preview video {
  width: 44px; height: 44px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--paper-edge);
}
.attach-cancel {
  margin-left: auto; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--seal-red); background: none; color: var(--seal-red);
  cursor: pointer;
}

/* ---------- 贴吧：板块 / 帖子 ---------- */
.board-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.board-card {
  position: relative;
  padding: 20px 16px 16px; text-align: center;
  border: 1px solid var(--paper-edge); border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 248, 228, .7), rgba(233, 217, 180, .6));
  box-shadow: 0 3px 10px rgba(80,55,20,.1);
  cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.board-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-deep);
  box-shadow: 0 10px 22px rgba(80,55,20,.2);
}
.board-name {
  font-size: 19px; font-weight: 700; letter-spacing: 4px; text-indent: 4px;
  color: var(--gold-deep); margin-bottom: 8px;
}
.board-meta { font-size: 12.5px; color: var(--ink-faint); letter-spacing: 1px; }
.board-del {
  position: absolute; top: 7px; right: 9px;
  width: 22px; height: 22px; line-height: 20px; text-align: center;
  font-size: 11px; border-radius: 50%; color: var(--seal-red);
  opacity: 0; transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.board-card:hover .board-del { opacity: 1; }
.board-del:hover { background: var(--seal-red); color: #fff; }

.forum-back { margin-bottom: 14px; }

.post-list { border: 1px solid var(--paper-edge); border-radius: 10px; overflow: hidden; }
.post-item {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 248, 228, .55);
  border-bottom: 1px solid var(--paper-edge);
  cursor: pointer; transition: background .15s ease;
}
.post-item:last-child { border-bottom: none; }
.post-item:hover { background: rgba(255, 248, 228, .9); }
.post-main { flex: 1; min-width: 0; }
.post-title {
  font-size: 16.5px; font-weight: 700; color: var(--ink);
  margin-bottom: 6px; letter-spacing: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-sub { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-faint); }
.post-author { font-weight: 700; font-size: 12px; padding: 0 7px; border-radius: 8px; border: 1px solid currentColor; }
.post-stats {
  flex: 0 0 auto; display: flex; gap: 12px;
  font-size: 13px; color: var(--ink-light);
}

/* 帖子详情 */
.post-detail {
  border: 1px solid var(--paper-edge); border-radius: 10px;
  background: rgba(255, 248, 228, .5);
  padding: 24px 26px;
}
.pd-title { font-size: 24px; letter-spacing: 3px; color: var(--ink); margin-bottom: 12px; }
.pd-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  font-size: 12.5px; color: var(--ink-faint);
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px dashed var(--paper-edge);
}
.pd-content {
  white-space: pre-wrap; word-break: break-word;
  font-size: 15.5px; line-height: 2; color: var(--ink);
}
.pd-replies-title {
  margin: 26px 0 14px; font-size: 15px; font-weight: 700;
  letter-spacing: 4px; color: var(--gold-deep);
}
.reply-list { display: flex; flex-direction: column; gap: 12px; }
.reply-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  background: rgba(253, 246, 226, .8);
  border: 1px solid var(--paper-edge);
}
.reply-ava {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #f6e7c6;
}
.reply-body { flex: 1; min-width: 0; }
.reply-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-faint); margin-bottom: 4px; }
.reply-content { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.75; }
.reply-box { margin-top: 18px; }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .chat-msgs { height: 56dvh; min-height: 260px; padding: 14px 12px; gap: 12px; }
  .chat-bubble-wrap { max-width: 80%; }
  .chat-img { max-width: 180px; max-height: 180px; }
  .chat-video { max-width: 220px; }
  .room-bar { gap: 8px; }
  .room-chip { padding: 7px 14px; font-size: 14px; letter-spacing: 1px; }
  .board-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .board-name { font-size: 17px; letter-spacing: 2px; }
  .post-detail { padding: 18px 15px; }
  .pd-title { font-size: 20px; letter-spacing: 1px; }
  .post-stats { flex-direction: column; gap: 2px; font-size: 12px; }
  .composer-btn { width: 38px; height: 38px; }
  .chat-send { height: 38px; padding: 0 14px; letter-spacing: 2px; }
  /* 房间头部操作按钮自动换行，避免手机上挤压溢出 */
  .ch-actions { flex-wrap: wrap; row-gap: 6px; }
  .chat-quote { max-width: 240px; }
}
@media (max-width: 560px) {
  .chat-ava, .reply-ava { width: 32px; height: 32px; font-size: 14px; }
  .chat-bubble-wrap { max-width: calc(100vw - 92px); }
  /* 输入框 16px 防止 iOS 聚焦时页面自动放大 */
  .chat-input { font-size: 16px; }
  .chat-composer { padding-left: 10px; padding-right: 10px; }
  .composer-row { gap: 6px; }
  .composer-btn { width: 36px; height: 36px; font-size: 18px; border-radius: 9px; }
  .chat-send { height: 36px; padding: 0 12px; letter-spacing: 1px; font-size: 13.5px; }
  .ep-grid-sys { grid-template-columns: repeat(8, 1fr); }
  .ep-grid-mine { grid-template-columns: repeat(5, 1fr); }
  .ep-grid { max-height: 180px; }
  .chat-head-title { font-size: 15px; letter-spacing: 1.5px; }
  .board-grid { grid-template-columns: repeat(2, 1fr); }
  .post-item { padding: 12px 13px; gap: 10px; }
  .post-title { font-size: 15px; }
}
@media (max-width: 380px) {
  .chat-bubble-wrap { max-width: calc(100vw - 80px); }
  .ep-grid-mine { grid-template-columns: repeat(4, 1fr); }
  .chat-send { padding: 0 10px; }
  .chat-msgs { padding-left: 9px; padding-right: 9px; }
}

/* ============================================================
   社区二轮：三级聊天 / 事件房间卡 / 案宗 / 查封举报 / 通用徽章
   ============================================================ */

/* 阁页签上的改名小笔（与删除叉并列，仅管理员可见） */
.cate-tabs.hall-tabs { flex-wrap: wrap; row-gap: 10px; }
.cate-tab .cate-edit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; margin-left: 7px; font-size: 10px;
  border: 1px solid rgba(122, 92, 34, .6); color: #7a5c22; border-radius: 50%;
  vertical-align: 1px; transition: all .18s ease;
}
.cate-tab .cate-edit:hover { background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }
.cate-tab.on .cate-edit { border-color: rgba(247, 234, 208, .65); color: #f7ead0; }
.cate-tab.on .cate-edit:hover { background: var(--gold-bright); color: #4a3814; border-color: var(--gold-bright); }

/* 子类 chips（阁之下横排） */
.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.cat-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 17px; font-size: 14px; letter-spacing: 2px; text-indent: 2px;
  font-family: "Noto Serif SC", "SimSun", serif;
  color: #6e5220; background: rgba(255, 251, 238, .55);
  border: 1.2px solid rgba(140, 106, 48, .5); border-radius: 20px;
  transition: all .2s ease;
}
.cat-chip:hover:not(.on):not(.cat-add) { border-color: var(--gold-deep); color: var(--gold-deep); }
.cat-chip.on {
  background: linear-gradient(180deg, #97742e, #6e5220); color: #f7ead0;
  border-color: #c9a44a; box-shadow: 0 0 12px rgba(212, 175, 55, .32);
}
.cat-chip.cat-add {
  border-style: dashed; background: none;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px; letter-spacing: 1px; text-indent: 1px;
}
.cat-chip.cat-add:hover { background: rgba(201, 164, 74, .12); border-color: var(--gold-deep); color: var(--gold-deep); }
.cc-name { line-height: 1.2; }
.cc-rooms { font-size: 11px; opacity: .75; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 1px; }
.cat-chip.on .cc-rooms { color: rgba(247, 234, 208, .82); }
.cc-unread {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--seal-red); color: #fff; font-size: 10.5px; line-height: 17px; text-align: center;
  box-shadow: 0 1px 4px rgba(142, 59, 47, .45);
}
.cc-edit, .cc-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; font-size: 9.5px; border-radius: 50%;
  background: rgba(255, 251, 238, .75);
}
.cc-edit { border: 1px solid rgba(122, 92, 34, .6); color: #7a5c22; }
.cc-edit:hover { background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }
.cc-del { border: 1px solid rgba(142, 59, 47, .55); color: #8e3b2f; }
.cc-del:hover { background: var(--seal-red); color: #fff; border-color: var(--seal-red); }
.cat-chip.on .cc-edit, .cat-chip.on .cc-del { background: rgba(60, 44, 16, .25); }

/* 子类内横排事件房间卡 */
.room-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}
.room-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 13px 15px 11px;
  background: linear-gradient(150deg, rgba(255, 250, 235, .62), rgba(250, 240, 214, .45));
  border: 1px solid #c2ab77; border-radius: 6px;
  cursor: pointer; transition: all .2s ease;
}
.room-card:hover { transform: translateY(-2px); border-color: var(--gold-deep); box-shadow: 3px 8px 18px rgba(90, 62, 22, .25); }
.room-card.mine { border-color: rgba(201, 164, 74, .9); box-shadow: 0 0 10px rgba(212, 175, 55, .22); }
.room-card.banned {
  opacity: .72;
  background: linear-gradient(150deg, rgba(120, 90, 70, .16), rgba(250, 240, 214, .42));
  border-color: rgba(142, 59, 47, .55);
}
.room-card.banned:hover { box-shadow: 3px 8px 18px rgba(90, 40, 30, .25); }
.rc-top { display: flex; align-items: center; gap: 7px; padding-right: 30px; min-height: 20px; }
.rc-no {
  font-size: 12px; color: var(--ink-faint); letter-spacing: 1px;
  font-family: Consolas, "Courier New", monospace;
}
.rc-title {
  font-family: "Noto Serif SC", "SimSun", serif;
  font-size: 16px; letter-spacing: 2px; color: #57431f; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc-intro {
  font-size: 12.5px; line-height: 1.6; color: var(--ink-light);
  min-height: 40px; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rc-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--ink-faint); letter-spacing: 1px;
  border-top: 1px dashed rgba(140, 106, 48, .3); padding-top: 8px;
}
.rc-owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-msgs { flex: 0 0 auto; }
.rc-unread {
  position: absolute; top: 10px; right: 10px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--seal-red); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
  box-shadow: 0 1px 4px rgba(142, 59, 47, .5);
  animation: unreadPulse 2s ease-in-out infinite;
}
@keyframes unreadPulse {
  0%, 100% { box-shadow: 0 1px 4px rgba(142, 59, 47, .5); }
  50% { box-shadow: 0 1px 9px rgba(190, 70, 52, .8); }
}

/* 通用状态徽章 */
.tag {
  display: inline-block; font-size: 11px; line-height: 1.15;
  padding: 3px 8px; border-radius: 3px; letter-spacing: 1px;
  border: 1px solid currentColor; vertical-align: middle;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  white-space: nowrap;
}
.tag-mine { color: #4a3c8e; background: rgba(70, 60, 140, .12); border-color: rgba(70, 60, 140, .4); }
.tag-banned { color: #8e3b2f; background: rgba(142, 59, 47, .1); border-color: rgba(142, 59, 47, .45); }
.tag-report { color: #8a5322; background: rgba(138, 83, 34, .12); border-color: rgba(138, 83, 34, .5); }
.tag-open { color: #2e6e56; background: rgba(46, 110, 86, .1); border-color: rgba(46, 110, 86, .4); }

/* 搜索/筛选提示条 */
.strip-hint {
  font-size: 12.5px; color: var(--ink-faint); letter-spacing: 1px;
  margin-bottom: 12px; padding: 6px 12px;
  background: rgba(201, 164, 74, .1); border-left: 3px solid var(--gold-dim); border-radius: 0 4px 4px 0;
}
.ban-reason-txt { color: var(--seal-red); }

/* 房间内头部（v2：信息与操作分行） */
.chat-head-v2 { align-items: center; justify-content: space-between; gap: 10px; }
.ch-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.ch-left .chat-head-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rc-no-head { color: var(--gold-deep); font-weight: 700; font-size: 12.5px; }
.ch-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.chat-head-sub {
  padding: 8px 18px; font-size: 12.5px; color: var(--ink-faint); letter-spacing: 1px;
  background: rgba(201, 164, 74, .07); border-bottom: 1px solid rgba(214, 194, 148, .6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ban-banner {
  padding: 9px 18px; font-size: 13px; letter-spacing: 1px;
  color: #f2cfc4; background: linear-gradient(180deg, #7e3527, #5e2419);
  border-bottom: 1px solid rgba(142, 59, 47, .6);
}

/* 案宗弹窗 */
.modal-paper.modal-wide { width: 780px; padding: 24px 32px 28px; }
.case-sec { margin-bottom: 15px; }
.case-lbl {
  font-size: 12.5px; color: #8a6313; letter-spacing: 3px;
  font-weight: 700; margin-bottom: 5px;
}
.case-val { font-size: 14px; color: var(--ink); line-height: 1.7; word-break: break-word; }
.case-text-box {
  white-space: pre-wrap;
  background: rgba(255, 251, 238, .5);
  border: 1px dashed rgba(140, 106, 48, .35); border-radius: 4px;
  padding: 10px 13px; max-height: 260px; overflow-y: auto;
}

/* 板块改名小笔 */
.board-edit {
  position: absolute; top: 7px; right: 36px;
  width: 22px; height: 22px; line-height: 20px; text-align: center;
  font-size: 11px; border-radius: 50%; color: var(--gold-deep);
  opacity: 0; transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.board-card:hover .board-edit { opacity: 1; }
.board-edit:hover { background: var(--gold-deep); color: #fff; }

/* 帖子操作行 / 查封态 */
.pd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 12px; }
.post-item.banned { opacity: .72; background: rgba(120, 90, 70, .07); }
.post-title .rc-no, .pd-title .rc-no { font-size: .72em; vertical-align: 2px; }

/* 管理端 */
.sec-title-inline { font-size: 13px; color: var(--ink-faint); letter-spacing: 1px; white-space: nowrap; }
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--paper-edge); border-radius: 8px;
  margin-bottom: 22px; background: rgba(255, 250, 236, .35);
}
.tbl-wrap .tbl { min-width: 680px; }
.tbl tr.row-banned td { background: rgba(142, 59, 47, .06); }
.tbl tr.row-handled td { opacity: .55; }
.rep-target { color: var(--gold-deep); font-weight: 700; cursor: pointer; letter-spacing: 1px; }
.rep-target:hover { text-decoration: underline; color: var(--gold); }
.rep-owner { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; }
.rep-reason { white-space: pre-wrap; word-break: break-word; max-width: 340px; font-size: 13px; line-height: 1.6; }

/* ---------- 社区二轮移动端 ---------- */
@media (max-width: 860px) {
  .room-strip { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 10px; }
  .chat-head-v2 { align-items: flex-start; flex-direction: column; }
  .ch-actions { width: 100%; }
  .modal-paper.modal-wide { width: calc(100vw - 24px); padding: 22px 20px 24px; }
  .rep-reason { max-width: none; }
}
@media (max-width: 560px) {
  .hall-tabs .cate-tab { padding: 8px 22px; font-size: 14.5px; letter-spacing: 3px; text-indent: 3px; }
  .cat-chips { gap: 8px; }
  .cat-chip { padding: 5px 13px; font-size: 13px; }
  .room-strip { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
  .room-card { padding: 11px 12px 9px; gap: 6px; }
  .rc-top { gap: 5px; padding-right: 24px; }
  .rc-title { font-size: 14.5px; letter-spacing: 1px; }
  .rc-intro { min-height: 34px; font-size: 12px; }
  .rc-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
  .ch-actions .btn { padding: 4px 9px; font-size: 12px; }
  .chat-head-sub { padding: 7px 13px; }
  .case-lbl { letter-spacing: 2px; }
  .tbl-wrap .tbl { min-width: 560px; }
}

