/* ============ TOTKMAP · 存档修改器（save-edit） ============
 *
 * 独立页样式。不引 app/css/style.css（那个是 overflow:hidden 的全屏地图，本页要滚动）。
 *
 * 视觉基调（延续《UI-MANUAL》Part 1，但升级质感）：
 *   底色更深 #0e1115 → 衬托卡片；金色 #eac27e 作主强调；青色 #6fd3e0 只用于「可交互」的反馈，
 *   避免整页全是金色导致强调失效。
 *
 * 原则：
 *   1. 一个页面只有一个主按钮（预览并下载），其余全是不抢眼的次级样式
 *   2. 能点选就不让人填数字 —— 金手指的形态是「扳开关」，不是「填表单」
 *   3. 所有数字用 tabular-nums，避免位数变化时左右跳动
 */

:root {
  --tk-bg: #0e1115;
  --tk-bg-2: #12161b;
  --tk-panel: #171b21;
  --tk-panel-hi: #1c212a;
  --tk-sunken: #101318;

  --tk-line: rgba(255, 255, 255, .07);
  --tk-line-2: rgba(255, 255, 255, .13);

  --tk-gold: #eac27e;
  --tk-gold-hi: #f8dba6;
  --tk-gold-soft: rgba(234, 194, 126, .11);
  --tk-gold-line: rgba(234, 194, 126, .38);

  --tk-cyan: #6fd3e0;
  --tk-cyan-soft: rgba(111, 211, 224, .1);

  --tk-text: #e8ebef;
  --tk-text-2: #a8b0ba;
  --tk-text-3: #6d757f;

  --tk-ok: #74c98a;
  --tk-ok-soft: rgba(116, 201, 138, .1);
  --tk-danger: #e0715f;
  --tk-danger-soft: rgba(224, 113, 95, .1);

  --tk-r: 12px;
  --tk-r-sm: 8px;
  --tk-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
}

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

/* hidden 属性会被后面的 display:flex 覆盖掉（flex 容器里的 hidden 元素照样显示），
   这里统一钉死 —— 顶栏芯片就是踩了这个坑才露出一堆空方块。 */
[hidden] { display: none !important; }

html { background: var(--tk-bg); scrollbar-gutter: stable; }

body {
  min-height: 100vh;
  background:
    radial-gradient(760px 340px at 50% -8%, rgba(234, 194, 126, .09), transparent 62%),
    radial-gradient(520px 280px at 92% 4%, rgba(111, 211, 224, .05), transparent 60%),
    var(--tk-bg);
  color: var(--tk-text);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}

/* 极细网格纹理，让深色底不平板。fixed 避免随滚动抖动 */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
}

.num { font-variant-numeric: tabular-nums; }

/* ================= 顶栏 ================= */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 20px;
  background: rgba(14, 17, 21, .82);
  border-bottom: 1px solid var(--tk-line);
  backdrop-filter: blur(14px) saturate(1.2);
}

.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 auto;
  border: 1px solid var(--tk-line-2);
  border-radius: 9px;
  background: transparent;
  color: var(--tk-text-2);
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.back:hover { color: var(--tk-gold); border-color: var(--tk-gold-line); background: var(--tk-gold-soft); }
.back svg { width: 15px; height: 15px; }

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { display: flex; color: var(--tk-gold); opacity: .85; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.brand-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  padding: 2px 6px; border-radius: 4px;
  color: var(--tk-gold); background: var(--tk-gold-soft);
  border: 1px solid var(--tk-gold-line);
  transform: translateY(-1px);
}

.top-meta { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: 6px;
  background: var(--tk-sunken);
  border: 1px solid var(--tk-line);
  font-size: 11.5px; color: var(--tk-text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip b { color: var(--tk-text); font-weight: 600; }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--tk-ok); box-shadow: 0 0 6px var(--tk-ok); }
.chip .dot.bad { background: var(--tk-danger); box-shadow: 0 0 6px var(--tk-danger); }

/* ================= 布局 ================= */
.stage { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 22px 20px 8px; }

/* 未加载时让投放区在视口里居中 —— 否则底下是一大片死白，看着像页面没加载完 */
#loadingStage {
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100vh - 152px);
  max-width: 780px;
}

/* ================= 未加载：投放区 ================= */
.drop {
  display: flex; flex-direction: column; align-items: center;
  padding: 54px 26px 40px;
  border: 1px solid var(--tk-line-2);
  border-radius: 18px;
  background:
    radial-gradient(560px 220px at 50% 0%, rgba(234, 194, 126, .07), transparent 68%),
    linear-gradient(180deg, var(--tk-panel-hi), var(--tk-panel));
  box-shadow: var(--tk-shadow);
  text-align: center;
  transition: border-color .2s, background .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
/* 虚线框只在内部，比整块虚线框更克制 */
.drop::after {
  content: '';
  position: absolute; inset: 12px;
  border: 1px dashed rgba(255, 255, 255, .1);
  border-radius: 12px;
  pointer-events: none;
  transition: border-color .2s;
}
.drop.over { border-color: var(--tk-gold-line); transform: translateY(-2px); }
.drop.over::after { border-color: var(--tk-gold-line); }

.drop-ring {
  display: flex; align-items: center; justify-content: center;
  width: 62px; height: 62px; margin-bottom: 18px;
  border-radius: 50%;
  background: var(--tk-gold-soft);
  border: 1px solid var(--tk-gold-line);
  color: var(--tk-gold);
  box-shadow: 0 0 0 8px rgba(234, 194, 126, .035), inset 0 0 18px rgba(234, 194, 126, .1);
}
.drop-ring svg { width: 26px; height: 26px; }

.drop h1 { font-size: 19px; font-weight: 600; letter-spacing: .2px; }
.drop h1 span { color: var(--tk-gold); }
.drop .sub { margin-top: 7px; font-size: 12.5px; color: var(--tk-text-3); line-height: 1.7; }

.drop-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }

.drop-path {
  margin-top: 24px; padding: 9px 13px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--tk-line);
  font-size: 11.5px; color: var(--tk-text-3);
  line-height: 1.6;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  word-break: break-all;
  max-width: 560px;
}
.drop-path em { color: var(--tk-gold); font-style: normal; }

#loadMsg { margin-top: 14px; }

/* 已加载状态下的提示落点（改不了 / 连不上 navi / 下载完成） */
#liveMsg { margin-bottom: 14px; }
#liveMsg:empty { display: none; }

