/* ============================================================
 * style.css —— 魂缚角色卡网站样式（暗色奇幻主题）
 * ============================================================ */

:root {
  --bg: #12141c;
  --bg2: #171a26;
  --panel: #1e2230;
  --panel2: #262b3d;
  --line: #343b52;
  --line2: #464f6e;
  --text: #e8e4d8;
  --text-dim: #9aa2bd;
  --gold: #c9a45c;
  --gold-soft: #e0c98a;
  --blue: #5c8bd6;
  --red: #c45b5b;
  --green: #6fae7a;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
}

/* ---------- 整体布局 ---------- */
#app {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  width: 230px;
  flex: 0 0 230px;
  background: linear-gradient(180deg, #171a26 0%, #10131d 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: flex-basis 0.28s ease, width 0.28s ease, padding 0.28s ease;
  overflow: hidden;
}

/* 导航栏缩回/展开 */
.nav-toggle {
  position: fixed;
  left: 230px;
  top: 14px;
  z-index: 100;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--gold-soft);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: left 0.28s ease, transform 0.28s ease, background 0.2s;
}

.nav-toggle:hover {
  border-color: var(--gold);
  background: rgba(201, 164, 92, 0.15);
}

/* 角色切换栏（KP端 / PL端 / 访客端） */
.role-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px 0;
}

.role-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 2px;
  cursor: pointer;
  font-size: 12px;
  text-align: center;
}

.role-btn:hover {
  border-color: var(--gold);
  color: var(--text);
}

.role-btn.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(201, 164, 92, 0.12);
}

.role-status {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 12px 8px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

body.access-guest .role-status {
  color: #d9b36a;
}

/* 访客端只读：输入与修改按钮弱化提示 */
body.access-guest .btn-danger,
body.access-guest .add-card,
body.access-guest .roster-add {
  opacity: 0.55;
}

body.nav-collapsed #sidebar {
  flex-basis: 0;
  width: 0;
  padding: 0;
  border-right: none;
}

body.nav-collapsed #sidebar .sidebar-brand,
body.nav-collapsed #sidebar #nav,
body.nav-collapsed #sidebar .sidebar-footer {
  opacity: 0;
  pointer-events: none;
}

body.nav-collapsed .nav-toggle {
  left: 4px;
  transform: rotate(180deg);
}

.sidebar-brand {
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.brand-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(201, 164, 92, 0.35);
}

.brand-sub {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

#nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--panel);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.16), rgba(201, 164, 92, 0.03));
  border-color: rgba(201, 164, 92, 0.45);
  color: var(--gold-soft);
}

.nav-item.placeholder .nav-icon {
  opacity: 0.45;
}

.nav-icon {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-dim);
}

#save-status.flash {
  color: var(--green);
  transition: color 0.2s;
}

#main {
  flex: 1;
  min-width: 0;
  padding: 24px 30px 60px;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(92, 139, 214, 0.10), transparent 60%),
    radial-gradient(900px 460px at -10% 110%, rgba(201, 164, 92, 0.07), transparent 60%),
    var(--bg);
}

#page-header h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--gold-soft);
}

#page-header .sub {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 13px;
}

.sheet {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- 顶部名册导航栏 ---------- */
.roster-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.roster-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.roster-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 20px;
  padding: 6px 10px 6px 14px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  user-select: none;
}

.roster-tab:hover {
  border-color: var(--gold);
  color: var(--text);
}

.roster-tab.active {
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.22), rgba(201, 164, 92, 0.06));
  border-color: var(--gold);
  color: var(--gold-soft);
}

.roster-del {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 50%;
}

.roster-del:hover {
  color: var(--red);
}

.roster-add {
  margin-left: 4px;
}

/* 名册分组（无主角色卡 / 各PL账号的角色卡） */
.roster-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.roster-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  border-radius: 14px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 13px;
}

.roster-group small {
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(140, 145, 170, 0.15);
  border-radius: 8px;
  padding: 0 6px;
}

.roster-group.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(201, 164, 92, 0.1);
}

/* PL账号管理（KP登录后显示在角色栏下方） */
.pl-accounts-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.pl-accounts-label {
  color: var(--gold-soft);
  font-weight: 700;
}

.pl-account-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 3px 6px 3px 10px;
  color: var(--text);
  font-size: 12px;
}

.pl-account-del {
  background: #7a2b2b;
  border-color: #b04a4a;
  color: #ffd9d9;
  font-size: 13px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-weight: 800;
}

/* PL查看他人角色卡：只读弱化提示 */
.sheet-readonly input,
.sheet-readonly textarea,
.sheet-readonly select {
  opacity: 0.7;
}

.sheet-readonly .btn[data-action] {
  opacity: 0.55;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.card h3 {
  margin: 18px 0 10px;
  font-size: 15px;
  color: var(--gold-soft);
}

.card .hint {
  margin: -4px 0 12px;
  font-size: 12px;
  color: var(--text-dim);
}

.empty-tip {
  color: var(--text-dim);
  font-size: 13px;
  margin: 8px 0;
}

/* ---------- 顶部角色卡 ---------- */
.header-card {
  display: flex;
  gap: 22px;
}

.portrait-area {
  flex: 0 0 190px;
}

.img-frame {
  width: 100%;
  height: 210px;
  border: 1px dashed var(--line2);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-uploader.round .img-frame {
  border-radius: 50%;
  height: 150px;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-uploader .img-empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.img-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: center;
}

.meta-area {
  flex: 1;
  min-width: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.field.wide {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

/* ---------- 属性 ---------- */
.attrs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.attr-block {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.attr-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-soft);
}

.attr-name span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.attr-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 8px;
}

.attr-value {
  font-size: 34px;
  font-weight: 800;
  min-width: 54px;
  color: var(--text);
}

.attr-btn {
  width: 30px;
  height: 30px;
  font-size: 17px;
  line-height: 1;
}

.attr-desc {
  font-size: 11px;
  color: var(--text-dim);
}

.attr-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--blue);
}

