/* Shadowbane 角色模拟器 — 暗色主题（致敬原版黑底 + 青铜金色调）
 * © 2024-2025 shadowbane.online — 未经许可不得转载或二次分发 */

:root {
  --bg: #0a0a0a;
  --panel: #161616;
  --panel-2: #1f1f1f;
  --border: #2e2e2e;
  --text: #d4c8a8;        /* 羊皮纸色 */
  --text-dim: #8a8170;
  --accent: #c9a84c;       /* 青铜金 */
  --accent-dim: #6b5a28;
  --select: #4a90d9;       /* 选中蓝（与 aardio 版一致） */
  --select-text: #ffffff;
  --disabled: #4a4a4a;
  --danger: #c94a4a;
  --good: #5aa84a;
  --page-scale: 1;  /* 缩放比例（A-/A+ 控制） */
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 缩放：CSS zoom（A-/A+ 控制 --page-scale）。
     ponytail: 用原生 zoom 而非 transform:scale —— zoom 会重排并真正改变文档尺寸，
     放大时滚动条自动适配；transform:scale 只视觉缩放、布局尺寸不变，会溢出/显示不全。 */
  zoom: var(--page-scale);
}

/* 右上角悬浮工具条：缩放 + 分享 */
.toolbar {
  position: fixed; top: 12px; right: 16px; z-index: 100;
  display: flex; gap: 4px; align-items: center;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.toolbar-items { display: flex; gap: 4px; align-items: center; }
.toolbar-toggle { display: none; }  /* 桌面端不需要切换按钮 */
.toolbar button {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 5px; cursor: pointer;
  padding: 4px 8px; font-size: 13px; font-family: inherit;
  min-width: 32px; transition: all 0.15s;
}
.toolbar button:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.toolbar #btnExport { min-width: auto; }

/* 论坛文本导出弹窗 */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6);
  justify-content: center; align-items: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; width: 90%; max-width: 640px;
  max-height: 86vh; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-tabs { display: flex; gap: 4px; }
.modal-tab {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  padding: 5px 12px; border-radius: 5px; cursor: pointer; font-family: inherit; font-size: 13px;
}
.modal-tab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.modal-close {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 24px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--accent); }
.modal-text {
  flex: 1; min-height: 280px; width: 100%;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 12px;
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px;
  line-height: 1.6; resize: none; white-space: pre; overflow: auto;
}
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-hint { color: var(--text-dim); font-size: 11px; }
.modal-copy {
  background: var(--accent); color: var(--bg); border: none;
  padding: 6px 16px; border-radius: 5px; cursor: pointer; font-family: inherit; font-size: 13px;
}

header {
  position: relative;
  text-align: center;
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--border);
}
header h1 {
  color: var(--accent);
  font-size: 22px;
  letter-spacing: 2px;
}
header h1 a { color: inherit; text-decoration: none; }
/* 顶部左侧：返回魔剑中文站（风格同 h1，字号略小）。
   fixed 定位贴视口最左边缘，与右上角 .toolbar 对称（同为 top:12px），不与居中标题重叠。*/
.back-home {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 100;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 2px;
  text-decoration: none;
  white-space: nowrap;
}
.back-home:hover { text-decoration: underline; }
/* 标题后版本号小字 */
.version { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; margin-left: 6px; font-weight: normal; }
.subtitle { color: var(--text-dim); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; }