/* ================= HUD 状态条 ================= */
.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  position: relative;
  padding: 11px 13px 12px;
  border-radius: var(--tk-r);
  background: linear-gradient(180deg, var(--tk-panel-hi), var(--tk-panel));
  border: 1px solid var(--tk-line);
  overflow: hidden;
  transition: border-color .2s;
}
/* 顶部细高光，制造「玻璃面板」感 */
.stat::before {
  content: '';
  position: absolute; top: 0; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
}
.stat.dirty { border-color: var(--tk-gold-line); background: linear-gradient(180deg, rgba(234, 194, 126, .1), var(--tk-panel)); }

.stat-top { display: flex; align-items: center; gap: 6px; color: var(--tk-text-3); }
.stat-top svg { width: 13px; height: 13px; }
.stat-lbl { font-size: 10.5px; letter-spacing: .09em; }
.stat-val {
  margin-top: 5px;
  font-size: 21px; font-weight: 600;
  color: var(--tk-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.4px;
  line-height: 1.2;
}
.stat.dirty .stat-val { color: var(--tk-gold); }
.stat-val small { font-size: 12px; font-weight: 500; color: var(--tk-text-3); margin-left: 5px; letter-spacing: 0; }
.stat-was {
  margin-top: 1px;
  font-size: 10.5px; color: var(--tk-text-3);
  font-variant-numeric: tabular-nums;
  height: 14px;
}
.stat-was s { text-decoration-color: rgba(224, 113, 95, .6); }

/* ================= 卡片网格 ================= */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; align-items: stretch; }
.grid > .span-2 { grid-column: 1 / -1; }

.card {
  border-radius: var(--tk-r);
  background: linear-gradient(180deg, var(--tk-panel), #14181d);
  border: 1px solid var(--tk-line);
  box-shadow: var(--tk-shadow);
  overflow: hidden;
}

.card-head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 15px 11px;
  border-bottom: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, .015);
}
.card-head .idx {
  display: inline-flex; align-items: center; justify-content: center;
  height: 19px; padding: 0 7px;
  border-radius: 5px;
  background: var(--tk-gold-soft);
  border: 1px solid var(--tk-gold-line);
  color: var(--tk-gold);
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}
.card-head h2 { font-size: 13px; font-weight: 600; letter-spacing: .3px; }
.card-head .note { margin-left: auto; font-size: 11px; color: var(--tk-text-3); white-space: nowrap; }
.card-body { padding: 6px 15px 14px; }

/* ================= 键值行 ================= */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
  min-height: 44px;
}
.row:last-child { border-bottom: none; }
.row > .lbl { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--tk-text-2); }
.row > .lbl small { display: block; font-size: 10.5px; color: var(--tk-text-3); line-height: 1.55; margin-top: 2px; }
.row > .ctl { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }

/* ================= 输入控件 ================= */
input[type="number"], input[type="text"], select {
  height: 32px;
  min-width: 88px;
  padding: 0 10px;
  border: 1px solid var(--tk-line-2);
  border-radius: 7px;
  background: var(--tk-sunken);
  color: var(--tk-text);
  font-size: 13px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type="number"] { width: 92px; text-align: right; padding-right: 11px; }
