/* 万象棋攻略库管理后台 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e3e6eb;
  --text: #24292f;
  --text2: #6a7381;
  --primary: #2f6fed;
  --gold: #d9950a;
  --danger: #d93838;
  --q1: #7c8798; --q2: #4fc47f; --q3: #4a9df8; --q4: #b07af5; --q5: #f5b544;
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }

/* 登录 */
.login-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,20,32,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 320px; background: var(--panel); border-radius: 12px;
  padding: 28px 24px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-title { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 18px; }
.login-err { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 16px; text-align: center; }

/* 顶栏 */
.topbar {
  height: 52px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 700; white-space: nowrap; }
.stat-chips { display: flex; gap: 8px; flex: 1; overflow-x: auto; }
.stat-chip {
  white-space: nowrap; font-size: 12px; color: var(--text2);
  background: var(--bg); border-radius: 20px; padding: 4px 10px;
}
.stat-chip b { color: var(--text); font-weight: 600; }

/* 布局 */
.main { display: flex; height: calc(100vh - 52px); }
.sidebar {
  width: 300px; min-width: 300px; border-right: 1px solid var(--line);
  background: var(--panel); display: flex; flex-direction: column;
}
.editor { flex: 1; overflow-y: auto; padding: 18px 22px 90px; }
.editor.empty { display: flex; align-items: center; justify-content: center; }
.empty-tip { color: var(--text2); }

