:root {
  --navy: #081726;
  --navy-2: #0b1f34;
  --navy-3: #15365e;
  --ink: #0f172a;
  --muted: #7d8ba1;
  --muted-2: #9aa8ba;
  --line: #e6edf6;
  --line-2: #edf2f8;
  --bg: #f3f6fb;
  --card: #ffffff;
  --blue: #3f7cf3;
  --blue-2: #2f6fed;
  --blue-soft: #eaf1ff;
  --green: #22c55e;
  --red: #e5484d;
  --radius: 14px;
}

* { box-sizing: border-box; }
/* [hidden] 必须能压住组件自己的 display。
   .nav-item 是 display:flex，作者样式优先于浏览器默认的 [hidden]{display:none}，
   不加 !important 的话 el.hidden = true 完全不起作用（好友模式的菜单就藏不住）。 */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
.app { min-height: 100vh; }

/* ---------------- sidebar ---------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  padding: 50px 18px 26px;
  display: flex;
  flex-direction: column;
  color: #cbd7e6;
  background: linear-gradient(180deg, #071624 0%, #0a1d31 55%, #0b2036 100%);
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px 20px 12px;
  margin: 0 0 28px;
  border-bottom: 1px solid rgba(145, 173, 205, .13);
}
.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(123, 190, 224, .48);
  border-radius: 16px;
  color: #e9f8ff;
  background: linear-gradient(145deg, rgba(73, 143, 184, .3), rgba(31, 72, 109, .35));
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 8px 22px rgba(0,0,0,.14);
}
.snow { width: 29px; height: 29px; color: #eaf8ff; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #f4f8ff;
  line-height: 1.2;
}
.brand-owner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: #a9d9ee;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 1.4px;
}
.brand-owner-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #70d8d0;
  box-shadow: 0 0 9px rgba(112,216,208,.7);
}
.brand-sub {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 1px;
  color: #718ca7;
  font-weight: 500;
}
.nav-label {
  padding: 0 16px;
  margin-bottom: 22px;
  font-size: 12px;
  letter-spacing: 1px;
  color: #5f7690;
}
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #a9bad0;
  font-size: 14px;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e8f1ff; }
.nav-item.active {
  background: linear-gradient(100deg, #17395f, #143254);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #4f8df5, 0 8px 18px rgba(0,0,0,.18);
}
.nav-icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-flex; }
.nav-icon svg { width: 20px; height: 20px; }
.nav-text { flex: 1; white-space: nowrap; }
.nav-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4b647e;
}
.nav-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.sidebar-bottom {
  margin-top: auto;
  padding: 22px 14px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.local { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b9c8db; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.muted { color: var(--muted-2); font-size: 12px; margin-top: 7px; }

/* ---------------- main ---------------- */
.main {
  margin-left: 264px;
  padding: 34px 42px 60px;
  min-height: 100vh;
}
.page { display: none; max-width: 1120px; }
.page.active { display: block; }
.page-head { margin: 4px 0 22px; }
.page-head h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: .5px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