input::placeholder { color: #545c66; }
input[type="number"]:focus, input[type="text"]:focus, select:focus {
  border-color: var(--tk-gold-line);
  background: #0c0f13;
  box-shadow: 0 0 0 3px rgba(234, 194, 126, .08);
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

select {
  cursor: pointer;
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236d757f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
select:hover { border-color: rgba(255, 255, 255, .22); }
select option { background: #171b21; color: var(--tk-text); }

.unit { font-size: 11px; color: var(--tk-text-3); min-width: 26px; }

/* 快捷档位（小圆角按钮群） */
.quick { display: flex; gap: 5px; }
.qbtn {
  height: 27px; min-width: 30px; padding: 0 8px;
  border: 1px solid var(--tk-line-2);
  border-radius: 6px;
  background: transparent;
  color: var(--tk-text-3);
  font-size: 11px; font-family: inherit;
  cursor: pointer; transition: .14s;
  font-variant-numeric: tabular-nums;
}
.qbtn:hover { color: var(--tk-gold); border-color: var(--tk-gold-line); background: var(--tk-gold-soft); }
.qbtn.on { background: var(--tk-gold-soft); border-color: var(--tk-gold-line); color: var(--tk-gold); }

/* 分段选择（精力 / 电池）—— 比下拉更快，一眼看到全部选项 */
.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 8px;
  background: var(--tk-sunken);
  border: 1px solid var(--tk-line-2);
}
.seg button {
  height: 26px; padding: 0 11px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--tk-text-3);
  font-size: 11.5px; font-family: inherit;
  cursor: pointer; transition: .14s;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.seg button:hover { color: var(--tk-text); background: rgba(255, 255, 255, .04); }
.seg button.on {
  background: var(--tk-gold);
  color: #1a1408;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(234, 194, 126, .3);
}

/* ================= 材料分类格子 =================
 * 一个类别一格，格子里最显眼的是「你有几种」—— 先让人知道自己会动多少东西，
 * 再决定点不点。比「材料全部 999」那种一把拉满的开关克制得多。 */
.mg-head {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 8px;
}
.mg-title { font-size: 11.5px; color: var(--tk-text-3); }
.mg-all {
  margin-left: auto;
  height: 24px; padding: 0 10px;
  border: 1px solid var(--tk-line-2); border-radius: 6px;
  background: transparent; color: var(--tk-text-3);
  font-size: 11px; font-family: inherit; cursor: pointer;
  transition: .14s;
}
.mg-all:hover { color: var(--tk-gold); border-color: var(--tk-gold-line); background: var(--tk-gold-soft); }
.mg-all.on { color: var(--tk-gold); border-color: var(--tk-gold-line); background: var(--tk-gold-soft); }

.mg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}
.mg {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 9px 4px 8px;
  border: 1px solid var(--tk-line-2);
  border-radius: 9px;
  background: var(--tk-sunken);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .12s;
}
.mg:hover:not(:disabled) { border-color: rgba(255, 255, 255, .24); transform: translateY(-1px); }
.mg-n {
  font-size: 17px; font-weight: 600;
  color: var(--tk-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.mg-l { font-size: 10.5px; color: var(--tk-text-3); white-space: nowrap; }
.mg.on {
  border-color: var(--tk-gold-line);
  background: linear-gradient(180deg, rgba(234, 194, 126, .11), var(--tk-sunken));
}
.mg.on .mg-n, .mg.on .mg-l { color: var(--tk-gold); }
.mg.on .mg-l { opacity: .85; }
.mg:disabled { opacity: .28; cursor: not-allowed; }
.mg-warn {
  grid-column: 1 / -1;
  font-size: 10.5px; color: var(--tk-danger);
  line-height: 1.5;
}

/* ================= 动作磁贴（箭矢开关） ================= */
/* 竖排一行一个：横排两列时文字区只剩 120px，「96 种材料 · 容量 510」必换行，
   而竖排正好填掉卡片 02 与卡片 01 的高度差 */
.tiles { display: grid; grid-template-columns: 1fr; gap: 9px; padding: 8px 0 4px; }
.tile {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 13px 12px;
  border: 1px solid var(--tk-line-2);
  border-radius: 10px;
  background: var(--tk-sunken);
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .12s;
  user-select: none;
}
.tile:hover { border-color: rgba(255, 255, 255, .22); transform: translateY(-1px); }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile-ico {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  color: var(--tk-text-3);
  transition: .16s;
}
.tile-ico svg { width: 16px; height: 16px; }
.tile-txt { min-width: 0; }
.tile-t1 { display: block; font-size: 12.5px; color: var(--tk-text); font-weight: 500; }
.tile-t2 { display: block; font-size: 10.5px; color: var(--tk-text-3); line-height: 1.55; margin-top: 2px; }
/* 勾选态 */
.tile input:checked ~ .tile-ico { background: var(--tk-gold-soft); color: var(--tk-gold); }
.tile:has(input:checked) {
  border-color: var(--tk-gold-line);
  background: linear-gradient(180deg, rgba(234, 194, 126, .09), var(--tk-sunken));
}
/* 右上角勾标记 */
.tile::after {
  content: '';
  position: absolute; top: 10px; right: 10px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--tk-line-2);
  transition: .16s;
}
.tile:has(input:checked)::after {
  border-color: var(--tk-gold);
  background: var(--tk-gold)
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='7' viewBox='0 0 9 7'%3E%3Cpath d='M1 3.4L3.2 5.6 8 1' fill='none' stroke='%231a1408' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat center;
}

/* ================= 装备 ================= */
.eq-tabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.eq-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 29px; padding: 0 12px;
  border: 1px solid var(--tk-line-2);
  border-radius: 7px;
  background: transparent;
  color: var(--tk-text-2);
  font-size: 12px; font-family: inherit; cursor: pointer; transition: .14s;
}
.eq-tab svg { width: 13px; height: 13px; opacity: .7; }
.eq-tab .cnt {
  font-size: 10px; color: var(--tk-text-3);
  font-variant-numeric: tabular-nums;
  padding: 1px 4px; border-radius: 4px;
  background: rgba(255, 255, 255, .06);
}
.eq-tab:hover { border-color: rgba(255, 255, 255, .24); color: var(--tk-text); }
.eq-tab.on {
  background: var(--tk-gold-soft);
  border-color: var(--tk-gold-line);
  color: var(--tk-gold);
}
.eq-tab.on svg { opacity: 1; }
.eq-tab.on .cnt { background: rgba(234, 194, 126, .18); color: var(--tk-gold); }

/* 附加数值：同一格在「攻击力 / 防御力 / 额外耐久」三种属性下含义不同，
   所以框内不写标签，用 placeholder 提示当前含义（见 save-edit.js） */
.eq-valwrap { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
.eq-valwrap input { flex: 1 1 auto; min-width: 0; }
.eq-valwrap input:disabled { opacity: .38; cursor: not-allowed; }
/* ∞ 状态：框内不显示 2100000000（10 位数会被裁切，用户读到错的），改用金色占位文字 */
.eq-valwrap.inf-mode input { opacity: 1; color: var(--tk-gold); -webkit-text-fill-color: var(--tk-gold); }
.eq-valwrap.inf-mode input::placeholder { color: var(--tk-gold); opacity: .78; font-size: 11px; }
/* 「无限」快捷键：只在耐久类出现，点了直接填 2100000000 */
.eq-inf {
  flex: 0 0 auto; width: 22px; height: 30px; padding: 0;
  display: none; align-items: center; justify-content: center;
  border: 1px solid var(--tk-line-2); border-radius: 6px;
  background: var(--tk-sunken); color: var(--tk-text-3);
  font-size: 13px; line-height: 1; cursor: pointer;
  transition: color .14s, border-color .14s, background .14s;
}
.eq-inf.show { display: flex; }
.eq-inf:hover { color: var(--tk-gold); border-color: var(--tk-gold-line); }
.eq-inf.on { color: var(--tk-gold); border-color: var(--tk-gold-line); background: rgba(234, 194, 126, .1); }

.empty {
  padding: 26px 12px; text-align: center;
  color: var(--tk-text-3); font-size: 12px;
  border: 1px dashed var(--tk-line-2);
  border-radius: 9px;
}

/* ================= 坐标 ================= */
.axis-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 8px 0 4px; }
.axis {
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--tk-sunken);
  border: 1px solid var(--tk-line-2);
  transition: border-color .14s;
}
.axis:focus-within { border-color: var(--tk-gold-line); }
.axis-name {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--tk-text-3);
  letter-spacing: .05em;
}
.axis-name i { width: 6px; height: 6px; border-radius: 2px; display: inline-block; }
.axis-x i { background: #e0715f; }
.axis-y i { background: var(--tk-gold); }
.axis-z i { background: var(--tk-cyan); }
.axis input {
  width: 100%; height: 26px; margin-top: 3px;
  padding: 0; border: none; background: transparent;
  font-size: 15px; font-weight: 600;
  color: var(--tk-text);
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.axis input:focus { box-shadow: none; background: transparent; }

/* 当前坐标显示条 */
.cur-pos {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(111, 211, 224, .05);
  border: 1px solid rgba(111, 211, 224, .16);
  font-size: 11.5px; color: var(--tk-text-3);
}
.cur-pos b {
  color: var(--tk-cyan); font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}
.cur-pos .fill {
  margin-left: auto;
  height: 22px; padding: 0 9px;
  border: 1px solid rgba(111, 211, 224, .3);
  border-radius: 5px;
  background: transparent;
  color: var(--tk-cyan);
  font-size: 10.5px; font-family: inherit;
  cursor: pointer; transition: .14s;
  white-space: nowrap;
}
.cur-pos .fill:hover { background: var(--tk-cyan-soft); }

/* ================= 提示条 =================
   ★ 严禁 display:flex —— 内容是纯文本 + <b>，flex 会把每段文字当独立 item 排开，
     字间距被拉开、整段话散成一地。要的就是普通段落流。 */
.tip {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.75;
  border: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, .025);
  color: var(--tk-text-2);
}
.tip + .tip { margin-top: 8px; }
.tip.warn { border-color: rgba(224, 113, 95, .34); background: var(--tk-danger-soft); color: #f0b4a9; }
.tip.ok { border-color: rgba(116, 201, 138, .3); background: var(--tk-ok-soft); color: #a5d9b2; }
.tip b { color: var(--tk-text); font-weight: 600; }
.tip.warn b { color: #ffd0c7; }
.tip.ok b { color: #ccf0d3; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 17px;
  border: 1px solid var(--tk-line-2);
  border-radius: 9px;
  background: rgba(255, 255, 255, .03);
  color: var(--tk-text);
  font-size: 12.5px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: rgba(255, 255, 255, .26); background: rgba(255, 255, 255, .06); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(180deg, var(--tk-gold-hi), var(--tk-gold));
  border-color: var(--tk-gold);
  color: #1a1408;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 4px 14px -4px rgba(234, 194, 126, .45);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffe6bd, var(--tk-gold-hi)); color: #1a1408; }

.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--tk-line-2); background: rgba(255, 255, 255, .03); }
.btn.primary:disabled { box-shadow: none; }
.btn.primary:disabled:hover { background: linear-gradient(180deg, var(--tk-gold-hi), var(--tk-gold)); }

/* 键盘焦点（无障碍：不止 hover 有反馈） */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--tk-cyan);
  outline-offset: 2px;
}

/* ================= 底部操作栏 ================= */
.foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 11px;
  padding: 12px 20px;
  background: rgba(14, 17, 21, .88);
  border-top: 1px solid var(--tk-line);
  backdrop-filter: blur(14px) saturate(1.2);
}
.foot .status {
  flex: 1 1 auto; min-width: 0;
  font-size: 11.5px; color: var(--tk-text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.foot .status b { color: var(--tk-gold); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.foot .status .sep { margin: 0 7px; opacity: .4; }

/* ================= 预览弹层 ================= */
.mask {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(6, 8, 10, .74);
  backdrop-filter: blur(5px);
  animation: fadeIn .16s ease;
}
.mask.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.dlg {
  width: 100%; max-width: 540px; max-height: 84vh;
  display: flex; flex-direction: column;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--tk-panel-hi), var(--tk-panel));
  border: 1px solid var(--tk-line-2);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .8);
  overflow: hidden;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }

