/* ============================================================
   Wiki 会客室效率天梯榜 —— 主样式
   可伸缩布局: 兼容 1920x1080 / 2560x1440 / 3840x2160
   ============================================================ */

:root {
  /* 主题 */
  --bg: #10131c;
  --surface: #1a1f2e;
  --panel: #222a3d;
  --line: #39445f;
  --text: #e7ecf4;
  --text-dim: #93a0b8;
  --accent: #6fb3ff;

  --row-h: 92px;               /* 统一行高，上下榜严格相等 */
  --radius: 10px;

  /* 列宽分配 (相对比例) */
  --c1: 0.9fr;
  --c2: 2.2fr;
  --c3: 2.5fr;
  --c4: 0.9fr;
  --c5: 0.9fr;
  --c6: 0.9fr;
  --c7: 0.9fr;
  --c8: 1fr;
  --c9: 2.5fr;

  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans", "Segoe UI", system-ui, sans-serif;
  line-height: 1.35;
  overflow-x: hidden;            /* 禁止页面级横向溢出 */
  min-height: 100%;
}

/* 页面主体：可伸缩容器，占满视口宽，随分辨率伸缩 */
.page {
  width: 100%;
  max-width: 100%;
  padding: 18px 28px;
  margin: 0 auto;
}

/* ---------------- 顶部标签页导航 ---------------- */
.tabbar {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
}
.tabbar .tab {
  padding: 8px 22px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: default;
  font-size: 15px;
  border: 1px solid transparent;
}
.tabbar .tab.active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ---------------- 提示格式 (下划线, 与文字同色, 无末尾星号) ----------------
   文字用默认颜色, 下划线随文字颜色(默认 currentColor) */
.hint {
  text-decoration: underline;
}

/* 通用悬停提示：由 JS 生成 .tip-tooltip 浮动层，并按视口位置自动避免越界 */
[data-tip] { position: relative; cursor: help; }
.tip-tooltip {
  position: fixed;
  display: none;
  background: #0c0f16;
  color: #dfe6f0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  max-width: 320px;
  white-space: normal;
  font-size: 12.5px;
  z-index: 9999;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
  pointer-events: none;
}

/* ---------------- 板块标题 ---------------- */
/* 只读版顶部的更新时间/版本小字 (位于筛选栏上方) */
.meta-line {
  margin: 6px 0 2px;
  font-size: 12px;
  color: var(--text-dim);
}
/* 署名超链接: 默认无下划线, 悬停出现下划线 (目标网址提示由 JS tooltip 提供) */
.meta-line a {
  color: var(--accent);
  text-decoration: none;
}
.meta-line a:hover {
  text-decoration: underline;
}
.sec-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 22px 0 14px;
  font-size: 19px;
  font-weight: 600;
}
.sec-title .t { min-width: 0; }
/* 注释紧贴标题文字之后, 垂直对齐到标题的右下角; 缩小字号; 以提示格式(橙色下划线+星号)呈现 */
/* .note 同时带 hint 类, 需更高特异性以覆盖下方 .sec-title .hint 的 12px */
.sec-title .note.hint {
  align-self: flex-end;
  font-size: 10.5px;
}
.sec-title .note .h,
.sec-title .hint { font-size: 12px; }