/* 筛选 */
.filters { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.filter-row { display: flex; gap: 8px; }
.filter-row .input { flex: 1; min-width: 0; }

.input, select.input {
  width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 10px; font-size: 13px; background: #fff; color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--primary); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }

/* 按钮 */
.btn {
  height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #2a62d4; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.btn-gold:hover { background: #c58709; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c22f2f; }
.btn-block { width: 100%; height: 38px; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

/* 列表 */
.comp-list { flex: 1; overflow-y: auto; }
.comp-item {
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.comp-item:hover { background: var(--bg); }
.comp-item.active { background: #eef3fe; box-shadow: inset 3px 0 0 var(--primary); }
.comp-item-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.comp-item-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg); color: var(--text2);
}
.mini-tag.camp { background: #eaf2ea; color: #2e7d43; }
.mini-tag.warn { background: #fdf1dc; color: #b4770a; }
.comp-item-count { float: right; font-size: 11px; color: var(--text2); }

/* 编辑器卡片 */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 14px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 14px; background: #fafbfc;
}
.card-body { padding: 14px 16px; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.form-item label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.form-item .input { height: 34px; }
.form-item-full { grid-column: span 4; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 14px; font-size: 12px;
  background: #eef3fe; color: #2a5cc9; cursor: default;
}
.chip.gold { background: #fdf1dc; color: #b4770a; }
.chip.green { background: #eaf2ea; color: #2e7d43; }
.chip .x { cursor: pointer; font-weight: 700; opacity: .6; }
.chip .x:hover { opacity: 1; }
.chip-add {
  padding: 3px 10px; border-radius: 14px; font-size: 12px; cursor: pointer;
  border: 1px dashed var(--line); color: var(--text2); background: none;
}
.chip-add:hover { border-color: var(--primary); color: var(--primary); }

/* 站位棋盘 */
.board-wrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.board { display: grid; grid-template-columns: repeat(7, 58px); gap: 4px; }
.cell {
  width: 58px; height: 58px; border-radius: 8px; border: 1px dashed var(--line);
  background: #fafbfc; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
}
.cell:hover { border-color: var(--primary); background: #eef3fe; }
.cell.filled { border-style: solid; background: #fff; }
.cell .hero-name { font-size: 11px; font-weight: 600; text-align: center; padding: 0 2px; }
.cell .hero-role { font-size: 10px; color: var(--text2); }
.cell .q-dot {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.cell .cell-pos { position: absolute; bottom: 1px; right: 3px; font-size: 9px; color: #c3c9d2; }
.board-side { flex: 1; min-width: 260px; }
.board-hint { font-size: 12px; color: var(--text2); margin-bottom: 10px; line-height: 1.7; }

/* 核心战备表 */
.loadout-row {
  display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px;
  padding: 7px 0; border-bottom: 1px dashed var(--line); align-items: center;
}
.loadout-row:last-child { border-bottom: none; }
.loadout-hero { font-size: 13px; font-weight: 600; }
.loadout-hero .q1,.q2,.q3,.q4,.q5 { }
.loadout-field label { font-size: 11px; color: var(--text2); display: block; }
.loadout-field input { margin-top: 2px; }

/* 阶段站位 */
.stage-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.stage-tab {
  padding: 4px 14px; border-radius: 16px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: #fff;
}
.stage-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.stage-note { margin-bottom: 10px; }
.unit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.unit-table th {
  text-align: left; font-weight: 500; color: var(--text2);
  padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.unit-table td { padding: 4px 6px; vertical-align: middle; }
.unit-table .input { height: 28px; font-size: 12px; padding: 0 6px; }
.unit-eq { display: flex; gap: 4px; }
.unit-eq .input { min-width: 0; }
.add-unit-btn { margin-top: 8px; }

/* 底部操作条 */
.editor-footer {
  position: fixed; bottom: 0; left: 300px; right: 0; z-index: 9;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 10px 22px; display: flex; gap: 10px; align-items: center;
}
.editor-footer .spacer { flex: 1; }
.edit-id { font-size: 12px; color: var(--text2); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(15,20,32,.45);
  display: flex; align-items: center; justify-content: center;
}
.modal { background: var(--panel); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.picker-modal { width: 560px; max-height: 78vh; padding: 16px; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--text2); line-height: 1; }
.camp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.camp-tab {
  font-size: 12px; padding: 3px 10px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line);
}
.camp-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.picker-list { overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; min-height: 120px; }
.picker-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 12px;
}
.picker-item:hover { border-color: var(--primary); background: #eef3fe; }
.q-dot-inline { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.picker-item .p-meta { color: var(--text2); font-size: 11px; }
.confirm-modal { width: 380px; padding: 22px; }
.confirm-text { line-height: 1.7; margin-bottom: 18px; white-space: pre-wrap; }
.confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }

/* toast */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: rgba(20,26,41,.92); color: #fff; padding: 9px 18px;
  border-radius: 8px; font-size: 13px; max-width: 70vw;
}
.toast.err { background: rgba(217,56,56,.95); }

/* 来源切换（精选 / 官方 / 阵容码） */
.src-tabs { display: flex; gap: 0; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.src-tab {
  flex: 1; padding: 7px 2px; border: none; background: #fff; cursor: pointer;
  font-size: 12px; color: var(--text2); white-space: nowrap;
}
.src-tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.src-tab span { opacity: .75; font-size: 11px; }

/* 阵容码 */
.mini-tag.code { background: #e6f4ea; color: #1e7a3c; font-weight: 600; }
.mini-tag.nocode { background: #f7f8fa; color: #a2a9b4; }
.code-edit { display: flex; gap: 8px; align-items: center; }
.code-input {
  flex: 1; font-size: 15px; letter-spacing: 1px;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.code-hint { margin-top: 10px; font-size: 12px; color: var(--text2); line-height: 1.75; }
.code-meta { margin-top: 8px; font-size: 12px; color: var(--text2); }
.code-meta b { color: var(--text); font-family: Consolas, monospace; }

/* 批量导入 */
.bulk-modal { width: 560px; padding: 16px; }
.bulk-tip { font-size: 12px; color: var(--text2); line-height: 1.7; margin-bottom: 8px; }
.bulk-modal textarea {
  font-family: Consolas, monospace; font-size: 13px; line-height: 1.7;
}
.bulk-btns { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.bulk-result { flex: 1; font-size: 12px; color: var(--text2); }

/* 官方阵容只读预览 */
.ro-val { padding: 7px 10px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.ro-text {
  font-family: inherit; font-size: 13px; line-height: 1.7; white-space: pre-wrap;
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin: 0;
}
.ro-stage { margin-bottom: 14px; }
.ro-stage-head { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.ro-stage-note { font-size: 12px; color: var(--text2); margin-bottom: 6px; line-height: 1.6; }
.unit-table.ro td { background: #fff; font-size: 12px; }