/* ---------- 战斗能力 ---------- */
.combat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.stat-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
}

.stat-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-soft);
}

.stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-dim);
}

.resource-input {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.resource-input input {
  width: 68px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  padding: 3px 6px;
  text-align: center;
}

.resource-sep {
  color: var(--text-dim);
}

.resource-max {
  color: var(--text-dim);
  font-size: 15px;
}

.combat-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.combat-ladder,
.combat-wounds {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.combat-ladder h3,
.combat-wounds h3 {
  margin-top: 0;
}

.ladder-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}

.ladder-name {
  width: 82px;
  font-size: 13px;
}

.ladder-num {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ladder-value {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-size: 22px;
  color: var(--gold-soft);
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 2px 6px;
}

.ladder-btn {
  padding: 2px 8px;
}

.ladder-info {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--text-dim);
}

.def-bonus {
  margin-top: 8px;
  font-size: 12px;
  color: var(--green);
}

.wound-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.wound-box {
  width: 34px;
  height: 26px;
  border: 1px solid var(--line2);
  border-radius: 4px;
  background: var(--bg2);
  cursor: pointer;
  transition: all 0.15s;
}

.wound-box:hover {
  border-color: var(--gold);
}

.wound-box.filled {
  background: linear-gradient(180deg, #7d2f2f, #a84a3c);
  border-color: #c46a55;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.4);
}

.wound-info {
  font-size: 12px;
  color: var(--text-dim);
}

.dying-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--red);
}

/* ---------- 状态栏 ---------- */
.status-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.status-col {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.status-col h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
  margin-bottom: 10px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 16px;
  padding: 4px 8px 4px 12px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.12s;
}

.status-chip:hover {
  filter: brightness(1.15);
}

.status-chip.buff {
  background: rgba(111, 174, 122, 0.14);
  border-color: rgba(111, 174, 122, 0.55);
  color: #a8d6b0;
}

.status-chip.debuff {
  background: rgba(196, 91, 91, 0.14);
  border-color: rgba(196, 91, 91, 0.55);
  color: #e5a6a6;
}

.chip-effect {
  color: var(--text-dim);
}

.chip-duration {
  font-size: 11px;
  color: var(--text-dim);
  border-left: 1px solid var(--line2);
  padding-left: 6px;
}

.chip-del {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.chip-del:hover {
  opacity: 1;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.diff-table th,
.diff-table td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
}

.diff-table th {
  background: var(--panel2);
  color: var(--gold-soft);
}

.diff-num {
  text-align: center;
  font-weight: 700;
  color: var(--gold);
}

/* ---------- 技能 ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: 2.2fr 0.9fr 0.9fr;
  gap: 2px 8px;
  align-items: center;
}

.skill-head {
  font-size: 12px;
  color: var(--gold-soft);
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}

.skill-row {
  display: contents;
}

.skill-row > div {
  padding: 5px 4px;
  border-bottom: 1px dashed var(--line);
}

.skill-name {
  font-size: 13px;
}

.skill-attr {
  margin-left: 6px;
  font-size: 11px;
  color: var(--blue);
  border: 1px solid rgba(92, 139, 214, 0.4);
  border-radius: 10px;
  padding: 1px 7px;
}

.skill-note {
  font-size: 11px;
  color: var(--text-dim);
}

.skill-dots {
  display: flex;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  user-select: none;
}

.skill-dots .circle {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--line2);
  background: transparent;
  display: inline-block;
  cursor: pointer;
  transition: all 0.12s;
}

.skill-dots .circle.on {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(201, 164, 92, 0.55);
}

.skill-dots .circle:hover {
  border-color: var(--gold);
}

.skill-dots .star {
  font-size: 16px;
  line-height: 1;
  color: var(--line2);
  cursor: pointer;
  transition: all 0.12s;
}

.skill-dots .star.on {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(201, 164, 92, 0.6);
}

.skill-dots .star:hover {
  color: var(--gold);
}

.skill-dots .dot-level {
  margin-left: 5px;
  font-size: 11px;
  color: var(--text-dim);
  min-width: 14px;
}

/* 技能卡内的两行熟练度/专注值 */
.skill-levels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 5px;
}

.level-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.level-label {
  flex: 0 0 34px;
  font-size: 11px;
  color: var(--text-dim);
}

.level-row .skill-dots .circle {
  width: 13px;
  height: 13px;
}

.level-row .skill-dots .star {
  font-size: 14px;
}