.topbar { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.kid-input {
  flex: 1;
  height: 50px;
  padding: 0 18px;
  border: 1px solid #dce6f2;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.kid-input:focus { border-color: #9dbcf3; box-shadow: 0 0 0 3px rgba(63,124,243,.10); }

.scan-row { display: flex; gap: 18px; margin-bottom: 6px; }
.scan-row .btn { flex: 1; height: 54px; font-size: 15px; }
.status {
  min-height: 22px;
  margin: 12px 2px 22px;
  color: #8b98a9;
  font-size: 14px;
}
.status.ok { color: #0f8a5f; }
.status.error { color: var(--red); }
.status.warn { color: #b7791f; }
.status.running { color: var(--blue-2); }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  background: #eef3fa;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #7fa7f6, #5a8df0);
  box-shadow: 0 6px 14px rgba(63,124,243,.18);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #6d9af4, #4b80eb); }
.scan-row .btn.primary {
  background: linear-gradient(180deg, #a9c2f8, #8fb2f5);
  box-shadow: 0 6px 14px rgba(63,124,243,.12);
}
.scan-row .btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #9bb7f6, #7ea6f3);
}
.btn.ghost {
  background: #eef4fb;
  border-color: #e3ebf5;
  color: #334155;
}
.btn.ghost:hover { background: #e6eef9; }
.btn.stop {
  background: #f7f9fd;
  border-color: #e6edf6;
  color: #8a97a8;
}
.btn.stop:not(:disabled) { background: #fdeceb; border-color: #f7d4d2; color: #c53a3f; }
.btn.stop:disabled { background: #f8fafc; border-color: #e9eff7; color: #a3aebd; opacity: 1; }
.btn.outline {
  background: #f7f9fd;
  border-color: #e2eaf5;
  color: #3c4c62;
}
.btn.outline:hover { background: #eef4fd; border-color: #cfdcf0; }
.btn.wide { width: 100%; height: 48px; font-size: 15px; }
.export-actions { display: flex; gap: 12px; }
.export-actions .btn { flex: 1; width: auto; height: 48px; font-size: 14px; }
.icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: #f1f5fa; color: #64748b; font-size: 22px; line-height: 1;
}
.icon-btn:hover { background: #e8eef7; }

/* ---------------- cards ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 30px rgba(15,23,42,.045);
  padding: 24px 26px;
  margin-bottom: 18px;
}
.card h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.export-card h2 { margin-bottom: 8px; }
.export-card p { margin: 0 0 18px; color: #8794a7; font-size: 13px; }
.meta { color: var(--muted-2); font-size: 13px; }

/* ---------------- toolbar ---------------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin: 18px 0 14px; }
.toolbar .search { flex: 1; }
.search, .level, .form-grid input, .form-grid select {
  height: 44px;
  padding: 0 14px;
  border: 1px solid #dfe8f3;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
.search:focus, .level:focus, .form-grid input:focus, .form-grid select:focus {
  border-color: #a7c2f4;
  box-shadow: 0 0 0 3px rgba(63,124,243,.08);
  background: #fff;
}
.level { width: 140px; }
.toolbar .btn { height: 44px; }

/* ---------------- table ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.players { width: 100%; border-collapse: collapse; min-width: 720px; }
.players th {
  padding: 13px 16px;
  background: #eff5ff;
  color: #5a6b82;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.players th:first-child { border-radius: 8px 0 0 8px; }
.players th:last-child { border-radius: 0 8px 8px 0; }
.players th.c, .players td.c { text-align: center; }
.players th.r, .players td.r { text-align: right; }
.players td {
  padding: 16px;
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
  vertical-align: middle;
}
.players tbody tr:hover td { background: #f9fbff; }
.players tbody tr:last-child td { border-bottom: 0; }
.pname { font-weight: 600; color: #172033; line-height: 1.35; }
.puid { margin-top: 3px; color: #9aa8ba; font-size: 12px; }
.alliance { color: #45546a; }
.queue { color: #45546a; }
.detail-link {
  border: 0; background: transparent; color: var(--blue-2);
  font-size: 13px; font-weight: 600; padding: 4px 0;
}
.detail-link:hover { text-decoration: underline; }

/* ---------------- 玩家表：三行玩家信息 + 行内操作按钮 ---------------- */
.pinfo .pmeta {
  margin-top: 2px;
  color: #8b99ad;
  font-size: 12px;
  line-height: 1.5;
}
.pinfo .pmeta:first-of-type { margin-top: 4px; }

/* 公开行军 / 城内援军数量：有就高亮，0 就压暗 */
.cnt { color: #b3bfd0; font-weight: 600; font-size: 13px; }
.cnt.on { color: #1d6fe0; font-size: 14px; }

.players td.act { white-space: nowrap; }
.row-btn {
  height: 30px;
  padding: 0 12px;
  margin-left: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.row-btn:first-child { margin-left: 0; }
.row-btn:hover { text-decoration: none; }
.row-btn.solid { background: var(--blue-2); border-color: var(--blue-2); color: #fff; }
.row-btn.solid:hover { background: #1a5fbf; border-color: #1a5fbf; }
.row-btn:not(.solid) { background: #fff; border-color: #c8dbf5; color: var(--blue-2); }
.row-btn:not(.solid):hover { background: #f0f6ff; border-color: #a9c8ef; }
.empty {
  padding: 44px 16px !important;
  text-align: center !important;
  color: #9aa8ba;
  font-size: 14px;
}

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 0 2px; }
.pager button {
  border: 1px solid #e2eaf5; background: #f8fafd; color: #4a5a70;
  border-radius: 7px; height: 32px; padding: 0 12px; font-size: 13px;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager span { color: #8a97a8; font-size: 13px; }

/* ---------------- connect ---------------- */
.badge {
  display: inline-flex; align-items: center; height: 26px;
  padding: 0 10px; border-radius: 999px;
  background: #f1f5fa; color: #7b8798; font-size: 12px; font-weight: 600;
}
.badge.on { background: #e8f8ef; color: #0f8a5f; }
.account-info { margin-top: 18px; color: #334155; font-size: 14px; line-height: 1.9; }
.account-info b { color: #111c30; }
.role-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.role-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 12px; border: 1px solid #edf2f8; border-radius: 9px; background: #fbfdff;
}
.role-row .role-name { font-size: 14px; color: #253247; }
.role-line { font-size: 13px; color: #334155; min-width: 0; flex: 1 1 auto; line-height: 1.5; }
.role-kid { display: inline-block; border-radius: 6px; background: #eaf2ff; color: #3f6fd8; padding: 1px 7px; font-size: 12.5px; font-weight: 700; margin-right: 2px; }
.role-row .role-sub { color: #93a1b4; font-size: 12px; margin-top: 2px; }
.role-row .btn { height: 28px; padding: 0 12px; font-size: 12px; flex-shrink: 0; }
.role-using { color: #0f8a5f; font-size: 14px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
/* 被服务器封禁（登录 code=13）的角色：灰掉并标明，不给「使用」按钮 */
.role-row.banned { opacity: .62; }
.role-row.banned .role-line { text-decoration: line-through; text-decoration-color: #c9d3e0; }
.role-banned {
  color: #b42318; background: #fef3f2; border: 1px solid #fecdc9; border-radius: 6px;
  padding: 1px 8px; font-size: 12px; font-weight: 700; white-space: nowrap; flex-shrink: 0; cursor: help;
}
.account-list { margin-top: 10px; display: grid; grid-template-columns: 1fr; gap: 8px; max-width: 660px; }
/* 游戏连接页：左右等高对齐（grid 的 align-items:stretch 自己就会等高，
   千万别给卡片写 height:100% —— 父级高度是 auto 时它解析成 auto，反而破坏等高） */
.connect-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.connect-grid > .card { margin-bottom: 0; }
.connect-login { display: flex; flex-direction: column; }
.connect-login .connect-form { grid-template-columns: 1fr 1fr; gap: 10px; }   /* 手机号 | 验证码 一行两列 */
.connect-login .connect-row {
  display: flex; flex-direction: row; gap: 8px; margin-top: 14px; width: 100%;
}
.connect-login .connect-row .btn { flex: 1 1 0; min-width: 0; width: auto; }
.connect-login .connect-row-sec { display: flex; margin-top: 8px; }
.connect-login .connect-row-sec .btn { width: 100%; }
.connect-list { display: flex; flex-direction: column; }
@media (max-width: 1000px) {
  .connect-grid { grid-template-columns: 1fr; }
}
/* 账号卡片高度随「角色折叠展开」变化，两列会高低错落很难看 → 固定单列；
   再限 max-width（660px）并把内边距压小，做成紧凑小卡片 */
/* ==== 一行式账号卡片（游戏连接页）==== */
.acct-row {
  padding: 0; border: 1px solid #edf2f8; border-radius: 8px; background: #fbfdff;
  overflow: hidden;
}
.acct-row.busy { border-color: #f7b4b4; background: #fff6f6; }
.acct-row.active { border-color: #cbe8d7; background: #f7fcf9; }
.acct-main {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; min-height: 44px;
}
.acct-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1;
  flex-shrink: 0;
}
.acct-dot.busy { background: #e53e3e; animation: busyPulse 1.2s ease-in-out infinite; }
.acct-dot.active { background: #0f8a5f; }
.acct-name { font-weight: 700; font-size: 13.5px; color: #111c30; flex-shrink: 0; }
.acct-role {
  font-size: 12px; color: #4a5568; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-role.empty { color: #94a3b8; }
.acct-spacer { flex: 1 1 auto; }
.acct-more {
  flex-shrink: 0; font-size: 12.5px; padding: 2px 7px; line-height: 1.6;
  border: 1px solid #e2e8f0; border-radius: 5px; background: #fff;
  color: #64748b; cursor: pointer;
}
.acct-more:hover { border-color: #cbd5e1; color: #334155; background: #f8fafc; }
/* 账号级封禁标记（loginauth.block_reason） */
.acct-block {
  flex-shrink: 0; font-size: 11.5px; padding: 1px 7px; border-radius: 5px;
  color: #c53030; background: #fff5f5; border: 1px solid #feb2b2;
}
/* 账号健康：掉线（凭证失效，需重新登录） / 角色被封 */
.acct-health { flex-shrink: 0; font-size: 11.5px; padding: 1px 7px; border-radius: 5px; }
.acct-health.offline { color: #b45309; background: #fffbeb; border: 1px solid #fcd34d; }
.acct-health.banned { color: #c53030; background: #fff5f5; border: 1px solid #feb2b2; }
.acct-others-wrap { display: none; padding: 0 12px 10px; }
.acct-others-wrap.open { display: block; }
.acct-row > * { min-width: 0; }
.acct-row.active { border-color: #b7e0c8; background: #f5fbf7; }
.acct-row.busy { border-color: #f7b4b4; background: #fff6f6; }
/* 当前使用的角色：露在外面，一眼看到现在用的是谁 */
.acct-now {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  width: 100%; box-sizing: border-box;      /* 撑满卡片，否则右侧会空一大截 */
  font-size: 12px; padding: 4px 8px; margin: 2px 0;
  background: #eef8f1; border: 1px solid #cfe9d9; border-radius: 6px; color: #17452b;
}
.acct-now.empty { background: #f7f9fc; border-color: #e8eef6; color: #8b96a8; }
.acct-now-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: #0f8a5f; color: #fff; flex-shrink: 0;
}
.acct-others { margin-top: 0; }
.acct-others > summary { font-size: 11.5px; padding: 2px 0; }
.acct-row .role-row { padding: 6px 10px; }
.acct-actions .btn.small { height: 24px; padding: 0 9px; font-size: 12px; }
/* 任务中的账号：手机号前面的脉冲红点 */
.busy-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #e53e3e;
  display: inline-block; flex-shrink: 0;
  animation: busyPulse 1.2s ease-in-out infinite;
}
@keyframes busyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, .65); }
  50% { box-shadow: 0 0 0 7px rgba(229, 62, 62, 0); }
}
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.acct-phone { font-size: 14px; font-weight: 700; color: #111c30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct-roles { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.acct-roles .role-row { border-color: #e6edf6; background: #fff; }
.acct-roles .role-row.cur { border-color: #c6e0d0; background: #f4fbf7; }
.acct-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.acct-actions .btn { height: 28px; padding: 0 12px; font-size: 12px; }
.acct-actions .badge.active, .acct-phone .badge.active { background: #e8f8ef; color: #0f8a5f; }
.acct-actions .badge.busy, .acct-phone .badge.busy { background: #fff0dc; color: #c77c1a; }
.acct-actions .badge.idle, .acct-phone .badge.idle { background: #f1f5fa; color: #7b8798; }
.role-title { font-size: 12px; color: #93a1b4; margin-bottom: 4px; }
@media (max-width: 720px) {
  .account-list { grid-template-columns: 1fr; }
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 7px; color: #5b6b82; font-size: 13px; }
.form-grid input, .form-grid select { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 7px; color: #5b6b82; font-size: 13px; cursor: pointer; }
.check input { width: auto; height: auto; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.msg { font-size: 13px; color: #7d8ba1; }
.msg.error { color: var(--red); }
.msg.ok { color: #0f8a5f; }

/* ---------------- find / history ---------------- */
.merged-query-head { margin-top: 28px; }
.direct-lookup-card { border: 1px solid #dce9fc; }
.direct-toolbar .level { width: 130px; flex: 0 0 130px; }
.lookup-result { margin-top: 8px; }
.lookup-card { border: 1px solid #e5edf8; border-radius: 12px; background: #fbfdff; padding: 13px 15px; }
.lookup-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.lookup-kid { border-radius: 999px; background: #eaf2ff; color: #3f6fd8; padding: 4px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.lookup-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.lookup-copy.sm { padding: 4px 11px; font-size: 11.5px; }
.live-badge { border-radius: 999px; background: #e9f8ef; color: #0f8a5f; border: 1px solid #c2e9d3; padding: 4px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.lookup-section { border-top: 1px solid #e8eef7; margin-top: 14px; padding-top: 13px; }
.lookup-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: #334155; font-size: 13px; }
.lookup-section h3 span { color: #93a1b4; font-size: 11px; font-weight: 400; }
.lookup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lookup-note { margin-top: 12px; color: #708198; font-size: 12px; line-height: 1.6; }
.lookup-hint { color: #9aa8ba; font-size: 11.5px; }
.lookup-actions { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e2ebf7; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lookup-copy { border: 1px solid #c9dcfa; background: #f3f8ff; color: #2f6bd8; border-radius: 8px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.lookup-copy:hover { background: #e6f0ff; border-color: #a9c8f6; }
.lookup-copy:active { transform: translateY(1px); }
.lookup-copy-hint { color: #9aa8ba; font-size: 11.5px; }
.lookup-panel-cta { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e2ebf7; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.find-results { margin-top: 8px; }
.find-row {
  display: grid; grid-template-columns: 1.6fr .8fr .7fr 1.2fr 1.1fr;
  gap: 12px; align-items: center;
  padding: 14px 10px; border-bottom: 1px solid var(--line-2);
  font-size: 14px; cursor: pointer;
}
.find-row:hover { background: #f9fbff; }
.find-row:last-child { border-bottom: 0; }
.find-head { color: #8a97a8; font-size: 12px; font-weight: 600; cursor: default; }
.find-head:hover { background: transparent; }
.find-detail { height: 28px; padding: 0 10px; font-size: 12px; }
.queue-sub { color: #94a3b8; font-size: 10.5px; margin-top: 3px; white-space: nowrap; }
.queue-sub.help { color: #0f8a5f; }
/* 扫描记录 / 查询记录左右各一半：整页宽度下一行只占左边一小截，
   中间空出好几百像素，看着很散。对半分以后每行都紧凑了。 */
.history-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
}
.history-grid .card { min-width: 0; }        /* 不加这条，长文本会把网格撑破 */
/* 两个列表各自滚动：查询记录能有上百条，不限制高度的话页面要滚很久，
   而且左右两张卡长度差太多，短的下面会留一大块空白 */
.history-scroll { max-height: calc(100vh - 320px); min-height: 220px; overflow-y: auto; }

/* 宽屏下让这一页撑满一屏：卡片跟着视口长高，底部不留白。
   之前用 max-height: calc(100vh - 320px) 估算，估多了 —— 实际头部只占 120 左右，
   卡片下面空出 200 多像素。改成让 flex 自己算，卡片底边贴到 .main 的下内边距。 */
@media (min-width: 721px) {
  #page-history.active {
    display: flex; flex-direction: column;
    /* 用 height 而不是 min-height：min-height 只是下限，内容多高页面还是多高，
       列表就不会滚。这里把整页钉在一屏内，多出来的行交给列表自己滚。 */
    height: calc(100vh - 94px);              /* .main 上下 padding 34 + 60 */
    min-height: 480px;                       /* 窗口太矮时保底，交给页面滚 */
  }
  #page-history .history-grid { flex: 1 1 auto; min-height: 0; align-items: stretch; }
  #page-history .history-grid .card { display: flex; flex-direction: column; min-height: 0; }
  #page-history .history-scroll { flex: 1 1 auto; min-height: 160px; max-height: none; }
}

.history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 4px; border-bottom: 1px solid var(--line-2);
}
.history-row:last-child { border-bottom: 0; }
/* 半宽卡片里文本要能自己换行，不然会把按钮挤出去 */
.history-grid .history-row > div:first-child { min-width: 0; }
.history-kid { font-size: 16px; font-weight: 700; color: #172033; }
.history-meta { margin-top: 5px; color: #8a97a8; font-size: 12.5px; line-height: 1.55; }
/* 半宽卡片里这一行会折行，别让「详情 3375」被拆成「详情」/「3375」两行 */
.history-meta .nb { white-space: nowrap; }
.history-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; justify-content: flex-end; }
.history-actions .btn { height: 32px; padding: 0 12px; font-size: 12px; }

/* ---------------- logs ---------------- */
.log-item { border-bottom: 1px solid #eef2f7; }
.log-item:last-child { border-bottom: 0; }
.log-row { cursor: pointer; }
.log-row:hover { background: var(--bg-hover, #f6f9fc); }
.log-status {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; vertical-align: 1px;
}
.log-status.running { background: #eaf2ff; color: #2f6bdc; }
.log-status.done { background: #e8f8ef; color: #0f8a5f; }
.log-status.failed { background: #ffebeb; color: #d13b3b; }
.log-status.cancelled { background: #f1f5fa; color: #7b8798; }
.log-status.unknown { background: #f1f5fa; color: #7b8798; }
.log-err { margin-top: 4px; color: #d13b3b; font-size: 12px; }
.log-detail {
  margin: 0; padding: 14px 16px; background: #0f1b2d; color: #cfe3f7;
  border-radius: 10px; font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-all;
  max-height: 60vh; overflow-y: auto;
}
/* 展开在某一条任务下面，而不是跑到页面底部 */
.log-detail.log-inline {
  margin: 0 0 14px 0; max-height: 46vh;
  border: 1px solid #1d2c42;
}

/* ---------------- modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
/* 不用 backdrop-filter：弹层后面是上千行的表格，每帧重算背景模糊会明显掉帧 */
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,23,38,.52); }
.modal-card {
  position: relative; width: min(840px, calc(100vw - 32px));
  max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 70px rgba(8,23,38,.28);
  padding: 22px 24px 24px;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 19px; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.copy-btn { height: 34px; padding: 0 12px; font-size: 12px; }
.detail-item.copyable { cursor: pointer; transition: border-color .15s, background .15s; }
.detail-item.copyable:hover { border-color: #cfe0fb; background: #f4f8ff; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
.detail-item { background: #f8fafd; border: 1px solid #eef3f9; border-radius: 8px; padding: 8px 11px; }
.detail-item .k { color: #8a97a8; font-size: 11px; }
.detail-item .v { color: #172033; font-size: 13px; margin-top: 2px; word-break: break-all; }
.detail-section { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.detail-section:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.detail-section h3 {
  margin: 0 0 8px; font-size: 14px; display: flex;
  justify-content: space-between; align-items: center; gap: 12px;
}
.detail-section h4 { margin: 8px 0 5px; font-size: 12px; color: #5b6b82; }
.section-count {
  font-size: 11px; color: #7d8ba1; background: #f1f5fa;
  padding: 3px 8px; border-radius: 999px; font-weight: 500;
}
.mini-table-wrap { overflow-x: auto; }
.mini-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 12.5px; }
.mini-table th {
  background: #eff5ff; color: #5a6b82; padding: 8px 10px;
  text-align: left; white-space: nowrap; font-weight: 600;
}
.mini-table td { padding: 9px 10px; border-bottom: 1px solid #edf2f8; vertical-align: top; }
.mini-table tr:last-child td { border-bottom: 0; }
.march-behavior { color: #172033; font-weight: 600; }
.soldier-text { color: #45546a; line-height: 1.5; min-width: 200px; }
.no-data { color: #9aa8ba; font-size: 12.5px; padding: 3px 0; }
.detail-loading { color: #8a97a8; font-size: 13px; margin-top: 12px; }
.detail-loading.error { color: var(--red); }
.sub { color: #94a3b8; font-size: 11px; margin-top: 3px; line-height: 1.4; }
.march-list, .help-list { display: flex; flex-direction: column; gap: 7px; }
.march-card, .help-card {
  border: 1px solid #e8eef7; border-radius: 9px;
  background: #fbfdff; padding: 9px 12px;
}
.march-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.march-head b { font-size: 13.5px; color: #172033; }
.march-index {
  width: 18px; height: 18px; border-radius: 50%; background: #eaf1ff;
  color: #3f6fd8; font-size: 10.5px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto;
}
.march-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px 14px; }
.march-field .k { color: #8a97a8; font-size: 11px; }
.march-field .v { color: #253247; font-size: 12.5px; line-height: 1.5; word-break: break-all; }
.march-field.span-all { grid-column: 1 / -1; }
.lookup-card .lookup-title { margin-bottom: 10px; }
.state-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef4ff; color: #3f6fd8; font-size: 11px; white-space: nowrap;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed; right: 26px; bottom: 26px; z-index: 80;
  max-width: 360px; padding: 12px 16px;
  border-radius: 10px; background: #10233a; color: #eaf2ff;
  font-size: 13px; box-shadow: 0 12px 30px rgba(8,23,38,.25);
}
.toast[hidden] { display: none; }
.toast.error { background: #7f1d1d; }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) {
  .sidebar { width: 86px; padding: 24px 10px; }
  .brand { justify-content: center; padding: 0 0 18px; margin-bottom: 24px; }
  .brand-mark { width: 48px; height: 48px; border-radius: 15px; }
  .snow { width: 26px; height: 26px; }
  .brand-text, .nav-label, .nav-text, .sidebar-bottom { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-icon { width: 22px; height: 22px; }
  .main { margin-left: 86px; padding: 26px; }
}
@media (max-width: 720px) {
  .app { display: flex; flex-direction: column; }
  .sidebar {
    position: static; width: 100%; height: auto; flex-direction: row;
    align-items: center; padding: 12px 14px; gap: 12px; overflow: visible;
  }
  .brand { margin: 0; padding: 0; border: 0; gap: 8px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .snow { width: 22px; height: 22px; }
  .brand-text { display: block; }
  .brand-text h1 { font-size: 14px; letter-spacing: .5px; }
  .brand-owner { margin-top: 3px; font-size: 9px; letter-spacing: .8px; }
  .brand-sub { display: none; }
  .nav { flex: 1; flex-direction: row; justify-content: flex-end; gap: 2px; }
  .nav-item { width: 42px; height: 40px; }
  .main { margin-left: 0; padding: 18px 14px 40px; }
  .topbar { flex-wrap: wrap; }
  .kid-input { width: 100%; flex: 1 1 100%; }
  .topbar .btn { flex: 1; }
  .scan-row { gap: 10px; }
  .scan-row .btn { height: 48px; }
  .card { padding: 18px 16px; }
  .toolbar { flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .level { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .export-actions { flex-direction: column; }
  .find-row { grid-template-columns: 1.5fr 1fr .7fr; }
  .find-row > :nth-child(4), .find-row > :nth-child(5) { display: none; }
  .history-row { flex-direction: column; align-items: flex-start; }
  .history-grid { grid-template-columns: 1fr; }
  /* 单列时也留个上限，不然上百条查询记录能把页面拉成一万多像素 */
  .history-scroll { max-height: 70vh; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .direct-toolbar .level { width: 110px; flex: 0 0 110px; }
  .lookup-grid { grid-template-columns: 1fr; }
  .modal-card { width: calc(100vw - 16px); padding: 18px 16px; }
  .mini-table { min-width: 680px; }
  .march-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- 战力对比 ---------------- */
.compare-vs {
  color: var(--muted); font-weight: 700; font-size: 14px;
  white-space: nowrap; letter-spacing: .5px; text-align: center;
  flex: 0 0 auto; width: 22px;
}

/* 「对比设置」一行放完：区服组 + 联盟组 + 按钮组。
   区服号就 4 位数，输入框给 84px 够了，省下来的宽度留给联盟下拉，
   这样两组能并排，不用上下两行（两行不管怎么排都会剩一块空）。
   组内 gap 小、组间 gap 大，靠疏密区分分组，不需要分隔线。 */
.compare-form {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 18px; margin-top: 18px;
}
.cmp-group { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cmp-group[hidden] { display: none; }
.cmp-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cmp-kid { width: 84px; flex: 0 0 84px; text-align: left; }
.compare-tail { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-left: auto; }

.ally-select {
  width: 182px; flex: 0 0 182px; height: 44px;
  padding: 0 8px 0 12px; border: 1px solid #dfe8f3; border-radius: 8px;
  background: #fbfdff; color: var(--ink); font-size: 13px; font-family: inherit;
  cursor: pointer;
}
.ally-select:focus { outline: none; border-color: #a7c2f4; box-shadow: 0 0 0 3px rgba(63,124,243,.08); background: #fff; }
.ally-select:disabled { background: #f4f7fb; color: #9aa7b8; cursor: not-allowed; }
.cmp-clear { height: 44px; padding: 0 12px; font-size: 13px; }

/* 区服进度：两个输入框 + 两个按钮，一行放完。天数框宽一点（最多 4 位），
   按钮组用 margin-left:auto 贴右边，这样区号/天数在左、操作在右，一眼能对上。 */
.progress-form {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 18px; margin-top: 18px;
}
.pf-item { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cmp-day { width: 108px; flex: 0 0 108px; text-align: left; }
.progress-tail { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-left: auto; }

/* 播报文本：等宽字体 + 浅底卡片，方便直接 Ctrl+A 复制到群里 */
.progress-text {
  margin: 14px 0 0; padding: 16px 18px;
  background: #f7fafd; border: 1px solid #e3ecf6; border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.95; color: #243447;
  white-space: pre-wrap; word-break: break-word; user-select: text;
}

/* 估算出来的天数不是实打实读到的，卡片头的来源说明标黄提醒一下 */
.hint.warn { color: #b7791f; }

/* 状态行和联盟提示共用一行：状态在左，提示靠右，都是小字 */
.compare-foot {
  display: flex; align-items: baseline; gap: 16px;
  margin-top: 12px; flex-wrap: wrap;
}
.compare-foot .status { margin: 0; flex: 1 1 auto; min-width: 0; }
.compare-foot #compareAllyMeta { flex: 0 0 auto; white-space: nowrap; }

/* 联盟全员模式的标记：数据来源和「排行榜前 100」不一样，得让人一眼看出来 */
.full-badge {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  background: #dcfce7; color: #15803d; font-size: 11px; font-weight: 700;
  vertical-align: 1px;
}

.compare-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0;
}
.compare-tab {
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.compare-tab:hover { border-color: var(--blue-2); color: var(--blue); }
.compare-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.compare-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 16px 0;
}
.compare-summary.four { grid-template-columns: repeat(4, 1fr); }
.compare-sum-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.compare-sum-name { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.compare-sum-vals { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.compare-sum-vals .val-a { font-size: 18px; font-weight: 700; color: var(--blue); }
.compare-sum-vals .val-b { font-size: 18px; font-weight: 700; color: var(--muted); }
.compare-sum-val { font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.compare-sum-val.win { color: var(--green); }
.compare-sum-val.lose { color: var(--muted); }
.compare-sum-val.tie { color: var(--muted); }
.compare-sum-val.verdict { font-size: 17px; }
.compare-sum-val.verdict.win-a { color: var(--green); }
.compare-sum-val.verdict.win-b { color: var(--green); }
.compare-sum-val.verdict.tie { color: var(--muted); }
.compare-sum-diff { font-size: 12px; font-weight: 600; }
.compare-sum-diff.win-a { color: var(--blue); }
.compare-sum-diff.win-b { color: var(--green); }
.compare-sum-diff.tie { color: var(--muted); }

.compare-card { margin-bottom: 14px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th {
  text-align: left; padding: 9px 10px; color: var(--muted);
  font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--line);
  background: #f8fafc; white-space: nowrap;
}
.compare-table th.c { text-align: center; }
.compare-table th.r { text-align: right; }
.compare-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.compare-table td.c { text-align: center; }
.compare-table td.r { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.compare-table td.r.win { color: var(--green); font-weight: 700; }
.compare-table td.r.lose { color: var(--muted-2); }
.compare-table .rank-idx { color: var(--muted-2); font-weight: 600; width: 32px; }
.compare-table .pname { font-weight: 600; }
/* 玩家名下面那行联盟：太长就省略号，鼠标悬停看全名（title） */
.compare-table .pally {
  margin-top: 3px; max-width: 200px; margin-left: auto; margin-right: auto;
  color: #7d8ba1; font-size: 12px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compare-table .lead-mark {
  display: inline-block; margin-right: 4px; font-size: 11px; color: var(--green);
  vertical-align: 1px;
}

@media (max-width: 720px) {
  .compare-summary, .compare-summary.four { grid-template-columns: 1fr 1fr; }
  /* 窄屏一行放不下，按组换行：标签独占一行，控件平分 */
  .compare-form { gap: 12px; }
  .cmp-group { flex-wrap: wrap; width: 100%; gap: 8px; }
  .cmp-label { width: 100%; }
  .cmp-kid, .ally-select { flex: 1 1 110px; width: auto; }
  .compare-vs { display: none; }
  .compare-tail { width: 100%; }
  .compare-tail .btn { flex: 1; }
  .compare-foot { flex-direction: column; gap: 6px; }
  .compare-foot #compareAllyMeta { white-space: normal; }
  /* 区服进度：窄屏同样按组换行，按钮平分整行 */
  .progress-form { gap: 12px; }
  .pf-item { width: 100%; }
  .cmp-day { flex: 1 1 110px; width: auto; }
  .progress-tail { width: 100%; margin-left: 0; }
  .progress-tail .btn { flex: 1; }
}


/* ---------------- account info ---------------- */
.acct-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0;
}
.acct-stat {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 12px; padding: 14px 16px; color: #fff;
}
.acct-stat-name { font-size: 12px; opacity: .9; margin-bottom: 6px; }
.acct-stat-val { font-size: 20px; font-weight: 700; }
.acct-stat-sub { font-size: 11px; opacity: .85; margin-top: 4px; }

.acct-card { margin-bottom: 14px; }
.acct-card-yellow { background: #fffbeb; border-color: #fde68a; }
/* 账号资产：保存为图片按钮条（截图时会被临时隐藏） */
.acct-save-bar { display: flex; justify-content: flex-end; gap: 8px; margin: 14px 0 4px; }
.acct-save-bar .btn { height: 30px; padding: 0 14px; font-size: 12px; }
/* 账号资产：卡片头部右侧的徽标 + 刷新按钮 */
.card-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.card-head-actions .btn.small { height: 26px; padding: 0 10px; font-size: 12px; }
/* 账号资产：角色列表折叠 */
.role-collapse { margin-top: 10px; }
.role-collapse > summary { cursor: pointer; font-size: 13px; color: #2b6cb0; padding: 6px 0; user-select: none; }
.role-collapse > summary:hover { text-decoration: underline; }
.role-collapse[open] > summary { margin-bottom: 8px; }
.acct-kv {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 2px; border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.acct-kv:last-child { border-bottom: none; }
.acct-label { color: var(--muted); font-weight: 600; }
.acct-val { font-weight: 600; }
.acct-val.blue { color: var(--blue); }
.acct-cache { margin-top: 10px; font-size: 12px; color: var(--muted-2); }

@media (max-width: 720px) {
  .acct-cards { grid-template-columns: 1fr; }
}

/* ---------------- 地图与玩家页排版优化（main_v4） ---------------- */
/* .hint 原先没有任何样式，吃的是浏览器默认段边距，白占高度 */
.hint {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* 顶部控制区收紧 */
#page-map .topbar { margin-bottom: 12px; }
#page-map .kid-input { height: 46px; font-size: 17px; }
#page-map .scan-row { gap: 12px; margin-bottom: 4px; }
#page-map .scan-row .btn { height: 46px; font-size: 14px; }
#page-map .status { margin: 10px 2px 12px; }

/* 查询区小标题：一行放完，不再用 24px 大标题占两行 */
.section-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 14px 0 12px;
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* 两张查询卡并排，省掉一整块纵向空白 */
.query-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
#page-map .query-grid > .card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
/* 两张卡的标题行、说明行、输入行都对齐到同一水平线 */
#page-map .query-grid .card-head { min-height: 26px; }
#page-map .query-grid .lookup-result,
#page-map .query-grid .find-results { flex: 1; }

/* 卡片与工具栏整体收紧 */
#page-map .card { padding: 18px 20px; margin-bottom: 14px; }
#page-map .toolbar { margin: 12px 0 10px; }
#page-map .lookup-result,
#page-map .find-results { margin-top: 6px; }
/* 空状态从 44px 压到 14px，避免一张卡空一大片 */
#page-map .lookup-result .empty,
#page-map .find-results .empty { padding: 14px 12px !important; font-size: 12.5px; }
#page-map .direct-toolbar .level { width: 110px; flex: 0 0 110px; }

/* 导出卡改横向：说明在左，按钮在右 */
.export-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.export-card .export-info { min-width: 0; }
.export-card h2 { margin: 0 0 4px; font-size: 15px; }
.export-card p { margin: 0; color: #8794a7; font-size: 12.5px; line-height: 1.5; }
.export-card .export-actions { flex: 0 0 auto; }
.export-card .btn.wide { width: auto; height: 40px; padding: 0 20px; font-size: 13.5px; }

/* 中等屏：两列会挤，改成上下堆叠 */
@media (max-width: 1280px) {
  .query-grid { grid-template-columns: 1fr; }
}
/* 窄屏：导出卡也改回上下 */
@media (max-width: 860px) {
  .export-card { flex-direction: column; align-items: stretch; }
  .export-card .btn.wide { width: 100%; }
}

/* ---------------- 查询区下沉到页尾（main_v4） ---------------- */
/* 顶部「玩家查询 ↓」：把工具入口放右上角，不打断扫描主流程 */
.query-jump {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 16px;
  font-size: 13.5px;
  white-space: nowrap;
}

/* 页尾查询区：一条细分隔线，和上面的数据表分开 */
#querySection {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #e9eff7;
}
#querySection .section-head { margin: 0 0 12px; }
#querySection .query-grid > .card { margin-bottom: 0; }

@media (max-width: 860px) {
  .query-jump { height: 42px; padding: 0 12px; font-size: 13px; }
}

/* ---------------- 玩家数据表：排序 / 筛选 / 分页（main_v4） ---------------- */
/* 8 列后整体收一点内边距，避免一行太松 */
#page-map .players { min-width: 900px; }
#page-map .players td { padding: 13px 14px; }
#page-map .players th { padding: 12px 14px; }

/* 可排序表头 */
.players th.sortable { cursor: pointer; user-select: none; }
.players th.sortable:hover { color: var(--blue-2); }
.players th.sortable::after { content: '↕'; margin-left: 5px; font-size: 10px; opacity: .35; }
.players th.sortable.sorted { color: var(--blue-2); }
.players th.sortable.sorted::after { content: '↓'; opacity: 1; }
.players th.sortable.sorted[data-dir="asc"]::after { content: '↑'; }

/* 新增列：数字用等宽数字，扫视时不跳动 */
#page-map .players td.power { font-variant-numeric: tabular-nums; font-weight: 600; color: #2b3a52; }
#page-map .players td.coord { font-variant-numeric: tabular-nums; color: #5a6b82; }
.shield-tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.shield-tag.on { background: #e7f7ef; color: #0f8a5f; }
.shield-tag.off { background: #f1f4f9; color: #7c8ba1; }
.shield-tag.none { background: #fdecec; color: #d9534f; }

/* 燃烧标记 */
.tag-burn {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  border-radius: 4px; background: #fff1e6; color: #c26a15;
  font-size: 11px; font-weight: 600; vertical-align: 1px;
}

/* 状态快捷筛选 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -2px 0 14px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 15px;
  border: 1px solid #e2eaf5; background: #f8fafd; color: #5a6b82;
  font-size: 12.5px;
}
.chip:hover { border-color: #cfdcf0; }
.chip.active { background: #eaf2ff; border-color: #bcd4fa; color: var(--blue-2); font-weight: 600; }

/* 下拉框：和 .level 输入框保持同一视觉 */
.pick {
  height: 44px; padding: 0 10px; border-radius: 8px;
  border: 1px solid #dce6f2; background: #fff; color: var(--ink);
  font-size: 13.5px; outline: none; max-width: 190px;
}
.pick:focus { border-color: #9dbcf3; box-shadow: 0 0 0 3px rgba(63,124,243,.10); }

/* 分页条 */
.pager-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-top: 6px;
}
.pager-bar .pager { padding: 12px 0 2px; justify-content: flex-start; }
.pager-size { color: #8a97a8; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.pager-size .pick { height: 32px; font-size: 12.5px; max-width: 76px; }
.pager-info { color: #8a97a8; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pager-jump {
  width: 52px; height: 28px; text-align: center; border-radius: 6px;
  border: 1px solid #e2eaf5; background: #fff; color: #4a5a70;
  font-size: 13px; outline: none;
}
.pager-jump:focus { border-color: #9dbcf3; }

/* ---------------- 表头吸顶 + 表格窗口只显示 5 行（main_v4） ---------------- */
/* 高度不写死：由 fitTableHeight() 按当前行高算出表头 + 5 行的实际高度 */
#page-map .table-wrap {
  overflow: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;   /* 滚到底不要带着整页一起滚 */
}

#page-map .players thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eff5ff;
  box-shadow: inset 0 -1px 0 #e2eaf5;
}

/* 滚动条细一点，别把表格挤窄 */
#page-map .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
#page-map .table-wrap::-webkit-scrollbar-thumb {
  background: #dbe4f0; border-radius: 5px; border: 2px solid #fff;
}
#page-map .table-wrap::-webkit-scrollbar-thumb:hover { background: #c8d5e6; }
#page-map .table-wrap::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 顶部控制区压成两行（main_v4） ---------------- */
/* 第 1 行：区服 + 载入 + 扫描控制 + 导出 + 玩家查询 */
#page-map .ctrl-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
#page-map .ctrl-bar .kid-input {
  flex: 0 0 108px; width: 108px; height: 44px;
  padding: 0 10px; font-size: 16px; text-align: center;
}
#page-map .ctrl-bar .btn { height: 44px; padding: 0 15px; font-size: 13.5px; }
#page-map .ctrl-spacer { flex: 1 1 0; min-width: 6px; }

/* 第 2 行：账号健康 + 载入信息，共用一行 */
#page-map .status-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
#page-map .status-bar .status {
  flex: 1 1 220px; min-width: 0; min-height: 0; margin: 0;
  font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- 顶部控制卡：与「玩家查询」两张卡同一套语言 ---------------- */
/* 卡片本身沿用 .card 的内边距和阴影，这里只处理卡内两处内联元素 */
#page-map .ctrl-card .card-head { margin-bottom: 12px; }
#page-map .ctrl-card .ctrl-bar { margin-bottom: 0; }
#page-map .ctrl-card .status {
  margin: 10px 0 0; min-height: 0; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 详情格子的副行（如保护罩剩余时间） */
.detail-item .sub {
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0f8a5f;
}

/* 查询卡在宽屏是两列并排，卡内详情格只有 ~80px，4 列会把文字拆成竖条 */
.lookup-card .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* ≤1280px 时 query-grid 变单列，卡片变宽，回到 4 列 */
@media (max-width: 1280px) {
  .lookup-card .detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 运行日志：展开其余按钮 */
.log-more-wrap { display: flex; justify-content: center; padding: 14px 0 6px; }


/* 账号资产：第一步/第二步折叠卡片（summary 当标题栏用） */
.card-step { padding: 0; }
.card-step > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 26px; cursor: pointer; list-style: none; user-select: none;
}
.card-step > summary::-webkit-details-marker { display: none; }
.card-step > summary::before {
  content: '\25B8'; font-size: 12px; color: #64748b; margin-right: 6px; flex-shrink: 0;
}
.card-step[open] > summary::before { content: '\25BE'; }
.card-step > summary h2 { margin: 0; font-size: 17px; flex: 1; }
.card-step[open] > summary { border-bottom: 1px solid #eef2f7; }
.card-step-body { padding: 16px 26px 20px; }


/* 账号资产：第一步（登录）/ 第二步（选角色）合并成左右两栏（等高 + 边角规整） */
.acct-two-col {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;          /* 两列等高，分隔线才能上下贯通 */
}
.acct-col { min-width: 0; display: flex; flex-direction: column; }
.acct-col-login {
  padding-right: 24px;
  border-right: 1px solid #eef2f7;   /* 分隔线跟着左列高度走（卡片内边距 24px 上下留白） */
}
.acct-col-roles { padding-left: 24px; }
.acct-col > h2, .acct-col-head h2 {
  margin: 0 0 8px; font-size: 17px; line-height: 1.35;
}
.acct-col-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.acct-col-head h2 { margin: 0; flex: 1; }
.acct-col-head .badge { flex-shrink: 0; }
.acct-col-head .btn.small { flex-shrink: 0; height: 26px; padding: 0 10px; }
.acct-login-form { grid-template-columns: 1fr; gap: 10px; }
.acct-login-row {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px; width: 100%;
}
.acct-login-row .btn { width: 100%; }
.acct-col-login .msg { display: block; margin-top: 8px; min-height: 18px; }
/* 右侧角色列表：撑满剩余高度，滚动在卡片内 */
.acct-col-roles .role-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

@media (max-width: 900px) {
  .acct-two-col { grid-template-columns: 1fr; }
  .acct-col-login {
    padding-right: 0; border-right: 0;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 18px; margin-bottom: 18px;
  }
  .acct-col-roles { padding-left: 0; }
}


/* 角色行（账号资产 / 已登录账号 通用一行式） */
.acct-role-item { border-bottom: 1px solid #f1f5f9; padding: 7px 6px; }
.acct-role-item:last-child { border-bottom: 0; }
.acct-role-item.cur { background: #f4fbf7; border-radius: 6px; border-bottom-color: transparent; }
.acct-role-name { font-weight: 700; font-size: 13.5px; color: #111c30; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-role-meta { font-size: 13px; color: #64748b; flex-shrink: 0; }


/* 账号资产：左侧「添加账号」折叠后不被等高拉伸 */
.connect-login.card-step { align-self: start; }
.connect-login.card-step > summary { padding: 16px 20px; }
.connect-login.card-step .card-step-body { padding: 0 20px 16px; }
.connect-login.card-step > summary h2 { font-size: 16px; }


/* 账号资产：角色折叠（原生 details，和游戏连接的 .acct-others-wrap 分开） */
.acct-role-details { margin-top: 4px; }
.acct-role-details { margin-top: 6px; }
.acct-role-details > summary {
  display: inline-flex; align-items: center; gap: 4px;   /* 按内容宽度，右侧不再留大片空白 */
  cursor: pointer; list-style: none; user-select: none;
  font-size: 12px; color: #2b6cb0; padding: 3px 10px;
  border: 1px solid #dbe7f3; border-radius: 12px; background: #f7fbff;
}
.acct-role-details > summary:hover { background: #eef6ff; border-color: #c3daf0; }
.acct-role-details > summary::-webkit-details-marker { display: none; }
.acct-role-details > summary::before { content: '\25B8 '; font-size: 11px; }
.acct-role-details[open] > summary::before { content: '\25BE '; }


/* 账号资产：#aiRoles 用 role-list 会带 gap:8px，和游戏连接（.acct-others-wrap 无 gap）不一致 → 清零 */
#aiRoles { margin-top: 6px; gap: 0; }


/* 账号资产：查询操作条（并进「选择角色」卡片底部） */
.ai-query-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: auto; padding-top: 16px; border-top: 1px solid #eef2f7;
}
.ai-query-bar .btn { flex-shrink: 0; }
.ai-query-bar .msg { font-size: 13px; color: #64748b; line-height: 1.5; }

.connect-list > .role-list { flex: 1 1 auto; min-height: 0; }


/* ===== 游戏连接：token 登录折叠区 ===== */
.connect-token { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.connect-token > summary { cursor: pointer; font-size: 13px; color: #2b6cb0; user-select: none; padding: 2px 0; }
.connect-token > summary:hover { text-decoration: underline; }
.connect-token[open] > summary { margin-bottom: 8px; }
.connect-token .muted { font-size: 12px; line-height: 1.5; margin: 4px 0 10px; }
.connect-token .connect-form label { font-size: 12.5px; }
.connect-token .connect-form input { font-size: 13px; }


/* token 登录输入框：一整串很长，用多行文本框更好粘 */
.token-box {
  width: 100%; box-sizing: border-box; margin: 8px 0 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.5;
  resize: vertical; min-height: 68px; word-break: break-all;
}
.token-box:focus { outline: none; border-color: var(--blue); }
.connect-token code { background: #f1f5fb; padding: 1px 5px; border-radius: 4px; font-size: 12px; }


/* ===== 号池：主力 / 使用中 标记 ===== */
.acct-flag {
  display: inline-block; padding: 1px 6px; border-radius: 5px;
  font-size: 11px; line-height: 1.5; font-weight: 600; white-space: nowrap;
}
.acct-flag.primary { background: #e8f1ff; color: #1a5fb4; border: 1px solid #c5dafb; }
.acct-flag.active  { background: #e9f7ee; color: #1f7a3d; border: 1px solid #c2e6cf; }


/* ===== 号池：当前运行横幅 ===== */
.active-banner {
  display: none; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 6px 0 12px; padding: 10px 14px;
  background: linear-gradient(180deg, #f2f8ff, #e8f2ff);
  border: 1px solid #cfe2ff; border-radius: 10px;
}
.active-banner.on { display: flex; }
.ab-tag { font-size: 11px; font-weight: 700; color: #fff; background: #2b6cb0; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.ab-tag.warn { background: #c05621; }
.ab-acct { font-weight: 600; color: #1a365d; }
.ab-arrow { color: #8aa4c8; }
.ab-role { font-weight: 600; color: #1a5fb4; }
.ab-meta { font-size: 12px; color: #5b7ba3; }
.ab-bad { font-size: 12px; color: #b83232; background: #fff0f0; padding: 1px 6px; border-radius: 5px; }
.ab-spacer { flex: 1 1 auto; }
.ab-note { font-size: 11.5px; color: #8aa4c8; white-space: nowrap; }

/* 账号级：主力 / 备用 · 运行中 / 待命 */
.acct-flag.standby { background: #f3f5f8; color: #6b7a8f; border: 1px solid #e2e7ee; }
.acct-flag.running { background: #e9f7ee; color: #1f7a3d; border: 1px solid #c2e6cf; }
.acct-flag.idleflag { background: #f7f8fa; color: #98a2b3; border: 1px solid #eaedf2; }
.role-preset { font-size: 11.5px; color: #98a2b3; padding: 1px 6px; border-radius: 5px; background: #f5f7fa; }

.acct-flag.retired { background: #fdecec; color: #b83232; border: 1px solid #f5c2c2; }

.qh-target { margin: 0 8px; color: #1f2937; font-weight: 600; font-size: 13px; }
.qh-target::before { content: ''; }

.qh-target.first { margin-left: 0; }

.cross-tag { display: inline-block; margin-right: 6px; padding: 2px 8px; border-radius: 10px; background: #fef3c7; color: #b45309; font-size: 12px; font-weight: 600; }

.cf-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 9998; }
.cf-box { position: fixed; z-index: 9999; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(720px, 92vw); max-height: 80vh; display: flex; flex-direction: column; gap: 10px;
  background: #fff; border-radius: 12px; padding: 18px 18px 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.cf-title { font-size: 14px; color: #1f2937; }
.cf-text { flex: 1; min-height: 260px; max-height: 56vh; resize: none; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #f9fafb; }
.cf-actions { display: flex; justify-content: flex-end; }

.lookup-view { border: 1px solid #93c5fd; background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.lookup-view:hover { background: #dbeafe; }

.scan-actions-extra { display: flex; justify-content: flex-end; margin: 8px 0 2px; }

.scan-extra-row { display: flex; justify-content: flex-end; margin: 10px 0 2px; }

/* modal-compact-v2：宽弹窗（玩家数据）——头部紧凑、内容区独立滚动 */
.modal-card.modal-wide {
  width: min(1560px, 97vw);
  max-width: 97vw;
  height: 88vh;              /* 固定高度撑满，别让内容少时缩成一条 */
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 10px;
  overflow: hidden;          /* 滚动交给内层 table-wrap */
}
.modal-wide .modal-head {
  margin-bottom: 8px;
  flex: 0 0 auto;
}
.modal-wide .modal-head h2 { font-size: 18px; }
.modal-wide .modal-head .meta { flex: 1; text-align: center; font-size: 12.5px; color: #6b7280; }
.modal-body-pad {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.modal-wide .toolbar {
  flex: 0 0 auto;
  margin: 0 0 8px;
}
.modal-wide .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

/* 【2026-11-14】层级：详情弹窗(#modal) 要压在玩家数据弹窗(#playersModal) 之上，
   否则从玩家数据里点「查看详情」，新弹窗会被下面那个盖住，看起来像"跳到外面去了"。 */
#modal { z-index: 60; }
#playersModal { z-index: 50; }

.modal-wide .toolbar { flex-wrap: wrap; gap: 8px; }
.modal-wide .toolbar .level { width: 112px; }   /* 加宽，placeholder 不被截断 */
.modal-wide .toolbar .search { min-width: 160px; flex: 0 1 260px; }   /* 搜索框别占太宽 */

/* modal-perf：1052 行渲染会卡，用 content-visibility 让屏幕外的行不参与布局/绘制 */
#playersModal #playerRows tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 78px;   /* 大概行高，避免滚动条跳动 */
}
/* 表格固定布局，避免未渲染行的列宽抖动 */
#playersModal .players { table-layout: fixed; }
#playersModal .players th:nth-child(1), #playersModal .players td:nth-child(1) { width: 26%; }
#playersModal .players th:nth-child(2), #playersModal .players td:nth-child(2) { width: 9%; }
#playersModal .players th:nth-child(3), #playersModal .players td:nth-child(3) { width: 11%; }
#playersModal .players th:nth-child(4), #playersModal .players td:nth-child(4) { width: 8%; }
#playersModal .players th:nth-child(5), #playersModal .players td:nth-child(5) { width: 9%; }
#playersModal .players th:nth-child(6), #playersModal .players td:nth-child(6) { width: 9%; }
#playersModal .players th:nth-child(7), #playersModal .players td:nth-child(7) { width: 150px; }

/* 重置 / 导出 推到工具栏右侧 */
.modal-wide .toolbar #resetBtn { margin-left: auto; }
.modal-wide .toolbar #pmExportBtn { margin-left: 0; }

/* 虚拟滚动配套：行高必须固定，否则算出来的滚动位置会对不上 */
#playersModal #playerRows > tr { height: 78px; }
#playersModal #playerRows > tr > td { overflow: hidden; }
#playersModal #playerRows > tr > td.pinfo .pname,
#playersModal #playerRows > tr > td.pinfo .pmeta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 首页底部：最近查询 + 运行状态 ---------------- */
.home-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}
@media (max-width: 1180px) { .home-bottom { grid-template-columns: 1fr; } }
.home-bottom .card { margin: 0; }
.home-more { font-size: 12.5px; color: #3b82f6; cursor: pointer; user-select: none; }
.home-more:hover { text-decoration: underline; }

.recent-list { display: flex; flex-direction: column; min-height: 40px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid #f1f4f9;
}
.recent-item:last-child { border-bottom: 0; }
.recent-tag {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px;
  background: #eef2ff; color: #4338ca;
}
.recent-tag.find { background: #fef3c7; color: #b45309; }
.recent-tag.cmp  { background: #e0f2fe; color: #0369a1; }
.recent-who { flex: 1 1 auto; min-width: 0; }
.recent-n {
  font-size: 13.5px; font-weight: 600; color: #1f2937;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-m {
  font-size: 11.5px; color: #8b95a5; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-when { flex: 0 0 auto; font-size: 12px; color: #9aa3b2; }
.recent-act {
  flex: 0 0 auto; font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid #d6e2f5; background: #f5f9ff; color: #2563eb;
}
.recent-act:hover { background: #e8f1ff; }

.stat-list { display: flex; flex-direction: column; gap: 13px; }
.stat-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.stat-k { flex: 0 0 46px; color: #8b95a5; font-size: 12.5px; padding-top: 1px; }
.stat-v { flex: 1 1 auto; color: #1f2937; font-weight: 600; line-height: 1.5; }
.stat-v small { font-weight: 400; color: #6b7280; }
.stat-v .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; margin-right: 5px; vertical-align: 1px;
}
.stat-v .dot.warn { background: #f59e0b; }
.stat-bar { height: 6px; border-radius: 3px; background: #eef2f7; overflow: hidden; margin-top: 6px; }
.stat-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #60a5fa, #3b82f6); }

/* ---------------- 首页一屏（用户要求不滚动）---------------- */
/* 原来总高 ~923px，视口 ~800px，需要压掉 120+ px */
#page-map > .card { padding: 11px 16px; }
#page-map > .card .ctrl-bar { margin: 0 0 2px; }
#page-map > .card .status { margin-top: 6px; font-size: 12px; }

#querySection { margin-top: 10px; }
#querySection .section-head { margin-bottom: 8px; }
#querySection .section-head h2 { font-size: 15px; }
#querySection .section-head p { font-size: 11.5px; }
#querySection .card { padding: 11px 16px; }
#querySection .card h3 { font-size: 14.5px; margin-bottom: 2px; }
#querySection .card .card-sub { font-size: 11.5px; margin-bottom: 8px; }
#querySection .card .lookup-row { margin-bottom: 4px; }
#querySection .card .lookup-hint { font-size: 11px; margin-top: 6px; }

.home-bottom { margin-top: 10px; gap: 14px; }
.home-bottom .card { padding: 11px 16px; }
.home-bottom .card-head { margin-bottom: 6px; }
.home-bottom .card-head h2 { font-size: 15px; }

.recent-item { padding: 7px 4px; gap: 10px; }
.recent-n { font-size: 13px; }
.recent-m { font-size: 11px; margin-top: 1px; }
.recent-when { font-size: 11.5px; }
.recent-act { padding: 3px 9px; font-size: 11.5px; }

.stat-list { gap: 9px; }
.stat-row { font-size: 12.5px; }
.stat-k { font-size: 12px; }
.stat-v small { font-size: 11.5px; }
.stat-bar { margin-top: 4px; }

/* 一屏收紧（803px → 目标 780 以内，留 20px 余量给不同窗口） */
.home-bottom { margin-top: 6px; }
#querySection { margin-top: 8px; }
#page-map > .card { padding: 10px 16px; }
#page-map { padding-bottom: 4px; }
.recent-item { padding: 6px 4px; }
.stat-list { gap: 8px; }

/* 扫描卡片右侧两个按钮对齐（查看玩家数据 / 导出 Excel） */
.ctrl-bar { align-items: center; }
.ctrl-bar > .btn { display: inline-flex; align-items: center; justify-content: center; }
#openPlayersBtn, #xlsxBtn { height: 38px; line-height: 1; }

/* 运行状态独占整行（最近查询已移除），指标横排 */
.home-bottom { grid-template-columns: 1fr; }
.home-bottom .stat-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px 40px;
  align-items: flex-start;
}
.home-bottom .stat-row { flex: 0 0 auto; min-width: 240px; }
.home-bottom .stat-k { flex: 0 0 auto; min-width: 42px; }
/* 查看玩家数据 与 导出 Excel 并排时的对齐 */
#openPlayersBtn, #xlsxBtn { min-width: 104px; }

/* 2026-11-16 用户要求：三个区块标题字号统一（地图扫描 / 玩家查询 / 运行状态）
   放在文件末尾 = 覆盖前面 @media(max-width:1180px) 里的 15px，桌面和窄屏都一致 */
.ctrl-card .card-head h2,
#querySection .section-head h2,
.home-bottom .card-head h2 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }

/* 2026-11-16 战力对比：对位表改成卡片式（左 A区 | 中间名次+领先徽章 | 右 B区） */
.cmp-list { display: flex; flex-direction: column; }
.cmp-row { display: grid; grid-template-columns: 1fr 86px 1fr; align-items: center;
           gap: 10px; padding: 10px 6px; border-top: 1px solid #eef2f7; }
.cmp-row:hover { background: #fbfdff; }
.cmp-side { min-width: 0; }
.cmp-side.b { text-align: right; }
.cmp-nick { font-size: 14px; font-weight: 650; color: var(--ink);
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-ally { font-size: 11.5px; color: var(--muted); margin-top: 2px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-val { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
           margin-top: 4px; color: var(--ink); }
.cmp-side.win .cmp-val { color: var(--green); }
.cmp-side.win-b .cmp-val { color: #c2410c; }
.cmp-side.lose .cmp-val { color: var(--muted-2); }
.cmp-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cmp-rank { min-width: 34px; height: 24px; padding: 0 8px; border-radius: 12px;
            background: #f1f5f9; color: #64748b; font-size: 12px; font-weight: 700;
            display: flex; align-items: center; justify-content: center; }
.cmp-pill { font-size: 10.5px; line-height: 1; padding: 4px 8px; border-radius: 10px;
            font-weight: 700; color: #fff; white-space: nowrap; }
.cmp-pill.a { background: var(--green); }
.cmp-pill.b { background: #c2410c; }
.cmp-pill.tie { background: #e2e8f0; color: #475569; }
@media (max-width: 560px) {
  .cmp-row { grid-template-columns: 1fr 62px 1fr; gap: 6px; padding: 9px 2px; }
  .cmp-nick { font-size: 13px; }
  .cmp-val { font-size: 15px; }
}

/* 2026-11-16 用户反馈「两边太大」：宽屏下把对位列表内容收窄并居中，
   别让 A/B 两侧贴到卡片两端（2025px 宽时左右相隔近 900px，看着空） */
.cmp-list { max-width: 1040px; margin: 0 auto; }
.cmp-row { padding-left: 10px; padding-right: 12px; }
@media (max-width: 1180px) {
  .cmp-list { max-width: none; }
}

/* 2026-11-16 再收一档（用户：中间边距还是太宽）——内容带宽 1040 -> 820，中间列 86 -> 72 */
.cmp-list { max-width: 820px; }
.cmp-row { grid-template-columns: 1fr 72px 1fr; padding-left: 8px; padding-right: 10px; }

/* 2026-11-16 第三次调：不再让内容在卡片里「悬空居中」，改成把整张对位卡收窄居中
   —— 卡片边界本身就是视觉锚点，标题和行内容对齐，不会出现左右各一大块空白 */
.cmp-list { max-width: none; }
#compareResult .compare-card { max-width: 900px; margin-left: auto; margin-right: auto; }

/* 2026-11-16 最终定案：整页对齐比「局部收窄」好看 —— 把对比页整列内容限制在 1040 并居中，
   设置卡 / 维度标签 / 汇总卡 / 对位卡 全部同一个左边缘，不再出现「卡片缩在中间偏右」的怪相 */
#page-compare { max-width: 1040px; margin-left: auto; margin-right: auto; width: 100%; }
#compareResult .compare-card { max-width: none; margin-left: 0; margin-right: 0; }
.cmp-list { max-width: none; }

/* 2026-11-17 运行日志分页条（只显示一页，其余用页码跳） */
.log-pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid #e2e8f0;
  background: #fff; border-radius: 8px; font: inherit; color: var(--ink); cursor: pointer;
}
.pg-btn:hover:not(:disabled) { border-color: #c7d7ee; background: #f7faff; }
.pg-btn.on { background: #3b82f6; border-color: transparent; color: #fff; font-weight: 600; }
.pg-btn:disabled { opacity: .45; cursor: default; }
.pg-gap { padding: 0 2px; color: var(--muted-2); }
.pg-jump { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.pg-input {
  width: 52px; height: 34px; text-align: center; border: 1px solid #e2e8f0;
  border-radius: 8px; font: inherit; color: var(--ink);
}
.pg-select {
  height: 34px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0 8px;
  font: inherit; background: #fff; color: var(--ink);
}
.pg-total { color: var(--muted); font-size: 13px; margin-left: auto; }

/* 2026-11-17 运行日志「一屏一页」：整页占满视口，列表区自己撑开，
   分页条固定在卡片底部（页面本身不再上下滚动，装不下就在列表内滚） */
#page-logs.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 94px);      /* .main 上下 padding = 34 + 60 */
}
#page-logs .page-head { flex: 0 0 auto; margin-bottom: 14px; }
#page-logs > .card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
#page-logs > .card > .card-head { flex: 0 0 auto; }
#logList { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#logList .log-pager {
  position: sticky;
  bottom: 0;
  margin-top: 10px;
  padding: 10px 0 2px;
  background: #fff;
  border-top: 1px solid #eef2f7;
}
/* 屏幕太矮 / 太窄就别锁高度了，退回普通流式布局 */
@media (max-height: 620px), (max-width: 1180px) {
  #page-logs.active { height: auto; }
  #logList { overflow-y: visible; }
}

/* 分页条贴到卡片底部（列表短的时候也不会浮在中间） */
#logList { display: flex; flex-direction: column; }
#logList .log-item { flex: 0 0 auto; }
#logList .log-pager { margin-top: auto; }


/* 2026-11-17 用户反馈「底部别留空白」：取消固定满高，改成最多一屏、内容多高就多高 */
#page-logs.active { height: auto; }
#page-logs > .card { max-height: calc(100vh - 94px); }
#logList { padding-bottom: 2px; }
#logList .log-pager { margin-top: 12px; }

/* 日志行里的时间（挪到「完成」后面） */
#logList .log-time {
  margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--muted);
  font-variant-numeric: tabular-nums;
}


/* 2026-11-17 日志行：全部信息一行内显示 */
#logList .log-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-width: 0;
}
#logList .log-type { font-size: 15px; font-weight: 600; color: var(--ink); }
#logList .log-time {
  margin-left: 0; font-size: 13px; font-weight: 400; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#logList .log-meta-inline { font-size: 13px; color: var(--muted); min-width: 0; }
#logList .log-err { flex: 1 1 100%; }

/* 2026-11-17 用户反馈：不要列表内部的滚动条 —— 一页的 10 条全部平铺出来，
   页面整体按需滚动，翻页交给分页条（不再锁高度、不再内部滚动） */
#page-logs.active { display: block; height: auto; }
#page-logs > .card { display: block; max-height: none; }
#logList { display: block; overflow: visible; max-height: none; }
#logList .log-pager { position: static; margin-top: 14px; border-top: 1px solid #eef2f7; padding-top: 12px; }


/* 2026-11-17 最终版：日志页 = 一屏，页面和列表都不出现滚动条。
   一页显示几条由 JS 按可用高度算（见 fitLogRows）。 */
#page-logs.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 94px);     /* .main 上下 padding 34+60 */
  overflow: hidden;
}
#page-logs .page-head { flex: 0 0 auto; margin-bottom: 14px; }
#page-logs > .card {
  flex: 1 1 auto; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden; margin-bottom: 0;
}
#page-logs > .card > .card-head { flex: 0 0 auto; }
#logList { display: block; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#logList .log-pager {
  position: static; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid #eef2f7;
}

/* 再修：卡片高度跟着内容走（不再被拉满留白），页面固定不滚，条数按可用高度自动算 */
#page-logs > .card { flex: 0 0 auto; display: block; overflow: visible; }
#logList { flex: none; display: block; overflow: visible; }

/* 【最终】日志页固定占一屏：页面不滚、无滚动条；卡片高度随内容；
   一页几条由 JS 按剩余高度算，把空白吃掉 */
#page-logs.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 94px);
  overflow: hidden;
}
#page-logs .page-head { flex: 0 0 auto; margin-bottom: 14px; }
#page-logs > .card {
  flex: 0 0 auto; display: block; margin-bottom: 0; max-height: none; overflow: visible;
}
#logList { display: block; flex: none; overflow: visible; max-height: none; }
#logList .log-pager { position: static; margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef2f7; }


/* 2026-11-17 日志行固定 46px：条数才能算得准、底部不留白 */
#logList .log-item { height: 46px; overflow: hidden; }
#logList .log-row { height: 46px; align-items: center; }
#logList .log-line { flex-wrap: nowrap; overflow: hidden; }
#logList .log-meta-inline {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0;
}
#logList .log-err {
  flex: 0 1 auto; max-width: 46%; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; margin: 0; font-size: 12.5px;
}
#logList .log-detail { margin: 0; }

/* 【定稿】日志页：卡片撑满一屏，行从上往下排，分页条永远贴卡片底部。
   剩余不足一行的高度被分页条吃掉，看起来就是「刚好铺满」。 */
#page-logs.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 94px);
  overflow: hidden;
}
#page-logs .page-head { flex: 0 0 auto; margin-bottom: 14px; }
#page-logs > .card {
  flex: 1 1 auto; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden; margin-bottom: 0;
}
#page-logs > .card > .card-head { flex: 0 0 auto; }
#logList {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
#logList .log-item { flex: 0 0 auto; }
#logList .log-pager {
  margin-top: auto; position: static; border-top: 1px solid #eef2f7; padding-top: 10px;
}


/* 2026-11-17 定稿：分页条紧贴最后一行，不再用 auto 外边距顶到底 */
#logList .log-pager { margin-top: 0 !important; }

/* 定稿2：卡片不再被拉伸（高度=内容），列表高度精确到「行×46 + 分页条」，
   所以分页条下面不会再有空白；页面本身固定不滚 */
#page-logs > .card { flex: 0 0 auto !important; }


/* 2026-11-17 修复：日志行自适应高度 + 详情走弹窗（容器锁高不再裁内容） */
#logList .log-item { height: auto !important; min-height: 44px; overflow: visible !important; }
#logList .log-line { flex-wrap: wrap; row-gap: 2px; }
#logList .history-actions { flex: 0 0 96px; }
#logList .log-err {
  flex: 1 1 100%; max-width: none; white-space: normal; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin: 2px 0 0; font-size: 12.5px; color: #d13b3b;
}
/* 弹窗里的日志正文 */
#logModalPre { max-height: 62vh; }
.log-modal-foot { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.log-modal-foot .meta { color: var(--muted); font-size: 12.5px; }

/* 弹窗顶部的失败原因（列表里不再显示） */
.log-modal-err {
  margin: 0 0 10px; padding: 10px 12px; border-radius: 8px;
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 13px;
}

/* ===== 2026-11-18 版面优化（用户：看看还能怎么优化） ===== */
html, body { background: var(--bg); }
/* 宽屏别把右边空着：内容区放宽到 1360 并居中 */
.main { padding: 22px 32px 40px; }
.page { max-width: 1360px; margin: 0 auto; }
.page-head { margin: 2px 0 16px; }
.page-head h1 { font-size: 22px; margin-bottom: 6px; }
/* 运行状态压成一行 chips（原来 4 列格子占一大块） */
.stat-list { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.stat-list > * { flex: 0 0 auto; }
.home-bottom .card { padding: 14px 16px; }
/* 地图扫描可折叠 */
.ctrl-card .card-head { display: flex; align-items: center; gap: 10px; }
.ctrl-card .card-head #foldScan { margin-left: auto; }
.ctrl-card.folded .ctrl-bar, .ctrl-card.folded .status { display: none; }

/* 折叠：必须压过 #page-map .ctrl-bar 的 ID 优先级 */
#page-map .ctrl-card.folded .ctrl-bar,
#page-map .ctrl-card.folded .status { display: none !important; }

/* 未登录：主内容虚化，防泄露 */
.gate-open .main { filter: blur(3px); pointer-events: none; user-select: none; }
.gate-open .sidebar { filter: blur(2px); pointer-events: none; }


/* ================= 移动端适配（2026-11-18） ================= */
@media (max-width: 720px) {
  /* 侧栏 → 顶部横条 */
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 10px 12px 8px;
    flex-direction: column;
    overflow: visible;
  }
  .brand { padding: 0 0 8px; gap: 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-text h1 { font-size: 16px; }
  .brand-sub, .sidebar-bottom, .nav-label { display: none !important; }

  .nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 auto;
    width: auto;
    padding: 8px 12px;
    border-radius: 10px;
    gap: 6px;
  }
  .nav-item .nav-icon { width: 16px; height: 16px; }
  .nav-text { font-size: 13px; }

  /* 主区 */
  .main { margin-left: 0 !important; padding: 12px 12px 28px !important; min-height: auto; }
  .page { max-width: 100% !important; }
  .page-head { margin: 0 0 12px; }
  .page-head h1 { font-size: 18px; }
  .page-head p { font-size: 12.5px; }

  /* 卡片与工具栏 */
  .card { padding: 12px !important; border-radius: 12px; }
  .card-head h2 { font-size: 15px; }
  .ctrl-bar, .toolbar, .row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .ctrl-bar > *, .toolbar > * { flex: 1 1 auto; min-width: 0; }
  .kid-input, .search, .level, .pick, .ally-select {
    width: 100% !important;
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
  .btn { height: 40px; padding: 0 14px; font-size: 13.5px; }
  .query-grid, .compare-grid, .history-grid, .connect-grid, .stat-list {
    display: block !important;
  }
  .query-grid > *, .compare-grid > *, .history-grid > *, .connect-grid > * { margin-bottom: 10px; }
  .stat-list > * { margin-bottom: 6px; }

  /* 表格横向滚动 */
  .table-wrap, .history-scroll { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  table.players { min-width: 640px; }

  /* 管理端表格也允许横滚 */
  .adm-pane .table-wrap { overflow-x: auto; }

  /* 弹层铺满 */
  .modal-card { width: 94vw !important; max-width: 94vw !important; max-height: 88vh; }
}

/* 移动端收口：禁止横向溢出 + 长文本换行 */
@media (max-width: 720px) {
  html, body { overflow-x: hidden !important; }
  .main, .page, .card, .card * { box-sizing: border-box; }
  .page p, .hint, .muted, .section-head p, .history-meta,
  .log-meta-inline, .stat-list, .card-head h2, .brand-sub {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .page, .card { max-width: 100% !important; }
  .query-grid, .compare-grid, .history-grid, .connect-grid { grid-template-columns: 1fr !important; }
  .ctrl-bar .btn, .toolbar .btn { flex: 1 1 auto; }
}

/* 客户视角：隐藏运行状态里的「账号」一格（含手机尾号） */
body.client-mode .stat-list > *:first-child { display: none !important; }