.dlg-head {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--tk-line);
}
.dlg-head .dot-ico {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--tk-gold-soft); color: var(--tk-gold);
  border: 1px solid var(--tk-gold-line);
}
.dlg-head .dot-ico svg { width: 13px; height: 13px; }
.dlg-head h3 { font-size: 13.5px; font-weight: 600; }
.dlg-head button {
  margin-left: auto;
  width: 26px; height: 26px;
  border: 1px solid var(--tk-line-2); border-radius: 7px;
  background: transparent; color: var(--tk-text-3);
  font-size: 16px; line-height: 1; cursor: pointer;
  transition: .14s;
}
.dlg-head button:hover { color: var(--tk-text); border-color: var(--tk-line-2); background: rgba(255, 255, 255, .06); }

.dlg-body {
  padding: 12px 16px 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.dlg-body::-webkit-scrollbar { width: 8px; }
.dlg-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 4px; }

.dlg-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--tk-line);
  display: flex; gap: 9px; justify-content: flex-end;
  background: rgba(0, 0, 0, .18);
}

.chg {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  background: var(--tk-sunken);
  border: 1px solid var(--tk-line);
  border-radius: 7px;
  font-size: 12px;
}
.chg .nm { flex: 1 1 auto; color: var(--tk-text-2); min-width: 0; }
.chg .va {
  color: var(--tk-text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 11.5px;
}
.chg .va b { color: var(--tk-gold); font-weight: 600; font-size: 12.5px; }

/* 汇总条要和上面那串改动行拉开距离，否则看着像最后一条改动的一部分 */
.dlg-body > .tip { margin-top: 5px; }

/* ================= 下载结果面板 =================
 * 从「改动清单」切到「文件清单」只用这一组类，不动 .chg 那套。
 * 每个文件一个 .dl-row，右侧一个独立按钮 —— 一次点击只下一次文件，
 * 这是绕开 Chrome「多文件下载」拦截的唯一可靠办法，别合并回一个按钮。 */
.dl-busy {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--tk-cyan);
  background: var(--tk-cyan-soft);
  border: 1px solid rgba(111, 211, 224, .24);
}

.dl-note {
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--tk-text-2);
  border: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, .025);
}
.dl-note b { color: var(--tk-text); font-weight: 600; }
.dl-note.ok { border-color: rgba(116, 201, 138, .3); background: var(--tk-ok-soft); color: #a5d9b2; }
.dl-note.ok b { color: #ccf0d3; }
.dl-note.warn { border-color: rgba(224, 113, 95, .34); background: var(--tk-danger-soft); color: #f0b4a9; }
.dl-note.warn b { color: #ffd0c7; }

.dl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--tk-sunken);
  border: 1px solid var(--tk-line);
  border-radius: 8px;
}
.dl-txt { flex: 1 1 auto; min-width: 0; }
.dl-txt b {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--tk-text);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  word-break: break-all;
  line-height: 1.4;
}
.dl-txt small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--tk-text-3); line-height: 1.5; }
.dl-txt small em { font-style: normal; display: block; color: var(--tk-danger); }

/* 「再下一次」：按钮必须够大够显眼 —— 这是拦截发生时的唯一出路，不是装饰 */
.dl-again {
  flex: 0 0 auto;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--tk-gold-line);
  border-radius: 7px;
  background: var(--tk-gold-soft);
  color: var(--tk-gold);
  font-size: 11.5px; font-family: inherit; font-weight: 600;
  cursor: pointer; transition: .14s;
  white-space: nowrap;
}
.dl-again:hover { background: rgba(234, 194, 126, .18); }
.dl-again.bad { border-color: rgba(224, 113, 95, .45); background: var(--tk-danger-soft); color: var(--tk-danger); }

/* 目录路径：等宽字体，别让 › 被当成正文 */
.dlg-body .pth {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--tk-cyan);
  word-break: break-all;
}

@media (max-width: 720px) {
  .dl-row { flex-wrap: wrap; }
  .dl-again { flex: 1 1 100%; }
}