/* ---------- 卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.card-mini {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  transition: border-color 0.15s, transform 0.12s;
  cursor: pointer;
}

.card-mini:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.mini-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.mini-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.icon-fallback {
  line-height: 1;
}

.mini-body {
  flex: 1;
  min-width: 0;
}

.mini-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 10px;
  font-weight: 400;
  color: var(--blue);
  border: 1px solid rgba(92, 139, 214, 0.4);
  border-radius: 8px;
  padding: 0 6px;
}

.mini-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.mini-edit,
.mini-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}

.add-card {
  border: 1px dashed var(--line2);
  background: transparent;
  color: var(--text-dim);
  min-height: 70px;
  font-size: 14px;
  border-radius: 8px;
}

.add-card:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
}

/* ---------- 装备 ---------- */
.equip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.equip-slot {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.equip-slot-label {
  font-size: 12px;
  color: var(--gold-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 8px;
  font-weight: 700;
}

.equip-slot-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.equip-empty {
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 0;
}

.btn-add-slot {
  align-self: flex-start;
}

/* ---------- 货币 ---------- */
.currency-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.currency-row .field {
  width: 120px;
}

.currency-total {
  font-size: 13px;
  color: var(--gold-soft);
  padding-bottom: 6px;
}

/* ---------- 按钮 ---------- */
.btn {
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.btn-mini {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-primary {
  background: linear-gradient(180deg, rgba(201, 164, 92, 0.25), rgba(201, 164, 92, 0.12));
  border-color: var(--gold);
  color: var(--gold-soft);
}

.btn-danger {
  border-color: rgba(196, 91, 91, 0.7);
  color: #e0a0a0;
}

.btn-danger:hover {
  background: rgba(196, 91, 91, 0.15);
  border-color: var(--red);
  color: #f0c0c0;
}

/* ---------- 工具区 ---------- */
.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.tool-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---------- 成长花费参考 ---------- */
.xp-ref summary {
  cursor: pointer;
}

.xp-ref summary h2 {
  display: inline;
  border: none;
  padding: 0;
}

.xp-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.xp-ref table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.xp-ref th,
.xp-ref td {
  border: 1px solid var(--line);
  padding: 5px 8px;
  text-align: center;
}

.xp-ref th {
  background: var(--panel2);
  color: var(--gold-soft);
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 14, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-mask.closing {
  opacity: 0;
  transition: opacity 0.15s;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

/* 视野共享卡片：更小、不模糊背景 */
.modal-mask.share-modal {
  background: rgba(8, 9, 14, 0.45);
  backdrop-filter: none;
}
.modal-mask.share-modal .modal-box {
  max-width: 360px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  color: var(--gold-soft);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

/* 详情弹窗 */
.detail-icon {
  width: 90px;
  min-height: 90px;
  margin: 0 auto 14px;
}

.detail-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-icon .img-uploader .img-frame {
  height: 90px;
  border-radius: 10px;
  font-size: 32px;
}

.detail-icon .img-actions {
  margin-top: 6px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.detail-table th,
.detail-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  vertical-align: top;
  text-align: left;
}

.detail-table th {
  background: var(--panel2);
  color: var(--gold-soft);
  width: 90px;
  white-space: nowrap;
}

.detail-desc {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.detail-desc h4 {
  margin: 0 0 6px;
  color: var(--gold-soft);
}

.detail-desc p {
  margin: 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* 详情弹窗中的效果数据分区 */
.detail-effects {
  margin-top: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.detail-effects h4 {
  margin: 0 0 10px;
  color: var(--gold-soft);
}

.fx-block {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}

.fx-block:last-child {
  border-bottom: none;
}

.fx-label {
  flex: 0 0 72px;
  font-size: 12px;
  color: var(--text-dim);
}

.fx-content {
  flex: 1;
  font-size: 13px;
}

.fx-list {
  margin: 0;
  padding-left: 18px;
}

.fx-empty {
  color: var(--line2);
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}

.confirm-text {
  line-height: 1.7;
}

/* 表单弹窗 */
.form-grid {
  display: flex;
  gap: 16px;
}

.form-icon-col {
  flex: 0 0 130px;
}

.form-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-fields .field.wide {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  grid-column: 1 / -1;
  color: var(--text);
}

/* 效果编辑器（表单内） */
.fx-editor {
  grid-column: 1 / -1;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.fx-editor h4 {
  margin: 0 0 10px;
  color: var(--gold-soft);
}

.fx-group {
  margin-bottom: 12px;
}

.fx-group h5 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fx-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.fx-row input,
.fx-row select {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  flex: 1;
  min-width: 90px;
}

.fx-row input:focus,
.fx-row select:focus {
  border-color: var(--gold);
}

.fx-row .fx-stat {
  flex: 0 0 110px;
}

.fx-row .fx-value {
  flex: 0 0 110px;
}

.fx-percent {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--text-dim);
  flex: 0 0 auto;
}

.fx-del {
  flex: 0 0 auto;
}

/* ---------- 提示 ---------- */
#toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-left: 3px solid var(--green);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(16px);
  transition: all 0.22s;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.error {
  border-left-color: var(--red);
}

/* ---------- 预留页 ---------- */
.placeholder-page {
  text-align: center;
  padding: 90px 20px;
  color: var(--text-dim);
}

.placeholder-icon {
  font-size: 60px;
  color: var(--line2);
  margin-bottom: 18px;
}

.placeholder-page h2 {
  color: var(--text);
  margin-bottom: 10px;
}

.placeholder-page code {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--gold-soft);
}

/* ============================================================
 * 地图与战斗系统
 * ============================================================ */
.map-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 1500px;
  margin: 0 auto;
}

.map-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.map-check,
.map-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
}

.map-field input,
.map-field select {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  max-width: 90px;
}

.map-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}

.map-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 250px);
}

.map-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: crosshair;
  border-radius: 6px;
  background: #10131d;
}

/* 世界/冒险地图：范围更大、方格更细密，允许横向滚动查看 */
.map-canvas.full {
  max-width: none;
}

.map-status {
  min-height: 22px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

.map-confirm {
  display: flex;
  gap: 8px;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 8px;
}

/* 地图多开：顶部标签页 + 回合控制 */
.map-layout {
  flex-direction: column;
  max-width: 1700px;
}

.map-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.map-tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow);
}

.map-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.map-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg2);
  user-select: none;
}

.map-tab.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.08);
}

