/* ===================================================================
   泰拉方舟 Wiki —— MediaWiki / minecraft.wiki 风格
   要点：直角、灰色细边框、信息密集、经典 wikitable / infobox、
        蓝色链接、左侧 portlet 文字导航、衬线标题带下划线。
   =================================================================== */
:root {
  --page: #eceae3;            /* 页面底（content 外） */
  --content: #ffffff;
  --soft: #f4f3ee;            /* 浅灰底（表头/盒头/图底） */
  --soft2: #e9e7df;
  --ink: #1f1f1c;
  --ink2: #54595d;
  --ink3: #72777d;
  --border: #c8c5ba;          /* 普通边框 */
  --border-strong: #a2a29b;   /* 重边框（wikitable/infobox/标题线） */
  --border-light: #ddd9cd;
  --link: #0b5db3;
  --link-hover: #0a4d91;
  --link-visited: #0b3e7a;
  --accent: #e08308;          /* 罗德岛琥珀（品牌色，仅用于头条/信息框标题/表头强调） */
  --accent-dark: #b3680a;
  --topbar: #25262a;
  --topbar-line: #3a3b40;
  --topbar-h: 50px;          /* 顶栏实际高度，JS 动态测量（两行时更高） */
  --side-w: 158px;           /* 侧栏宽度（桌面端固定贴左） */
  --boss: #b23a3a; --enemy: #6a4fb0; --weapon: #c2700c; --npc: #2f7d4f;
  --accessory: #0d7a70; --armor: #7a47a8; --materials: #a06f1e;
  --weapons: #c2700c; --bosses: #b23a3a; --enemies: #6a4fb0;
  --accessories: #0d7a70; --armors: #7a47a8; --friendly: #2f7d4f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  /* 恒定预留滚动条宽度：长短页面切换时不再因滚动条出现/消失而整体横向抖动 */
  scrollbar-gutter: stable;
  /* 锚点跳转（目录）时给固定顶栏让出高度，标题不会被压在顶栏下面 */
  scroll-padding-top: calc(var(--topbar-h) + 10px);
}
body {
  background: var(--page); color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6; min-height: 100vh;
  padding-top: var(--topbar-h);   /* 顶栏已脱离文档流，正文整体下移 */
}
img { image-rendering: pixelated; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--link-hover); }
ul, ol { list-style: none; }

