/* 新战场（battle2）：HUD 与测试菜单。遵循布局稳定性：动态内容容器定宽定高、单行省略、等宽数字 */

/* ---------- 测试菜单 ---------- */
#dmenu { position: fixed; inset: 0; z-index: 30; display: flex; overflow: auto; }
.dbg { position: fixed; inset: 0; background: linear-gradient(rgba(14, 10, 6, .55), rgba(14, 10, 6, .88)), url(assets/scenes/war.png) center / cover no-repeat; image-rendering: pixelated; }
.dwrap { position: relative; width: min(1440px, calc(100vw - 32px)); padding: 28px 0; margin: auto; }   /* auto 外边距居中：内容高于视口时从顶部起排，不被裁掉 */
.dhead { display: flex; align-items: baseline; gap: 18px; margin-bottom: 8px; }
.dlogo { font-family: var(--f-brush); font-size: 64px; color: var(--gold); letter-spacing: 10px; text-shadow: 0 4px 0 #3a2a10, 0 0 30px rgba(214,178,94,.3); }
.dsub { letter-spacing: 4px; opacity: .8; }
.dback { margin-left: auto; padding: 6px 18px; color: var(--tx); text-decoration: none; letter-spacing: 3px; border: 1px solid var(--br1); background: rgba(20, 14, 8, .6); }
.dback:hover { color: var(--gold); border-color: var(--gold); }
#dlast { height: 26px; line-height: 26px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dlast .good { color: var(--good); } #dlast .bad { color: var(--bad); }
#dcards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.dcard { display: flex; flex-direction: column; height: 360px; padding: 14px 16px; background: rgba(22, 17, 12, .92); border: 1px solid var(--gold-dim); box-shadow: 0 0 0 3px rgba(0,0,0,.5); }
.dcard:hover { border-color: var(--gold); }
.dtitle { font-family: var(--f-title); font-weight: 900; font-size: 30px; color: var(--gold); white-space: nowrap; }
.dtag { font-size: 12px; color: #fff3d0; background: #5e1a10; align-self: flex-start; padding: 1px 8px; margin: 2px 0 8px; white-space: nowrap; }
.ddesc { font-size: 13px; line-height: 1.6; height: 64px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; opacity: .85; }
.dside { margin-top: 8px; font-size: 13px; }
.dside b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dpor { display: flex; gap: 3px; margin-top: 4px; height: 36px; }
.dpor img { width: 36px; height: 36px; image-rendering: pixelated; border: 1px solid #000; }
.dgo { margin-top: auto; font-family: var(--f-title); font-weight: 900; font-size: 24px; letter-spacing: 6px; padding: 4px; cursor: pointer; color: #fff3d0; background: linear-gradient(#a33a26, #5e1a10); border: 2px solid var(--gold); }
.dgo:hover { filter: brightness(1.2); }
.dfoot { margin-top: 16px; font-size: 12px; opacity: .6; letter-spacing: 1px; }

/* ---------- 战场 ---------- */
/* 界面随窗口等比缩放（--uiz 由 hud.js 设定：以 1600×900 为基准，0.72~1.25） */
#b2 { position: fixed; inset: 0; z-index: 20; background: #000; }
#b2view canvas { display: block; }
#b2over { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#b2hud { position: absolute; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; zoom: var(--uiz, 1); }
#b2hud > * { pointer-events: auto; }
#b2toasts, #b2paused, #b2title, .b2skill, #b2duel { pointer-events: none !important; }

#b2top { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--gold-dim); box-shadow: 0 3px 12px rgba(0,0,0,.4); }
.b2side { display: flex; align-items: center; gap: 6px; width: 160px; white-space: nowrap; }
.b2side.a { justify-content: flex-end; } .b2side.e { justify-content: flex-start; }
.b2side .nm { font-family: var(--f-title); font-weight: 900; font-size: 20px; max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
.b2side .tr { width: 50px; font-size: 13px; color: #fff; text-align: center; }
.b2side .role { width: 18px; height: 18px; line-height: 16px; text-align: center; font-family: var(--f-title); font-weight: 900; font-size: 13px; border: 1px solid var(--gold-dim); color: var(--gold); }
.b2side.a .role { border-color: #58b8ff; color: #9fd6ff; } .b2side.e .role { border-color: #ff5a48; color: #ff9a8a; }
.b2mid { display: flex; flex-direction: column; align-items: center; gap: 3px; }
#b2bal { position: relative; width: 330px; height: 8px; border: 1px solid var(--gold-dim); }
#b2balP { display: block; height: 100%; width: 50%; transition: width .5s; }
/* 中线刻度：只在条的上下缘各露一个白色小刻口，不压在颜色条上（避免与势力色混淆） */
#b2bal .mid { position: absolute; left: calc(50% - 1px); top: -5px; bottom: -5px; width: 2px; pointer-events: none; }
#b2bal .mid::before, #b2bal .mid::after { content: ''; position: absolute; left: 0; width: 2px; height: 4px; background: #fff; box-shadow: 0 0 2px #000; }
#b2bal .mid::before { top: 0; } #b2bal .mid::after { bottom: 0; }
.b2clock { display: flex; gap: 5px; font-size: 12px; white-space: nowrap; width: 330px; justify-content: center; }
#b2day { color: var(--gold); font-weight: 700; width: 50px; text-align: right; }
/* 天气与风向：定宽，箭头按镜头投影指向风的去向，无风时隐去但保留占位 */
#b2wx { display: inline-flex; align-items: center; gap: 2px; width: 42px; color: var(--gold); }
#b2wx .warr { display: inline-block; width: 12px; text-align: center; font-style: normal; font-weight: 700; color: #cfe8ff; }
#b2wx .warr.off { visibility: hidden; }
#b2left { color: #fff; width: 40px; }
.b2clock .lefl, .b2clock .sep { opacity: .6; }
#b2food { width: 118px; } #b2food b { color: #fff; } #b2food small { opacity: .7; }
b.starve { color: #ff5a4a !important; }
#b2title { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); font-size: 11px; opacity: .7; text-shadow: 0 1px 3px #000; white-space: nowrap; }
#b2pts { position: absolute; top: 68px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.b2pt { position: relative; width: 54px; height: 19px; line-height: 17px; text-align: center; font-size: 11px; background: rgba(20,15,10,.85); border: 2px solid #888; overflow: hidden; cursor: pointer; white-space: nowrap; }
.b2pt.vp { width: 70px; font-family: var(--f-title); font-weight: 900; font-size: 14px; }
.b2pt .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; opacity: .75; transition: width .3s; }
.b2pt span { position: relative; text-shadow: 0 1px 2px #000; }
.b2pt.contest { animation: b2blink .6s infinite alternate; }
.b2pt.taken span { color: #fff27a; }
@keyframes b2blink { from { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); } to { box-shadow: inset 0 0 8px 2px rgba(255,255,255,.35); } }

#b2time { position: absolute; bottom: 196px; right: 8px; display: flex; gap: 3px; padding: 3px 4px; background: var(--panel); border: 1px solid var(--gold-dim); }
#b2time button { min-width: 28px; height: 22px; padding: 0 4px; font-size: 12px; background: linear-gradient(#3a2e20, #241b12); color: var(--paper); border: 1px solid var(--gold-dim); cursor: pointer; white-space: nowrap; }
#b2time button:hover { border-color: var(--gold); filter: brightness(1.2); }
#b2time button.on { background: var(--gold); color: var(--ink); }
#b2qBtn { width: 56px; }
#b2paused { position: absolute; top: 92px; left: 50%; transform: translateX(-50%); font-family: var(--f-title); font-weight: 900; font-size: 22px; color: var(--gold); text-shadow: 0 2px 6px #000; letter-spacing: 6px; }

/* 兵牌 */
#b2cards { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 5px; background: var(--panel); border: 1px solid var(--gold-dim); max-width: calc(100% - 574px); }   /* 兵牌过多时自动换行（hud.layoutCards 均衡各行张数） */
.b2card { position: relative; flex: none; width: 78px; height: 118px; background: linear-gradient(#3a3024, #1a140e); border: 2px solid #3a3226; border-top-color: #3f7fb0; cursor: pointer; overflow: hidden; }
.b2card:hover { border-color: var(--gold-dim); }
.b2card.sel { border-color: #fff27a; box-shadow: 0 0 8px rgba(255,242,122,.55); }
.b2card.fight { animation: b2fight .6s infinite alternate; }
.b2card.rout { background: linear-gradient(#6a2a22, #301410); }
.b2card.down .por { filter: grayscale(1); }
.b2card.dead { filter: grayscale(1) brightness(.45); cursor: default; }
.b2card .key { position: absolute; top: 1px; left: 3px; font-size: 11px; color: rgba(255,255,255,.6); }
.b2card .por { display: block; width: 50px; height: 50px; margin: 6px auto 0; border: 1px solid #000; image-rendering: pixelated; }
.b2card .por.glyph { font-family: var(--f-title); font-weight: 900; font-size: 32px; line-height: 48px; text-align: center; background: #3a2c1c; color: #e8c890; }
.b2card .tglyph { position: absolute; top: 38px; right: 5px; font-family: var(--f-title); font-weight: 900; font-size: 15px; background: rgba(0,0,0,.65); padding: 0 2px; color: #ffd75a; }
.b2card .cname { font-size: 14px; line-height: 18px; margin-top: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.b2card .cnt { font-size: 13px; line-height: 16px; text-align: center; color: #fff; font-weight: 700; height: 16px; }
.b2card .bar { position: absolute; left: 5px; right: 5px; height: 5px; background: rgba(0,0,0,.6); }
.b2card .bar.hp { bottom: 12px; } .b2card .bar.mor { bottom: 2px; }
.b2card .bar i { display: block; height: 100%; }
.b2card .bar.hp i { background: #e8e0c8; }
.b2card .bar.ammo { bottom: 8px; height: 3px; }   /* 弓兵：兵力条下的箭矢余量 */
.b2card .bar.ammo i { background: #d0924a; }
.b2card .bar.ammo.out { background: rgba(150,40,28,.75); }
.b2card .st { position: absolute; top: 1px; right: 4px; font-family: var(--f-title); font-weight: 900; font-size: 15px; color: #ffd75a; text-shadow: 0 1px 2px #000; }
#b2cards.many .b2card { width: 72px; }
/* 部队很多时（>11）改用紧凑兵牌 */
#b2cards.dense .b2card { width: 62px; height: 104px; }
#b2cards.dense .b2card .por { width: 42px; height: 42px; }
#b2cards.dense .b2card .tglyph { top: 32px; font-size: 13px; }
#b2cards.dense .b2card .cname { font-size: 12px; }
#b2cards.dense .b2card.siege { width: 50px !important; }
#b2cards.dense .b2card.siege .por.glyph { width: 38px; height: 38px; font-size: 24px; line-height: 36px; }
.b2card.siege { width: 62px !important; }
/* 部队更多时（>20，援军到齐）再缩一档：只留头像、名字与两条状态条 */
#b2cards.tiny .b2card { width: 50px; height: 80px; }
#b2cards.tiny .b2card .por { width: 34px; height: 34px; margin-top: 4px; }
#b2cards.tiny .b2card .tglyph { top: 26px; right: 2px; font-size: 11px; }
#b2cards.tiny .b2card .cname { font-size: 11px; line-height: 14px; }
#b2cards.tiny .b2card .cnt { font-size: 11px; line-height: 13px; height: 13px; }
#b2cards.tiny .b2card .st { font-size: 12px; }
#b2cards.tiny .b2card.siege { width: 42px !important; }
#b2cards.tiny .b2card.siege .por.glyph { width: 30px; height: 30px; font-size: 20px; line-height: 28px; }
.b2card.siege .por.glyph { width: 44px; height: 44px; font-size: 28px; line-height: 42px; margin-top: 9px; }
.b2card.siege .tglyph { display: none; }
@keyframes b2fight { from { box-shadow: inset 0 0 0 0 rgba(200,40,30,0); } to { box-shadow: inset 0 0 12px 0 rgba(220,50,30,.7); } }

/* 城门 / 箭楼 / 器械耐久条（悬于建筑上方，随界面缩放） */
.b2hpb { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; pointer-events: none; }
.b2hpb .lb { position: absolute; left: -45px; top: -24px; width: 90px; text-align: center; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; }
.b2hpb .bb { position: absolute; left: -45px; top: -8px; width: 90px; height: 7px; background: rgba(0,0,0,.7); border: 1px solid #ff5a48; }
.b2hpb.own .bb { border-color: #58b8ff; }
.b2hpb.gate .lb { left: -60px; width: 120px; font-family: var(--f-title); font-weight: 900; font-size: 17px; top: -30px; }
.b2hpb.gate .bb { left: -60px; width: 120px; height: 10px; top: -11px; }
.b2hpb.tower .bb, .b2hpb.engine .bb { left: -30px; width: 60px; height: 5px; }
.b2hpb.tower .lb, .b2hpb.engine .lb { left: -30px; width: 60px; font-size: 11px; top: -20px; }
.b2hpb .bb i { display: block; height: 100%; transition: width .25s; }
.b2hpb.hit .bb { box-shadow: 0 0 6px rgba(255,210,120,.8); }

/* 部队面板：定宽定高。头部（像 · 名 · 兵种阵形状态地形 · 统武智训）＋ 统一 26px 左标签列的五行（兵力 / 士气 / 状态 / 阵形 / 战技），
   各行右缘共线；角饰缩为 14px，内边距 13px 让出，底部提示另起一栏不被角饰压住 */
#b2info { position: absolute; left: 8px; bottom: 6px; width: 276px; height: 290px; padding: 12px 13px; font-size: 12px; overflow: hidden; }
#b2info.foe { box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(255,90,72,.55), 0 14px 36px rgba(0,0,0,.6); }
#b2info .foetag { display: inline-block; width: 18px; height: 18px; line-height: 17px; margin-right: 5px; text-align: center; font-family: var(--f-title); font-weight: 900; font-size: 14px; color: #fff; background: #b8322a; border: 1px solid #ff8a7a; vertical-align: 1px; }
#b2info .fbtn.ro, #b2info .abil.ro { cursor: default; pointer-events: none; }
#b2info .fbtn.ro:not(.on) { opacity: .45; }
#b2info .ihead { display: flex; gap: 9px; align-items: center; height: 48px; }
#b2info .iport { width: 46px; height: 46px; image-rendering: pixelated; border: 1px solid var(--gold); box-shadow: 0 0 0 1px #000; flex: none; }
#b2info .iglyph { width: 46px; height: 46px; font-family: var(--f-title); font-weight: 900; font-size: 28px; line-height: 44px; text-align: center; background: #3a3024; border: 1px solid var(--gold); flex: none; }
#b2info .ititle { flex: 1; min-width: 0; }
#b2info .inoduel { flex: none; align-self: flex-start; width: 40px; height: 20px; padding: 0; font-size: 11px; line-height: 18px; cursor: pointer; background: #241b12; color: var(--paper); border: 1px solid var(--gold-dim); white-space: nowrap; }
#b2info .inoduel:hover { border-color: var(--gold); }
#b2info .inoduel.on { background: var(--gold); color: var(--ink); }
#b2info .inoduel.ro { cursor: default; opacity: .45; }
#b2info .iname { height: 19px; line-height: 19px; font-size: 15px; font-weight: 700; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b2info .iname small { font-size: 11px; color: var(--paper); font-weight: 500; }
#b2info .isub { height: 14px; line-height: 14px; font-size: 11px; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b2info .istat { display: flex; gap: 9px; height: 15px; line-height: 15px; font-size: 11px; color: var(--tx2); white-space: nowrap; overflow: hidden; }
#b2info .istat b { margin-left: 2px; color: var(--num); font-weight: 700; }
#b2info .idiv { height: 1px; margin: 7px 0 6px; background: linear-gradient(90deg, transparent, var(--br1) 12%, var(--br1) 88%, transparent); }
#b2info .lbl { font-size: 10px; color: var(--gold); opacity: .6; white-space: nowrap; }
#b2info .ibar { display: grid; grid-template-columns: 26px 1fr 66px; gap: 6px; align-items: center; height: 16px; }
#b2info .ibar + .ibar { margin-top: 2px; }
#b2info .ibar .mt { display: block; height: 7px; background: rgba(0,0,0,.55); border: 1px solid rgba(230,204,140,.2); }
#b2info .ibar .mt i { display: block; height: 100%; }
#b2info .ibar .mt i.hp { background: linear-gradient(180deg, var(--br3), var(--br2)); }
#b2info .ibar b { text-align: right; font-size: 11px; color: var(--tx); white-space: nowrap; }
#b2info .ibar b small { font-size: 10px; font-weight: 500; color: var(--tx2); }
#b2info .ibar .mt i.ammo { background: linear-gradient(180deg, #e0a860, #a86c30); }
#b2info .ibar.out b { color: #ff7a64; }
#b2info .ibar.na { opacity: .35; }
#b2info .ibuffs { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: center; height: 16px; margin-top: 2px; white-space: nowrap; overflow: hidden; }
#b2info .ibuffs .chips { overflow: hidden; }
.buff, .debuff { font-size: 10px; padding: 0 4px; margin-right: 3px; }
.buff { background: #6a5a1a; color: #ffe27a; } .debuff { background: #6a1a1a; color: #ff9a8a; }
#b2info .none { font-size: 11px; color: var(--txd); }
/* 七阵全列（未习得置灰虚框）：行宽恒定、与战技右缘对齐，同一阵形永远在同一格 */
#b2info .forms { display: grid; grid-template-columns: 26px repeat(7, 1fr); gap: 2px; margin-top: 6px; height: 21px; align-items: center; }
#b2info .forms .lbl { margin-right: 4px; }
#b2info .fbtn { min-width: 0; height: 19px; padding: 0; font-size: 11px; line-height: 17px; cursor: pointer; background: #241b12; color: var(--paper); border: 1px solid var(--gold-dim); white-space: nowrap; }
#b2info .fbtn.on { background: var(--gold); color: var(--ink); }
#b2info .fbtn:hover { border-color: var(--gold); }
#b2info .forms .fbtn.na { cursor: default; background: transparent; color: var(--paper); opacity: .28; border-style: dashed; }
#b2info .fbtn.na:hover { border-color: var(--gold-dim); }
#b2info .askills { display: grid; grid-template-columns: 26px 1fr; gap: 6px; margin-top: 4px; height: 72px; }
#b2info .askills .lbl { height: 22px; line-height: 22px; }
#b2info .abil-row { min-width: 0; margin-top: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; height: 72px; align-content: start; }   /* 最多 5 项（3 战法 + 滚木 + 挑战）= 3 行 */
#b2info .abil-row .none { line-height: 22px; }
#b2info .abil { position: relative; display: flex; align-items: center; gap: 3px; height: 22px; padding: 0 6px; cursor: pointer; background: linear-gradient(#7a5a1e, #3e2c0e); color: #fff3cc; border: 1px solid var(--gold); font-size: 11px; overflow: hidden; }
#b2info .abil .an { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; }
#b2info .abil .ak { margin-left: auto; font-size: 10px; opacity: .85; position: relative; z-index: 1; width: 24px; text-align: right; }
#b2info .abil i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.55); }
#b2info .abil:hover { filter: brightness(1.2); }
#b2info .abil.cool { filter: grayscale(.8) brightness(.75); cursor: default; }
#b2info .iorder { margin-top: 5px; padding: 4px 8px 0; height: 20px; line-height: 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--tx2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#b2mm { position: absolute; right: 8px; bottom: 6px; padding: 3px; background: var(--panel); border: 1px solid var(--gold-dim); }
#b2minimap { display: block; width: 176px; height: 176px; cursor: pointer; }

/* 旗标：我军青蓝框 + ▼，敌军赤红框 + ◆（与脚下阵营环一致） */
#b2banners { position: absolute; inset: 0; }
.b2ban { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: auto; cursor: pointer; transform-origin: 0 0; }
.b2ban .pole { position: absolute; left: -1px; top: -30px; width: 2px; height: 30px; background: #3a2a18; }
.b2ban .flag { position: absolute; left: 1px; top: -30px; width: 20px; height: 20px; font-family: var(--f-title); font-weight: 900; font-size: 14px; line-height: 17px; text-align: center; color: #fff;
  border: 2px solid #ff5a48; text-shadow: 0 1px 1px #000; transform-origin: left center; }
.b2ban.own .flag { border-color: #58b8ff; }
.b2ban .tm { position: absolute; left: -4px; top: -3px; width: 7px; height: 7px; background: #ff5a48; transform: rotate(45deg); border: 1px solid #000; }
.b2ban.own .tm { left: -5px; top: -4px; width: 0; height: 0; background: none; border: 5px solid transparent; border-top: 7px solid #58b8ff; transform: none; }
.b2ban .bhp, .b2ban .bmo { position: absolute; left: 1px; width: 20px; height: 3px; background: rgba(0,0,0,.65); }
.b2ban .bhp { top: -10px; } .b2ban .bmo { top: -7px; }
.b2ban .bhp i, .b2ban .bmo i { display: block; height: 100%; }
.b2ban .bhp i { background: #e8e0c8; }
.b2ban.sel .flag { outline: 2px solid #fff27a; }
.b2ban.hov .flag { filter: brightness(1.35); }
.b2ban.fight .flag { animation: b2wave .35s infinite alternate; }
.b2ban.down .flag { filter: grayscale(.7); }
.b2ban.rout .flag { background: #eee !important; color: #a33; }
@keyframes b2wave { from { transform: skewY(-6deg); } to { transform: skewY(6deg); } }

#b2toasts { position: absolute; top: 84px; left: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 380px; }
.b2toast { padding: 2px 30px 2px 8px; background: linear-gradient(90deg, rgba(20,15,10,.85) 70%, transparent); font-size: 12px; transition: opacity .8s; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.b2toast.good { color: #9bf09b; } .b2toast.bad { color: #ff8a7a; } .b2toast.ability { color: #ffe27a; }
.b2toast.enemy { color: #9ab8ff; } .b2toast.order { color: #e8e0c8; } .b2toast.out { opacity: 0; }
#b2sel { position: absolute; display: none; border: 1px solid #fff27a; background: rgba(255,242,122,.12); }
#b2help { position: absolute; bottom: 228px; right: 8px; width: 400px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--gold-dim); font-size: 12px; line-height: 1.8; }
#b2help h3 { margin: 0 0 4px; color: var(--gold); font-size: 13px; }
#b2help b { color: #fff; }

/* 战技立绘卡片：左上（我军）/ 右上（敌军）角落滑入，不遮挡战场中央 */
.b2skill { position: absolute; top: 6px; display: flex; gap: 8px; width: 290px; height: 70px; padding: 6px 10px 6px 6px; opacity: 0;
  background: linear-gradient(90deg, rgba(20,14,9,.95), rgba(20,14,9,.85) 70%, rgba(20,14,9,0)); border-left: 3px solid var(--kc, #ffd75a);
  transition: transform .42s cubic-bezier(.2,.8,.2,1), opacity .42s ease; }
.b2skill.own { left: 6px; transform: translateX(-30px); }
.b2skill.foe { right: 6px; transform: translateX(30px); flex-direction: row-reverse; text-align: right; padding: 6px 6px 6px 10px; border-left: 0; border-right: 3px solid var(--kc, #ffd75a);
  background: linear-gradient(270deg, rgba(20,14,9,.95), rgba(20,14,9,.85) 70%, rgba(20,14,9,0)); }
.b2skill.show { opacity: 1; transform: none; }
.b2skill .por { width: 58px; height: 58px; image-rendering: pixelated; border: 2px solid var(--fc, #888); box-shadow: 0 0 10px var(--kc); flex: none; background: #1a130c; }
.b2skill.own .por { border-color: #58b8ff; } .b2skill.foe .por { border-color: #ff5a48; }
.b2skill .txt { min-width: 0; flex: 1; }
.b2skill .row1 { display: flex; align-items: baseline; gap: 8px; height: 28px; white-space: nowrap; }
.b2skill.foe .row1 { flex-direction: row-reverse; }
.b2skill .who { font-size: 12px; color: #fff; }
.b2skill .sk { font-family: var(--f-brush); font-size: 24px; color: var(--kc, #ffd75a); text-shadow: 0 0 10px rgba(0,0,0,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b2skill .ds { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 16px; }
.b2skill .ln { font-size: 12px; color: #f4ead0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 18px; }

/* 单挑：两将立绘对峙，顶部居中（标题之下），不遮挡战场中央；尺寸固定、文字单行，逐合只换内容。受击只在立绘上划一道刀痕，不震不闪 */
#b2duel { position: absolute; top: 70px; left: 50%; width: 480px; height: 118px; margin-left: -240px; display: flex; opacity: 0; transform: translateY(-8px);
  background: linear-gradient(180deg, rgba(20,14,9,.94), rgba(20,14,9,.86)); border-top: 2px solid rgba(255,255,255,.7); border-bottom: 1px solid rgba(216,176,96,.45);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2,.8,.2,1); }
#b2duel.show { opacity: 1; transform: none; }
#b2duel .dd { width: 176px; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 8px; }
#b2duel .top { display: flex; gap: 8px; height: 76px; }
#b2duel .r .top { flex-direction: row-reverse; text-align: right; }
#b2duel .pw { position: relative; width: 72px; height: 72px; flex: none; overflow: hidden; border: 2px solid #58b8ff; background: #1a130c; }
#b2duel .r .pw { border-color: #ff5a48; }
#b2duel .pw img { display: block; width: 100%; height: 100%; image-rendering: pixelated; transition: filter .6s ease; }
#b2duel .pw::after { content: ''; position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(135deg, transparent 45%, rgba(255,236,210,.85) 49%, rgba(255,236,210,.85) 51%, transparent 55%); }
#b2duel .dd.hit .pw::after { animation: b2slash .4s ease-out; }
@keyframes b2slash { 0% { opacity: 0; clip-path: inset(0 100% 100% 0); } 45% { opacity: 1; clip-path: inset(0); } 100% { opacity: 0; clip-path: inset(0); } }
#b2duel .dd.down img { filter: grayscale(1) brightness(.55); }
#b2duel .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
#b2duel .nm { height: 20px; font-size: 15px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b2duel .hpb { height: 6px; background: rgba(255,255,255,.12); display: flex; }
#b2duel .r .hpb { justify-content: flex-end; }
#b2duel .hpb i { display: block; height: 100%; width: 100%; background: #58b8ff; transition: width .3s ease; }
#b2duel .r .hpb i { background: #ff5a48; }
#b2duel .res { height: 30px; line-height: 30px; font-family: var(--f-brush); font-size: 24px; color: #ffd75a; white-space: nowrap; opacity: 0; transition: opacity .35s ease; }
#b2duel .res.on { opacity: 1; }
#b2duel .dd.down .res { color: #b8aa90; }
#b2duel .say { height: 18px; font-size: 12px; color: #f4ead0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .3s ease; }
#b2duel .r .say { text-align: right; }
#b2duel .say.on { opacity: 1; }
#b2duel .say.late { transition-delay: .5s; }
#b2duel .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#b2duel .t { height: 40px; line-height: 40px; font-family: var(--f-brush); font-size: 32px; color: #fff; text-shadow: 0 0 10px rgba(0,0,0,.8); }
#b2duel .rd { height: 16px; font-size: 12px; color: #d8b060; }
#b2duel .act { height: 18px; width: 100%; font-size: 12px; color: #f4ead0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 开战 / 战报 */
.b2overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(0,0,0,.2), rgba(0,0,0,.7)); z-index: 10; }
#b2prep { background: none; align-items: flex-start; padding-top: 130px; pointer-events: none; }
#b2prep .b2panel { pointer-events: auto; }
/* 我军被挑战：应战 / 拒绝 / 本场免战 */
#b2duelAsk .dq { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0 4px; }
#b2duelAsk .dqo { width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#b2duelAsk .dqo img { width: 72px; height: 72px; image-rendering: pixelated; border: 2px solid #58b8ff; background: #1a130c; }
#b2duelAsk .dqo.foe img { border-color: #ff5a48; }
#b2duelAsk .nm { width: 100%; height: 22px; line-height: 22px; font-size: 17px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b2duelAsk .wr { height: 16px; line-height: 16px; font-size: 12px; color: var(--tx2); }
#b2duelAsk .vs { font-family: var(--f-brush); font-size: 30px; color: #ffd75a; }
#b2duelAsk .pgoal { height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b2duelAsk .odds { height: 20px; font-size: 13px; color: var(--tx2); }
#b2duelAsk .odds b { color: var(--num); }
#b2duelAsk .bigbtn { font-size: 22px; padding: 5px 22px; }
.b2panel { width: min(780px, calc(100vw - 32px)); max-height: 90vh; overflow-y: auto; padding: 22px 30px; text-align: center; background: rgba(20,15,10,.94);
  border: 1px solid var(--gold); box-shadow: 0 0 0 4px rgba(0,0,0,.6), 0 0 0 5px var(--gold-dim), 0 20px 60px rgba(0,0,0,.6); }
.b2panel.small { width: min(560px, calc(100vw - 32px)); }
.b2btns { display: flex; justify-content: center; gap: 16px; }
.bigbtn.alt { background: linear-gradient(#4a3a24, #241a0e); border-color: var(--gold-dim); }
.ptitle2 { font-size: 15px; color: #fff; margin: 4px 0; }
.pgoal { font-size: 14px; line-height: 1.7; margin: 6px 0; text-wrap: balance; }
.pmeta { font-size: 12px; opacity: .7; }
#b2resTitle { font-family: var(--f-brush); font-size: 72px; letter-spacing: 10px; }
#b2resTitle.win { color: var(--gold); } #b2resTitle.lose { color: #c8412e; }
#b2resSub { margin-bottom: 12px; color: var(--tx2); font-size: var(--s2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 战报：双方左右两栏，定宽定行高，数字等宽右对齐；队多时栏内滚动，面板不被撑高 */
#b2result .b2panel { width: min(1060px, calc(100vw - 32px)); }
.br-rcols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; }
.br-rcol { min-width: 0; padding: 10px 12px 8px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-top: 3px solid var(--fc); }
.br-rhead { display: flex; align-items: baseline; gap: 8px; height: 26px; white-space: nowrap; }
.br-rhead b { font-size: var(--s3); max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.br-rrole { font-size: var(--s1); color: var(--tx2); }
.br-rwin { margin-left: auto; padding: 0 8px; font-size: var(--s1); line-height: 18px; color: #fbecc8; background: var(--ver1); border: 1px solid var(--br2); }
.br-rsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; font-size: var(--s1); color: var(--tx2); }
.br-rsum span { display: flex; align-items: baseline; gap: 6px; }
.br-rsum b { font-size: var(--s3); color: var(--num); font-variant-numeric: tabular-nums; }
.br-rsum b.bad { color: var(--bad); }
.br-rbar { height: 6px; margin: 6px 0 8px; background: rgba(0, 0, 0, .5); border: 1px solid var(--br0); }
.br-rbar i { display: block; height: 100%; background: var(--fc); }
.br-rr { display: grid; grid-template-columns: 32px minmax(0, 1fr) 52px 104px 40px 50px; align-items: center; gap: 8px; height: 38px; padding: 0 4px; border-bottom: 1px solid var(--line); font-size: var(--s2); white-space: nowrap; }
.br-rr.br-rh { height: 22px; font-size: var(--s1); color: var(--tx2); border-bottom-color: var(--br1); }
.br-rlist { max-height: calc(90vh - 430px); min-height: 76px; overflow-y: auto; }
.br-rp { width: 32px; height: 32px; image-rendering: pixelated; border: 1px solid #000; }
.br-rn { overflow: hidden; text-overflow: ellipsis; color: var(--tx); }
.br-rt { color: var(--tx2); font-size: var(--s1); }
.br-rtr { display: flex; flex-direction: column; gap: 3px; }
.br-rr.br-rh .br-rtr { display: block; text-align: right; }
.br-rnum { text-align: right; font-variant-numeric: tabular-nums; }
.br-rnum b { color: var(--tx); } .br-rnum small { color: var(--tx2); font-size: var(--s1); }
.br-rtr i { display: block; height: 3px; background: rgba(0, 0, 0, .5); }
.br-rtr em { display: block; height: 100%; background: var(--br2); }
.br-rs { font-size: var(--s1); text-align: center; }
.br-rk { text-align: right; font-variant-numeric: tabular-nums; color: var(--num); }
.br-rr.br-rh .br-rk, .br-rr.br-rh .br-rs { color: var(--tx2); }
.br-rr.down .br-rs, .br-rr.lost .br-rs { color: var(--bad); }
.br-rr.rout .br-rs { color: var(--tx2); }
.br-rr.lost .br-rn, .br-rr.lost .br-rp { opacity: .55; }
.br-rr.late { opacity: .5; }
.br-rsiege { height: 22px; line-height: 22px; margin-top: 4px; font-size: var(--s1); color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-rfoot { margin: 10px 0 12px; font-size: var(--s1); color: var(--tx2); }
@media (max-width: 900px) { .br-rcols { grid-template-columns: 1fr; } }

@media (max-width: 1480px) {
  #dcards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  #dcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 界面 v2：弹出面板与部队信息窗沿用战略界面的窗口外观（青铜斜面边 + 回纹角饰）；二者自身滚动 / 裁切，角饰收进边框内 */
.b2panel, #b2info { position: relative; background: var(--pat), linear-gradient(180deg, var(--lq2), var(--lq1) 70%);
  border: 3px solid transparent; border-image: linear-gradient(180deg, var(--br3), var(--br1) 40%, var(--br0)) 1; box-shadow: 0 0 0 1px #000, 0 14px 36px rgba(0, 0, 0, .6); }
#b2info { position: absolute; }
.b2panel::before, #b2info::before { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: var(--cn-tl) left top / 20px no-repeat, var(--cn-tr) right top / 20px no-repeat, var(--cn-bl) left bottom / 20px no-repeat, var(--cn-br) right bottom / 20px no-repeat; }
#b2info::before { background-size: 14px; }
.bigbtn { color: #fbecc8; background: linear-gradient(180deg, var(--ver2), var(--ver1) 60%, var(--ver0)); border: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255, 210, 160, .3), inset 0 0 0 1px #c8784a; }
.bigbtn.alt { color: var(--tx); background: linear-gradient(180deg, var(--lq3), var(--lq2)); box-shadow: inset 0 1px 0 rgba(255, 230, 170, .16), inset 0 0 0 1px var(--br1); }

/* 英文：卡片标题较长，按列宽缩字、单行省略，不撑开网格 */
:root[data-lang=en] .dtitle { font-size: 22px; overflow: hidden; text-overflow: ellipsis; }
:root[data-lang=en] .b2side { width: 190px; }
:root[data-lang=en] .b2side .nm { max-width: 116px; font-size: 16px; }
:root[data-lang=en] .b2clock { width: 370px; }
:root[data-lang=en] #b2day { width: auto; }
:root[data-lang=en] #b2wx { width: auto; }
:root[data-lang=en] #b2food { width: auto; }
:root[data-lang=en] .b2pt { width: auto; min-width: 54px; padding: 0 4px; }
:root[data-lang=en] .b2pt.vp { font-size: 12px; }
:root[data-lang=en] .b2card .tglyph { font-size: 11px; }
:root[data-lang=en] #b2info .fbtn { font-size: 10px; }
:root[data-lang=en] #b2info .inoduel { width: 50px; font-size: 10px; }
:root[data-lang=en] .b2side .role { width: auto; min-width: 18px; padding: 0 3px; font-size: 11px; }
