/* 《三分天下》水墨风格 UI */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  background: #efe7d3;
  color: #2b2620;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 15px;
}

header {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 10px 20px;
  background: #2b2620;
  color: #f0e9d8;
  border-bottom: 3px solid #a3281f;
}
header h1 { font-size: 22px; letter-spacing: 6px; font-weight: 600; }
header .scenario { font-size: 14px; color: #cbbfa3; }
header .turn { font-size: 14px; color: #e8b04b; }

#layout { flex: 1; display: flex; min-height: 0; }

#mapWrap { flex: 1; position: relative; min-width: 0; }
#map { width: 100%; height: 100%; display: block; cursor: grab; }

#statusbar {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 12px;
  color: rgba(43, 38, 32, 0.65);
  background: rgba(240, 233, 216, 0.75);
  padding: 3px 10px;
  border-radius: 3px;
  pointer-events: none;
}

aside {
  width: 320px;
  border-left: 1px solid #cbbfa3;
  background: #f5efdf;
  overflow-y: auto;
  padding: 16px 18px;
}

aside h2 {
  font-size: 20px;
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 4px solid #a3281f;
}
aside h2 small { font-size: 13px; color: #7a6f5c; font-weight: normal; }

.intro { line-height: 1.8; color: #4a4336; margin-bottom: 14px; text-indent: 2em; }
.owner { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.note { font-size: 13px; color: #7a6f5c; font-style: italic; margin-bottom: 10px; }

.hint { border-top: 1px dashed #cbbfa3; padding-top: 12px; font-size: 13px; color: #5c5344; line-height: 2; }

table.stats {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
  font-size: 14px;
}
table.stats td { padding: 5px 4px; border-bottom: 1px solid #e2d8bf; }
table.stats td:first-child { color: #7a6f5c; width: 40%; }
table.stats td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.sub {
  font-size: 13px;
  color: #7a6f5c;
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #cbbfa3;
}

.neighbors { display: flex; flex-wrap: wrap; gap: 6px; }
span.nb {
  font-size: 13px;
  padding: 2px 8px;
  border: 1px solid #999;
  border-radius: 3px;
  background: #fffdf6;
}

ul.factions { list-style: none; }
ul.factions li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 14px;
  border-bottom: 1px solid #eee4cb;
}
ul.factions i {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid #3a332a;
  flex: none;
}
.fname { font-weight: 600; min-width: 56px; }
.fleader { color: #7a6f5c; font-size: 13px; }
.fn { margin-left: auto; color: #7a6f5c; font-size: 13px; font-variant-numeric: tabular-nums; }

#tooltip {
  position: fixed;
  display: none;
  pointer-events: none;
  background: rgba(43, 38, 32, 0.92);
  color: #f5efdf;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 4px;
  z-index: 10;
  white-space: nowrap;
}

/* ---------- 顶栏扩展 ---------- */
header .date { font-size: 14px; color: #cbbfa3; }
header .who { font-size: 14px; }
header .res { font-size: 14px; color: #e8b04b; margin-left: 10px; }
header .res b { font-variant-numeric: tabular-nums; }
header .actions { margin-left: auto; display: flex; gap: 8px; }
.hbtn {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 14px;
  background: #4a4336;
  color: #f0e9d8;
  border: 1px solid #6b5f4a;
  border-radius: 3px;
  cursor: pointer;
}
.hbtn:hover { background: #5c5344; }
.hbtn.primary { background: #a3281f; border-color: #c14a3e; }
.hbtn.primary:hover { background: #b3261e; }

/* ---------- 政令 ---------- */
.slots { color: #a3281f; letter-spacing: 2px; }
.orders { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
button.order {
  font-family: inherit;
  display: grid;
  grid-template-columns: 26px 52px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fffdf6;
  border: 1px solid #cbbfa3;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}
button.order:hover:not(:disabled) { border-color: #a3281f; background: #fbf3e2; }
button.order:disabled { opacity: 0.45; cursor: not-allowed; }
button.order i {
  font-style: normal;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: #2b2620; color: #e8b04b;
  border-radius: 50%;
  font-size: 13px;
}
button.order b { font-size: 14px; }
button.order span { color: #5c5344; }
button.order em { font-style: normal; color: #a3281f; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 军情（行军进度） ---------- */
#armies { display: none; }
.army { border-left: 3px solid #a3281f; padding: 3px 0 4px 8px; margin-bottom: 6px; }
.ar-h { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.ar-h i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ar-bar { height: 6px; background: #e2d8bf; border-radius: 3px; overflow: hidden; margin: 3px 0; }
.ar-bar u { display: block; height: 100%; background: linear-gradient(90deg, #c14a3e, #e8b04b); }
.ar-bar.done u { background: #2e7d32; }
/* .hbtn.pulse 与 @keyframes pulse 已移至 css/theme.css（ui-pulse），此处旧定义删除 */
.odds { font-size: 12.5px; padding: 3px 0; }
.odds b.good { color: #2e7d32; }
.odds b.mid { color: #b8860b; }
.odds b.bad { color: #a3281f; }

/* ---------- 战果捷报 ---------- */
.report .rp-title { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.report.win .rp-title { color: #2e7d32; }
.report.lose .rp-title { color: #a3281f; }
.report .win-t { color: #2e7d32; font-weight: 600; }
.report .lose-t { color: #a3281f; font-weight: 600; }
.report .promo { background: #fdf4e6; border: 1px solid #e8b04b; border-radius: 4px; padding: 4px 6px; margin-top: 4px; }
.days { margin: 4px 0 6px; }
.days .dy { display: flex; align-items: center; gap: 5px; font-size: 11px; margin: 1px 0; }
.days .dy span { width: 20px; color: #7a6f5c; }
.days .dy u { display: inline-block; height: 7px; border-radius: 3px; text-decoration: none; }
.days .dy u.a { background: #4a6f8a; }   /* wave4：Material 蓝 #1565c0 归一到花青（与 badge-info 同源） */
.days .dy u.d { background: #a3281f; }
.days .dy em { font-style: normal; color: #5c5344; }
.ofc .merit { font-size: 11px; color: #8a6a2f; margin-top: 2px; }

/* ---------- 武将卡 ---------- */
.officers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.ofc {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: #fffdf6;
  border: 1px solid #e0d5b8;
  border-radius: 4px;
}
.ofc.is-gov { border-color: #a3281f; background: #fdf4e6; }
.ofc .pt {
  position: relative;
  width: 42px; height: 52px;
  border: 1px solid #cbbfa3;
  border-radius: 3px;
  background: linear-gradient(#efe6cf, #e2d7b8);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ofc .pt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ofc .pt span { font-size: 20px; color: #8a7a5c; }
.ofc .ofc-main b { font-size: 14px; }
.ofc .zi { color: #7a6f5c; font-size: 12px; margin-left: 4px; }
.ofc .tag {
  font-style: normal; font-size: 11px; margin-left: 4px;
  background: #a3281f; color: #fff; padding: 1px 5px; border-radius: 2px;
}
.ofc .five { font-size: 11px; color: #5c5344; margin-top: 2px; }
.ofc .five i { font-style: normal; margin-right: 6px; }
.ofc .loy { font-size: 11px; color: #7a6f5c; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.ofc .loy u {
  text-decoration: none; display: inline-block; height: 6px;
  background: linear-gradient(90deg, #c14a3e, #e8b04b);
  border-radius: 3px;
}
.ofc .ofc-act { display: flex; flex-direction: column; gap: 4px; }
.ofc .ofc-act button {
  font-family: inherit; font-size: 11px; padding: 3px 7px;
  background: #f0e9d8; border: 1px solid #cbbfa3; border-radius: 3px; cursor: pointer;
}
.ofc .ofc-act button:hover:not(:disabled) { background: #fbf3e2; border-color: #a3281f; }
.ofc .ofc-act button:disabled { opacity: 0.45; cursor: not-allowed; }
.hire { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.march { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.march select, .march input {
  font-family: inherit; font-size: 12.5px; padding: 3px 5px;
  background: #fffdf6; border: 1px solid #cbbfa3; border-radius: 3px;
}
.march select { max-width: 100%; }
.march input { width: 62px; }
.battle { border-left: 3px solid #a3281f; padding: 4px 0 4px 8px; margin-bottom: 8px; }
.bt-head { font-size: 13px; }
button.order.off { opacity: 0.5; }
.battle .bt-res { font-weight: 600; font-size: 13px; }
.battle .bt-res.win { color: #2e7d32; }
.battle .bt-res.lose { color: #a3281f; }
.dim { color: #a08c66; font-size: 12px; }

/* ---------- 日志 ---------- */
#logbox { margin-top: 18px; }
#log { max-height: 220px; overflow-y: auto; font-size: 12.5px; line-height: 1.7; }
#log p { border-bottom: 1px dashed #e2d8bf; padding: 3px 0; color: #4a4336; }
#log p span { color: #a08c66; margin-right: 6px; }
#log p.imp { color: #2b2620; font-weight: 600; }
ul.factions li.me { background: rgba(163, 40, 31, 0.07); }

/* ---------- 开局遮罩 ---------- */
#start-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 25, 18, 0.82);
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
}
.start-card {
  background: #f5efdf;
  border: 2px solid #a3281f;
  border-radius: 6px;
  padding: 26px 30px;
  width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  text-align: center;
}
.start-card h2 { font-size: 30px; letter-spacing: 10px; margin-bottom: 8px; }
.start-card .sc { font-size: 13px; color: #7a6f5c; margin-bottom: 6px; }
.start-card .intro { margin-bottom: 14px; }
#faction-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
button.pick {
  font-family: inherit;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: #fffdf6;
  border: 1px solid #cbbfa3;
  border-left: 4px solid var(--c, #999);
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  text-align: left;
}
button.pick:hover { background: #fbf3e2; border-color: #a3281f; }
button.pick i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #3a332a; flex: none; }
button.pick b { min-width: 52px; }
button.pick span { color: #7a6f5c; font-size: 13px; }
button.pick em { font-style: normal; margin-left: auto; color: #a08c66; font-size: 13px; }
button.pick.continue { grid-column: 1 / -1; justify-content: center; border-left: 4px solid #2e7d32; }
button.pick.danger { grid-column: 1 / -1; justify-content: center; border-left: 4px solid #a3281f; }
button.pick.danger b { color: #a3281f; }

/* ---------- 弹窗 ---------- */
#modal {
  position: fixed; inset: 0;
  background: rgba(30, 25, 18, 0.6);
  display: none;
  align-items: center; justify-content: center;
  z-index: 60;
}
.modal-card {
  background: #f5efdf;
  border: 2px solid #a3281f;
  border-radius: 6px;
  padding: 20px 24px;
  width: 460px;
  max-height: 80vh;
  overflow-y: auto;
}
/* 宽版弹窗（2026-09-29）：战斗等横向内容。旧版固定 460px 把 9 列格盘压到 ~46px/格 */
.modal-card.modal-wide {
  width: min(92vw, 940px);
  max-height: 88vh;
  padding: 20px 28px;
}
/* 宽版下格子跟着放大（46 → 64px）：兵力/士气/兵种章不再挤成一团 */
.modal-card.modal-wide .bgrid .bc { height: 64px; font-size: 12px; }
.modal-card h3 { margin-bottom: 12px; font-size: 18px; text-align: center; }
.modal-card .hbtn { display: block; margin: 14px auto 0; padding: 6px 28px; }
table.st { width: 100%; border-collapse: collapse; font-size: 13px; }
table.st th { color: #7a6f5c; font-weight: normal; border-bottom: 1px solid #cbbfa3; padding: 4px; }
table.st td { padding: 4px; border-bottom: 1px solid #eee4cb; text-align: center; font-variant-numeric: tabular-nums; }
table.st td:first-child { text-align: left; }
p.sum { margin-top: 10px; text-align: center; font-weight: 600; }
.relbar { display: inline-block; width: 70px; height: 6px; background: #e2d8bf; border-radius: 3px; overflow: hidden; }
.relbar u { display: inline-block; height: 100%; }
.bgrid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; margin: 6px 0; }
.bgrid .bc {
  height: 46px;
  /* wave4 格线虚实：内部 0.5px 淡线（外框 1.5px 墨线在 theme.css .bgrid）；
     底改半透明纸——battle.js 只注入 background-color，让战场纸底的四角晕染透出来 */
  border: 0.5px solid rgba(58, 50, 38, 0.16); border-radius: 3px;
  background: rgba(242, 235, 219, 0.62); display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer; font-size: 11px;
}
/* 水墨化战斗格（wave2 视觉）：地形晕染底由 battle.js 按格内联注入（山/林/道/丘 4~6% 淡彩），
   单位不再整格铺蓝/红——改「纸底 + 朱/墨描边 + 兵符圆章」，归属靠描边、兵种靠章色 */
.bgrid .bc.gate {
  background: rgba(163, 40, 31, 0.07);
  border-color: rgba(163, 40, 31, 0.65);
  box-shadow: inset 0 0 0 1px rgba(163, 40, 31, 0.18);
}
.bgrid .bc.gate span { color: #a3281f; }
.bgrid .bc.u-atk { border-color: #3a3226; box-shadow: inset 0 0 0 1px rgba(58, 50, 38, 0.35); }
.bgrid .bc.u-def { border-color: rgba(163, 40, 31, 0.75); box-shadow: inset 0 0 0 1px rgba(163, 40, 31, 0.22); }
.bgrid .bc.u-atk b { color: #3a3226; }
.bgrid .bc.u-def b { color: #8d201a; }
.bgrid .bc.sel { outline: 2px solid #b8860b; outline-offset: 1px; }
/* 可达 / 可攻击提示（2026-09-29）：选中部队后直接标出「能走哪、能打谁」，
   省掉玩家数格子；口径与 battle.js _reachSet 一致（移动力内空格 / 相邻敌军） */
.bgrid .bc.reach { box-shadow: inset 0 0 0 2px rgba(74, 124, 63, 0.55); }
.bgrid .bc.aim { box-shadow: inset 0 0 0 2px rgba(163, 40, 31, 0.75); cursor: crosshair; }
.bgrid .bc b { font-size: 14px; }   /* wave4：单位小卡字号 +2px（12→14 / 10→12） */
.bgrid .bc span { font-size: 12px; color: #5c5344; }
/* 兵符圆章：墨色兵符 + 朱/墨描边（攻墨、守朱），单字取兵种色（与 .ub 同一色板） */
.bgrid .useal {
  font-style: normal;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  font-size: 11px; line-height: 1; font-weight: 600;
  border-radius: 50%;
  background: rgba(252, 248, 239, 0.92);
  box-shadow: 0 0 0 1px rgba(252, 248, 239, 0.85);
}
.bgrid .useal.i-ink { border: 1.5px solid #3a3226; color: #3a3226; }
.bgrid .useal.i-zhu { border: 1.5px solid #a3281f; color: #a3281f; }
.bgrid .useal.rout { border-style: dashed; opacity: 0.55; }
.bgrid .useal.u-sword { color: #3a3226; }
.bgrid .useal.u-spear { color: #2e7d32; }
.bgrid .useal.u-halberd { color: #8f6a09; }
.bgrid .useal.u-cavalry { color: #a3281f; }
.bgrid .urow { display: flex; align-items: center; gap: 3px; max-width: 100%; }
.bgrid .ubar {
  display: block; width: 80%; height: 3px; margin-top: 1px;
  background: #ddd2b4; border-radius: 1px; overflow: hidden;
}
.blog { max-height: 110px; overflow-y: auto; font-size: 12px; margin-bottom: 6px; }
.blog p { margin: 0; border-bottom: 1px dashed #e2d8bf; padding: 2px 0; }
.bact { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }

button.dip {
  font-family: inherit; font-size: 11px; padding: 2px 6px; margin: 1px;
  background: #f0e9d8; border: 1px solid #cbbfa3; border-radius: 3px; cursor: pointer;
}
button.dip:hover:not(:disabled) { border-color: #a3281f; }
button.dip:disabled { opacity: 0.4; cursor: not-allowed; }
p.warn { margin-top: 8px; text-align: center; color: #a3281f; font-weight: 600; }