/* 步骤进度条 */
.steps {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.step {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 2px;
  transition: all .15s;
}
.step .num { display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center;
  background: var(--disabled); border-radius: 50%; margin-right: 6px; font-size: 11px; }
.step.active { color: var(--accent); border-color: var(--accent); }
.step.active .num { background: var(--accent); color: #000; }
.step.done .num { background: var(--good); color: #000; }
.step:hover:not(.active) { color: var(--text); border-color: var(--text-dim); }

/* 顶部状态栏 */
.status-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}

/* 已选回显栏 */
.selection-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  min-height: 36px;
  flex-wrap: wrap;
}
.sel-chip {
  background: var(--panel-2);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
}
.sel-chip .sel-label { color: var(--text-dim); margin-right: 4px; }
.stat-pill {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.stat-pill b { color: var(--accent); font-size: 14px; }
.stat-pill.warn b { color: var(--danger); }

main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.panel { display: none; }
.panel.active { display: block; }
.panel h2 { color: var(--accent); margin-bottom: 16px; font-size: 18px; }
.panel h2 small { color: var(--text-dim); font-size: 12px; font-weight: normal; }

/* 卡片网格（种族/职业） */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px;
  cursor: pointer;
  transition: all .15s;
}
.card:hover { border-color: var(--accent-dim); }
.card.selected { border-color: var(--select); background: rgba(74,144,217,.12); }
.card.disabled { opacity: .4; cursor: not-allowed; }
.card.disabled:hover { border-color: var(--border); }
.card-name { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.card-name .en { color: var(--text-dim); font-size: 11px; margin-left: 6px; }
.card-name .race-trait-tag { float: right; color: var(--accent); font-size: 11px; cursor: help; }
.card-name .gender-tag { color: var(--accent); font-size: 12px; margin-left: 2px; }
.gender-grid { grid-template-columns: repeat(2, 1fr); max-width: 240px; }
.card-cost { color: var(--accent); font-size: 12px; }
.card-mini-attrs { margin-top: 6px; font-size: 11px; color: var(--text-dim); }

.hint { margin-top: 16px; padding: 10px; background: var(--panel-2); border-left: 3px solid var(--accent); color: var(--text-dim); font-size: 12px; }

/* 符石分组 */
.rune-group { margin-bottom: 20px; }
.rune-group-title {
  color: var(--accent); font-size: 13px; letter-spacing: 1px;
  border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 8px;
}
.rune-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.rune {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: all .12s;
}
.rune:hover:not(.disabled) { border-color: var(--accent-dim); }
.rune.selected { border-color: var(--select); background: rgba(74,144,217,.15); }
.rune.disabled { opacity: .35; cursor: not-allowed; }
.rune-name { font-size: 13px; }
.rune-cost { color: var(--accent); font-size: 11px; float: right; }
.rune-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* 属性表 */
.attr-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}
.attr-table th, .attr-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.attr-table th { color: var(--text-dim); font-weight: normal; font-size: 12px; }
.attr-table .attr-name { color: var(--accent); width: 80px; }
.attr-table .attr-cur { font-size: 18px; color: var(--select-text); }
.attr-controls button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  width: 28px; height: 28px; cursor: pointer; border-radius: 2px; font-size: 16px;
}
.attr-controls button:hover:not(:disabled) { border-color: var(--accent); }
.attr-controls button:disabled { opacity: .3; cursor: not-allowed; }
.attr-controls button.mini { width: auto; padding: 0 8px; font-size: 11px; background: var(--panel-2); }

/* 技能训练输入框 */
.train-input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  width: 70px;
  border-radius: 2px;
  font-size: 13px;
  text-align: center;
}
.train-input:focus { outline: none; border-color: var(--accent); }

/* 技能训练表紧凑化 */
.skill-table th, .skill-table td { padding: 6px 8px !important; font-size: 12px; text-align: center; vertical-align: middle; }
.skill-table .attr-name { width: auto !important; text-align: left; }  /* 名称列左对齐，其余居中 */
/* 技能/特技名：中文主行 + 英文副行（两行布局，节省横向空间） */
.skill-table .name-cn { display: block; }
.skill-table .name-en { display: block; font-size: 11px; color: var(--text-dim); }
.skill-table .card-mini-attrs { display: block; margin-top: 2px; }
.skill-table td:nth-child(2) { width: 50px !important; }
.skill-table .attr-controls { white-space: nowrap; }
.skill-table .attr-controls .gap { display: none; }
.skill-table .attr-controls button { width: 26px; height: 24px; padding: 0; font-size: 14px; }
.skill-table .attr-controls button.mini { width: auto; padding: 0 6px; font-size: 11px; }
.attr-controls { white-space: nowrap; text-align: right; }
.attr-controls .gap { display: inline-block; width: 10px; }
/* 属性表：前4列窄，操作列靠右撑满 */
.attr-table th, .attr-table td { vertical-align: middle; }
.attr-table .attr-name { width: 60px; }
.attr-table td:nth-child(2) { width: 70px; }   /* 当前值 */
.attr-table td:nth-child(3), .attr-table td:nth-child(4) { width: 60px; }  /* 下限/上限 */
.attr-table td:last-child { text-align: right; }

.attr-summary { margin-top: 16px; padding: 12px; background: var(--panel-2); border-radius: 3px; font-size: 13px; }
.attr-summary b { color: var(--accent); }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}
footer button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 8px 20px;
  cursor: pointer;
  border-radius: 2px;
  font-size: 13px;
  font-weight: bold;
}
footer button:disabled { background: var(--disabled); color: var(--text-dim); cursor: not-allowed; }
footer button:hover:not(:disabled) { background: var(--select-text); }
.progress-text { color: var(--text-dim); font-size: 12px; }

