* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #14171c;
  color: #e0e0e0;
  font-size: 13px;
  overflow: hidden;
  height: 100vh;
}
#app { display: flex; flex-direction: column; height: 100vh; }

/* ===== 顶部资源条 ===== */
#topbar {
  background: linear-gradient(180deg, #2a2f3a 0%, #1f242e 100%);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #3a3f4b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: border-color 0.3s;
}
#topbar.player-A { border-bottom-color: #e74c3c; box-shadow: 0 2px 12px rgba(231,76,60,0.3); }
#topbar.player-B { border-bottom-color: #3498db; box-shadow: 0 2px 12px rgba(52,152,219,0.3); }

.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar-left h1 {
  font-size: 18px;
  color: #f0c040;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(240,192,64,0.4);
}
.topbar-left .subtitle { font-size: 10px; color: #8a92a6; }

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 720px;
}
.player-block {
  display: flex;
  align-items: center;
  gap: 12px;
}
.player-name {
  font-size: 16px;
  font-weight: bold;
  padding: 2px 12px;
  border-radius: 12px;
}
.player-name.player-A { color: #fff; background: rgba(231,76,60,0.25); border: 1px solid #e74c3c; }
.player-name.player-B { color: #fff; background: rgba(52,152,219,0.25); border: 1px solid #3498db; }
.phase-tag {
  font-size: 12px;
  color: #8ab4f8;
  padding: 2px 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
}

.resource-bar {
  display: flex;
  gap: 14px;
  background: rgba(0,0,0,0.35);
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid #3a3f4b;
}
.res-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #b0b8c4;
}
.res-item .res-icon { font-size: 14px; }
.res-item b { color: #f0c040; font-size: 14px; font-weight: bold; }

.topbar-right { display: flex; gap: 8px; align-items: center; }
.topbar-btn {
  background: #3a3f4b;
  color: #e0e0e0;
  border: 1px solid #555;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.topbar-btn:hover { background: #4a5060; border-color: #8ab4f8; }
.topbar-btn.end-turn {
  background: linear-gradient(180deg, #f0c040 0%, #d4a020 100%);
  color: #1a1d23;
  font-weight: bold;
  border: 1px solid #f0d060;
  padding: 6px 18px;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(240,192,64,0.4);
}
.topbar-btn.end-turn:hover { background: linear-gradient(180deg, #f0d060 0%, #e0b030 100%); }

/* ===== 主布局 ===== */
#layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}

#centerPanel {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1f242e;
  border: 1px solid #3a3f4b;
  border-radius: 6px;
  padding: 8px;
  overflow: auto;
}
#mapCanvas {
  background: #2d3a2d;
  border: 2px solid #555;
  border-radius: 4px;
  cursor: pointer;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}
#legend {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  justify-content: center;
}
#legend span { display: inline-flex; align-items: center; gap: 4px; color: #b0b8c4; }
#legend i { width: 14px; height: 14px; display: inline-block; border-radius: 3px; border: 1px solid rgba(255,255,255,0.2); }

/* ===== 侧边行动面板 ===== */
.action-panel {
  background: #1f242e;
  border: 1px solid #3a3f4b;
  border-radius: 6px;
  padding: 10px;
  overflow-y: auto;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-panel::-webkit-scrollbar { width: 8px; }
.action-panel::-webkit-scrollbar-track { background: #1a1d23; }
.action-panel::-webkit-scrollbar-thumb { background: #3a3f4b; border-radius: 4px; }
.action-panel::-webkit-scrollbar-thumb:hover { background: #4a5060; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 4px solid;
}
.panel-head.player-a { background: rgba(231,76,60,0.15); border-left-color: #e74c3c; }
.panel-head.player-b { background: rgba(52,152,219,0.15); border-left-color: #3498db; }
.player-badge { font-size: 15px; font-weight: bold; color: #fff; }
.phase-tag { font-size: 11px; color: #8ab4f8; }

.panel-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
}
.panel-stats .stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
}
.panel-stats .stat-icon { font-size: 13px; }
.panel-stats b { color: #f0c040; font-size: 13px; }

.list-title {
  font-size: 11px;
  color: #8ab4f8;
  margin: 4px 0 2px;
  font-weight: bold;
  border-bottom: 1px solid #3a3f4b;
  padding-bottom: 2px;
}

/* 提示框 */
.hint {
  background: rgba(138,180,248,0.1);
  border-left: 3px solid #8ab4f8;
  padding: 8px 10px;
  border-radius: 4px;
  color: #b0c4f0;
  font-size: 11px;
  line-height: 1.6;
}
.hint-setup { background: rgba(240,192,64,0.1); border-left-color: #f0c040; }
.hint-step { font-weight: bold; color: #f0c040; font-size: 12px; margin-bottom: 2px; }
.hint-desc { color: #b0b8c4; }
.hint .mv-cell { color: #2ecc71; font-weight: bold; }
.hint .atk-cell { color: #e74c3c; font-weight: bold; }

/* 军团卡片列表 */
.legion-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legion-card {
  background: #2a3040;
  border: 1px solid #3a3f4b;
  border-radius: 4px;
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.legion-card:hover { border-color: #8ab4f8; background: #323844; }
.legion-card.selected { border-color: #f0c040; background: rgba(240,192,64,0.1); box-shadow: 0 0 6px rgba(240,192,64,0.3); }
.lc-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-bottom: 3px;
}
.lc-type { font-weight: bold; color: #f0c040; }
.lc-type.type-infantry { color: #95a5a6; }
.lc-type.type-spear { color: #2ecc71; }
.lc-type.type-archer { color: #f39c12; }
.lc-type.type-lightCav { color: #9b59b6; }
.lc-type.type-bowCav { color: #e74c3c; }
.lc-type.type-heavyCav { color: #34495e; }
.lc-id { color: #8a92a6; font-size: 10px; }
.lc-pos { color: #6c7989; font-size: 10px; margin-left: auto; }
.lc-bars { display: flex; flex-direction: column; gap: 2px; }
.lc-state { font-size: 10px; color: #8a92a6; margin-top: 2px; }

/* 血条/士气条 */
.bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}
.bar-label { width: 24px; color: #8a92a6; }
.bar {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  overflow: hidden;
}
.bar > div { height: 100%; transition: width 0.3s; }
.bar-hp { background: linear-gradient(90deg, #2ecc71, #27ae60); }
.bar-mor { background: linear-gradient(90deg, #3498db, #2980b9); }
.bar-research { background: linear-gradient(90deg, #f0c040, #e0a020); }
.bar-val { width: 42px; text-align: right; color: #b0b8c4; font-size: 10px; }

/* 选中军团详情 */
.selected-legion {
  background: linear-gradient(180deg, #2a3540 0%, #243040 100%);
  border: 1px solid #f0c040;
  border-radius: 4px;
  padding: 8px;
  font-size: 11px;
  line-height: 1.6;
  box-shadow: 0 0 8px rgba(240,192,64,0.2);
}
.sl-title { margin-bottom: 4px; }
.sl-title b { color: #f0c040; font-size: 13px; }
.sl-pos { color: #8a92a6; font-size: 10px; }
.sl-bars { display: flex; flex-direction: column; gap: 3px; margin: 4px 0; }
.sl-stats { display: flex; gap: 12px; margin: 4px 0; color: #b0b8c4; }
.sl-stats b { color: #f0c040; }
.sl-meta { color: #8a92a6; font-size: 10px; margin: 2px 0; }
.sl-meta b { color: #b0c4f0; }
.warn { color: #e74c3c; font-weight: bold; }

/* 按钮行 */
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0;
}
.action-panel button {
  background: #3a3f4b;
  color: #e0e0e0;
  border: 1px solid #555;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  width: 100%;
}
.action-panel button:hover:not(:disabled) {
  background: #4a5060;
  border-color: #8ab4f8;
  transform: translateY(-1px);
}
.action-panel button:active:not(:disabled) { transform: translateY(0); }
.action-panel button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-row button:only-child { grid-column: span 2; }

/* 研发中列表 */
.research-list {
  background: rgba(0,0,0,0.3);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.research-item { margin: 4px 0; }
.ri-name { color: #f0c040; font-size: 11px; }
.ri-turns { color: #8a92a6; font-size: 10px; margin-top: 1px; }

/* 已解锁兵种 */
.unlock-list {
  background: rgba(0,0,0,0.3);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.unlock-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.unit-tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  background: #2a3040;
  border: 1px solid #3a3f4b;
}
.unit-tag.type-infantry { border-color: #95a5a6; color: #bdc3c7; }
.unit-tag.type-spear { border-color: #2ecc71; color: #2ecc71; }
.unit-tag.type-archer { border-color: #f39c12; color: #f39c12; }
.unit-tag.type-lightCav { border-color: #9b59b6; color: #b370d8; }
.unit-tag.type-bowCav { border-color: #e74c3c; color: #ec7063; }
.unit-tag.type-heavyCav { border-color: #34495e; color: #5d6d7e; }

.action-panel .game-over {
  background: linear-gradient(180deg, #4a2a2a 0%, #3a1a1a 100%);
  border: 2px solid #e74c3c;
  color: #fff;
  padding: 24px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  border-radius: 6px;
  line-height: 1.6;
}
.action-panel .game-over .game-over-title { font-size: 20px; margin-bottom: 8px; }
.action-panel .game-over .game-over-winner { font-size: 24px; color: #f0c040; margin-bottom: 16px; }
.action-panel .game-over .btn-restart {
  background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
  color: #fff;
  border: none;
  padding: 10px 28px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.action-panel .game-over .btn-restart:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(46,204,113,0.5);
}

/* ===== 底部控制条（精简） ===== */
#controls {
  background: #1f242e;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #3a3f4b;
  font-size: 11px;
}
.legacy-info { color: #8a92a6; }
#resultSummary { color: #f0c040; font-weight: bold; margin-left: auto; }

/* ===== 日志面板 ===== */
#logPanel {
  background: #14171c;
  border-top: 1px solid #3a3f4b;
  height: 120px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
#logPanel h3 {
  color: #8ab4f8;
  padding: 4px 16px;
  font-size: 11px;
  background: #1f242e;
  border-bottom: 1px solid #3a3f4b;
}
#battleLog {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 11px;
  line-height: 1.5;
}
.log-entry { padding: 1px 0; }
.log-A { color: #ff6b6b; }
.log-B { color: #6b9eff; }
.log-system { color: #f0c040; }
.log-combat { color: #ff9f43; }
.log-weather { color: #a8e6cf; }

/* play-only 在交互模式下显示 */
.play-only { display: inline-block; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,23,28,0.95);
  color: #f0c040;
  padding: 12px 24px;
  border-radius: 24px;
  border: 1px solid #f0c040;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
  max-width: 80%;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ===== 模态弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: linear-gradient(180deg, #2a2f3a 0%, #1f242e 100%);
  border: 1px solid #f0c040;
  border-radius: 8px;
  padding: 20px;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  min-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 24px rgba(240,192,64,0.2);
}
.modal-title {
  color: #f0c040;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #3a3f4b;
  padding-bottom: 8px;
}
.modal-close {
  background: transparent;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}
.modal-close:hover { color: #fff; }
.modal-body button {
  display: inline-block;
  margin: 3px;
  padding: 8px 12px;
  background: #3a3f4b;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.modal-body button:hover:not(:disabled) {
  background: #4a5060;
  border-color: #8ab4f8;
}
.modal-body button:disabled { opacity: 0.4; cursor: not-allowed; }
.modal-body h4 {
  color: #8ab4f8;
  font-size: 13px;
  margin: 12px 0 6px;
  border-top: 1px solid #3a3f4b;
  padding-top: 8px;
}

/* 招募/解锁卡片网格 */
.modal-body button[data-recruit-type],
.modal-body button[data-unlock-type] {
  display: block;
  width: 100%;
  margin: 4px 0;
  text-align: left;
  padding: 8px 12px;
}

.modal-box.pass-box {
  text-align: center;
  padding: 32px;
  min-width: 320px;
}
.modal-box.pass-box p { margin: 8px 0; color: #b0b8c4; }
.modal-box.pass-box b { color: #f0c040; font-size: 16px; }
.modal-box.pass-box button {
  margin-top: 16px;
  padding: 10px 32px;
  background: linear-gradient(180deg, #f0c040 0%, #d4a020 100%);
  color: #1a1d23;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(240,192,64,0.4);
}

/* 帮助弹窗 */
.help-dialog h3 {
  color: #f0c040;
  font-size: 14px;
  margin: 10px 0 6px;
  border-bottom: 1px solid #3a3f4b;
  padding-bottom: 4px;
}
.help-dialog ul { list-style: none; padding-left: 0; }
.help-dialog li {
  padding: 4px 0;
  color: #b0b8c4;
  font-size: 12px;
  line-height: 1.6;
}
.help-dialog li b { color: #f0c040; }
.help-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.help-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #b0b8c4;
}
.help-legend .lg {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ===== 通用 tooltip（JS 驱动的 #hoverTip 浮层，绕开父容器 overflow 裁剪）===== */
.tip[data-tip] { cursor: help; }
.hover-tip {
  position: fixed;
  display: none;
  background: #14171c;
  color: #e8e8e8;
  border: 1px solid #f0c040;
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 11px;
  line-height: 1.55;
  max-width: 250px;
  z-index: 1300;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.75);
}
.hover-tip.tone-good { border-color: #2ecc71; color: #d4f7da; }
.hover-tip.tone-bad { border-color: #e74c3c; color: #f7d4d0; }

/* ===== 地图悬浮提示浮动层 ===== */
.canvas-tip {
  position: fixed;
  display: none;
  background: #14171c;
  color: #e8e8e8;
  border: 1px solid #f0c040;
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 11px;
  line-height: 1.6;
  max-width: 260px;
  z-index: 1200;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.7);
  white-space: nowrap;
}
.canvas-tip b { color: #f0c040; }

/* ===== 完整规则手册弹窗 ===== */
.modal-box.help-wide {
  max-width: 760px;
  min-width: 420px;
  max-height: 88vh;
}
.help-manual { font-size: 12px; color: #c8d0dc; line-height: 1.65; }
.help-manual h3 {
  color: #f0c040;
  font-size: 14px;
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #3a3f4b;
}
.help-manual ul { list-style: none; padding-left: 0; margin: 4px 0; }
.help-manual li { padding: 3px 0; }
.help-manual li b { color: #f0c040; }
.help-manual .hm-intro {
  background: rgba(138,180,248,0.08);
  border-left: 3px solid #8ab4f8;
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: #b0b8c4;
}
.help-manual .hm-pos { color: #2ecc71; font-weight: bold; }
.help-manual .hm-neg { color: #e74c3c; font-weight: bold; }
.help-manual .hm-ui { color: #8ab4f8; font-weight: bold; }
.help-manual .hm-note {
  color: #b0b8c4;
  font-size: 11px;
  margin: 4px 0 6px;
  padding: 6px 8px;
  background: rgba(240,192,64,0.06);
  border-radius: 4px;
}
.help-manual .hm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px 10px;
  margin: 4px 0 6px;
}
.help-manual .hm-units .hm-u,
.help-manual .hm-unlock span {
  background: #2a2f3a;
  border: 1px solid #3a3f4b;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
}
.help-manual .hm-units .hm-u b { color: #f0c040; }
.help-manual .hm-units .hm-u i,
.help-manual .hm-unlock i { color: #8ab4f8; font-style: normal; }
.help-manual .help-legend { margin: 4px 0 6px; }

/* ===== 国策树 ===== */
.policy-tree { font-size: 11px; line-height: 1.5; }

/* ===== 国策节点卡片 ===== */
.policy-tree .pnode {
  padding: 6px 10px;
  margin: 4px 0;
  border-radius: 5px;
  border-left: 4px solid var(--rc, #888);
  background: #2a2f3a;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.policy-tree .pnode:hover { transform: translateX(2px); }
.policy-tree .pnode-done { background: rgba(46,204,113,0.12); border-left-color: #2ecc71 !important; }
.policy-tree .pnode-researching { background: rgba(240,192,64,0.12); border-left-color: #f0c040 !important; }
.policy-tree .pnode-available { background: #2d323d; cursor: default; }
.policy-tree .pnode-available:hover { background: #353a48; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.policy-tree .pnode-locked { background: rgba(0,0,0,0.3); border-left-color: #555 !important; opacity: 0.45; }
.policy-tree .pnode-disabled { background: rgba(231,76,60,0.08); border-left-color: #888 !important; opacity: 0.55; }

.policy-tree .pnode-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.policy-tree .pnode-icon { font-size: 16px; }
.policy-tree .pnode-status { font-size: 14px; width: 16px; text-align: center; }
.policy-tree .pnode-done .pnode-status { color: #2ecc71; }
.policy-tree .pnode-researching .pnode-status { color: #f0c040; }
.policy-tree .pnode-available .pnode-status { color: #8ab4f8; }
.policy-tree .pnode-locked .pnode-status { color: #555; }
.policy-tree .pnode-name { font-weight: bold; color: #e8eaed; }
.policy-tree .pnode-cost { color: #b0b8c4; font-size: 10px; margin-left: auto; }
.policy-tree .t-route-tag {
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: normal;
}
.policy-tree .pnode-eff {
  margin-top: 3px;
  padding-left: 22px;
  color: #7fd4a0;
  font-size: 10px;
  line-height: 1.4;
}
.policy-tree .pnode-done .pnode-eff { color: #2ecc71; }
.policy-tree .pnode-locked .pnode-eff { color: #6a7280; }
.policy-tree .pnode-meta {
  margin-top: 3px;
  padding-left: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.policy-tree .t-merge { color: #c0a060; font-size: 10px; font-style: italic; }
.policy-tree .t-progress { color: #f0c040; font-size: 10px; font-weight: bold; }
.policy-tree .t-block { color: #e07a7a; font-size: 10px; }
.policy-tree .t-btn {
  margin-left: auto;
  padding: 4px 14px;
  background: linear-gradient(180deg, #f0c040 0%, #d4a020 100%);
  color: #1a1d23;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-weight: bold;
  transition: filter 0.12s;
}
.policy-tree .t-btn:hover { filter: brightness(1.15); }

/* ===== 路线标题栏 ===== */
.policy-tree .route-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 6px;
  padding: 8px 12px;
  border-radius: 5px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--rc, #888) 25%, transparent) 0%, transparent 100%);
  border-left: 4px solid var(--rc, #888);
}
.policy-tree .route-header.route-active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--rc, #888) 40%, transparent) 0%, transparent 100%);
  box-shadow: 0 0 8px color-mix(in srgb, var(--rc, #888) 30%, transparent);
}
.policy-tree .route-header.route-blocked { opacity: 0.4; }
.policy-tree .route-header .route-icon { font-size: 20px; }
.policy-tree .route-header .route-name { font-weight: bold; font-size: 14px; color: var(--rc, #888); }
.policy-tree .route-header .route-desc { font-size: 10px; color: #8a92a6; }
.policy-tree .route-header .route-status { margin-left: auto; font-size: 11px; font-weight: bold; }

/* ===== 路线分支容器 ===== */
.policy-tree .route-branch {
  border-left: 2px dashed color-mix(in srgb, var(--rc, #888) 40%, transparent);
  margin-left: 8px;
  padding-left: 8px;
}

/* 响应式 */
@media (max-width: 1100px) {
  #layout { grid-template-columns: 1fr 260px; }
  .resource-bar { gap: 8px; }
}
@media (max-width: 900px) {
  #layout { grid-template-columns: 1fr; }
  .action-panel { max-height: 300px; }
  .topbar-center { display: none; }
}

/* ===== 顶部天气小字 ===== */
#weatherTag .wsub { color: #a8e6cf; font-size: 10px; }

/* ===== 选中军团天气行 ===== */
.sl-weather {
  margin-top: 6px;
  padding: 5px 8px;
  background: rgba(58,111,168,0.18);
  border-left: 3px solid #3a6fa8;
  border-radius: 3px;
  font-size: 11px;
  color: #cfe0f0;
  line-height: 1.5;
}
.sl-weather .wicon { font-size: 13px; }
.sl-weather .weff { color: #f0a040; font-weight: bold; }

/* ===== 警告提示 ===== */
.hint.warn { color: #e74c3c; border-left-color: #e74c3c; background: rgba(231,76,60,0.12); }

/* ===== 按钮分组 ===== */
.action-group {
  margin: 6px 0;
  padding: 6px;
  background: rgba(0,0,0,0.25);
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.05);
}
.action-group .ag-title {
  font-size: 11px;
  color: #8ab4f8;
  font-weight: bold;
  margin-bottom: 5px;
  letter-spacing: 1px;
}
.action-group .btn-row { margin: 0; }

/* ===== 状态切换分段按钮 ===== */
.seg-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.seg-label {
  font-size: 10px;
  color: #8a92a6;
  min-width: 28px;
}
.seg-row { display: flex; gap: 4px; flex: 1; }
.seg {
  flex: 1;
  padding: 4px 6px !important;
  font-size: 11px !important;
  background: #2a3040 !important;
  border: 1px solid #3a3f4b !important;
  border-radius: 3px !important;
  color: #b0b8c4 !important;
  cursor: pointer;
  transition: all 0.15s;
}
.seg:hover:not(:disabled) { background: #353c50 !important; border-color: #8ab4f8 !important; }
.seg.on {
  background: linear-gradient(180deg, #f0c040 0%, #d4a020 100%) !important;
  color: #1a1d23 !important;
  border-color: #f0c040 !important;
  font-weight: bold;
}

/* ===== 市场访问按钮 ===== */
.btn-market {
  background: linear-gradient(180deg, #7a4fa8 0%, #5a3a88 100%) !important;
  color: #fff !important;
  border-color: #a070d0 !important;
}

/* ===== 空状态提示 ===== */
.empty-hint {
  padding: 16px;
  text-align: center;
  color: #8a92a6;
  font-size: 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  margin: 8px 0;
}

/* ===== 战斗谋略选单 ===== */
.tactic-pick { font-size: 12px; }
.tactic-target {
  padding: 8px 10px;
  background: rgba(231,76,60,0.15);
  border-left: 3px solid #e74c3c;
  border-radius: 3px;
  margin-bottom: 8px;
  color: #f5b8b0;
}
.tactic-tip { color: #8a92a6; margin-bottom: 8px; }
.tactic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.tactic-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #2a3040;
  border: 1px solid #3a3f4b;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 11px;
}
.tactic-opt:hover { background: #353c50; border-color: #8ab4f8; }
.tactic-opt.off { opacity: 0.4; cursor: not-allowed; }
.tactic-opt input { margin: 0; }
.tactic-opt .t-name { font-weight: bold; color: #f0c040; }
.tactic-opt .t-cost { color: #2ecc71; font-size: 10px; }
.tactic-opt .t-desc { color: #8a92a6; font-size: 10px; flex: 1; }
.tactic-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.tactic-foot .btn-cancel,
.tactic-foot .btn-confirm {
  padding: 8px 18px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
}
.tactic-foot .btn-cancel {
  background: #3a3f4b;
  color: #b0b8c4;
  border: 1px solid #555;
}
.tactic-foot .btn-cancel:hover { background: #4a5060; }
.tactic-foot .btn-confirm {
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(231,76,60,0.4);
}
.tactic-foot .btn-confirm:hover { background: linear-gradient(180deg, #ff5d4d 0%, #d0493b 100%); }

/* ===== 斥候技能选单 ===== */
.scout-pick { font-size: 12px; }
.scout-tip { color: #8a92a6; margin-bottom: 8px; }
.scout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.modal-body button[data-scout-id] {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 3px 0;
  padding: 8px 10px;
  text-align: left;
  background: #2a3040;
  border: 1px solid #3a3f4b;
}
.modal-body button[data-scout-id]:hover:not(:disabled) {
  background: #353c50;
  border-color: #8ab4f8;
}
.modal-body button[data-scout-id] .sk-name { font-weight: bold; color: #f0c040; min-width: 60px; }
.modal-body button[data-scout-id] .sk-cost { color: #2ecc71; font-size: 11px; }
.modal-body button[data-scout-id] .sk-desc { color: #b0b8c4; font-size: 11px; }
.modal-body button[data-scout-id] .sk-state { color: #8a92a6; font-size: 10px; }

/* ===== 议事手牌 ===== */
.council-info {
  padding: 8px 10px;
  background: rgba(138,180,248,0.12);
  border-left: 3px solid #8ab4f8;
  border-radius: 3px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #cfe0f0;
}
.council-hand {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.council-card {
  padding: 8px 10px;
  background: #2a3040;
  border: 1px solid #3a3f4b;
  border-radius: 5px;
  border-left: 4px solid #888;
  position: relative;
}
.council-card.cat-military { border-left-color: #e74c3c; }
.council-card.cat-economy { border-left-color: #2ecc71; }
.council-card.cat-city { border-left-color: #8ab4f8; }
.council-card.cat-nation { border-left-color: #f0c040; }
.council-card.done { opacity: 0.6; }
.council-card .cc-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.council-card .cc-cat {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: #b0b8c4;
}
.council-card .cc-head b { color: #f0c040; font-size: 13px; }
.council-card .cc-desc { color: #b0b8c4; font-size: 11px; line-height: 1.5; margin-bottom: 6px; }
.council-card .cc-reward { color: #2ecc71; font-size: 10px; margin-bottom: 6px; }
.council-card .cc-done {
  display: inline-block;
  color: #2ecc71;
  font-size: 11px;
  font-weight: bold;
}
.council-card .cc-complete {
  padding: 4px 10px !important;
  background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 3px !important;
  font-size: 11px !important;
  cursor: pointer;
  margin: 0 !important;
}
.council-card .cc-complete:hover { background: linear-gradient(180deg, #3fdd81 0%, #37be70 100%) !important; }

@media (max-width: 600px) {
  .tactic-grid, .council-hand { grid-template-columns: 1fr; }
}

/* ===== 国策树顶部状态栏 ===== */
.policy-status-bar {
  background: linear-gradient(180deg, #2a3040 0%, #232838 100%);
  border: 1px solid #4a5268;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 11px;
  line-height: 1.8;
}
.policy-status-bar .ps-item {
  display: inline-block;
  margin-right: 16px;
  color: #c0c8d4;
}
.policy-status-bar .route-chosen { color: #f0c040; }
.policy-status-bar .route-none { color: #888; }
.policy-status-bar .queue-full { color: #e74c3c; }
.policy-status-bar .queue-ok { color: #2ecc71; }
.policy-status-bar .ps-tip {
  display: block;
  color: #8a92a6;
  font-size: 10px;
  margin-top: 2px;
}

/* ===== 侧边栏：已生效国策 / 永久效果 面板 ===== */
.policy-active {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(138,180,248,0.06);
  border: 1px solid rgba(138,180,248,0.25);
  border-radius: 4px;
}
.policy-active .list-title { color: #8ab4f8; }
.policy-active .pa-item {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  font-size: 11px;
}
.policy-active .pa-item:last-child { border-bottom: none; }
.policy-active .pa-item.perm .pa-name { color: #f0c040; }
.policy-active .pa-name { font-weight: bold; color: #e0e0e0; }
.policy-active .pa-eff { color: #9aa6b8; font-size: 10px; margin-top: 1px; }

/* ===== 市场预览弹窗 ===== */
.market-preview { font-size: 13px; min-width: 280px; }
.market-preview .mp-card {
  background: #2d323d;
  border: 1px solid #8ab4f8;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}
.market-preview .mp-name {
  font-size: 16px;
  font-weight: bold;
  color: #f0c040;
  margin-bottom: 4px;
}
.market-preview .mp-desc { color: #e0e0e0; margin-bottom: 6px; line-height: 1.5; }
.market-preview .mp-cost { color: #2ecc71; font-weight: bold; }
.market-preview .mp-cost .warn { color: #e74c3c; font-weight: normal; }
.market-preview .mp-meta { color: #8a92a6; font-size: 11px; margin-bottom: 10px; line-height: 1.5; }
.market-preview .mp-btns { display: flex; gap: 8px; justify-content: flex-end; }
.market-preview .mp-btns button {
  padding: 8px 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
}
.market-preview #marketBuy {
  background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(46,204,113,0.4);
}
.market-preview #marketBuy:hover { background: linear-gradient(180deg, #3fdd81 0%, #2dbf5f 100%); }
.market-preview #marketBuy:disabled {
  background: #3a3f4b; color: #6a7280; cursor: not-allowed; box-shadow: none;
}
.market-preview #marketCancel {
  background: #3a3f4b; color: #b0b8c4; border: 1px solid #555;
}
.market-preview #marketCancel:hover { background: #4a5060; }

/* ===== 科技右键钉住说明浮窗 ===== */
.pinned-tip {
  position: fixed;
  display: none;
  background: #14171c;
  color: #e8e8e8;
  border: 1px solid #8ab4f8;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  max-width: 280px;
  z-index: 1400;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.8), 0 0 12px rgba(138,180,248,0.3);
  transition: opacity 0.18s;
}
.pinned-tip b { color: #f0c040; font-size: 13px; }

/* ===== 战斗结果弹窗 ===== */
.modal-box.combat-wide {
  max-width: 680px;
  min-width: 460px;
  max-height: 92vh;
}
.combat-result { font-size: 12px; color: #c8d0dc; }
.cb-arena {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}
.cb-side {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid #3a3f4b;
  border-radius: 6px;
  padding: 8px 10px;
  position: relative;
  transition: background 0.3s, border-color 0.3s;
}
.cb-side.side-A { border-color: rgba(231,76,60,0.45); }
.cb-side.side-B { border-color: rgba(52,152,219,0.45); }
.cb-side.flash-hit {
  background: rgba(231,76,60,0.28);
  border-color: #e74c3c;
  animation: cb-flash 0.45s;
}
.cb-side.flash-morale {
  background: rgba(230,126,34,0.22);
  border-color: #e67e22;
  animation: cb-flash 0.45s;
}
@keyframes cb-flash {
  0% { transform: scale(1); }
  30% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.cb-label {
  font-size: 11px;
  color: #8a92a6;
  margin-bottom: 2px;
}
.cb-side.side-A .cb-label { color: #e74c3c; }
.cb-side.side-B .cb-label { color: #3498db; }
.cb-unit {
  font-size: 14px;
  font-weight: bold;
  color: #f0c040;
  margin-bottom: 4px;
}
.cb-stat { font-size: 11px; color: #b0b8c4; margin-bottom: 6px; }
.cb-stat b { color: #e0e0e0; }
.cb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
}
.cb-row-label {
  width: 28px;
  font-size: 10px;
  color: #8a92a6;
}
.cb-bar {
  flex: 1;
  height: 12px;
  background: #1a1d24;
  border: 1px solid #2a2f3a;
  border-radius: 2px;
  overflow: hidden;
}
.cb-bar-fill {
  height: 100%;
  transition: width 0.35s ease;
}
.cb-hp-fill { background: linear-gradient(90deg, #e74c3c 0%, #2ecc71 100%); }
.cb-mor-fill { background: linear-gradient(90deg, #8a4a2a 0%, #3498db 100%); }
.cb-row-num {
  width: 52px;
  font-size: 10px;
  color: #c0c8d4;
  text-align: right;
}
.cb-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #f0c040;
  padding: 0 4px;
  text-shadow: 0 0 8px rgba(240,192,64,0.5);
}
/* 弹窗内飘字 */
.cb-float-dmg {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  animation: cb-float 0.9s ease-out forwards;
  z-index: 10;
}
@keyframes cb-float {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -36px); }
}
/* 战斗日志条目 */
.cb-log {
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0,0,0,0.3);
  border: 1px solid #2a2f3a;
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 8px;
  cursor: pointer;
}
.cb-log-row {
  padding: 3px 0;
  font-size: 11.5px;
  line-height: 1.5;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
  animation: cb-row-in 0.3s ease;
}
@keyframes cb-row-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.cb-log-row.tone-attack { color: #f7d4d0; }
.cb-log-row.tone-counter { color: #ffd4a0; }
.cb-log-row.tone-ambush { color: #c9a0ff; font-weight: bold; }
.cb-log-row.tone-rear { color: #ff6b6b; font-weight: bold; }
.cb-log-row.tone-flank { color: #ffa940; }
.cb-log-row.tone-tactic { color: #8ab4f8; }
.cb-log-row.tone-rout { color: #e67e22; font-style: italic; }
.cb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cb-result-banner {
  flex: 1;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  padding: 6px;
  border-radius: 4px;
  min-height: 20px;
}
.cb-result-banner:empty { background: transparent; }
.cb-result-banner.banner-A { color: #e74c3c; background: rgba(231,76,60,0.15); border: 1px solid rgba(231,76,60,0.4); }
.cb-result-banner.banner-B { color: #3498db; background: rgba(52,152,219,0.15); border: 1px solid rgba(52,152,219,0.4); }
.cb-result-banner.banner-draw { color: #95a5a6; background: rgba(149,165,166,0.12); border: 1px solid rgba(149,165,166,0.4); }
.cb-foot .btn-confirm {
  padding: 8px 24px;
  background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
}
.cb-foot .btn-confirm:hover:not(:disabled) { background: linear-gradient(180deg, #3fdd81 0%, #2dbf5f 100%); }
.cb-foot .btn-confirm:disabled { background: #3a3f4b; color: #6a7280; cursor: not-allowed; }

/* ===== canvas 伤害飘字（DOM 浮层） ===== */
.canvas-float-text {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(0,0,0,0.95), 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 800;
  animation: cft-rise 1.1s ease-out forwards;
}
@keyframes cft-rise {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -70%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(1); }
}