.map-tab-close {
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.map-tab-close:hover {
  color: #e06666;
}

.map-tabs-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.map-turn-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-turn-label {
  font-size: 13px;
  color: var(--gold-soft);
  font-weight: 700;
}

.new-map-kinds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.new-map-kind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
}

.new-map-kind small {
  color: var(--text-dim);
  font-size: 11px;
}

#chat-input {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  width: 220px;
}

/* 聊天泡泡：角色头顶弹出，标明说话者，带动态特效 */
.map-wrap {
  position: relative;
}

.chat-bubble {
  position: absolute;
  z-index: 30;
  width: 160px;
  background: rgba(24, 28, 42, 0.96);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 6px 8px;
  opacity: 0;
  transform: translateY(8px) scale(0.85);
  transform-origin: bottom center;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.chat-bubble.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-bubble.hide {
  opacity: 0;
  transform: translateY(-6px) scale(0.92);
}

.chat-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--gold);
}

.chat-bubble-speaker {
  font-size: 11px;
  color: var(--gold-soft);
  font-weight: 700;
  margin-bottom: 2px;
}

.chat-bubble-text {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.chat-bubble-who {
  color: var(--gold-soft);
  font-weight: 700;
}

/* 标记到文本框的连接线 */
.chat-bubble-line {
  position: absolute;
  z-index: 29;
  width: 2px;
  background: linear-gradient(to bottom, rgba(198, 167, 92, 0.15), rgba(198, 167, 92, 0.85));
  pointer-events: none;
}

/* ============================================================
 * 侧栏：行动次序 / 当前行动者 / 居中头像 / 弹出卡片
 * ============================================================ */
.side-order {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--bg2);
}

.current-actor {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(198, 167, 92, 0.18), rgba(198, 167, 92, 0.05));
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.current-actor.empty {
  color: var(--text-dim);
  font-size: 12px;
  border-color: var(--line);
  background: var(--bg2);
}

.current-actor-avatar,
.order-chip-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #39405a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #e8e4d8;
  font-weight: 700;
}

.current-actor-avatar {
  width: 44px;
  height: 44px;
  border: 2px solid var(--gold);
}

.current-actor-avatar img,
.order-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.current-actor-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.current-actor-info b {
  font-size: 14px;
  color: var(--gold-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-actor-info span {
  font-size: 11px;
  color: var(--text-dim);
}

.order-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg2);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
}

.order-chip:hover {
  border-color: var(--gold);
}

.order-chip.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.12);
}

.order-chip.selected {
  box-shadow: 0 0 0 2px rgba(255, 215, 130, 0.35);
}

.order-chip-name {
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-chip-init {
  font-size: 10px;
  color: var(--text-dim);
}

/* 未展开条目：中央头像（可操作） */
.side-entry-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 10px;
}

.side-entry:not(.expanded) .side-entry-head {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 12px 8px;
  gap: 6px;
}

.side-entry-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #39405a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #e8e4d8;
  font-weight: 700;
  border: 2px solid transparent;
  cursor: pointer;
}

.side-entry:not(.expanded) .side-entry-avatar {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.side-entry-avatar:hover {
  border-color: var(--gold);
}

.side-entry-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-entry.selected:not(.expanded) .side-entry-head {
  background: rgba(198, 167, 92, 0.1);
  border: 1px solid rgba(198, 167, 92, 0.5);
}

/* 条目内聊天 */
.side-chat {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.side-chat input {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
}

/* 侧栏弹出卡片 */
.side-popover {
  position: absolute;
  left: 8px;
  right: 8px;
  z-index: 60;
  background: #20243a;
  border: 1px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  padding: 10px;
}

.battle-sidebar {
  position: relative;
}

.side-pop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.side-pop-tab.active {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.side-pop-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.pop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
}

.pop-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.side-pop-title {
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.side-pop-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}

.side-pop-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 百科次级导航（统一风格） */
.ency-group-nav {
  align-items: center;
}

.ency-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
}

.ency-group-chip.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.1);
}

.ency-group-chip small {
  font-size: 11px;
  color: var(--text-dim);
}

.group-chip-actions {
  display: inline-flex;
  gap: 2px;
  margin-left: 2px;
}

.group-chip-actions .btn-mini {
  padding: 1px 5px;
  font-size: 11px;
}

.ency-card-tag {
  font-size: 11px;
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.1);
  border-radius: 6px;
  padding: 1px 6px;
  align-self: flex-start;
}

.ency-toolbar {
  margin: 10px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 地图标签拖动中 */
.map-tab.dragging {
  opacity: 0.45;
  border-style: dashed;
}

/* 工具按钮激活高亮：选择某工具（如放置浓雾）时边框亮起 */
.map-toolbar .btn.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(201, 164, 92, 0.14);
  box-shadow: 0 0 0 1px var(--gold);
}