/* 页面底部版权栏 */
.copyright-bar {
  text-align: center; padding: 12px 16px; font-size: 11px;
  color: var(--text-dim); border-top: 1px solid var(--border);
}
.copyright-bar a { color: var(--accent); text-decoration: none; }
.copyright-bar a:hover { text-decoration: underline; }

.empty { color: var(--text-dim); padding: 40px; text-align: center; }

/* 法术页：前置未满足的行变暗；warn 标记 */
.skill-table tr.dim { opacity: 0.4; }
.skill-table .warn { color: var(--danger); }
.rune-effects { color: var(--text-dim); cursor: help; border-bottom: 1px dotted var(--text-dim); }

/* 技能达智力上限标记（calc.js skillcap 态） */
.skillcap-row td { color: var(--text-dim); }
.cap-mark { color: var(--accent); cursor: help; font-size: 0.85em; }
/* 特技 rank 输入框 */
.power-input { width: 56px; }
.power-rank .card-mini-attrs { margin-left: 4px; color: var(--text-dim); font-size: 0.8em; }

/* 两列布局（基础职业 + 初始属性 / 75级属性 + 已选清单）*/
.two-col {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: start;
}
.two-col-left, .two-col-right { min-width: 0; }
/* HP/MP/STA 卡片块：三色区分，醒目大字 */
.vitals-bar { display: flex; gap: 10px; margin: 10px 0 16px; }
.vital-card {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel-2);
}
.vital-label { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }
.vital-val { font-size: 22px; font-weight: bold; margin-top: 2px; }
.vital-hp { border-color: #5a2a2a; } .vital-hp .vital-val { color: #e85a5a; }   /* HP 红 */
.vital-mp { border-color: #2a4a6a; } .vital-mp .vital-val { color: #5a9ae8; }   /* MP 蓝 */
.vital-sta { border-color: #2a5a3a; } .vital-sta .vital-val { color: #5ac878; } /* STA 绿 */
.two-col-equal { grid-template-columns: 1fr 1fr; }  /* 特技页：职业/副职等宽 */
.disc-power-group { margin-bottom: 14px; }
.disc-power-group-title { font-size: 13px; color: var(--accent); margin: 6px 0 4px; font-weight: 600; }

/* 特技表：固定列宽。名称窄(两行)、头衔宽(容4字)、条件窄(只✓/✗) */
.power-table { table-layout: fixed; }
.power-table th.pw-name, .power-table td:first-child { width: 34%; }
.power-table th.pw-rank, .power-table td.power-rank { width: 18%; }  /* 头衔紧凑 */
.power-table th.pw-train { width: 22%; }
.power-table th.pw-ctrl { width: 16%; }
.power-table th.pw-req, .power-table td.pw-req-cell { width: 10%; text-align: center; white-space: nowrap; }
.power-table .power-rank { white-space: nowrap; }  /* 头衔+rank 不换行 */
.power-table .power-rank .card-mini-attrs { margin-left: 4px; }
.power-table .pw-req-cell .warn { font-size: 16px; }
.power-table .req-ok { color: var(--accent); font-size: 16px; }
/* 满级授予型特技（无需训练） */
.power-table .auto-grant { color: var(--accent); font-size: 12px; }
.power-table .auto-grant-mark { color: var(--accent); font-size: 16px; }
.two-col h2 { font-size: 16px; margin-bottom: 12px; }
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  /* 移动端：步骤导航允许横向滚动，避免5个按钮挤一行 */
  .steps { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
  .step { flex-shrink: 0; font-size: 11px; padding: 8px 10px; }
  /* 移动端：工具条折进 ☰ 按钮里。桌面端 5 按钮横排太占顶部空间，
     收成一个按钮，点击展开竖排下拉面板。
     ponytail: 用 details/summary 或 CSS :target 都不如 JS 切 class 干净 ——
     5 个按钮的 onclick 已绑死，只需 show/hide 容器，不碰事件。 */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-toggle {
    display: block;
    background: var(--panel-2); border: 1px solid var(--border);
    color: var(--accent); padding: 6px 14px; font-size: 16px; line-height: 1;
    border-radius: 5px; cursor: pointer; font-family: inherit; min-width: 40px;
  }
  .toolbar-toggle:hover, .toolbar.open .toolbar-toggle { background: var(--accent); color: var(--bg); border-color: var(--accent); }
  .toolbar-items {
    display: none;
    flex-direction: column; gap: 4px;
    margin-top: 4px; padding-top: 4px;
    border-top: 1px solid var(--border);
    min-width: 120px;
  }
  .toolbar.open .toolbar-items { display: flex; }
  .toolbar button { padding: 8px 10px; font-size: 14px; }
  /* 移动端：表格水平滚动（属性/技能/特技表不挤压） */
  .skill-table, .attr-table { font-size: 11px; }
  /* 移动端：HP/MP/STA 卡片缩小 */
  .vital-val { font-size: 18px; }
  /* 移动端：8档符石允许换行 */
  .ingame-tiers { flex-wrap: wrap; }
  /* 移动端：标题及以下整体下移，给贴顶的 .toolbar(右) 与 .back-home(左) 让位，
     ponytail: 用 header padding-top 而非改 fixed 定位 —— fixed 元素留在最顶部，
     正常文档流的 header 及其后所有内容自然下移。*/
  header { padding-top: 52px; }
  .back-home { font-size: 12px; }
}

/* 已选清单（天赋符石/副职）*/
.summary-list { display: flex; flex-direction: column; gap: 4px; }
.summary-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.summary-name { color: var(--accent); font-size: 13px; flex-shrink: 0; }
.summary-desc { color: var(--text-dim); font-size: 11px; text-align: right; white-space: nowrap; flex-shrink: 0; margin-left: auto; }
.summary-empty { color: var(--text-dim); font-size: 12px; padding: 12px; text-align: center; }

/* 游戏内8档属性符石 */
.ingame-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ingame-attr {
  color: var(--accent);
  font-size: 14px;
  width: 44px;
  flex-shrink: 0;
}
.ingame-tiers { display: flex; gap: 3px; flex: 1; flex-wrap: nowrap; }
.ingame-tier {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 0;
  cursor: pointer;
  border-radius: 2px;
  font-size: 12px;
  transition: all .12s;
  flex: 1;
  text-align: center;
  min-width: 0;
}
.ingame-tier:hover:not(.disabled):not(.selected) { border-color: var(--accent); }
.ingame-tier.selected { border-color: var(--select); background: rgba(74,144,217,.2); color: var(--select-text); }
.ingame-tier.disabled { opacity: .3; cursor: not-allowed; }

/* 创建阶段属性减点区 */
.stat-reduce {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px;
  margin-bottom: 20px;
}
.stat-reduce-title { color: var(--accent); font-size: 13px; margin-bottom: 10px; }
.stat-reduce-title small { color: var(--text-dim); font-weight: normal; }
.stat-reduce-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-reduce-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--panel);
  padding: 8px 12px;
  border-radius: 2px;
}
.stat-reduce-item .stat-reduce-name { flex: 0 0 auto; }
.stat-reduce-item .stat-reduce-val { flex: 1 1 auto; white-space: nowrap; }
.stat-reduce-item button { flex: 0 0 auto; }
.stat-reduce-name { color: var(--accent); font-size: 13px; min-width: 30px; }
.stat-reduce-base { color: var(--text-dim); font-size: 11px; flex: 0 0 auto; }
.stat-reduce-val { font-size: 15px; min-width: 40px; text-align: center; }
.stat-reduce-val small { color: var(--text-dim); font-size: 11px; }
.stat-reduce-val.active { color: var(--accent); }
.stat-reduce-item button {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 20px; height: 22px; cursor: pointer; border-radius: 2px; font-size: 14px; line-height: 1;
}
.stat-reduce-item button.mini { width: auto; padding: 0 6px; font-size: 12px; }
.stat-reduce-item button:hover:not(:disabled) { border-color: var(--accent); }
.stat-reduce-item button:disabled { opacity: .3; cursor: not-allowed; }
.stat-reduce-info { margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.stat-reduce-info b { color: var(--good); }

/* 抗性/Buff 面板（A19，第3页右侧栏）。复用 summary-list 视觉语言。 */
.resist-panel-inner { display: flex; flex-direction: column; gap: 12px; }
.resist-group { display: flex; flex-direction: column; gap: 3px; }
.resist-group-title { color: var(--text-dim); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 2px; }
.resist-row {
  background: var(--panel); border: 1px solid var(--border); border-radius: 2px;
  padding: 5px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.resist-name { color: var(--text); font-size: 12px; }
.resist-val { color: var(--good); font-size: 12px; font-weight: bold; white-space: nowrap; }
.resist-row.other .resist-name { color: var(--text-dim); font-size: 11px; }

/* 悬浮滚动按钮（到顶/到底） */
.scroll-fab {
  position: fixed; bottom: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 6px;
}
.scroll-fab button {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--accent); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); transition: all 0.15s;
}
.scroll-fab button:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