/* ===================== 顶栏 ===================== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  height: 50px; padding: 0 14px;
  background: var(--topbar); border-bottom: 3px solid var(--accent);
}
.hamburger { display: none; font-size: 22px; color: #d9d4c4; background: none; border: none; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand-txt { color: #f2ede0; font-size: 17px; font-weight: 600; }
.brand-txt b { color: var(--accent); font-weight: 700; }

.topsearch { position: relative; flex: 1 1 auto; max-width: 420px; }
.topsearch input {
  width: 100%; height: 32px; padding: 0 10px;
  background: #fff; color: #1f1f1c;
  border: 1px solid #6a6b70; font-size: 13.5px; outline: none;
}
.topsearch input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(224,131,8,.25); }
.search-drop {
  position: absolute; top: 34px; left: 0; right: 0; z-index: 120;
  background: #fff; border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgba(0,0,0,.25); max-height: 64vh; overflow-y: auto; display: none;
}
.search-drop.show { display: block; }
.sr-item { display: flex; align-items: center; gap: 9px; padding: 7px 11px; cursor: pointer; border-bottom: 1px solid var(--border-light); }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--soft); }
.sr-item img { width: 28px; height: 28px; object-fit: contain; flex: 0 0 28px; }
.sr-item span:nth-child(2) { color: var(--ink); }
.sr-item .sr-cat { margin-left: auto; font-size: 11px; color: #fff; padding: 1px 6px; }
.sr-empty { padding: 11px; color: var(--ink2); font-size: 13px; }

/* 顶栏右侧组：margin-left:auto 把语言/建议/账户整体推到 banner 最右 */
.topright { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.top-btn {
  flex: 0 0 auto; height: 32px; padding: 0 11px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  background: #34353a; color: #e6dfce; border: 1px solid var(--topbar-line); font-size: 13px;
}
.top-btn:hover { background: #41434a; color: #fff; }

/* 语言下拉：按钮定宽，不随中/英文长度变化 */
.lang-wrap { position: relative; flex: 0 0 auto; }
.lang-btn { width: 92px; justify-content: center; }
.lang-menu {
  position: absolute; top: 36px; right: 0; z-index: 130; min-width: 120px;
  background: #fff; border: 1px solid var(--border-strong); box-shadow: 0 6px 18px rgba(0,0,0,.22); display: none;
}
.lang-menu.show { display: block; }
.lang-menu a { display: block; padding: 8px 13px; color: var(--link); font-size: 13.5px; cursor: pointer; border-bottom: 1px solid var(--border-light); }
.lang-menu a:last-child { border-bottom: none; }
.lang-menu a:hover { background: var(--soft); text-decoration: none; }

.account { flex: 0 0 auto; position: relative; display: flex; align-items: center; }
.btn-login { background: var(--accent); color: #fff; border: 1px solid var(--accent-dark); font-weight: 600; padding: 6px 14px; cursor: pointer; font-size: 13.5px; }
.btn-login:hover { background: var(--accent-dark); }
.user-chip { display: flex; align-items: center; gap: 7px; cursor: pointer; color: #ece6d6; padding: 5px 10px; border: 1px solid var(--topbar-line); }
.user-chip:hover { background: #34353a; }
.user-chip .role-tag { font-size: 10px; padding: 1px 6px; background: var(--accent); color: #fff; }
.user-menu { position: absolute; top: 42px; right: 0; z-index: 130; background: #fff; border: 1px solid var(--border-strong); min-width: 150px; box-shadow: 0 6px 18px rgba(0,0,0,.22); display: none; }
.user-menu.show { display: block; }
.user-menu a { display: block; padding: 8px 13px; color: var(--link); font-size: 13.5px; border-bottom: 1px solid var(--border-light); }
.user-menu a:hover { background: var(--soft); text-decoration: none; }
.user-menu a:last-child { border-bottom: none; }
.user-chip .uc-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 头像 */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex: 0 0 auto; overflow: hidden; vertical-align: middle; }
.avatar.identicon { color: #fff; font-weight: 700; }
.up-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: #f3f1ea; border: 1px solid var(--border-strong); padding: 5px 11px; font-size: 13px; color: var(--ink); margin-top: 2px; }
.up-btn:hover { background: var(--soft2); }

/* 游戏进度推荐表（时间轴） */
.prog-timeline { margin-top: 8px; }
.prog-row { display: grid; grid-template-columns: 150px 1fr; gap: 0; align-items: stretch; }
.prog-stage { position: relative; padding: 14px 14px 14px 6px; text-align: center; border-right: 3px solid var(--accent); }
.prog-stage img { width: 40px; height: 40px; object-fit: contain; }
.prog-stage .ps-num { position: absolute; left: 2px; top: 10px; width: 20px; height: 20px; line-height: 20px; background: var(--accent); color: #fff; font-size: 12px; border-radius: 50%; }
.prog-stage .ps-name { font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.prog-content { padding: 12px 14px; border-bottom: 1px solid var(--border); min-width: 0; }
.prog-row:last-child .prog-content { border-bottom: none; }
.prog-group { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.pg-label { flex: 0 0 auto; color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; }
.prog-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prog-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--content); border: 1px solid var(--border); border-left: 3px solid var(--c); padding: 6px 12px 6px 9px; font-size: 14px; color: var(--ink); }
.prog-chip:hover { background: var(--soft); text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.prog-chip img { width: 32px; height: 32px; object-fit: contain; }
/* 进度表类型筛选 */
.prog-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--soft); border: 1px solid var(--border); padding: 8px 12px; margin: 6px 0 12px; }
.prog-filter-btn { padding: 6px 14px; font-size: 13.5px; font-weight: 700; color: var(--c); background: #fff; border: 2px solid var(--c); cursor: pointer; transition: all .15s; }
.prog-filter-btn:hover { background: var(--soft); }
.prog-filter-btn.active { background: var(--c); color: #fff; }
.prog-filter-btn:not(.active) { opacity: 0.45; }
/* 悬浮词条介绍浮层 */
.prog-pop { position: fixed; z-index: 300; display: none; width: 320px; max-width: 92vw; background: var(--content); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px rgba(0,0,0,.28); padding: 12px 14px; font-size: 13px; }
.prog-pop .pp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.prog-pop .pp-head img { width: 44px; height: 44px; object-fit: contain; }
.prog-pop .pp-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.prog-pop .pp-meta { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.prog-pop .pp-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.prog-pop .pp-stats span { background: var(--soft); border: 1px solid var(--border-light); padding: 1px 7px; font-size: 12px; }
.prog-pop .pp-sec { margin-top: 6px; border-top: 1px solid var(--border-light); padding-top: 6px; }
.prog-pop .pp-sec > b { display: block; color: var(--ink2); font-size: 12px; margin-bottom: 3px; }
.prog-pop .pp-sec-b { color: var(--ink); }
.prog-pop .pp-sec-b .recipe-table { min-width: 0; margin: 4px 0; font-size: 12px; }
.prog-pop .pp-sec-b p { margin: 2px 0; }
@media (max-width: 620px) { .prog-row { grid-template-columns: 92px 1fr; } .prog-stage img { width: 30px; height: 30px; } }

/* 建议页表单 */
.suggest-page .fld-label { display: block; font-size: 13px; color: var(--ink2); margin: 12px 0 4px; font-weight: 600; }
.sg-textarea { width: 100%; max-width: 640px; min-height: 150px; padding: 11px; border: 1px solid var(--border-strong); font-size: 14px; background: #fff; resize: vertical; line-height: 1.6; }
.sg-input { width: 100%; max-width: 360px; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); font-size: 14px; background: #fff; }
/* 文件选择：隐藏原生 input，用自定义按钮 + 文件名显示 */
.sg-file-wrap { display: flex; align-items: center; gap: 8px; max-width: 360px; }
.sg-file-wrap input[type="file"] { display: none; }
.sg-file-btn { padding: 6px 14px; cursor: pointer; font-size: 13px; background: #eceae3; color: var(--ink); border: 1px solid var(--border-strong); white-space: nowrap; }
.sg-file-btn:hover { background: #ddd9d0; }
.sg-file-name { font-size: 13px; color: var(--ink2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 公告框 */
.mp-box.announce .mp-box-h { background: #fff4df; border-bottom-color: var(--accent); color: var(--accent-dark); }
.mp-box.announce .mp-box-h i { margin-right: 6px; }

/* 最近更新列表 */
.rc-list { list-style: none; }
.rc-item { padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 13.5px; }
.rc-item:last-child { border-bottom: none; }
.rc-item a { color: var(--link); }
.rc-item .rc-meta { display: block; font-size: 11.5px; color: var(--ink3); margin-top: 1px; }
.rc-pager { list-style: none; padding: 8px 0 0 0; text-align: center; border-bottom: none; display: flex; gap: 8px; justify-content: center; align-items: center; }
.rc-pager button { padding: 4px 12px; font-size: 12px; color: var(--link); background: transparent; border: 1px solid var(--border-strong); cursor: pointer; }
.rc-pager button:hover:not(:disabled) { background: var(--bg-hover); }
.rc-pager button:disabled { color: var(--ink3); cursor: not-allowed; opacity: 0.5; }
.rc-pager span { font-size: 12px; color: var(--ink2); }

/* ===================== 布局 =====================
   顶栏与侧栏都是 fixed 的「外壳」，不参与正文文档流：
   - 侧栏恒定贴合视口左缘，任何分辨率下位置一致，切换页面不会位移；
   - 正文有无滚动条不再影响外壳（配合 html 的 scrollbar-gutter）。 */
.layout { padding-left: var(--side-w); }
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--side-w); overflow-y: auto;
  background: var(--page); border-right: 1px solid var(--border); padding: 10px 0; z-index: 90;
}
.portlet { margin-bottom: 12px; }
.portlet h3 {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink3); padding: 4px 14px 3px; margin: 4px 6px 2px; border-bottom: 1px solid var(--border);
}
.side-link {
  display: flex; align-items: center; padding: 3px 14px; font-size: 13px; color: var(--link); cursor: pointer;
}
.side-link:hover { background: #e3e0d6; text-decoration: none; }
.side-link.active { color: var(--ink); font-weight: 700; background: #dcd9cf; }
.side-link .cnt { margin-left: auto; font-size: 11px; color: var(--ink3); font-weight: 400; }
.side-link.side-new { color: var(--ink3); font-size: 12.5px; cursor: pointer; }
.side-link.side-new:hover { color: var(--accent-dark); }
.side-link.side-new i { font-size: 10px; margin-right: 4px; }
.side-link .reddot { width: 8px; height: 8px; border-radius: 50%; background: #e23b3b; margin-left: 6px; }
.side-link .reddot + .cnt { margin-left: 6px; }
.sidebar-mask { display: none; }

/* 超宽屏正文居中限宽，但侧栏保持贴左 */
.content { padding: 16px 22px 50px; min-width: 0; min-height: calc(100vh - var(--topbar-h)); max-width: 1480px; margin: 0 auto; }

/* ===================== 通用 ===================== */
.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 6px 13px; font-size: 13.5px; background: var(--accent); color: #fff; border: 1px solid var(--accent-dark); }
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.ghost { background: #f8f8f6; color: var(--ink); border: 1px solid var(--border-strong); }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.danger { background: #b23a3a; border-color: #8d2c2c; }
.btn.ok { background: #2f7d4f; border-color: #246340; }

.crumb { font-size: 12.5px; color: var(--ink2); margin-bottom: 8px; }
.crumb a { color: var(--link); }
.empty-note { color: var(--ink2); padding: 26px; text-align: center; }
.title-cnt { font-size: 16px; color: var(--ink3); font-weight: 400; }
.body-empty { color: var(--ink2); font-style: italic; }

/* 维基表格 */
.wikitable { border-collapse: collapse; background: var(--content); border: 1px solid var(--border-strong); }
.wikitable th, .wikitable td { border: 1px solid var(--border-strong); padding: 5px 10px; font-size: 13.5px; text-align: left; }
.wikitable th { background: var(--soft2); color: var(--ink); font-weight: 700; }
.wikitable a { color: var(--link); }

/* ===================== 首页（主页式分块） ===================== */
.mainpage { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.mp-col-main, .mp-col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mp-box { background: var(--content); border: 1px solid var(--border-strong); }
.mp-box-h { background: var(--soft2); color: var(--ink); font-weight: 700; font-size: 15px; padding: 7px 14px; border-bottom: 1px solid var(--border-strong); }
.mp-box-b { padding: 14px 16px; font-size: 14px; line-height: 1.7; }
.mp-box-b p { margin: 0 0 9px; }
.mp-box-b p:last-child { margin-bottom: 0; }
.mp-box-b a { color: var(--link); }
.mp-bignum { font-size: 38px; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 10px; }
.mp-bignum span { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink2); margin-top: 4px; }
.mp-stat-table { width: 100%; }
.mp-stat-table td:last-child { text-align: right; color: var(--ink2); width: 56px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.cat-card { display: flex; align-items: center; gap: 12px; cursor: pointer; background: var(--content); border: 1px solid var(--border); padding: 10px 12px; }
.cat-card:hover { background: var(--soft); border-color: var(--border-strong); text-decoration: none; }
.cc-thumb { flex: 0 0 50px; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; background: var(--soft); border: 1px solid var(--border); }
.cc-thumb img { max-width: 42px; max-height: 42px; object-fit: contain; }
.cc-info { flex: 1 1 auto; min-width: 0; }
.cc-name { font-size: 15px; color: var(--ink); font-weight: 600; }
.cc-count { font-size: 12.5px; color: var(--ink2); margin-top: 1px; }
.cc-arrow { flex: 0 0 auto; font-size: 20px; color: var(--ink3); }

/* ===================== 分类 / 搜索 列表 ===================== */
.toolbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.toolbar input { height: 32px; padding: 0 11px; border: 1px solid var(--border-strong); background: #fff; font-size: 13.5px; min-width: 220px; }
.toolbar .grp-label { font-size: 13px; color: var(--ink2); margin-left: 6px; }
.grp-btns { display: inline-flex; gap: 0; }
.grp-btn { font-size: 12.5px; padding: 5px 11px; cursor: pointer; background: #fff; border: 1px solid var(--border-strong); margin-left: -1px; color: var(--ink2); }
.grp-btn:first-child { margin-left: 0; }
.grp-btn.active { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.adv-panel { background: var(--soft); border: 1px solid var(--border-strong); padding: 10px 14px; margin-bottom: 14px; }
.af-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 4px 0; }
.af-group + .af-group { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.af-h { font-size: 12.5px; font-weight: 700; color: var(--ink2); margin-right: 4px; }
.af-box { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink); cursor: pointer; }
.af-box input { width: 14px; height: 14px; }
.grp-h { margin-top: 18px; }
.grp-h:first-child { margin-top: 4px; }
.entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.entry-card { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; background: var(--content); border: 1px solid var(--border); padding: 12px 8px; text-align: center; }
.entry-card:hover { background: var(--soft); border-color: var(--border-strong); text-decoration: none; }
.entry-card .ec-img { height: 54px; display: flex; align-items: center; justify-content: center; }
.entry-card .ec-img img { max-height: 54px; max-width: 78px; object-fit: contain; }
.entry-card .ec-name { font-size: 13.5px; color: var(--link); }
.entry-card .ec-meta { font-size: 11.5px; color: var(--ink2); }

/* ===================== 维基文章 ===================== */
.article { background: var(--content); border: 1px solid var(--border-strong); padding: 14px 26px 22px; max-width: 1280px; position: relative; }
.article .crumb { margin-bottom: 2px; }
/* 页面操作标签：阅读 / 编辑 / 历史 */
.page-tabs { position: absolute; top: 12px; right: 22px; display: flex; }
.page-tabs .pt { font-size: 12.5px; padding: 4px 12px; cursor: pointer; color: var(--link); border: 1px solid var(--border-strong); border-bottom: none; background: var(--soft); margin-left: -1px; }
.page-tabs .pt.active { background: var(--content); color: var(--ink); font-weight: 700; cursor: default; position: relative; top: 1px; }
.page-tabs .pt:not(.active):hover { background: #fff; }
.page-tabs .pt.danger { color: #b23a3a; }
.page-tabs .pt.danger:hover { background: #b23a3a; color: #fff; }
/* 新建页面弹层里的 ID 说明 */
.np-hint { font-size: 12px; color: var(--ink3); margin: 4px 0 2px; line-height: 1.6; }

/* ===================== 数学公式 ===================== */
.math { font-size: 1.05em; }
.math math { font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", serif; }
.math-block { display: block; text-align: center; margin: 12px 0; overflow-x: auto; }
.math-err { color: #b23a3a; font-family: Consolas, monospace; background: #fdeaea; padding: 0 4px; }
/* 符号选择面板 */
.sym-hint { font-size: 12.5px; color: var(--ink2); margin-bottom: 10px; line-height: 1.6; }
.sym-grp { margin-bottom: 12px; }
.sym-h { font-size: 11px; font-weight: 700; color: var(--ink3); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border-light); padding-bottom: 3px; margin-bottom: 6px; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 5px; }
.sym-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; cursor: pointer; background: #fff; border: 1px solid var(--border); }
.sym-cell:hover { border-color: var(--accent); background: #fff8ee; }
.sym-cell .sym-pv { font-size: 15px; min-height: 22px; display: flex; align-items: center; }
.sym-cell em { font-style: normal; font-size: 10.5px; color: var(--ink3); font-family: Consolas, monospace; word-break: break-all; }

/* ===================== 字号 / 字体 / 颜色 弹层 ===================== */
.sz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 5px; margin-bottom: 4px; }
.sz-cell { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 4px;
  cursor: pointer; background: #fff; border: 1px solid var(--border); color: var(--ink); line-height: 1; }
.sz-cell:hover { border-color: var(--accent); background: #fff8ee; }
.ft-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); }
.ft-cell { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; cursor: pointer;
  background: #fff; border: none; border-bottom: 1px solid var(--border-light); text-align: left; }
.ft-cell:last-child { border-bottom: none; }
.ft-cell:hover { background: #fff8ee; }
.ft-name { flex: 0 0 108px; font-size: 13px; color: var(--ink2); }
.ft-pv { font-size: 15px; color: var(--ink); }
.cl-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.cl-cell { height: 26px; cursor: pointer; border: 1px solid var(--border-strong); padding: 0; }
.cl-cell:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl-row { display: flex; gap: 8px; align-items: center; }
.modal-b .cl-row input[type="color"] { width: 44px; flex: 0 0 44px; height: 36px; padding: 2px; cursor: pointer; }
.modal-b .cl-row input#clHex { flex: 1 1 auto; font-family: Consolas, monospace; }
/* 首标题：衬线 + 整行下划线 */
.firstHeading { font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.3; border-bottom: 1px solid var(--border-strong); padding-bottom: 6px; margin-bottom: 12px; }
.article-body { font-size: 14.5px; color: var(--ink); line-height: 1.75; }
.article-body a { color: var(--link); }
.article-body a.new, .article-body a[href=""] { color: #ba0000; }
.mw-h2 { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.3; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 20px 0 10px; clear: both; }
.mw-sec { margin-bottom: 4px; }
.mw-sec p { margin: 8px 0; }
/* 正文里编辑写入的标题，与结构化章节标题统一样式，并参与目录 */
.mw-sec h2 { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.3; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 20px 0 10px; }
.sec-edit { font-size: 12px; font-weight: 400; color: var(--link); margin-left: 10px; cursor: pointer; vertical-align: middle; }
.sec-edit::before { content: "["; color: var(--ink3); }
.sec-edit::after { content: "]"; color: var(--ink3); }
.sec-edit:hover { text-decoration: underline; }
.mw-sec h3 { font-size: 16.5px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
.mw-sec h4 { margin: 13px 0 5px; color: var(--ink); font-weight: 600; }
.mw-sec ul { list-style: disc; margin: 8px 0 8px 26px; }
.mw-sec ol { list-style: decimal; margin: 8px 0 8px 26px; }
.mw-sec blockquote { border-left: 4px solid var(--border-strong); padding-left: 12px; color: var(--ink2); margin: 8px 0; }
.mw-sec code, .edit-preview code { background: var(--soft); border: 1px solid var(--border-light); padding: 0 4px; font-size: 90%; }
.mw-sec img, .edit-preview img { max-width: 100%; }
/* 正文/预览中的表格（Markdown 生成的 .md-table 与原生 <table> 统一为维基表格样式） */
.mw-sec table, .edit-preview table { border-collapse: collapse; border: 1px solid var(--border-strong); margin: 10px 0; max-width: 100%; }
.mw-sec th, .mw-sec td, .edit-preview th, .edit-preview td { border: 1px solid var(--border-strong); padding: 5px 10px; font-size: 13.5px; text-align: left; vertical-align: top; }
.mw-sec th, .edit-preview th { background: var(--soft2); font-weight: 700; }
.mw-sec table tr:nth-child(even) td, .edit-preview table tr:nth-child(even) td { background: #faf8f2; }
.mw-sec hr, .edit-preview hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.body-meta { font-size: 12px; color: var(--ink3); margin: 4px 0 0; }

/* 目录框 TOC（经典 MediaWiki） */
.toc { display: inline-block; min-width: 180px; max-width: 320px; background: var(--soft); border: 1px solid var(--border-strong); padding: 8px 16px 10px; margin: 8px 0 14px; }
.toc-h { font-weight: 700; color: var(--ink); text-align: center; margin-bottom: 5px; font-size: 13.5px; }
.toc li { margin: 2px 0; font-size: 13px; }
.toc a { color: var(--link); cursor: pointer; }
.toc .toc-n { color: var(--ink2); margin-right: 4px; }
.toc .toc-l2 { padding-left: 18px; }
.toc .toc-l3 { padding-left: 36px; }

/* 分类底栏 */
.catlinks { margin-top: 20px; padding: 7px 12px; font-size: 13px; color: var(--ink2); background: var(--soft); border: 1px solid var(--border-strong); }
.catlinks a { color: var(--link); }
.catlinks span { color: var(--ink2); }

/* ===================== 信息框（右浮动·条纹） ===================== */
.infobox { float: right; width: 224px; margin: 2px 0 14px 20px; background: var(--soft); border: 1px solid var(--border-strong); font-size: 12.5px; }
.infobox-title { background: var(--c, var(--accent)); color: #fff; padding: 7px 10px; font-size: 15px; font-weight: 700; text-align: center; }
.infobox-image { text-align: center; padding: 14px; background: #fff; border-bottom: 1px solid var(--border-strong); }
.infobox-image img { max-width: 140px; max-height: 130px; object-fit: contain; }
.infobox-data { width: 100%; border-collapse: collapse; }
.infobox-data th, .infobox-data td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.infobox-data tr:nth-child(even) { background: #efeee7; }
.infobox-data tr:last-child th, .infobox-data tr:last-child td { border-bottom: none; }
.infobox-data th { color: var(--ink2); font-weight: 700; width: 42%; }
.infobox-data td { color: var(--ink); }
.infobox-stage { display: flex; align-items: center; gap: 9px; padding: 9px 10px; background: var(--soft2); border-top: 1px solid var(--border-strong); }
.infobox-stage img { width: 32px; height: 32px; object-fit: contain; }
.infobox-stage .lbl { font-size: 11px; color: var(--ink2); }
.infobox-stage .nm { font-size: 13.5px; color: var(--ink); font-weight: 700; }

/* 合成配方表 / chips / 套装 */
/* 表宽随内容自适应：原来第二列被写死 64px、整表又限死 420px，
   「产物」「工作站」这两行的值也落在第二列里，长一点的名字就被强制折行。 */
/* fit-content：表宽由最长的那行内容决定，既不会被截窄导致折行，也不会撑满整个正文宽度 */
.recipe-table { min-width: 280px; width: fit-content; max-width: 100%; margin: 4px 0 14px; }
.recipe-table td, .recipe-table th { vertical-align: middle; }
.recipe-table .rt-mat { display: flex; align-items: center; gap: 7px; }
.recipe-table .rt-mat img { width: 22px; height: 22px; object-fit: contain; }
.recipe-table .rt-num { text-align: center; white-space: nowrap; padding-left: 16px; padding-right: 16px; color: var(--accent-dark); font-weight: 700; }
.recipe-table .rt-makes th, .recipe-table .rt-makes td { background: #efeee7; font-weight: 600; }
.recipe-table .rt-makes td, .recipe-table .rt-station td { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border: 1px solid var(--border); padding: 4px 9px; font-size: 13px; }
.chip img { width: 22px; height: 22px; object-fit: contain; }
.chip-link { color: var(--link); cursor: pointer; text-decoration: none; }
.chip-link:hover { background: var(--content); border-color: var(--link); text-decoration: none; }
.armor-pieces { display: flex; flex-wrap: wrap; gap: 14px; }
.armor-piece { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.armor-piece img { width: 50px; height: 50px; object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 4px; }
.armor-piece span { font-size: 12px; color: var(--ink2); }

/* ===================== 编辑器 ===================== */
.edit-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; background: var(--soft); border: 1px solid var(--border-strong); border-bottom: none; padding: 5px 6px; }
.tb-grp { display: flex; align-items: center; gap: 2px; }
.tb-div { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; flex: 0 0 auto; }
.tb-spacer { flex: 1; }
.tbtn { height: 28px; padding: 0 9px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; background: #fff; border: 1px solid var(--border); color: var(--ink2); font-size: 12.5px; }
.tbtn span { white-space: nowrap; }
.tbtn:hover { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.tbtn.warn:hover { background: #b23a3a; border-color: #8d2c2c; }
/* 纯图标按钮（高频格式操作，压缩横向占位） */
.tbtn.ico { width: 28px; padding: 0; justify-content: center; }
/* 下拉菜单（低频功能收纳，参考 Word 功能区分组） */
.tb-menu { position: relative; }
.tb-menu .caret { font-size: 10px; opacity: .7; margin-left: 1px; }
.tb-menu.open > .tbtn.drop { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.tb-pop { display: none; position: absolute; top: calc(100% + 3px); left: 0; z-index: 410; min-width: 178px;
  background: #fff; border: 1px solid var(--border-strong); box-shadow: 0 6px 18px rgba(0,0,0,.22); padding: 3px; }
.tb-menu.open .tb-pop { display: block; }
.tb-pop hr { border: none; border-top: 1px solid var(--border-light); margin: 3px 0; }
.tb-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 9px; cursor: pointer;
  background: none; border: none; color: var(--ink); font-size: 13px; text-align: left; }
.tb-item i { width: 14px; text-align: center; color: var(--ink3); flex: 0 0 auto; }
.tb-item em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--ink3); }
.tb-item:hover { background: var(--accent); color: #fff; }
.tb-item:hover i, .tb-item:hover em { color: #fff; }
/* 视图切换做成一组连体按钮 */
.tb-seg { display: flex; }
.tb-seg .tbtn { border-radius: 0; margin-left: -1px; }
.tb-seg .tbtn:first-child { margin-left: 0; }
.tb-seg .tbtn.active { background: var(--accent); color: #fff; border-color: var(--accent-dark); position: relative; z-index: 1; }
/* 链接弹层里的复选项（.modal-b input 是 100% 宽 36px 高，这里必须显式收回正常尺寸） */
.lk-chk { display: flex; align-items: center; gap: 7px; margin: 8px 0 2px; font-size: 13px; color: var(--ink2); cursor: pointer; }
.modal-b .lk-chk input[type="checkbox"] { width: 14px; height: 14px; flex: 0 0 14px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
/* 编辑器内的游戏时期选择 */
.edit-stage { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: var(--soft); border: 1px solid var(--border-strong); border-top: none; border-bottom: none; padding: 7px 10px; font-size: 13px; }
.edit-stage label { color: var(--ink2); font-weight: 600; }
.edit-stage label i { color: var(--accent); margin-right: 3px; }
.edit-stage select { height: 28px; padding: 0 8px; background: #fff; border: 1px solid var(--border); color: var(--ink); font-size: 13px; cursor: pointer; }
.edit-stage select:focus { outline: none; border-color: var(--accent); }
.edit-stage .es-note { color: var(--accent-dark); font-size: 12px; }
.editor .hint { font-size: 12px; color: var(--ink2); margin: 0 0 10px; line-height: 1.7; background: var(--soft); border: 1px solid var(--border-light); border-top: none; padding: 7px 10px; }
/* 内联物品图标 */
img.ii { height: 1.4em; width: auto; vertical-align: -0.32em; margin: 0 2px; display: inline-block; }
/* 链接弹层 */
.lk-results { max-height: 220px; overflow-y: auto; margin-top: 4px; }
.lk-res { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; border-bottom: 1px solid var(--border-light); }
.lk-res:hover { background: var(--soft); }
.lk-res img { width: 26px; height: 26px; object-fit: contain; }
.lk-res .lk-cat { margin-left: auto; font-size: 11px; color: var(--ink3); }
.lk-empty { padding: 10px; color: var(--ink3); font-size: 13px; }
.lk-icon { display: flex; align-items: center; gap: 8px; min-height: 20px; margin: 6px 0 2px; }
.lk-icon .lk-ok { font-size: 12px; color: var(--npc); }
.lk-icon .lk-detecting { font-size: 12px; color: var(--ink3); }
/* 物品选择弹层 */
.it-tabs { display: flex; gap: 0; margin-bottom: 10px; border-bottom: 1px solid var(--border-strong); }
.it-tab { padding: 6px 14px; cursor: pointer; background: none; border: none; color: var(--ink2); font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.it-tab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.item-hint { font-size: 12px; color: var(--ink2); margin: 8px 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; }
.item-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; cursor: pointer; background: #fff; border: 1px solid var(--border); }
.item-cell:hover { border-color: var(--accent); background: var(--soft); }
.item-cell img { width: 34px; height: 34px; object-fit: contain; }
.item-cell span { font-size: 10.5px; color: var(--ink2); text-align: center; line-height: 1.2; max-height: 26px; overflow: hidden; }
.editor.fullscreen { position: fixed; inset: 0; z-index: 250; background: var(--content); padding: 14px 18px; overflow: auto; margin: 0; }
.editor.fullscreen .edit-split { height: calc(100vh - 170px); }
.editor.fullscreen .edit-split textarea, .editor.fullscreen .edit-preview { min-height: 100%; height: 100%; }
.edit-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edit-split.vw-code { grid-template-columns: 1fr; }
.edit-split.vw-code .edit-preview { display: none; }
.edit-split.vw-preview { grid-template-columns: 1fr; }
.edit-split.vw-preview textarea { display: none; }
.edit-preview[contenteditable="true"]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.editor textarea { width: 100%; min-height: 320px; padding: 11px; font-size: 14px; line-height: 1.6; font-family: "Consolas", "Microsoft YaHei", monospace; border: 1px solid var(--border-strong); resize: vertical; background: #fff; }
.edit-preview { min-height: 320px; padding: 11px 15px; border: 1px solid var(--border); background: var(--content); overflow: auto; font-size: 14.5px; line-height: 1.75; color: var(--ink); }
.edit-preview p { margin: 8px 0; } .edit-preview ul { list-style: disc; margin: 8px 0 8px 26px; } .edit-preview ol { list-style: decimal; margin: 8px 0 8px 26px; }
.edit-preview blockquote { border-left: 4px solid var(--border-strong); padding-left: 12px; color: var(--ink2); margin: 8px 0; }
.edit-preview table td, .edit-preview table th { position: relative; }
.edit-preview td:hover, .edit-preview th:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 表格行列增删浮动控件 */
.tbl-tools { position: absolute; z-index: 400; display: flex; gap: 4px; background: var(--content); border: 1px solid var(--border-strong); border-radius: 4px; padding: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
/* 预览区选中图片后的缩放工具条与拖拽把手 */
.img-tools { align-items: center; }
.img-tools .it-label { color: var(--accent); padding: 0 4px; font-size: 12px; }
.img-tools .it-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 3px; }
.img-tools .it-pct { min-width: 42px; text-align: center; font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.edit-preview img.img-sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.img-grip { position: absolute; z-index: 401; width: 14px; height: 14px; background: var(--accent);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: nwse-resize; }
.tbl-tools button { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; padding: 3px 7px; background: var(--accent); color: #fff; border: none; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.tbl-tools button:hover { background: var(--accent-dark); }
.tbl-tools button[data-act$="del"] { background: #c0392b; }
.tbl-tools button[data-act$="del"]:hover { background: #a93226; }

/* ===================== 管理后台 ===================== */
.page-title { font-size: 24px; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--border-strong); padding-bottom: 6px; margin-bottom: 14px; }
.panel { background: var(--content); border: 1px solid var(--border-strong); padding: 16px 20px; }
.panel + .panel { margin-top: 14px; }
.sec-h { font-size: 16px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 12px; }
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border-strong); }
.tab { padding: 8px 16px; cursor: pointer; color: var(--link); font-size: 14px; border: 1px solid transparent; border-bottom: none; margin-bottom: -1px; }
.tab:hover { background: var(--soft); }
.tab.active { color: var(--ink); font-weight: 700; background: var(--content); border-color: var(--border-strong); }
table.grid { width: 100%; border-collapse: collapse; background: var(--content); border: 1px solid var(--border-strong); }
table.grid th, table.grid td { padding: 8px 11px; border: 1px solid var(--border); text-align: left; font-size: 13.5px; }
table.grid th { background: var(--soft2); color: var(--ink2); font-weight: 700; }
.pending-item { background: var(--content); border: 1px solid var(--border-strong); padding: 13px 16px; margin-bottom: 10px; }
.pending-item .pi-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pending-item .pi-stage { margin-bottom: 8px; font-size: 13px; color: var(--ink2); background: #fff6e6; border: 1px solid var(--accent); padding: 6px 9px; }
.pending-item .pi-stage i { color: var(--accent); margin-right: 3px; }
.pending-item .pi-stage s { color: var(--ink3); }
.pending-item .pi-stage b { color: var(--accent-dark); }
.pending-item .pi-body { background: var(--soft); border: 1px solid var(--border-light); padding: 9px; font-size: 13.5px; white-space: pre-wrap; max-height: 200px; overflow-y: auto; }
.pending-item .pi-actions { display: flex; gap: 8px; margin-top: 10px; }
.pi-head .sr-cat { font-size: 11px; color: #fff; padding: 1px 7px; }
.stat-cards { display: flex; gap: 12px; margin-bottom: 14px; }
.stat-card { flex: 1; background: var(--content); border: 1px solid var(--border-strong); padding: 16px 18px; }
.stat-card .sc-num { font-size: 30px; font-weight: 700; color: var(--accent); }
.stat-card .sc-lbl { font-size: 13px; color: var(--ink2); margin-top: 3px; }
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 72%; min-height: 2px; background: var(--accent); }
.bar-col:hover .bar { background: var(--accent-dark); }
.bar-col .bar-x { font-size: 10px; color: var(--ink3); margin-top: 4px; white-space: nowrap; }
.sec-h .period-toggle { margin-left: auto; display: inline-flex; gap: 4px; }
.period-btn { font-size: 12px; padding: 3px 11px; cursor: pointer; background: #fff; border: 1px solid var(--border-strong); color: var(--ink2); }
.period-btn.active { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.sec-h { display: flex; align-items: center; }
/* 账户管理 */
.user-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.user-search { height: 32px; padding: 0 11px; border: 1px solid var(--border-strong); background: #fff; font-size: 13.5px; min-width: 220px; }
.user-table td { vertical-align: middle; }
.user-table tr.row-super { background: #fff4e2; }
.user-table tr.row-admin { background: #e9f6ec; }
.role-pill { display: inline-block; padding: 1px 9px; font-size: 12px; border-radius: 2px; background: var(--soft2); color: var(--ink2); }
.role-pill.row-super { background: var(--accent); color: #fff; }
.role-pill.row-admin { background: #2f7d4f; color: #fff; }
/* 登录“保持30天”复选框（覆盖 .modal-b input 的大尺寸） */
.ckbox { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink2); margin-top: 10px; cursor: pointer; }
.modal-b .ckbox input[type="checkbox"] { width: 15px; height: 15px; flex: 0 0 15px; margin: 0; padding: 0; }

.stat-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
.stat-tables .panel { margin-top: 0; min-width: 0; }
.stat-tables table { table-layout: fixed; }
.stat-tables td code { font-size: 12.5px; word-break: break-all; }
@media (max-width: 760px) { .stat-tables { grid-template-columns: 1fr; } }

/* ===================== 弹层 / Toast ===================== */
.modal-root { position: fixed; inset: 0; z-index: 260; display: none; align-items: flex-start; justify-content: center; background: rgba(0,0,0,.5); padding-top: 9vh; overflow-y: auto; }
.modal-root.show { display: flex; }
/* 弹层整体不超过视口高度，超出部分在正文区内部滚动（表头与关闭按钮始终可见） */
.modal { background: var(--content); border: 1px solid var(--border-strong); width: 360px; max-width: 92vw;
  box-shadow: 0 16px 50px rgba(0,0,0,.4); display: flex; flex-direction: column; max-height: 82vh; margin-bottom: 9vh; }
.modal.wide { width: 560px; }
.modal:has(.item-grid) { width: 480px; }
.modal-h { background: var(--topbar); color: #f1e7d2; padding: 12px 16px; font-size: 16px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; }
.modal-h .x { cursor: pointer; color: #b9a982; font-size: 18px; }
.modal-b { padding: 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-b label { display: block; font-size: 13px; color: var(--ink2); margin: 10px 0 4px; }
.modal-b input, .modal-b select { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); font-size: 14px; background: #fff; }
.modal-b .err { color: #b23a3a; font-size: 13px; min-height: 18px; margin-top: 8px; }
.modal-b .row-btn { margin-top: 16px; display: flex; gap: 10px; }
.modal-b .row-btn .btn { flex: 1; justify-content: center; }
.modal-switch { text-align: center; margin-top: 12px; font-size: 13px; color: var(--ink2); }
.modal-switch a { cursor: pointer; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 300; background: #25262a; color: #f1e7d2; padding: 11px 20px; border-left: 4px solid var(--accent); opacity: 0; pointer-events: none; transition: .25s; font-size: 13.5px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-left-color: #2f7d4f; }
.toast.err { border-left-color: #b23a3a; }

/* ===================== 响应式 ===================== */
@media (max-width: 1000px) { .mainpage { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .infobox { float: none; width: auto; margin: 0 0 14px; }
  .page-tabs { position: static; justify-content: flex-end; margin-bottom: 6px; }
  .article { padding: 12px 14px 20px; }
  .firstHeading { font-size: 22px; }
  .toc { max-width: none; display: block; }
  .edit-split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { overflow-x: hidden; }                 /* 统一消除各页右侧多余横向区域 */
  #adminBody table.grid { display: block; overflow-x: auto; white-space: nowrap; }  /* 宽表格内部横向滚动 */
  .hamburger { display: block; }
  .layout { padding-left: 0; }   /* 侧栏改为抽屉，正文占满 */
  /* 顶栏两行：第一行 logo/语言/账户，搜索框单独占满第二行 */
  .topbar { height: auto; flex-wrap: wrap; padding: 6px 10px; row-gap: 6px; }
  .topsearch { order: 10; flex: 1 0 100%; max-width: none; }
  .topright { margin-left: auto; }
  /* 手机端隐藏角色标签，避免右侧多出占位 */
  .user-chip .role-tag { display: none; }
  .user-chip .uc-name { max-width: 84px; }
  /* 侧栏抽屉：层级高于顶栏(100)与搜索下拉(120)，即使 --topbar-h 有 1~2px 误差
     也只会盖住搜索栏，而不会反过来被搜索栏压住一截 */
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 240px; z-index: 130; transform: translateX(-100%); transition: transform .22s; background: var(--page); border-right: 1px solid var(--border); }
  .sidebar.open { transform: translateX(0); box-shadow: 2px 0 12px rgba(0,0,0,.18); }
  .sidebar-mask.show { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.4); z-index: 125; }
  /* 抽屉展开时搜索框变暗并禁用，避免下拉浮层与抽屉抢层级 */
  .topsearch.dimmed { opacity: .3; pointer-events: none; transition: opacity .22s; }
  .topsearch.dimmed .search-drop { display: none; }
  .content { padding: 14px 12px 46px; }
  .brand-txt { display: none; }
  .top-btn { padding: 0 8px; font-size: 12px; }
}

/* ===================== 贡献榜 ===================== */
.contrib-list { list-style: none; border: 1px solid var(--border); background: var(--content); }
.contrib-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border-light); }
.contrib-row:last-child { border-bottom: none; }
.contrib-row.top1 { background: #fdf5e3; }
.contrib-row.top2 { background: #f6f5f2; }
.contrib-row.top3 { background: #f9f1e6; }
.contrib-rank { flex: 0 0 30px; text-align: center; font-weight: 700; color: var(--ink3); font-size: 16px; }
.contrib-row.top1 .contrib-rank, .contrib-row.top2 .contrib-rank, .contrib-row.top3 .contrib-rank { font-size: 20px; }
.contrib-name { flex: 1 1 auto; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.contrib-name .role-tag { font-size: 10px; padding: 1px 6px; background: var(--accent); color: #fff; font-weight: 400; }
.contrib-count { flex: 0 0 auto; color: var(--ink2); font-size: 13px; }