/* ================= 响应式 ================= */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  body { padding-bottom: 100px; }
  .stage { padding: 14px 12px 8px; }
  .topbar { padding: 0 12px; height: 52px; }
  .top-meta .chip.opt { display: none; }
  .brand-tag { display: none; }

  .drop { padding: 40px 16px 32px; border-radius: 14px; }
  .drop-actions { flex-direction: column; width: 100%; }
  .drop-actions .btn { width: 100%; }

  .row { flex-wrap: wrap; }
  .row > .lbl { flex: 1 1 100%; }
  .row > .ctl { flex: 1 1 100%; justify-content: flex-end; }
  /* 输入框别占满一整行 —— 空荡得像没填完的表单，快捷按钮靠右跟着它更紧凑 */
  input[type="number"] { flex: 0 0 100px; width: 100px; }
  .seg { flex: 1 1 auto; }
  .seg button { flex: 1 1 0; padding: 0 6px; }

  .tiles { grid-template-columns: 1fr; }
  .axis-row { grid-template-columns: 1fr; }

  /* 小屏：名字独占一行，下面三个控件挤一行 —— 别再按两列排，
     否则「数值框」会被挤到第三行，一眼看不出它跟哪把武器对应 */
  .eq-item { grid-template-columns: 66px 1fr 84px; }
  .eq-name { grid-column: 1 / -1; }

  .foot { padding: 11px 12px; }
  .foot .status { display: none; }
  .foot .btn { flex: 1 1 0; }

  .dlg { max-height: 88vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================= v3 Tab 重构与紧凑网格扩展 ================= */
.save-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--tk-r); margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(234, 194, 126, .06), rgba(23, 27, 33, .95));
  border: 1px solid var(--tk-line-2);
}
.sb-left { display: flex; align-items: center; gap: 12px; }
.sb-ico {
  width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--tk-gold-soft); border: 1px solid var(--tk-gold-line); font-size: 17px; flex-shrink: 0;
}
.sb-title { font-size: 14px; color: var(--tk-text); }
.sb-title span { color: var(--tk-ok); font-size: 12px; margin-left: 4px; }
.sb-sub { font-size: 11.5px; color: var(--tk-text-3); margin-top: 2px; }
.sb-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--tk-text-3); }
.sb-right b { color: var(--tk-text); font-weight: 600; margin-left: 4px; }
.sb-right b.mod { color: var(--tk-gold); }

.hud.hud-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .hud.hud-5 { grid-template-columns: repeat(2, 1fr); } }

.main-tabs {
  display: flex; gap: 8px; padding: 6px; border-radius: var(--tk-r);
  background: var(--tk-sunken); border: 1px solid var(--tk-line);
  margin-bottom: 14px; overflow-x: auto; scrollbar-width: none;
}
.main-tabs::-webkit-scrollbar { display: none; }
.mtab {
  flex: 1; min-width: max-content;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--tk-text-2); cursor: pointer;
  font-size: 13px; font-family: inherit; font-weight: 500; transition: .15s;
}
.mtab:hover { color: var(--tk-text); background: rgba(255,255,255,.04); }
.mtab.on { background: var(--tk-panel-hi); color: var(--tk-gold-hi); border-color: var(--tk-gold-line); font-weight: 600; }
.mtab.cyan.on { color: var(--tk-cyan); border-color: rgba(111, 211, 224, .4); }
.mtab .badge {
  font-size: 11px; padding: 1px 6px; border-radius: 99px;
  background: var(--tk-gold-soft); color: var(--tk-gold); font-variant-numeric: tabular-nums;
}
.mtab.cyan .badge { background: var(--tk-cyan-soft); color: var(--tk-cyan); }

.tab-pane { display: none; }
.tab-pane.on { display: block; }

.btn-mini {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--tk-line-2);
  background: var(--tk-sunken); color: var(--tk-text-2); font-size: 11.5px; font-family: inherit;
  cursor: pointer; transition: .14s; white-space: nowrap;
}
.btn-mini:hover { color: var(--tk-text); border-color: var(--tk-gold-line); }
.btn-mini.gold { border-color: var(--tk-gold-line); background: var(--tk-gold-soft); color: var(--tk-gold-hi); font-weight: 600; }
.btn-mini.cyan { border-color: rgba(111, 211, 224, .4); background: var(--tk-cyan-soft); color: var(--tk-cyan); font-weight: 600; }

/* ---- Tab 2: 背包物品 4 列网格 ---- */
.bag-quick-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.bag-batch-ctl {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 7px; border: 1px solid var(--tk-line-2);
  background: var(--tk-sunken);
}
.bag-batch-lbl { font-size: 13.5px; font-weight: 600; color: var(--tk-text); letter-spacing: .3px; white-space: nowrap; }
.bag-batch-in {
  width: 44px; padding: 2px 2px; border: none; border-bottom: 1px solid var(--tk-line-2);
  border-radius: 0; background: transparent; color: var(--tk-text); font-size: 12.5px; font-family: inherit;
  text-align: center; outline: none;
}
.bag-batch-in:focus { border-bottom-color: var(--tk-gold-line); }
.bag-batch-999 {
  border: none; background: transparent; padding: 2px 4px; cursor: pointer;
  color: var(--tk-gold-hi); font-size: 12.5px; font-weight: 600; font-family: inherit;
}
.bag-batch-999:hover { text-decoration: underline; }
.bag-search {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--tk-line-2);
  background: var(--tk-sunken); color: var(--tk-text); font-size: 13px; font-family: inherit; outline: none;
}
.bag-search:focus { border-color: var(--tk-gold-line); }
.bag-cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.bag-cat-pill {
  padding: 5px 11px; border-radius: 7px; border: 1px solid var(--tk-line-2);
  background: var(--tk-sunken); color: var(--tk-text-2); font-size: 12px; font-family: inherit; cursor: pointer;
}
.bag-cat-pill.on { border-color: var(--tk-gold-line); background: var(--tk-gold-soft); color: var(--tk-gold-hi); font-weight: 600; }
.bag-editor-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--tk-gold-line);
  background: rgba(234, 194, 126, .07); margin-bottom: 10px;
}
.bag-ed-name { font-size: 12.5px; color: var(--tk-text-2); }
.bag-ed-name b { color: var(--tk-gold-hi); }
.bag-ed-name small { color: var(--tk-text-3); margin-left: 4px; font-family: ui-monospace, monospace; font-size: 11px; }
.bag-ed-ctl { display: flex; gap: 6px; align-items: center; }
.bag-ed-ctl input { width: 84px; text-align: right; }