/* ---------------- 编辑工具栏 ---------------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 6px 0 4px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toolbar .spacer { flex: 1 1 100%; }
button {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: #2a3fd0; color: #fff; }
button.danger { background: #8c2c2c; color: #ffe5e5; }
button.small { padding: 3px 8px; font-size: 12px; }

/* ---------------- 筛选面板 ---------------- */
.filter-bar {
  margin: 4px 0 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.filter-bar .row { display: flex; align-items: center; gap: 36px; flex-wrap: wrap; }
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
/* 拉开两个筛组距离并在中间加细分隔线, 便于分辨是两组 */
.filter-group + .filter-group {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}
/* 组标题与第一个标签的可见间距保持恒定(即使标题文字变长):
   用右侧 padding 代替 min-width, 避免文字较长时把标签挤得过近 */
.filter-group .glabel { font-size: 13px; color: var(--text-dim); padding-right: 14px; }
.tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.tag.selected {
  background: #2a3fd0;
  color: #fff;
  border-color: #2a3fd0;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.switch input[type="checkbox"] { accent-color: #2a3fd0; width: 15px; height: 15px; }

/* ---------------- 表格 (两榜共用格子) ---------------- */
.board { width: 100%; margin-top: 4px; }
.board .thead,
.board .tbody .row {
  width: 100%;
}
.board .thead {
  display: grid;
  border-bottom: 2px solid var(--line);
  background: var(--surface);
}
.board .thead > div {
  padding: 8px 6px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
}
.board .tbody { display: contents; }
.board .tbody > .row {
  display: grid;
  align-items: center;
  min-height: var(--row-h);
  height: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
/* 斑马纹由 JS 管理(筛选显隐切换时按可见行重新交替), 保持 hover 在后面的优先级 */
.board .tbody > .row.zebra { background: #1f2739; }
.board .tbody > .row:hover { background: #263047; }

/* 两榜均为 9 列, 列宽比例完全一致:
   单人榜 4 个加成列每列一个数值; 组合榜 4 个加成列每列上下叠放两行数值
   (上行=对象1, 下行=对象2), 因此组合榜不再需要额外的第4-11列。 */
.board.single .thead,
.board.combo .thead { grid-template-columns: var(--c1) var(--c2) var(--c3) var(--c4) var(--c5) var(--c6) var(--c7) var(--c8) var(--c9); }
.board.single .row,
.board.combo .row   { grid-template-columns: var(--c1) var(--c2) var(--c3) var(--c4) var(--c5) var(--c6) var(--c7) var(--c8) var(--c9); }

/* 单元格通用 */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px;
  min-height: var(--row-h);
}
.cell.small { font-size: 13px; }

/* 第1列: 编号 */
.cell.idx {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
}

/* 第2列: 图片 + 名称 */
.cell.portrait {
  flex-direction: column;
  justify-content: center;
}
.avatar {
  width: 50px; height: 50px;
  border-radius: 8px;
  overflow: hidden;
  background: #0c0f16;
}
.avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* 星级边框色 (-1星为特殊干员, 与4星同色) */
.avatar.star--1 { border: 4px solid #f6e8f8; }
.avatar.star-1 { border: 4px solid #ffffff; }
.avatar.star-2 { border: 4px solid #cde941; }
.avatar.star-3 { border: 4px solid #17c3fd; }
.avatar.star-4 { border: 4px solid #f6e8f8; }
.avatar.star-5 { border: 4px solid #fff1ce; }
.avatar.star-6 { border: 4px solid #feb406; }

/* 名称下的圆角矩形背景 (性别配色) */
.name-tag {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.3;
}
.name-tag.g-0 { background: #f7b1da; color: #2b2030; }
.name-tag.g-1 { background: #b1c7f7; color: #232a3a; }
.name-tag.g-2 { background: #d4d4d4; color: #23232b; }

/* ---------------- 左右双榜布局 ---------------- 
   单人榜与组合榜并排; 两榜行必须逐行对齐。
   两榜同为 9 列同一组列宽比例, 但组合榜第2列为双肖像(两倍内容宽度),
   故仍比单人榜多分配一些宽度: 45% / 55%。
   组合榜加成列上下叠放(上行=对象1, 下行=对象2), 与单榜共用统一的
   --row-h 行高 + 各自标题同高 + 顶对齐实现逐行对齐。 */
.boards {
  display: flex;
  align-items: flex-start;        /* 两榜标题行同顶 */
  gap: 20px;
  margin-top: 6px;
}
.boards > section {
  min-width: 0;
  /* 覆盖旧的内联 margin-top; 由 flex 调距 */
}
.boards > section.single-sec {
  flex: 0 0 45%;
}
.boards > section.combo-sec {
  flex: 1 1 55%;
}
/* 并排后标题上边距收紧, 保证两表头行在同一起点 */
.boards .sec-title {
  margin: 6px 0 10px;
}
/* 较窄窗口(如小窗/1280)恢复上下堆叠, 保证可用性 */
@media (max-width: 1500px) {
  .boards { flex-direction: column; }
  .boards > section.single-sec,
  .boards > section.combo-sec { flex: 1 1 auto; }
}
/* 组合榜第2列: 双肖像
   本格内嵌整个 dup-row(内部两个 .cell.portrait 已各带上下 4px padding/留白),
   故去掉本格垂直 padding, 否则其 min-height 内容盒 = 92-8=84px,
   装不下 92px 高的 dup-row, 会被撑到 100px, 使组合榜整行比单人榜高 8px、逐行错位。 */
.cell.duoportrait { flex-direction: column; padding-top: 0; padding-bottom: 0; }
/* 每个肖像占一个固定宽度槽(预留 6 个汉字宽), 头像在其槽内水平居中,
   因此两头像之间的间距恒定, 不随干员名称长短变化 */
.dup-row { display: flex; gap: 6px; align-items: center; justify-content: center; }
.dup-row .cell.portrait {
  width: 96px;
  flex: 0 0 auto;
}
.dup-row .name-tag {
  max-width: 96px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dup-row .port-md {
  flex-direction: column;
  align-items: center;
}

/* 第3列: 复选框/输入框 控件单元 */
.cell.ctrl { flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 8px; }
.ctrl-item { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; line-height: 1.8; }
.ctrl-item + .ctrl-item { margin-top: 9px; }
.ctrl-item .clabel { color: var(--text-dim); }
.ctrl-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: #2a3fd0; cursor: pointer; }
.ctrl-item input[type="number"] {
  width: 56px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #131827;
  color: var(--text);
  font-size: 13px;
}
.ctrl-item input[type="number"]:disabled { background: transparent; border-style: dashed; }

/* 百分比列 (两名小数有时会让数值更宽, 故字号适当缩小) */
.cell.pct { font-weight: 600; font-size: 15px; }
.cell.pct.sum { color: var(--accent); }

/* 组合榜加成列: 每个加成列内上下叠放两行数值
   (上行=对象1, 下行=对象2), 与左侧双肖像上下对应; 不增加整行高度 */
.cell.pct.dup {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.15;
}

/* 第9列: 线索倾向 (strA 与 strB 横向拼接, 强制单行不换行) */
.cell.clue {
  flex-direction: row;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.cell.clue > span,
.cell.clue .clue-main,
.cell.clue .hint { white-space: nowrap; }
.clue-main { font-size: 13px; color: var(--text); }
.cell.clue .hint { font-size: 12.5px; }

/* ---------------- 编辑操作 (仅编辑模式, 悬停行上显示, 不占表格列) ---------------- */
.row .row-actions {
  position: absolute;
  top: 4px; right: 8px;
  display: none;
}
.board .tbody > .row { position: relative; }
.row:hover .row-actions { display: inline-flex; gap: 4px; }
.row-actions button { opacity: .92; }
.row-actions button.del { color: #ffb4b4; }

/* ---------------- 模态编辑表单 ---------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  z-index: 1000;
}
.modal {
  position: fixed;
  left: 50%; top: 6%;
  transform: translateX(-50%);
  display: none;            /* 初始隐藏；openEditor 时展开 */
  width: 640px;
  max-height: 86%;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  z-index: 1001;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; color: var(--text-dim); }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #131827;
  color: var(--text);
  font-size: 13.5px;
}
/* 图片路径: 固定前缀 res\ (只读) + 其后可编辑部分 */
.img-path { display: flex; align-items: center; }
.img-path .img-prefix {
  padding: 6px 8px;
  color: var(--text-dim);
  background: #0c0f16;
  border: 1px solid var(--line);
  border-radius: 6px 0 0 6px;
  white-space: nowrap;
  user-select: none;
}
.img-path input[type="text"] {
  border-radius: 0 6px 6px 0;
  flex: 1 1 auto;
  min-width: 0;
}
/* 技能基础加成: 数字 + 只读 % 后缀 */
.pct-suffix { display: flex; align-items: center; }
.pct-suffix .pct-mark {
  padding: 6px 9px;
  color: var(--text-dim);
  background: #0c0f16;
  border: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  user-select: none;
}
.pct-suffix input[type="number"] {
  border-radius: 6px 0 0 6px;
  flex: 1 1 auto;
  min-width: 0;
}
.field input[type="checkbox"] { width: 18px; height: 18px; accent-color: #2a3fd0; }
.field.half { grid-column: span 1; }
.field.full { grid-column: span 2; }
.form-section { font-size: 13px; font-weight: 600; color: var(--accent); margin: 6px 0 2px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.formula-hint { font-size: 12px; color: var(--text-dim); }

/* ---------------- 导出提示条 ---------------- */
.banner {
  position: fixed;
  left: 50%; bottom: 30px;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--text);
  padding: 16px 20px;
  max-width: 720px;
  z-index: 1050;
  box-shadow: 0 8px 22px rgba(0,0,0,.5);
  white-space: pre-line;
}
.banner .b-close { float: right; cursor: pointer; border: 0; background: transparent; color: var(--text-dim); }

.empty-hint { padding: 26px; text-align: center; color: var(--text-dim); font-size: 14px; }

/* 500 分辨率预览帮助利于验证 */
.guide { font-size: 12px; color: #6b7690; margin-top: 10px; }