/* 战斗地图 · 商务浅色系 / 表格化外观（远看像电子表格，不像游戏页） */
.battlemap-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: #f6f8fa; color: #24292f;
  display: flex; flex-direction: column;
  font-size: 14px;
}
.battlemap-overlay * { box-sizing: border-box; }
.bm-open { overflow: hidden; }

/* 头部 */
.bm-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: #fff;
  border-bottom: 1px solid #d0d7de;
}
.bm-title { font-weight: 700; font-size: 16px; color: #24292f; }
.bm-room { color: #57606a; font-size: 13px; }
.bm-head-acts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bm-select {
  height: 30px; border: 1px solid #d0d7de; border-radius: 6px;
  background: #fff; color: #24292f; padding: 0 8px; font-size: 13px;
}
.bm-close {
  border: none; background: transparent; font-size: 22px; line-height: 1;
  color: #57606a; cursor: pointer; padding: 0 6px;
}
.bm-close:hover { color: #cf222e; }

/* 主体 */
.bm-body { flex: 1; display: flex; min-height: 0; }
.bm-board-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bm-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; background: #f6f8fa; border-bottom: 1px solid #e1e4e8;
}
.bm-tb-btn {
  height: 30px; padding: 0 12px; border: 1px solid #d0d7de; border-radius: 6px;
  background: #fff; color: #24292f; font-size: 13px; cursor: pointer;
}
.bm-tb-btn:hover { background: #f3f4f6; }
.bm-tb-btn.on { background: #2f6feb; border-color: #2f6feb; color: #fff; }
.bm-tb-btn.pri { background: #2f6feb; border-color: #2f6feb; color: #fff; }
.bm-tb-btn.pri:hover { background: #2563d6; }
.bm-tb-btn.warn { background: #fff; border-color: #d1242f; color: #d1242f; }
.bm-sep { width: 1px; height: 20px; background: #d0d7de; margin: 0 4px; }
.bm-hint { color: #57606a; font-size: 12px; }
.bm-empty { color: #57606a; font-size: 13px; }

/* 棋盘 */
.bm-board { flex: 1; overflow: auto; padding: 18px; background: #eef1f4; }
.bm-grid {
  display: grid;
  grid-template-columns: 30px repeat(var(--cols), 46px);
  grid-auto-rows: 46px;
  width: max-content; background: #d0d7de; border: 1px solid #d0d7de;
}
.bm-corner { background: #f6f8fa; }
.bm-colh, .bm-rowh {
  background: #f6f8fa; color: #57606a; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; border-right: 1px solid #e1e4e8; border-bottom: 1px solid #e1e4e8;
}
.bm-cell {
  background: #fff; border-right: 1px solid #e1e4e8; border-bottom: 1px solid #e1e4e8;
  position: relative; display: flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 0;
}
.bm-cell.hl { box-shadow: inset 0 0 0 2px #2f6feb; }

/* 地形着色（克制、低饱和商务色） */
.t-stone { background: #dde1e6; }
.t-wall  { background: #c9ccd1; }
.t-water { background: #dcebfb; }
.t-grass { background: #e9f3e7; }
.t-difficult { background: repeating-linear-gradient(45deg,#eef1f4,#eef1f4 4px,#e3e7ec 4px,#e3e7ec 8px); }
.t-trap  { background: repeating-linear-gradient(45deg,#fdecea,#fdecea 4px,#f9d7d3 4px,#f9d7d3 8px); }

/* 迷雾 */
.fog-hidden {
  background: #dfe3e8;
  background-image: repeating-linear-gradient(45deg, #d2d7de 0 1px, transparent 1px 7px);
}
.fog-lit { background: #fff7e6; }

/* token（克制小圆头像 / 缩写） */
.bm-tok {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; cursor: grab; user-select: none; touch-action: none;
}
.bm-tok.dragging { opacity: .65; cursor: grabbing; }
.bm-tok-ava {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; overflow: hidden;
}
.bm-tok.monster .bm-tok-ava.mon { background: #6e7781; color: #fff; }
.bm-tok.player .bm-tok-ava { background: #2f6feb; color: #fff; }
.bm-tok-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.bm-tok-txt { color: #fff; }
.bm-tok-name {
  font-size: 10px; color: #57606a; margin-top: 1px; max-width: 44px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; line-height: 1.1;
}
.bm-tok-hp { font-size: 9px; color: #cf222e; font-weight: 700; line-height: 1.1; }

/* 六边形 / 等距网格（clip-path 模拟，不破坏表格框架） */
.gt-hex .bm-cell {
  background: transparent; border: none;
  filter: drop-shadow(0 0 0.6px #c9d1d9);
}
.gt-hex .bm-cell > * { position: relative; z-index: 1; }
.gt-hex .bm-cell::before {
  content: ''; position: absolute; inset: 1px; background: #fff; z-index: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.gt-hex .bm-cell.t-stone::before { background: #dde1e6; }
.gt-hex .bm-cell.t-wall::before  { background: #c9ccd1; }
.gt-hex .bm-cell.t-water::before { background: #dcebfb; }
.gt-hex .bm-cell.t-grass::before { background: #e9f3e7; }
.gt-hex .bm-cell.t-difficult::before { background: repeating-linear-gradient(45deg,#eef1f4,#eef1f4 4px,#e3e7ec 4px,#e3e7ec 8px); }
.gt-hex .bm-cell.t-trap::before  { background: repeating-linear-gradient(45deg,#fdecea,#fdecea 4px,#f9d7d3 4px,#f9d7d3 8px); }
.gt-hex .bm-cell.fog-hidden::before {
  background: #dfe3e8;
  background-image: repeating-linear-gradient(45deg, #d2d7de 0 1px, transparent 1px 7px);
}
.gt-hex .bm-cell.fog-lit::before { background: #fff7e6; }
.gt-hex .bm-cell.even { margin-left: 23px; }

.gt-iso .bm-cell { background: transparent; border: none; filter: drop-shadow(0 0 0.6px #c9d1d9); }
.gt-iso .bm-cell::before {
  content: ''; position: absolute; inset: 1px; background: #fff; z-index: 0;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.gt-iso .bm-cell.t-stone::before { background: #dde1e6; }
.gt-iso .bm-cell.t-wall::before  { background: #c9ccd1; }
.gt-iso .bm-cell.t-water::before { background: #dcebfb; }
.gt-iso .bm-cell.t-grass::before { background: #e9f3e7; }
.gt-iso .bm-cell.t-difficult::before { background: repeating-linear-gradient(45deg,#eef1f4,#eef1f4 4px,#e3e7ec 4px,#e3e7ec 8px); }
.gt-iso .bm-cell.t-trap::before  { background: repeating-linear-gradient(45deg,#fdecea,#fdecea 4px,#f9d7d3 4px,#f9d7d3 8px); }
.gt-iso .bm-cell > * { position: relative; z-index: 1; }

/* 状态条 */
.bm-status {
  padding: 7px 14px; font-size: 12px; color: #57606a;
  background: #fff; border-top: 1px solid #e1e4e8;
}

/* 侧栏 */
.bm-side {
  width: 332px; flex: none; border-left: 1px solid #d0d7de;
  background: #fff; display: flex; flex-direction: column; min-height: 0;
}
.bm-side-tabs { display: flex; border-bottom: 1px solid #e1e4e8; }
.bm-side-tab {
  flex: 1; text-align: center; padding: 9px 0; font-size: 13px; color: #57606a;
  cursor: pointer; border-bottom: 2px solid transparent;
}
.bm-side-tab.on { color: #2f6feb; border-bottom-color: #2f6feb; font-weight: 600; }
.bm-side-body { flex: 1; overflow: auto; padding: 12px; }
.bm-side-pane { display: none; }
.bm-side-pane.on { display: block; }

/* 表单 */
.bm-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bm-form-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bm-lbl { font-size: 12px; color: #57606a; }
.bm-in {
  height: 30px; border: 1px solid #d0d7de; border-radius: 6px; padding: 0 8px;
  font-size: 13px; color: #24292f; background: #fff; min-width: 0;
}
.bm-in:focus { outline: 2px solid #2f6feb55; border-color: #2f6feb; }

/* 单位列表 */
.bm-tok-list { display: flex; flex-direction: column; gap: 4px; }
.bm-tok-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid #eaecef; border-radius: 6px; background: #fafbfc;
}
.bm-tok-item.monster { border-left: 3px solid #6e7781; }
.bm-tok-item.player { border-left: 3px solid #2f6feb; }
.bm-tok-dot { width: 10px; height: 10px; border-radius: 50%; }
.bm-tok-dot.monster { background: #6e7781; }
.bm-tok-dot.player { background: #2f6feb; }
.bm-tok-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.bm-tok-info b { font-size: 13px; }
.bm-tok-info i { font-size: 11px; color: #57606a; font-style: normal; }
.bm-tok-stat { font-size: 11px; color: #57606a; }
.bm-tok-del {
  border: none; background: transparent; color: #d1242f; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px;
}
.bm-tok-lt {
  border: 1px solid #e3e6ea; background: #fff; color: #9a6700; cursor: pointer;
  font-size: 11px; line-height: 1; padding: 2px 5px; border-radius: 5px;
}
.bm-tok-lt.on { background: #fff8e1; border-color: #d4a72c; color: #7d5700; }
/* 射程环（攻击模式选中攻击方后高亮射程内格子） */
.bm-cell.in-range { box-shadow: inset 0 0 0 2px #d4a72c; background: #fff8e1; }
.gt-hex .bm-cell.in-range::before,
.gt-iso .bm-cell.in-range::before { background: #fff8e1; }

/* 回放播放器 */
.bm-rp-bar { display: flex; gap: 6px; margin-bottom: 8px; }
.bm-rp-slider { width: 100%; accent-color: #2f6feb; }
.bm-rp-info { font-size: 12px; color: #57606a; margin: 6px 0 8px; }
.bm-dim { color: #8c959f; font-size: 12px; padding: 8px 2px; }

/* 先攻 */
.bm-init-list { list-style: none; margin: 0; padding: 0; counter-reset: ini; }
.bm-init-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid #eaecef; border-radius: 6px; margin-bottom: 4px; background: #fafbfc;
}
.bm-init-item.cur { border-color: #2f6feb; background: #eef4ff; }
.bm-init-idx {
  width: 20px; height: 20px; border-radius: 50%; background: #2f6feb; color: #fff;
  font-size: 11px; display: flex; align-items: center; justify-content: center; flex: none;
}
.bm-init-name { flex: 1; font-size: 13px; }
.bm-init-val { font-weight: 700; color: #24292f; }
.bm-init-mv { display: flex; flex-direction: column; gap: 1px; }
.bm-init-mv button { border: 1px solid #d0d7de; background: #fff; border-radius: 4px; cursor: pointer; font-size: 10px; padding: 0 4px; line-height: 1.3; }

/* 战斗记录 */
.bm-log { display: flex; flex-direction: column; gap: 3px; }
.bm-log-item { display: flex; gap: 6px; font-size: 12px; padding: 4px 6px; border-bottom: 1px solid #f0f2f4; }
.bm-log-t { color: #8c959f; flex: none; }
.bm-log-a { color: #2f6feb; flex: none; }
.bm-log-s { color: #24292f; }

/* 指令 */
.bm-cmd-in {
  width: 100%; height: 160px; resize: vertical; border: 1px solid #d0d7de; border-radius: 6px;
  padding: 8px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #24292f; margin-bottom: 8px;
}

/* 模态 */
.bm-modal-mask {
  position: absolute; inset: 0; background: rgba(27,31,36,.45);
  display: none; align-items: center; justify-content: center; z-index: 20;
}
.bm-modal {
  background: #fff; border-radius: 10px; width: 360px; max-width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); overflow: hidden;
}
.bm-modal-title { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid #eaecef; }
.bm-modal-body { padding: 16px; }
.bm-modal-acts { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid #eaecef; }

@media (max-width: 820px) {
  .bm-body { flex-direction: column; }
  .bm-side { width: 100%; border-left: none; border-top: 1px solid #d0d7de; max-height: 42%; }
  .bm-grid { grid-template-columns: 26px repeat(var(--cols), 40px); grid-auto-rows: 40px; }
  .bm-tok-ava { width: 26px; height: 26px; }
  .gt-hex .bm-cell.even { margin-left: 20px; }
}