.bag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 960px) { .bag-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .bag-grid { grid-template-columns: repeat(2, 1fr); } }
.bag-card {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--tk-line); background: var(--tk-sunken);
  cursor: pointer; transition: .14s; min-width: 0;
}
.bag-card:hover { border-color: var(--tk-line-2); background: var(--tk-panel-hi); }
.bag-card.sel { border-color: var(--tk-gold-line); background: var(--tk-gold-soft); }
.bag-card.mod { border-color: rgba(116, 201, 138, .45); }
.bag-ico {
  width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.05); font-size: 14px; flex-shrink: 0;
}
.bag-info { min-width: 0; flex: 1; }
.bag-name { font-size: 12px; font-weight: 600; color: var(--tk-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bag-qty { font-size: 11px; color: var(--tk-text-3); font-variant-numeric: tabular-nums; }
.bag-qty b { color: var(--tk-gold); }
.bag-qty b.mod { color: var(--tk-ok); }
.bag-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12px; color: var(--tk-text-3);
}
.bag-pager-btns { display: flex; gap: 6px; }

/* ---- Tab 3: 装备强化 3 列自适应 3~4 行卡片 ---- */
.eq-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 960px) { .eq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .eq-grid { grid-template-columns: 1fr; } }
.eq-grid .empty { grid-column: 1 / -1; }
.eq-card {
  padding: 10px 11px; border-radius: 10px; border: 1px solid var(--tk-line);
  background: var(--tk-sunken); display: flex; flex-direction: column; gap: 7px;
  min-width: 0; transition: border-color .14s, background .14s;
}
.eq-card:hover { border-color: rgba(255, 255, 255, .16); }
.eq-card.mod { border-color: rgba(116, 201, 138, .5); background: rgba(116, 201, 138, .04); }
.eq-card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.eq-card-title {
  font-size: 13px; font-weight: 700; color: var(--tk-cyan);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1;
}
.eq-card-top .stag { flex-shrink: 0; }
.stag {
  font-size: 11px; padding: 1px 6px; border-radius: 5px;
  background: rgba(255,255,255,.06); color: var(--tk-text-2); border: 1px solid var(--tk-line);
  font-variant-numeric: tabular-nums;
}
.stag.atk, .stag.mod-val { color: var(--tk-gold-hi); background: var(--tk-gold-soft); border-color: var(--tk-gold-line); font-weight: 600; }
.stag.inf { color: var(--tk-cyan); background: var(--tk-cyan-soft); border-color: rgba(111, 211, 224, .38); }
.stag.mod { color: var(--tk-ok); background: var(--tk-ok-soft); border-color: rgba(116, 201, 138, .4); }
.eq-card-dur { display: grid; grid-template-columns: 1fr 96px; gap: 6px; align-items: center; }
.eq-dur-info { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.eq-card-eff { display: grid; grid-template-columns: 1fr 96px; gap: 6px; align-items: center; }
.eq-card-dur input[type="number"], .eq-card-eff select, .eq-card-eff input[type="number"] {
  width: 100%; min-width: 0; font-size: 12px; height: 29px; padding: 0 7px;
}
.eq-card-dur input.is-mod, .eq-card-eff select.is-mod, .eq-card-eff input.is-mod, .eq-card-fuse input.is-mod {
  color: var(--tk-gold-hi); border-color: var(--tk-gold-line); font-weight: 600;
}
.eq-card-fuse { display: grid; grid-template-columns: 1fr 96px; gap: 6px; align-items: center; }
.eq-fuse-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.eq-fuse-btn {
  flex: 1 1 auto; min-width: 0; height: 29px; padding: 0 8px;
  display: flex; align-items: center; gap: 4px;
  background: var(--tk-sunken); color: var(--tk-text-2);
  border: 1px solid var(--tk-line-2); border-radius: 7px;
  font-size: 11.5px; font-family: inherit; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left; transition: border-color .14s, color .14s, background .14s;
}
.eq-fuse-btn:hover { border-color: var(--tk-gold-line); color: var(--tk-text); }
.eq-fuse-btn.has { color: var(--tk-text); }
.eq-fuse-btn.is-mod { color: var(--tk-gold-hi); border-color: var(--tk-gold-line); background: var(--tk-gold-soft); font-weight: 600; }
.eq-fuse-clr {
  flex: 0 0 auto; width: 22px; height: 29px; padding: 0;
  border: 1px solid var(--tk-line-2); border-radius: 6px;
  background: var(--tk-sunken); color: var(--tk-text-3);
  font-size: 13px; line-height: 1; cursor: pointer; transition: .14s;
}
.eq-fuse-clr:hover { color: var(--tk-danger); border-color: rgba(232, 112, 112, .5); }
.eq-card-fuse input[type="number"] { width: 100%; min-width: 0; font-size: 12px; height: 29px; padding: 0 7px; }
.eq-card-fuse input:disabled { opacity: .38; cursor: not-allowed; }

/* ---- 余料附着选择弹窗 ---- */
.fuse-sec-lbl { font-size: 11.5px; color: var(--tk-text-3); margin-bottom: 6px; }
.fuse-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fuse-chip {
  padding: 4px 9px; border-radius: 6px; font-size: 11.5px; font-family: inherit;
  border: 1px solid var(--tk-line-2); background: var(--tk-sunken); color: var(--tk-text);
  cursor: pointer; transition: .12s;
}
.fuse-chip:hover { border-color: var(--tk-gold-line); color: var(--tk-gold-hi); background: var(--tk-gold-soft); }
.fuse-chip small { color: var(--tk-gold); margin-left: 3px; font-size: 10.5px; }
.fuse-search {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--tk-line-2); background: var(--tk-sunken); color: var(--tk-text);
  font-size: 12.5px; font-family: inherit; outline: none; margin-bottom: 8px;
}
.fuse-search:focus { border-color: var(--tk-gold-line); }
.fuse-list {
  max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  padding-right: 2px;
}
.fuse-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--tk-line);
  background: var(--tk-sunken); color: var(--tk-text); font-size: 12px; font-family: inherit;
  cursor: pointer; text-align: left; transition: .12s;
}
.fuse-row:hover { border-color: var(--tk-gold-line); background: var(--tk-panel-hi); }
.fuse-row small { color: var(--tk-text-3); font-family: ui-monospace, monospace; font-size: 10.5px; }
.eq-card-eff .eq-valwrap { height: 29px; }
.eq-card-eff .eq-inf { height: 29px; }