/* ---------- 素材库 ---------- */
.asset-folder-bar {
  flex-wrap: wrap;
}
.asset-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.asset-toolbar h2 {
  margin: 0;
  flex: 1;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.asset-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg2);
  cursor: pointer;
}
.asset-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.asset-item-name {
  padding: 5px 8px;
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-item .asset-del {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 0 6px;
  line-height: 18px;
  min-height: 0;
}
.asset-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.asset-pick-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  text-align: center;
  background: var(--bg2);
}
.asset-pick-item:hover {
  border-color: var(--gold);
}
.asset-pick-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}
.asset-pick-item span {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 留档馆管理模式：拖动排序 */
.archive-card.manage {
  cursor: grab;
}
.archive-card.manage.dragging {
  opacity: 0.55;
  border-color: var(--gold, #c6a75c);
  cursor: grabbing;
}
.drag-handle {
  display: inline-block;
  margin-right: 8px;
  color: var(--text-dim, #9aa);
  cursor: grab;
  user-select: none;
}

/* 地图左侧聊天记录面板 */
.map-chat-panel {
  flex: 0 0 240px;
  max-width: 240px;
  min-height: 220px;              /* 常驻展开：无人说话也显示黑框 */
  max-height: calc(100vh - 180px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  position: sticky;
  top: 14px;
  background: #171a26;
  border-color: #2a2e3d;
}

.chat-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.chat-history-msg {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.chat-history-msg b {
  color: var(--gold-soft);
  font-size: 12px;
}

.chat-history-time {
  float: right;
  color: var(--text-dim);
  font-size: 10px;
}

.chat-history-msg p {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 12px;
  word-break: break-word;
}

.chat-history-msg img {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 4px;
}

/* 地图聊天面板底部发言框（KP=安德 / PL=主卡名称） */
.map-chat-footer {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.map-chat-footer-who {
  font-size: 12px;
  color: var(--gold-soft);
  font-weight: 700;
}

.map-chat-footer input {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
}

.map-chat-footer .btn {
  align-self: flex-end;
}

/* QQ 骰子机器人面板 */
.bot-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}
.bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: #222;
}
.bot-name {
  font-weight: 600;
}
.bot-qq {
  color: var(--text-dim, #999);
  font-size: 0.85em;
}
.bot-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-weight: 700;
}

.bot-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  display: inline-block;
}

.bot-dot.on {
  background: #57c26b;
  box-shadow: 0 0 8px rgba(87, 194, 107, 0.7);
}

.bot-group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.bot-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.bot-group-name {
  flex: 1;
  font-weight: 700;
  word-break: break-all;
}

.bot-toggle.on {
  border-color: #57c26b;
  color: #57c26b;
}

.bot-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.bot-add-row input {
  flex: 1;
  box-sizing: border-box;
}

.bot-help {
  margin-top: 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}

.bot-help ol {
  padding-left: 20px;
  margin: 8px 0;
  line-height: 1.8;
}

.bot-help code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
}

/* 可操作角色：侧箭头 + 便签 */
.side-entry {
  position: relative;
}

.side-minion-btn {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--gold-soft);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.side-minion-btn:hover {
  border-color: var(--gold);
  background: rgba(201, 164, 92, 0.15);
}

.side-entry:not(.expanded) .side-minion-btn {
  top: 8px;
  right: 8px;
}

.minion-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.minion-row .minion-jump {
  flex: 1;
  justify-content: space-between;
}

.minion-del {
  background: #7a2b2b;
  border-color: #b04a4a;
  color: #ffd9d9;
  font-size: 15px;
  width: 26px;
  height: 26px;
  padding: 0;
  flex-shrink: 0;
}

.minion-add {
  background: #1f4a2c;
  border-color: #3f8a55;
  color: #d9ffe2;
  font-size: 14px;
}

.minion-del,
.minion-add {
  font-weight: 800;
}

/* ============================================================
 * 滚动条：纤细、不显眼
 * ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: rgba(140, 145, 170, 0.25);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 145, 170, 0.45);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================
 * 行动次序条（顶部，与地图选择栏平行）
 * ============================================================ */
.map-order-zone {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 12px;
  width: 100%;
}

.order-strip-head {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.order-strip-head small {
  color: var(--text-dim);
  opacity: 0.8;
}

.order-strip {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
  scroll-behavior: smooth;
  min-height: 74px;
}

.order-cell {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-left: 1px solid rgba(140, 145, 170, 0.22); /* 竖线分割每个行动 */
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 0.3s;
  opacity: 0.65;
  min-width: 92px;
}

.order-cell:first-child {
  border-left: none;
}

.order-cell:hover {
  opacity: 1;
}

.order-cell.selected {
  box-shadow: inset 0 0 0 1px rgba(255, 215, 130, 0.5);
  border-radius: 10px;
}

.order-cell.current {
  opacity: 1;
  transform: scale(1.22);
  z-index: 2;
}

.order-cell-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: #39405a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #e8e4d8;
  font-weight: 700;
  border: 2px solid var(--line);
}

.order-cell.current .order-cell-avatar {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201, 164, 92, 0.55);
}

.order-cell-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.order-cell-name {
  font-size: 12px;
  color: var(--text);
  max-width: 96px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-cell-meta {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ============================================================
 * 侧栏列表标签（地图单位 / 可操作单位）
 * ============================================================ */
.side-list-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--panel, #141824);
  padding: 6px 0;
}

.side-list-tab {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
}

.side-list-tab.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.1);
}

/* ============================================================
 * 展开条目的内部导航与标签页
 * ============================================================ */
.side-entry-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.side-entry-tab {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 5px 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-entry-tab.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.12);
}

.side-tab-pane {
  animation: sideFade 0.22s ease;
}

