/* 斗罗世界 - 样式（无 emoji，图标用 CSS 实现） */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 17px; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #14161c;
  color: #cfd3dc;
  min-height: 100vh;
  font-size: 1rem;
}
a { color: #7ec8ff; }
.muted { color: #6b7280; font-size: 12px; }

header {
  padding: 18px 24px 10px;
  border-bottom: 1px solid #262a35;
  background: linear-gradient(180deg, #1a1d26, #14161c);
}
header h1 { font-size: 26px; color: #e8c97a; letter-spacing: 2px; }
header h1 .sub { font-size: 15px; color: #6b7280; letter-spacing: 1px; font-weight: normal; }
.header-row { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
#stats-bar { display: flex; gap: 24px; font-size: 15px; color: #8b93a5; flex-wrap: wrap; }
#stats-bar b { color: #e0e4ee; }
.god-text { color: #d4504a !important; }
.btn-reset {
  background: #2a1a1c; color: #d4756a; border: 1px solid #5a2a2a;
  padding: 7px 18px; font-size: 14px; border-radius: 4px; cursor: pointer;
  white-space: nowrap;
}
.btn-reset:hover { border-color: #d4756a; }
.btn-reset.confirming {
  background: #d4504a; color: #fff; border-color: #d4504a;
  animation: pulse .8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .7; } }

.tabs { padding: 0 24px; display: flex; gap: 4px; border-bottom: 1px solid #262a35; }
.tab {
  background: none; border: none; color: #8b93a5; font-size: 16px;
  padding: 12px 18px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: #e8c97a; border-bottom-color: #e8c97a; }

.tab-pane { padding: 14px 24px 40px; }

/* 工具栏 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.filters { display: flex; gap: 6px; }
.filter, .pager button, .chronicle-toolbar button {
  background: #1e2230; border: 1px solid #2e3446; color: #aab1c2;
  padding: 7px 18px; font-size: 15px; cursor: pointer; border-radius: 4px;
}
.filter.active { background: #3a3f55; color: #e8c97a; border-color: #e8c97a55; }
.filter:hover, .pager button:hover { border-color: #4a5170; }
.pager { display: flex; gap: 12px; align-items: center; font-size: 15px; color: #8b93a5; }

/* 表格 */
.npc-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
/* 固定列宽: 翻页时不跳动(魂环列自适应剩余宽度) —— 仅限魂师主表 */
.main-table th:nth-child(1) { width: 170px; }
.main-table th:nth-child(2) { width: 118px; }
.main-table th:nth-child(3) { width: 158px; }
.main-table th:nth-child(4) { width: 126px; }
.main-table th:nth-child(5) { width: 218px; }
.main-table th:nth-child(6) { width: 64px; }
.main-table th:nth-child(7) { width: 100px; }
.main-table th:nth-child(8) { width: 78px; }
.main-table th:nth-child(9) { width: 150px; }
/* 修为列占剩余宽度(已被压缩) */
.npc-table th {
  text-align: left; color: #6b7280; font-weight: normal; font-size: 12px;
  padding: 8px 5px; border-bottom: 1px solid #262a35; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.npc-table td { padding: 9px 5px; border-bottom: 1px solid #1e2230; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: 44px; }
.npc-table td:nth-child(4), .npc-table td:nth-child(6), .npc-table td:nth-child(7) { white-space: nowrap; }
.npc-table tbody tr { cursor: pointer; transition: background .15s; }
.npc-table tbody tr:hover { background: #1c2130; }
.row-dead { opacity: .45; }
.name-cell { color: #e8ecf5; font-weight: bold; }

.st { font-size: 13px; padding: 3px 10px; border-radius: 3px; white-space: nowrap; }
.st.cultivating { background: #1d2b3a; color: #7ec8ff; }
.st.hunting { background: #3a2b1d; color: #e8a15a; }
.st.dead { background: #33201f; color: #d4756a; }
.st.god { background: #3d1420; color: #ff9d5c; border: 1px solid #d4504a66; }

.evil-tag {
  display: inline-block; margin-left: 6px; font-size: 13px;
  color: #c58fff; border: 1px solid #7a4fd466; padding: 0 5px; border-radius: 3px;
}
.soul-name { font-weight: bold; }
.soul-beast { color: #8fd48f; }
.soul-tool { color: #8fb8e8; }

/* 魂环圆点 */
.rings-cell { white-space: nowrap; }
.ring {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  margin-right: 10px; vertical-align: middle; border: 1px solid #ffffff33;
  box-shadow: 0 0 4px currentColor;
}
.ring.sm { width: 11px; height: 11px; margin-right: 9px; }
.ring.sm:last-child { margin-right: 0; }
.ring.big { width: 16px; height: 16px; margin-right: 12px; }
.ring.evil-ring { border-color: #7a4fd4aa; }
/* 修为列 */
.exp-line { display: flex; align-items: center; }
.exp-bar { flex: 1; height: 8px; background: #10121a; border: 1px solid #262a35; border-radius: 4px; overflow: hidden; }
.exp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3a5a8c, #7ec8ff); }
.hunt-beast { color: #e8a15a; font-size: 13px; }

/* 同心套环魂环(参考江湖挂机) */
.rings-wrap { display: flex; gap: 28px; align-items: center; margin: 16px 0 4px; padding: 16px; background: #12141b; border: 1px solid #1e2230; border-radius: 6px; }
.rings { position: relative; width: 180px; height: 180px; flex: none; }
.rings .no-ring {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #6b7280; text-align: center; padding: 0 12px;
}
.soul-ring {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%; border: 3px solid; background: transparent;
  box-shadow: 0 0 10px currentColor, inset 0 0 6px currentColor;
  animation: ringSpin 6s linear infinite;
}
.soul-ring i {
  position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px; margin: -3.5px;
  border-radius: 50%; background: currentColor;
  box-shadow: 0 0 7px currentColor;
}
.rings-cell .soul-ring { border-width: 2px; box-shadow: 0 0 5px currentColor, inset 0 0 3px currentColor; }
.rings-cell .soul-ring i { width: 4px; height: 4px; margin: -2px; }
@keyframes ringSpin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.ring-legend { list-style: none; font-size: 13px; flex: 1; }
.ring-legend li { padding: 7px 0; border-bottom: 1px solid #1a1d26; }
.ring-legend li:last-child { border-bottom: none; }

/* 史书 */
.chronicle-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; font-size: 13px; color: #8b93a5; }
.chronicle { list-style: none; max-width: 1000px; }
.chronicle li { padding: 8px 4px; border-bottom: 1px solid #1e2230; font-size: 15px; line-height: 1.6; }
.chronicle li.epic { color: #e8c97a; }
.chronicle li.legend {
  color: #ff9d5c; font-size: 16px; font-weight: bold;
  background: linear-gradient(90deg, #3d1420, #171a23 70%);
  border-left: 3px solid #d4504a; padding-left: 12px !important; margin: 4px 0;
  text-shadow: 0 0 8px #d4504a66; border-radius: 0 4px 4px 0;
}
.chronicle li.legend .log-date { color: #d4756a; }
.log-date { color: #6b7280; margin-right: 10px; font-family: Consolas, monospace; font-size: 13px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: #00000099;
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #171a23; border: 1px solid #2e3446; border-radius: 8px;
  width: min(880px, 94vw); max-height: 88vh; overflow-y: auto;
  padding: 26px 30px; position: relative;
}
.modal-close {
  position: absolute; right: 14px; top: 10px; background: none; border: none;
  color: #8b93a5; font-size: 24px; cursor: pointer;
}
.detail-name { font-size: 24px; color: #e8ecf5; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.detail-head { font-size: 15px; color: #aab1c2; line-height: 1.9; margin-bottom: 8px; }
.attrs { display: flex; gap: 24px; font-size: 15px; flex-wrap: wrap; }
.death-info { color: #d4756a; margin-top: 4px; }
.modal section { margin-top: 18px; }
.modal h3 {
  font-size: 15px; color: #e8c97a; letter-spacing: 1px;
  border-left: 3px solid #e8c97a; padding-left: 8px; margin-bottom: 8px;
}
.ring-list, .bone-list, .log-list { list-style: none; }
.ring-item { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid #1e2230; }
.ring-title { font-size: 15px; color: #e0e4ee; }
.ring-skill { font-size: 13px; color: #8b93a5; }
.domain-tag { color: #ff9d5c; border: 1px solid #d4504a66; font-size: 11px; padding: 0 4px; border-radius: 3px; }
.bone-item { padding: 7px 0; border-bottom: 1px solid #1e2230; font-size: 14px; }
.bone-slot { color: #e8a15a; margin-right: 6px; }
.log-list li { padding: 6px 0; border-bottom: 1px solid #1a1d26; font-size: 14px; line-height: 1.6; }

/* 势力 */
.sect-name { color: #8fd4e8; font-weight: bold; }
.leader-tag {
  display: inline-block; margin-left: 6px; font-size: 11px;
  color: #ffd700; border: 1px solid #ffd70066; padding: 0 5px; border-radius: 3px;
}
.family-name { color: #e8c97a; font-weight: bold; }
.faction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .faction-grid { grid-template-columns: 1fr; } }
.faction-title {
  font-size: 16px; color: #e8c97a; letter-spacing: 1px;
  border-left: 3px solid #e8c97a; padding-left: 8px; margin-bottom: 10px;
}
.faction-table { font-size: 14px; }
/* 共同: 前三列(宗门/家族、宗主/族长、最强者)稍微收紧 */
.faction-table th:nth-child(1) { width: 20%; }
.faction-table th:nth-child(2) { width: 15%; }
.faction-table th:nth-child(3) { width: 15%; }
/* 宗门表后四列: 弟子/总战力/盛况/创派 */
.faction-sect th:nth-child(4) { width: 9%; }
.faction-sect th:nth-child(5) { width: 15%; }
.faction-sect th:nth-child(6) { width: 12%; }
.faction-sect th:nth-child(7) { width: 13%; }
/* 家族表后三列: 族人/总战力/盛况 */
.faction-family th:nth-child(4) { width: 10%; }
.faction-family th:nth-child(5) { width: 18%; }
.faction-family th:nth-child(6) { width: 21%; }
.faction-table td, .faction-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faction-table td { height: 44px; line-height: 26px; }
.faction-pager { margin-top: 12px; justify-content: center; }
/* 固定数据区高度: 翻页时分页控件不上下跳动(td 的 height 是最小行高, 10行实际≈478px, 需留足余量) */
.table-wrap { min-height: 940px; }   /* 魂师列表: 20 行 × 44.5px + 表头 33px + 余量 */
.faction-wrap { height: 500px; overflow-y: auto; } /* 势力表: 固定高度, 不满行不出底缝 */
.btn-create {
  background: #1d2b3a; color: #7ec8ff; border: 1px solid #2e4a66;
  padding: 7px 18px; font-size: 14px; border-radius: 4px; cursor: pointer;
}
.btn-create:hover { border-color: #7ec8ff; }
.grade-tag { margin-left: 5px; font-size: 11px; }
.badge {
  display: inline-block; font-size: 12px; padding: 2px 9px;
  border: 1px solid; border-radius: 10px; white-space: nowrap;
}

/* ---------- 通用弹窗(SweetAlert2 风格) & Toast ---------- */
.dlg-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 10, 16, .6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: dlgFade .18s ease;
}
.dlg-mask.closing { animation: dlgFade .18s ease reverse; }
.dlg {
  background: #1b1f2a; border: 1px solid #2e3446; border-radius: 12px;
  width: min(400px, 90vw); padding: 26px 28px 22px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
  animation: dlgPop .2s cubic-bezier(.34, 1.4, .64, 1);
  text-align: center;
}
.dlg-mask.closing .dlg { transform: scale(.92); opacity: 0; transition: .18s; }
.dlg-title { font-size: 19px; color: #e8ecf5; font-weight: bold; margin-bottom: 10px; }
.dlg-text { font-size: 14px; color: #8b93a5; line-height: 1.7; margin-bottom: 16px; }
.dlg-input {
  width: 100%; background: #12141b; border: 1px solid #2e3446; border-radius: 8px;
  color: #e0e4ee; font-size: 16px; padding: 11px 14px; outline: none;
  transition: border-color .15s;
}
.dlg-input:focus { border-color: #7ec8ff; box-shadow: 0 0 0 3px rgba(126, 200, 255, .15); }
.dlg-btns { display: flex; gap: 12px; margin-top: 22px; }
.dlg-btn {
  flex: 1; padding: 10px 0; font-size: 15px; border-radius: 8px;
  cursor: pointer; border: 1px solid #2e3446; transition: all .15s;
  background: #232838; color: #aab1c2;
}
.dlg-btn:hover { background: #2b3145; }
.dlg-ok { background: #2c4a6e; color: #bcdcff; border-color: #3a5a8c; }
.dlg-ok:hover { background: #35587f; }
.dlg-ok.btn-danger { background: #6e2c2c; color: #ffbcbc; border-color: #8c3a3a; }
.dlg-ok.btn-danger:hover { background: #7f3535; }
@keyframes dlgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlgPop { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#toast-box {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #1b1f2a; border: 1px solid #2e3446; border-radius: 10px;
  color: #d5dae5; font-size: 14px; padding: 11px 22px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(-14px);
  transition: all .3s cubic-bezier(.34, 1.3, .64, 1);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #3a6e4a; color: #a8e8b8; }
.toast-error { border-color: #8c3a3a; color: #ffb8b8; }