/* ---- Tab 4: 蓝图工坊 30槽拖拽 ---- */
.bp-split { display: grid; grid-template-columns: 1.05fr 1.15fr; gap: 14px; }
@media (max-width: 960px) { .bp-split { grid-template-columns: 1fr; } }
.bp-slot-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
@media (max-width: 640px) { .bp-slot-grid { grid-template-columns: repeat(3, 1fr); } }
.bp-slot {
  min-height: 50px; padding: 5px 6px; border-radius: 7px; border: 1px solid var(--tk-line);
  background: var(--tk-sunken); font-size: 10.5px; color: var(--tk-text-3);
  display: flex; flex-direction: column; justify-content: space-between; position: relative;
  cursor: pointer; transition: .12s;
}
.bp-slot.used { border-color: rgba(111, 211, 224, .35); color: var(--tk-text); background: rgba(111, 211, 224, .07); }
.bp-slot.next-empty { border: 1.5px dashed var(--tk-gold-line); color: var(--tk-gold); }
.bp-slot.queued { border: 1.5px solid var(--tk-gold); color: var(--tk-gold-hi); background: var(--tk-gold-soft); }
.bp-slot.drag-over { transform: scale(1.04); border-color: var(--tk-cyan); background: var(--tk-cyan-soft); }
.bp-slot.selected { box-shadow: 0 0 0 2px var(--tk-cyan); }
.bp-slot-head { display: flex; justify-content: space-between; align-items: center; font-size: 10px; opacity: .8; }
.bp-slot-rm { cursor: pointer; font-weight: 700; color: var(--tk-text-2); padding: 0 2px; }
.bp-slot-rm:hover { color: var(--tk-danger); }
.bp-slot-lbl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bp-slot-tools, .bp-code-row, .bp-lib-toolbar {
  display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px;
}
.bp-slot-tools select, .bp-code-row input {
  flex: 1; min-width: 140px; background: var(--tk-sunken); color: var(--tk-text);
  border: 1px solid var(--tk-line-2); border-radius: 7px; padding: 6px 8px; font-size: 12px; font-family: inherit;
}
.bp-share-box {
  margin: 8px 0; padding: 10px; border: 1px solid var(--tk-line-2); border-radius: 8px; background: var(--tk-sunken);
}
.bp-share-box textarea {
  width: 100%; background: var(--tk-bg); color: var(--tk-text); border: 1px solid var(--tk-line);
  border-radius: 6px; padding: 7px; font-size: 11px; font-family: ui-monospace, monospace; word-break: break-all;
}
.bp-lib-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.bp-preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (max-width: 640px) { .bp-preset-grid { grid-template-columns: 1fr; } }
.bp-preset-card {
  padding: 9px 10px; border-radius: 9px; border: 1px solid var(--tk-line-2);
  background: var(--tk-sunken); cursor: grab; display: flex; flex-direction: column; gap: 4px; transition: .14s;
}
.bp-preset-card:hover { border-color: rgba(111, 211, 224, .45); background: var(--tk-panel-hi); }
.bp-preset-card:active { cursor: grabbing; }

/* ---- 顶部 4 栏直接修改 HUD ---- */
.hud.hud-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .hud.hud-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-edit {
  margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--tk-line);
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.stat-edit input[type="number"] {
  width: 82px; flex: 1; min-width: 64px;
  background: var(--tk-sunken); color: var(--tk-text);
  border: 1px solid var(--tk-line-2); border-radius: 6px;
  padding: 4px 7px; font-size: 12px; font-family: inherit; outline: none;
}
.stat-edit input[type="number"]:focus { border-color: var(--tk-gold); }
.stat-edit .seg { width: 100%; }
.stat-edit .seg button { flex: 1; padding: 3px 6px; font-size: 12px; }
.stat-edit .qbtn { padding: 3px 7px; font-size: 12px; }

/* ---- v4: 最小字号 12px 规范化 + 正文 13-14px ---- */
.brand-tag, .chip, .sb-sub, .sb-right, .stat-lbl, .stat-was, .card-head .idx,
.card-head .note, .btn-mini, .qbtn, .seg button, .mtab .badge, .bag-ed-name small,
.bag-qty, .bag-pager, .eq-tab, .eq-tab .cnt, .stag, .eq-card-ctl input, .eq-card-ctl select,
.bp-slot, .bp-slot-head, .bp-slot-tools select, .bp-code-row input, .bp-share-box textarea,
.tip, .empty, .foot .status, .chg .va {
  font-size: 12px;
}
.sb-title, .mtab, .card-head h2, .btn, .bag-search, .bag-ed-name, .eq-card-title {
  font-size: 13.5px;
}
.bag-name, .bag-cat-pill, .chg, .chg b { font-size: 13px; }

/* ---- v8: 顶部左右等宽 1fr:1fr，修复 .save-banner 居中问题 ---- */
.top-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; align-items: stretch;
}
@media (max-width: 960px) { .top-split { grid-template-columns: 1fr; } }