@keyframes sideFade {
  from { opacity: 0.2; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 技能行：主按钮 + 效果小箭头 */
.action-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-row .side-btn {
  flex: 1;
  min-width: 0;
}

.effect-arrow {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

/* 临时调用 */
.temp-calls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.temp-cat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.temp-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.temp-cat-head h5 {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.temp-add {
  background: #1f4a2c;
  border-color: #3f8a55;
  color: #d9ffe2;
  font-size: 11px;
}

.temp-call-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.temp-call-row .temp-call-btn {
  flex: 1;
  min-width: 0;
}

.temp-del {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  flex-shrink: 0;
  background: #7a2b2b;
  border-color: #b04a4a;
  color: #ffd9d9;
  font-weight: 800;
}

.temp-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

/* 收起条目上的简洁聊天输入 */
.side-chat.slim {
  margin-top: 2px;
  padding: 0 8px 8px;
}

.side-chat.slim input {
  padding: 3px 6px;
  font-size: 11px;
}

/* 收起的地图单位：基础属性行 */
.side-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 0 10px 8px;
  font-size: 11px;
  color: var(--text-dim);
}

.side-mini-stats span {
  background: rgba(140, 145, 170, 0.12);
  border-radius: 6px;
  padding: 2px 6px;
}

/* 视野开关（KP地图单位 / 可操作单位） */
.vision-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.vision-toggle input {
  accent-color: var(--gold);
}

/* 可操作单位栏 */
.operable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.op-account {
  padding: 10px;
}

.op-account-head {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 700;
  color: var(--gold-soft);
  font-size: 13px;
}

.op-account-head small {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 11px;
}

.op-account-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.op-unit {
  padding: 10px;
}

.op-unit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.op-unit-head:hover .op-unit-main b {
  color: var(--gold);
}

.op-unit-toggle {
  color: var(--text-dim);
  font-size: 12px;
  flex-shrink: 0;
}

.op-unit.open {
  border-color: rgba(201, 164, 92, 0.5);
}

.op-unit-detail-wrap {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.op-unit-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.op-unit-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #39405a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #e8e4d8;
  font-weight: 700;
}

.op-unit-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.op-unit-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.op-unit-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.op-unit-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.op-add,
.op-share {
  width: 100%;
  margin-top: 6px;
}

.op-share {
  background: rgba(92, 139, 214, 0.14);
  border-color: rgba(92, 139, 214, 0.6);
  color: #bcd3f7;
}

.unit-del {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
  background: #7a2b2b;
  border-color: #b04a4a;
  color: #ffd9d9;
  flex-shrink: 0;
}

/* PL登录账号列表 */
.pl-login-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

/* 视野共享开关 */
.share-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #2a2e3d;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  display: inline-block;
  transition: background 0.2s;
}

.switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c7ccdd;
  transition: left 0.2s;
}

.switch.on {
  background: rgba(92, 183, 120, 0.4);
  border-color: #5cb778;
}

.switch.on i {
  left: 22px;
  background: #7fe09c;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* 展开动画：头像从收起位置移动到展开位置 */
.side-entry-avatar {
  transition: width 0.3s ease, height 0.3s ease, font-size 0.3s ease, border-width 0.3s ease;
}

.side-entry.expanded .side-entry-body {
  animation: sideBodyIn 0.28s ease;
}

@keyframes sideBodyIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 收起/展开时头像的“轨迹”感 */
.side-entry-head .side-entry-avatar {
  transition: width 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    height 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    font-size 0.3s ease, transform 0.3s ease;
}

.side-entry:not(.expanded) .side-entry-avatar {
  transform: translateY(0);
}

.side-entry.expanded .side-entry-avatar {
  transform: translateX(0);
}

/* ============================================================
 * 百科页（敌人 / 专长与奇迹 / 魔法 / 装备 / buff与debuff）
 * ============================================================ */
.ency-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1400px;
  margin: 0 auto;
}

.ency-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
}

.ency-tab {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}

.ency-tab.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(198, 167, 92, 0.08);
}

.ency-main {
  padding: 18px;
}

.ency-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
/* 非敌人分类卡片：头像左上、名称右侧、按钮右侧上下、描述在下方 */
.ency-generic-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.ency-card:hover {
  border-color: var(--gold);
}

.ency-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.ency-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ency-card-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ency-card-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.ency-card-actions {
  display: flex;
  gap: 6px;
}

/* 敌人卡片：头像左上、名称在头像右侧、描述左下、编辑/删除上下排 */
.enemy-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.enemy-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.enemy-desc {
  text-align: left;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  max-height: 56px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.ency-card-actions.stacked {
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.ency-card-actions.stacked .btn {
  white-space: nowrap;
}

/* ============================================================
 * 留档馆
 * ============================================================ */
.archive-sub-nav {
  border: none;
  box-shadow: none;
  padding: 0 0 8px 0;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.archive-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.archive-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.archive-orig {
  font-size: 12px;
  color: var(--text-dim);
}

.archive-time {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}

.archive-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-log-messages {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-log-msg {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.chat-log-msg b {
  color: var(--gold-soft);
}

.chat-log-time,
.chat-log-map {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

.chat-log-msg p {
  margin: 4px 0 0;
  font-size: 13px;
}

.chat-log-msg img {
  max-width: 180px;
  border-radius: 6px;
  margin-top: 6px;
}

/* 侧边栏：百科调用分组 / 怪物详细数据 */
.ency-calls {
  margin-top: 10px;
}

.ency-group {
  margin-top: 8px;
}

.ency-group h5 {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 4px;
}

.side-type {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.side-entry-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}

@media (max-width: 760px) {
  .map-body {
    flex-direction: column;
  }

  .map-chat-panel {
    flex: none;
    max-width: none;
    max-height: 220px;
    position: static;
  }

  .map-tabs-right {
    justify-content: flex-start;
  }

  .new-map-kinds {
    grid-template-columns: 1fr;
  }
}

/* 战斗侧边栏 */
.battle-sidebar {
  flex: 0 0 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.side-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg2);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--gold-soft);
  flex: 0 0 46px;
}

.side-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-soft);
}

.side-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.side-stat {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
}

.side-stat b {
  color: var(--text);
}

.side-edits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.side-edit {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-dim);
}

.side-edit input {
  width: 72px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 6px;
  font-size: 12px;
}

.side-actions h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--gold-soft);
}

.side-btn-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.side-btn {
  text-align: left;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.side-btn:hover {
  border-color: var(--gold);
}

.side-btn-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.side-btn-sub {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.side-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .map-layout {
    flex-direction: column;
  }

  .battle-sidebar {
    flex: none;
    width: 100%;
    position: static;
    max-height: none;
  }
}

/* 战斗侧边栏：所有标记条目 */
.side-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 10px;
}

.side-entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  overflow: hidden;
}

.side-entry.selected {
  border-color: var(--gold);
}

.side-entry-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
}

.side-entry-head:hover {
  background: rgba(255, 255, 255, 0.04);
}

.side-entry-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--line2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: 0 0 30px;
}

.side-entry-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-entry-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.side-entry-toggle {
  color: var(--text-dim);
  font-size: 12px;
}

.side-entry-body {
  border-top: 1px dashed var(--line);
  padding: 10px;
}

.side-temp {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  margin: 8px 0;
  padding: 8px;
  background: var(--bg2);
  border-radius: 6px;
}

.side-temp h5 {
  flex-basis: 100%;
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--gold-soft);
}

.side-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.side-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 6px 0;
}

/* 临时属性（角色卡页） */
.temp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.temp-mods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.temp-mod {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.temp-mod b {
  min-width: 22px;
  text-align: center;
  color: var(--gold-soft);
  font-size: 16px;
}

@media (max-width: 900px) {
  .temp-grid {
    grid-template-columns: 1fr;
  }
}

/* 怪物卡页面 */
.monsters-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 1180px;
  margin: 0 auto;
}

.monster-folders {
  flex: 0 0 280px;
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.monster-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.monster-folder:hover {
  border-color: var(--line2);
}

.monster-folder.active {
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.16), rgba(201, 164, 92, 0.03));
}

.folder-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.folder-count {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg2);
  border-radius: 10px;
  padding: 1px 7px;
}

.folder-actions {
  display: flex;
  gap: 4px;
}

.monster-main {
  flex: 1;
  min-width: 0;
}

.monster-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.monster-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
}

.monster-pick:hover {
  border-color: var(--gold);
}

/* 图片截取与缩放编辑器 */
.crop-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crop-view {
  position: relative;
  width: 520px;
  height: 400px;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10131d;
  touch-action: none;
}

.crop-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.crop-box {
  position: absolute;
  border: 2px dashed rgba(255, 215, 130, 0.9);
  background: rgba(255, 255, 255, 0.05);
  cursor: move;
  box-sizing: border-box;
}

.crop-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #fff;
  cursor: nwse-resize;
}

.crop-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crop-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.crop-controls input[type="range"] {
  flex: 1;
}

.crop-tip {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 600px) {
  .crop-view {
    height: 260px;
  }
}