.drop-zone {
  margin-bottom: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: 8px; padding: 12px;
  border: 1.5px dashed rgba(212, 169, 90, .42); border-radius: 12px;
  background: linear-gradient(135deg, rgba(212, 169, 90, .06), rgba(111, 211, 224, .03));
  transition: border-color .15s, background .15s;
}
.drop-zone.drag-over { border-color: var(--tk-gold); background: rgba(212, 169, 90, .14); }
.sb-top {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding-bottom: 8px; border-bottom: 1px solid var(--tk-line);
}
.sb-top-row { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.sb-drag-hint { font-size: 12px; color: var(--tk-text-3); flex: 1; min-width: 140px; }
.sb-info { width: 100%; min-width: 0; }
.sb-actions-inline { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.stats-subhead {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 2px 0 4px; font-size: 13px; font-weight: 700; color: var(--tk-text-2);
}
.stats-subhead-acts { display: flex; align-items: center; gap: 6px; }
.stats-subhead-acts [hidden] { display: none; }

.stat-list-plain {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; width: 100%;
}
@media (max-width: 640px) { .stat-list-plain { grid-template-columns: 1fr; } }
.stat-list-plain .stat-line {
  display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; min-width: 0;
  padding: 6px 4px; border: 0; border-bottom: 1px dashed var(--tk-line); border-radius: 0; background: transparent;
}
.stat-list-plain .stat-line:nth-last-child(-n+2) { border-bottom: 0; }
@media (max-width: 640px) {
  .stat-list-plain .stat-line:nth-last-child(2) { border-bottom: 1px dashed var(--tk-line); }
}
.stat-list-plain .stat-line.mod {
  border-color: rgba(212, 169, 90, .45); background: rgba(212, 169, 90, .06); border-radius: 5px;
}
.stat-list-plain .stat-lbl { font-size: 13.5px; color: #6fd3e0; font-weight: 700; min-width: 30px; flex-shrink: 0; }
.stat-list-plain .stat-val { font-size: 15px; font-weight: 700; color: #f59e0b; white-space: nowrap; }
.stat-list-plain .stat-was { display: none; }
.stat-list-plain .stat-edit {
  margin-top: 0; padding-top: 0; border-top: 0; margin-left: auto;
  display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: nowrap; flex-shrink: 0;
}
.stat-list-plain .stat-edit input[type="number"] {
  width: 66px; background: var(--tk-sunken); color: var(--tk-text);
  border: 1px solid var(--tk-line-2); border-radius: 6px; padding: 3px 6px; font-size: 13px; font-family: inherit;
}
.stat-list-plain .stat-edit .seg { width: auto; }
.stat-list-plain .stat-edit .seg button { padding: 3px 6px; font-size: 12px; }

.mod-log-panel {
  background: var(--tk-panel); border: 1px solid var(--tk-line); border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.mod-log-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--tk-text); padding-bottom: 5px; border-bottom: 1px solid var(--tk-line);
}
.mod-log-head b { color: var(--tk-gold); }
.sb-meta { font-size: 12px; color: var(--tk-text-3); font-weight: 400; }
.sb-meta b { color: var(--tk-text); }
.sb-meta b.mod { color: var(--tk-gold); }
.mod-log-list {
  flex: 1; max-height: 158px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 12px;
}
.mod-log-empty { color: var(--tk-text-3); padding: 6px 2px; font-size: 12px; }
.mod-log-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 4px; border-radius: 5px; background: rgba(255, 255, 255, .025);
}
.mod-log-item:hover { background: rgba(255, 255, 255, .05); }
.mod-log-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tk-text-2); }
.mod-log-txt b { color: var(--tk-gold); font-weight: 600; }

/* ---- 单项撤销按钮 ---- */
.undo-mini {
  background: rgba(212, 169, 90, .14); color: var(--tk-gold);
  border: 1px solid rgba(212, 169, 90, .4); border-radius: 5px;
  padding: 1px 6px; font-size: 12px; line-height: 1.3; cursor: pointer; font-family: inherit;
  transition: .12s; flex-shrink: 0;
}
.undo-mini:hover { background: rgba(212, 169, 90, .28); color: #fff; }
.bag-card { position: relative; }
.bag-card .undo-mini, .eq-card .undo-mini { margin-left: auto; flex-shrink: 0; }

/* ---- v7: 蓝图工坊等高左右双表格 + 流式蓝名橙矿 + 通栏二维码 ---- */
.bp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
@media (max-width: 980px) { .bp-split { grid-template-columns: 1fr; } }
.bp-split > .card { display: flex; flex-direction: column; height: 100%; }
.bp-split > .card > .card-body { flex: 1; display: flex; flex-direction: column; }

.bp-slot-tools { flex-wrap: nowrap; }
.bp-slot-tools select { max-width: 170px; }
.bp-slot-tools input[type="text"] {
  flex: 1; min-width: 120px; background: var(--tk-sunken); color: var(--tk-text);
  border: 1px solid var(--tk-line-2); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; font-family: inherit;
}
.bp-table-wrap {
  flex: 1; max-height: 460px; overflow-y: auto; border: 1px solid var(--tk-line); border-radius: 8px;
  background: var(--tk-sunken);
}
.bp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bp-table th {
  position: sticky; top: 0; z-index: 1; background: var(--tk-panel);
  color: var(--tk-text-3); font-weight: 600; font-size: 12px; text-align: left;
  padding: 7px 8px; border-bottom: 1px solid var(--tk-line-2);
}
.bp-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--tk-line); vertical-align: middle; line-height: 1.45;
}
.bp-table tbody tr { transition: background .12s; }
.bp-table tbody tr:hover { background: rgba(255, 255, 255, .04); }
.bp-table tbody tr.selected { background: rgba(111, 211, 224, .09); }
.bp-table tbody tr.queued { background: rgba(212, 169, 90, .10); }
.bp-table tbody tr.drag-over { background: rgba(212, 169, 90, .24); outline: 1px dashed var(--tk-gold); }
.bp-table tbody tr[draggable="true"] { cursor: grab; }
.bp-alias-tag {
  display: inline-block; padding: 1px 6px; margin-right: 6px; border-radius: 4px;
  background: rgba(111, 211, 224, .14); color: var(--tk-cyan); font-weight: 600; font-size: 12px;
}
.bp-lib-name-badge {
  display: inline-block; padding: 1px 6px; margin-right: 6px; border-radius: 4px;
  background: rgba(111, 211, 224, .14); color: #6fd3e0; font-weight: 700; font-size: 12px;
}
.bp-lib-ore-badge {
  display: inline-block; padding: 1px 6px; margin-right: 6px; border-radius: 4px;
  background: rgba(245, 158, 11, .16); color: #f59e0b; font-weight: 700; font-size: 12px;
}
.bp-parts-txt { color: var(--tk-text-2); font-size: 12px; }
.bp-row-ops { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.bp-row-ops .btn-mini { padding: 2px 7px; font-size: 12px; }
.bp-lib-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; font-size: 12px; color: var(--tk-text-3); min-height: 28px;
}

/* 通栏分享码 / 上方高清大图二维码 + 下方通栏分享码 */
.bp-share-panel { margin-top: 12px; border-color: rgba(111, 211, 224, .4); }
.bp-share-stack { display: flex; flex-direction: column; gap: 14px; }
.bp-share-qr-box { text-align: center; }
#bpQr { background: #fff; padding: 16px; border-radius: 10px; display: inline-block; line-height: 0; max-width: 100%; }
#bpQr svg { width: 520px; max-width: 100%; height: auto; display: block; }
.bp-share-code-box { width: 100%; }
.bp-share-code-box textarea {
  width: 100%; background: var(--tk-sunken); color: var(--tk-text);
  border: 1px solid var(--tk-line-2); border-radius: 7px; padding: 8px;
  font-size: 12px; font-family: ui-monospace, monospace; word-break: break-all;
}