@media (max-width: 900px) {
  .monsters-layout {
    flex-direction: column;
  }

  .monster-folders {
    flex: none;
    width: 100%;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    height: auto;
    position: static;
    overflow: visible;
  }

  .nav-toggle {
    display: none;
  }

  #nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-item {
    width: auto;
    margin-bottom: 0;
  }

  .header-card {
    flex-direction: column;
  }

  .portrait-area {
    flex: none;
  }

  .attrs-grid {
    grid-template-columns: 1fr;
  }

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

  .status-columns {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1.8fr 0.8fr 0.8fr;
    font-size: 12px;
  }

  .form-grid {
    flex-direction: column;
  }

  .form-fields {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
 * 阶段一：行动次序选中框 / 取消按钮 / 地图单位数值条 / 专长要求 / 技能被动
 * ============================================================ */
/* 行动次序条：选中用 outline（不越过分隔线），当前行动者时也清晰可见 */
.order-cell.selected {
  box-shadow: none;
  outline: 2px solid rgba(255, 215, 130, 0.85);
  outline-offset: -2px;
  border-radius: 10px;
  background: rgba(255, 215, 130, 0.08);
}
.order-cell.selected.current {
  outline-color: #ffd782;
  outline-width: 3px;
  background: rgba(255, 215, 130, 0.12);
}

/* 取消当前选择按钮：危险色 + 按下闪烁 */
.map-toolbar [data-map="cancel"] {
  border-color: #d96c4f;
  color: #f0a28c;
}
.map-toolbar [data-map="cancel"]:hover {
  background: rgba(217, 108, 79, 0.15);
}
.map-toolbar [data-map="cancel"].flash {
  animation: cancel-flash 0.7s ease;
}
@keyframes cancel-flash {
  0% { background: rgba(217, 108, 79, 0.95); color: #fff; transform: scale(1.12); }
  50% { background: rgba(217, 108, 79, 0.45); }
  100% { background: transparent; transform: scale(1); }
}

/* 地图单位收起卡片：数值条 */
.side-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 4px 2px;
  font-size: 11px;
  color: var(--text-dim);
}
.mini-vitals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 2px;
  font-size: 11px;
  color: var(--text-dim);
}
.mini-hp {
  position: relative;
  height: 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 200, 90, 0.35);
  border-radius: 8px;
  overflow: hidden;
  min-width: 100px;
}
.mini-hp-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, #f5c95c, #d9a73a);
  transition: width 0.4s ease;
}
.mini-hp span {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
  line-height: 15px;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.mini-armour b {
  font-size: 16px;
  color: var(--text);
  margin-left: 2px;
}
.mini-resolve {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mini-resolve-dots {
  display: inline-flex;
  gap: 3px;
}
.resolve-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3a3f55;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.3s;
}
.resolve-dot.on {
  background: #d9534f;
  border-color: #f0a0a0;
  box-shadow: 0 0 4px rgba(217, 83, 79, 0.5);
}
.mini-wound-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mini-wounds {
  display: inline-flex;
  gap: 3px;
}
.mini-wound {
  width: 10px;
  height: 14px;
  border: 1px solid rgba(217, 83, 79, 0.45);
  border-radius: 2px;
  background: transparent;
  transition: background 0.3s;
}
.mini-wound.filled {
  background: #d9534f;
  border-color: #f0a0a0;
}
.mini-none {
  color: var(--text-dim);
}

/* 百科非敌人条目：文字正常换行、不竖排；按钮水平靠右 */
.ency-card-main b {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.enemy-head .ency-card-actions {
  flex-shrink: 0;
  align-items: center;
}
.enemy-head .ency-card-actions .btn {
  white-space: nowrap;
}

/* 专长前提要求：满足绿色、未满足红色 */
.talent-req {
  margin-top: 4px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.talent-req.ok {
  color: #8fd08a;
  background: rgba(80, 160, 90, 0.12);
}
.talent-req.bad {
  color: #f0a28c;
  background: rgba(217, 108, 79, 0.14);
}

/* 技能被动值 */
.skill-passive {
  font-size: 11px;
  color: var(--gold-soft, #c6a75c);
  margin-top: 2px;
}

/* ============================================================
 * UI 优化（统一对齐 / 长文本截断 / 图片兜底）
 * ============================================================ */
/* 卡片标题与条目名：长文本截断，避免撑破布局 */
.mini-title,
.side-entry-name,
.order-cell-name,
.op-unit-main b,
.archive-main b,
.asset-item-name,
.temp-call-row .side-btn-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-title {
  display: block;
}
.mini-body {
  min-width: 0;
}
.card-mini {
  align-items: flex-start;
}
.card-mini .mini-body {
  padding-top: 2px;
}

/* 通用图片：任何 img 不超出其容器（防止移位/溢出） */
img {
  max-width: 100%;
}
.img-frame img,
.mini-icon img,
.asset-item img,
.asset-pick-item img,
.chat-history-msg img,
.chat-log-msg img {
  object-fit: cover;
  display: block;
}

/* 侧边栏条目头像与文本垂直对齐 */
.side-entry-head {
  align-items: center;
}
.side-entry-avatar img,
.order-cell-avatar img,
.op-unit-icon img {
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* 名册标签：名称省略号，标签长度自适应 */
.roster-tab {
  min-width: 0;
}
.roster-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

/* 表单字段标签与输入框对齐 */
.form-fields .field {
  min-width: 0;
}
.field label {
  display: block;
  margin-bottom: 4px;
}

/* 素材库/留档馆工具条按钮垂直居中 */
.asset-toolbar,
.archive-actions {
  align-items: center;
}

/* 行动次序条卡片头像尺寸统一 */
.order-cell-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
}
.order-cell-avatar img {
  width: 100%;
  height: 100%;
}
/* ============================================================
 * 第二阶段：战斗行动 / 双持 / 优势劣势 / 距离提示
 * ============================================================ */
.side-action-bar {
  margin-bottom: 10px;
  display: flex;
  gap: 6px;
}
.side-action-bar .btn {
  flex: 1;
  border-color: var(--gold, #c6a75c);
  color: var(--gold-soft, #e0c884);
}
.side-action-bar .btn:hover {
  background: rgba(198, 167, 92, 0.14);
}

/* 行动面板 */
.action-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.action-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
}
.action-item:hover {
  border-color: var(--gold);
  background: rgba(198, 167, 92, 0.1);
}
.action-item b {
  color: var(--gold-soft);
}
.action-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  white-space: normal;
}

/* 检定卡片：优势/劣势选项 */
.adv-opts {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.adv-label {
  font-size: 12px;
  color: var(--text-dim);
  width: 100%;
}
.check-opt.adv {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.check-opt.adv:has(input:checked) {
  border-color: var(--gold);
  background: rgba(198, 167, 92, 0.12);
}
/* ============================================================
 * 第三轮：按钮高亮 / 魂火火焰 / 行动按钮（PL）
 * ============================================================ */
/* 技能/法术/行动按钮按下高亮 */
.side-btn.active {
  border-color: var(--gold, #c6a75c) !important;
  background: rgba(198, 167, 92, 0.18) !important;
  color: var(--gold-soft, #e8d9a8) !important;
  box-shadow: 0 0 8px rgba(198, 167, 92, 0.35);
}

/* 魂火火焰标志 */
.soulfire-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.soulfire-icon {
  font-size: 18px;
  display: inline-block;
  animation: soulfire-flicker 1.4s ease-in-out infinite;
}
@keyframes soulfire-flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); filter: brightness(1); }
  25% { transform: scale(1.12) rotate(2deg); filter: brightness(1.25); }
  50% { transform: scale(0.95) rotate(-1deg); filter: brightness(0.9); }
  75% { transform: scale(1.08) rotate(1deg); filter: brightness(1.15); }
}
.soulfire-box {
  background: rgba(217, 83, 79, 0.14);
  border: 1px solid rgba(217, 83, 79, 0.4);
  border-radius: 12px;
  padding: 1px 10px;
  font-size: 12px;
  color: #f0a0a0;
  white-space: nowrap;
}
/* 云端同步面板 */
.cloud-row {
  align-items: center;
  flex-wrap: wrap;
}
.cloud-status {
  font-size: 13px;
  color: var(--text-dim);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
}
.cloud-status.on {
  color: #8fd08a;
  border-color: rgba(120, 190, 120, 0.4);
  background: rgba(80, 160, 90, 0.1);
}