/* v2：3D 沙盘布局 */
#view { position: absolute; inset: 0; background: #1a120a; }
#view canvas { display: block; touch-action: none; }
#ov { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
#fxl2 { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#hud { z-index: 3; }

/* 名字牌（魔兽风格） */
.np { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.np > span { position: absolute; left: 0; bottom: 0; transform: translateX(-50%); white-space: nowrap; font: bold 12px var(--ui-font);
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.np i { position: absolute; left: 0; bottom: -14px; transform: translateX(-50%); white-space: nowrap; font: normal 11px var(--ui-font); font-style: normal; color: #9fd0ff; text-shadow: 1px 1px 0 #000; }
.np b { position: absolute; left: 0; bottom: 18px; transform: translateX(-50%); white-space: nowrap; padding: 3px 8px; font: 12px var(--ui-font); color: #fff;
  background: rgba(0,0,0,.72); border: 1px solid #999; border-radius: 8px; }
.np em { position: absolute; left: 0; bottom: 16px; transform: translateX(-50%); font: bold 11px var(--ui-font); font-style: normal; color: #40ff40; text-shadow: 1px 1px 0 #000; }
.np.army { pointer-events: auto; cursor: pointer; }
.np.army { white-space: nowrap; transform-origin: 0 0; }
.np.army { font: bold 12px var(--ui-font); }
.np.army.ours { color: #9fc4ff; } .np.army.foe { color: #ff7a6a; }
.np.army { text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.np.army b { position: static; transform: none; padding: 0 5px; margin-left: 3px; background: rgba(0,0,0,.6); border-radius: 3px; border: 0; }
.np.army i { position: absolute; left: 0; top: 16px; bottom: auto; color: #ffd100; }

.wl { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap; }
.wl { font: bold 14px var(--title-font); color: #fff4c8; text-shadow: 0 0 3px #000, 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.wl > * { vertical-align: middle; }
.wl { transform-origin: 0 0; }
.wl::before { content: ""; }
.wl img { width: 16px; height: 16px; border-radius: 2px; margin-left: 3px; box-shadow: 0 0 0 1px #000; }
.wl small { display: block; font: bold 11px var(--ui-font); text-align: center; }
.wl.town { font-size: 20px; }
.wl.town small { color: #ffd100; }
.wl.base { color: #ffb8a8; }
.wl.small { font-size: 13px; pointer-events: none; }
.wl.board { pointer-events: none; }
.wl .qm, .qm { display: inline-block; margin-left: 4px; font: 900 30px/1 Georgia, serif; color: var(--gold); animation: bob 1.2s ease-in-out infinite;
  text-shadow: 0 0 2px #000, 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 0 0 12px rgba(255,200,0,.8); }
.wl.board .qm { font-size: 44px; }
/* 标签居中：用内部包裹偏移 */
.wl, .tbub { margin-left: 0; }
.wl { translate: -50% -100%; }
.tbub { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; translate: -50% -100%; }
.tbub .bub { display: flex; gap: 4px; align-items: center; padding: 4px 8px 4px 5px; border-radius: 16px; background: radial-gradient(circle at 50% 30%, #fff8dc, #e8d09a);
  box-shadow: 0 0 0 2px #7a5a1c, 0 3px 6px rgba(0,0,0,.6); animation: bob 1.4s ease-in-out infinite; }
.tbub .bub img { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 1px #000; }
.tbub .bub b { font: bold 13px var(--ui-font); color: #3a2006; margin-right: 3px; }
.tbub .prog { width: 60px; height: 8px; background: #000; border: 1px solid #000; box-shadow: 0 0 0 1px #c9a24c; }
.tbub .prog i { display: block; height: 100%; background: linear-gradient(180deg, #ffe46a, #c98a00); }

/* 顶部资源栏 */
#resbar { position: absolute; left: 320px; right: 8px; top: 6px; height: 40px; display: flex; gap: 6px; align-items: center; }
.rc { display: flex; align-items: center; gap: 5px; height: 36px; padding: 0 10px 0 3px; border-radius: 18px; background: linear-gradient(180deg, rgba(30,22,12,.92), rgba(8,6,3,.92));
  box-shadow: 0 0 0 1px #000, 0 0 0 2px #6d5424; min-width: 84px; cursor: pointer; }
.rc .icon { width: 30px; height: 30px; border-radius: 50%; }
.rc b { font: bold 15px var(--ui-font); color: #fff; text-shadow: 1px 1px 0 #000; line-height: 1; }
.rc small { display: block; font-size: 10px; line-height: 1.1; }
.rc small.p { color: #6f6; } .rc small.n { color: #f66; } .rc small.z { color: #a99a78; }
.rc.flash b { animation: rsflash .6s; }
.rc.full b { color: #ffb040; }

#player { top: 2px; }
#buffs { left: 12px; top: 128px; }
#crisis { position: absolute; left: 330px; top: 52px; display: none; padding: 6px 22px; border-radius: 4px; white-space: nowrap;
  background: linear-gradient(90deg, transparent, rgba(80,0,0,.85) 15%, rgba(80,0,0,.85) 85%, transparent); font: bold 16px var(--ui-font); color: #ffd0a0; text-shadow: 1px 1px 0 #000; cursor: pointer; }
#crisis b { color: #ff5a3a; } #crisis.calm { background: linear-gradient(90deg, transparent, rgba(0,0,0,.6) 15%, rgba(0,0,0,.6) 85%, transparent); color: #ddd; }

/* 右侧面板（可收起） */
#side { top: 52px; bottom: 84px; width: 290px; border-radius: 6px 0 0 6px; background: linear-gradient(90deg, rgba(10,7,4,.55), rgba(10,7,4,.88) 30%);
  box-shadow: -1px 0 0 #000, -3px 0 0 #6d5424, -4px 0 0 #000; transition: transform .25s; }
#side.hide { transform: translateX(300px); }
#sidetab { position: absolute; right: 290px; top: 70px; width: 26px; height: 56px; border-radius: 6px 0 0 6px; background: rgba(10,7,4,.9); box-shadow: 0 0 0 1px #6d5424;
  color: var(--gold); font: bold 14px/56px Arial; text-align: center; cursor: pointer; transition: right .25s; }
#sidetab.hide { right: 0; }
#bottombar { right: 0 !important; height: 80px; background: linear-gradient(180deg, rgba(43,34,24,.94) 0%, rgba(23,17,10,.96) 40%, rgba(10,7,4,.98) 100%); padding-top: 4px; }
#xpbar { display: none; }
#viewbtn { width: 118px; height: 64px; flex: none; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: linear-gradient(180deg, #3a5aa8, #1a2a60); box-shadow: 0 0 0 2px #000, 0 0 0 4px #d6b565, 0 0 14px rgba(80,140,255,.5); }
#viewbtn .icon { width: 44px; height: 44px; border-radius: 50%; background-size: cover; }
#viewbtn b { font: bold 18px var(--ui-font); color: #fff; text-shadow: 1px 1px 0 #000; }
#viewbtn:active { transform: scale(.96); }
#buildbtn { margin-left: auto; min-width: 120px; min-height: 48px; font-size: 17px; }
#collectbtn { min-width: 120px; min-height: 48px; font-size: 17px; }
#chat { bottom: 86px; width: 400px; height: 130px; }
#chat-tab { bottom: 217px; }
#chat.big + #chat-tab { bottom: 397px; }
#warns, #zonetext, #lvlup { right: 300px; }
#toast { transform: translateX(-50%); }
#bossframe { left: calc(50% - 150px) !important; transform: translateX(-50%); top: 56px; }
#siegehud.dragon { top: auto; bottom: 92px; }
#tut { z-index: 45; }

/* 守城 / 决战面板 */
#siegehud { position: absolute; left: calc(50% - 150px); top: 92px; transform: translateX(-50%); display: none; width: 480px; padding: 8px 12px 10px; border-radius: 6px;
  background: rgba(10,6,4,.88); box-shadow: 0 0 0 1px #000, 0 0 0 3px #8a1010, 0 0 0 4px #000, 0 6px 20px rgba(0,0,0,.7); }
#siegehud h4 { margin: 0 0 6px; text-align: center; font: bold 17px var(--ui-font); color: #ff6a4a; text-shadow: 1px 1px 0 #000; }
#siegehud .row { display: flex; gap: 10px; align-items: center; margin: 4px 0; font-size: 13px; color: #ddd; }
#siegehud .row > span { width: 66px; flex: none; text-align: right; }
#siegehud .row .bar { flex: 1; height: 14px; }
#siegehud .acts { display: flex; gap: 8px; margin-top: 8px; }
#siegehud .act { flex: 1; min-height: 46px; padding: 4px; border-radius: 5px; cursor: pointer; text-align: center; background: linear-gradient(180deg, #3a2c19, #1a1209);
  box-shadow: 0 0 0 1px #000, 0 0 0 2px #7a5a1c; position: relative; overflow: hidden; }
#siegehud .act b { display: block; font: bold 14px var(--ui-font); color: var(--gold); }
#siegehud .act small { display: block; font-size: 11px; color: #bbb; margin-top: 2px; }
#siegehud .act.dis { filter: grayscale(1) brightness(.6); }
#siegehud .act .cd { position: absolute; left: 0; bottom: 0; height: 3px; background: #ffd100; }
#siegehud .act:active { transform: scale(.97); }
#siegehud.dragon { width: 520px;  box-shadow: 0 0 0 1px #000, 0 0 0 3px #ff6000, 0 0 0 4px #000, 0 0 30px rgba(255,90,0,.5); }

/* 卡片（点击 3D 物体） */
#tip { max-width: 360px; min-width: 240px; }
#tip .row2 { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
#tip .qty { display: inline-flex; align-items: center; gap: 4px; }
#tip .qty b { min-width: 30px; text-align: center; font-size: 16px; color: #fff; }
#tip .qty i { width: 32px; height: 32px; border-radius: 4px; background: #3a2c19; box-shadow: 0 0 0 1px #7a5a1c; font: bold 20px/30px Arial; text-align: center; color: var(--gold); cursor: pointer; font-style: normal; }
#tip .blist { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 330px; overflow-y: auto; }
#tip .bi { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 4px; background: rgba(255,255,255,.05); cursor: pointer; }
#tip .bi .icon { width: 36px; height: 36px; }
#tip .bi .t { flex: 1; font-size: 13px; line-height: 1.35; }
#tip .bi .t b { color: var(--gold); font-size: 14px; }
#tip .bi .t small { color: #aaa; display: block; }
#tip .bi.dis { opacity: .5; }
#tip .bi:active { background: rgba(255,209,0,.15); }
#tip .cost { display: inline-flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
#tip .cost .mat .icon { width: 14px; height: 14px; }
#tip .cost .no { color: #ff5050; }
#tip .btn { margin-top: 0; }

/* 军队 / 市场窗口 */
.panel { flex: 1; display: flex; gap: 12px; }
.pcol { flex: 1; background: rgba(0,0,0,.55); border-radius: 4px; box-shadow: inset 0 0 0 1px #3d301a; padding: 12px; }
.pcol h4 { margin: 0 0 8px; color: var(--gold); font: bold 16px var(--ui-font); }
.kv { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; }
.kv b { color: #fff; }
.nrow { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; }
.nrow .icon { width: 30px; height: 30px; }
.nrow .t { flex: 1; } .nrow .t small { display: block; color: #aaa; font-size: 12px; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 15px; }
.mrow .icon { width: 36px; height: 36px; }
.mrow .t { flex: 1; }

/* 战斗场景 */
#battlehud { position: absolute; inset: 0; z-index: 48; display: none; pointer-events: none; }
#battlehud.show { display: block; }
#battlehud > * { pointer-events: auto; }
.bt-top { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 8px 16px; border-radius: 8px;
  background: rgba(8,6,4,.85); box-shadow: 0 0 0 1px #000, 0 0 0 3px #7a5a1c, 0 6px 16px rgba(0,0,0,.6); }
.bt-top .bs { display: flex; align-items: center; gap: 10px; width: 300px; }
.bt-top .bs.foe { justify-content: flex-end; text-align: right; }
.bt-top .bs > div { flex: 1; }
.bt-top .bs b { display: block; font: bold 16px var(--ui-font); color: #fff; text-shadow: 1px 1px 0 #000; margin-bottom: 4px; }
.bt-top .bs .bar { height: 14px; }
.bt-top .bs.foe .bar { transform: scaleX(-1); }
.bt-top .icon { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px #000, 0 0 0 4px #c9a24c; }
.bt-top .vs { font: 900 26px Georgia, serif; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.bt-cmds { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 10px; }
.bc2 { width: 150px; min-height: 64px; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: center; background: linear-gradient(180deg, #4a3418, #1e1409);
  box-shadow: 0 0 0 1px #000, 0 0 0 3px #a8863c, 0 4px 10px rgba(0,0,0,.6); }
.bc2 b { display: block; font: bold 19px var(--ui-font); color: var(--gold); text-shadow: 1px 1px 0 #000; }
.bc2 small { display: block; font-size: 11px; color: #ccc; margin-top: 3px; line-height: 1.3; }
.bc2.dis { filter: grayscale(1) brightness(.6); }
.bc2.on { background: linear-gradient(180deg, #2a4a8a, #0e1a40); }
.bc2.sp { width: 90px; }
.bc2:active { transform: scale(.96); }
.bc2[data-bc="retreat"] b { color: #ff9a80; }
#bt-banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none !important; font: bold 46px var(--title-font); opacity: 0;
  text-shadow: 3px 3px 0 #000, 0 0 20px rgba(0,0,0,.9); letter-spacing: 4px; }
#bt-banner.show { animation: zone 2.6s ease-in-out forwards; }
#bt-result { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.5); }
#bt-result.show { display: flex; animation: fadein .5s; }
#bt-result .br { width: 520px; padding: 24px 30px; text-align: center; }
#bt-result h2 { margin: 0 0 8px; font: bold 40px var(--title-font); text-shadow: 2px 2px 0 #000; }
#bt-result p { font-size: 16px; color: #ddd; }
.brs { display: flex; gap: 16px; margin: 16px 0 20px; }
.brs > div { flex: 1; padding: 10px; background: rgba(255,255,255,.05); border-radius: 4px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.brs b { font-size: 16px; }
#stage.in-battle #hud { display: none; }
.fct.heal { color: #40ff40; font-size: 18px; }
.nphp { position: absolute; left: 0; bottom: -8px; width: 50px; height: 5px; transform: translateX(-50%); background: #000; border: 1px solid #000; }
.nphp i { display: block; height: 100%; background: linear-gradient(180deg, #4fe34f, #0a9d0a); }
.bheroes { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; margin: 8px 0; font: bold 14px var(--ui-font); }
.bheroes em { font-style: normal; color: #ff7060; font-weight: normal; }
.lottag { position: absolute; left: 0; top: 0; translate: -50% -50%; pointer-events: auto; cursor: pointer; padding: 3px 10px 3px 6px; border-radius: 14px; white-space: nowrap;
  background: rgba(20,14,6,.72); box-shadow: 0 0 0 1px #c9a24c; color: #f0e0b0; font: bold 12px var(--ui-font); }
.lottag b { display: inline-block; width: 18px; height: 18px; margin-right: 4px; border-radius: 50%; background: #3a8a2a; color: #fff; text-align: center; line-height: 18px; font-size: 15px; }
.comp { display: flex; flex-wrap: wrap; gap: 6px; }
.cchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 10px; background: rgba(255,255,255,.07); font: bold 12px var(--ui-font); }
.cchip .icon { border-radius: 50%; }
#bt-fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none !important; }

/* 战利品 */
.loot { margin: -6px 0 16px; text-align: left; }
.loot h4 { margin: 0 0 8px; color: #ffd100; font-size: 15px; letter-spacing: 2px; text-align: center; }
.lootgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: rgba(0,0,0,.45); border: 1px solid #333; border-radius: 3px; opacity: 0; animation: lootIn .35s ease forwards; }
.li img { width: 34px; height: 34px; border: 2px solid #9d9d9d; border-radius: 3px; flex: none; }
.li.q1 img { border-color: #1eff00; } .li.q2 img { border-color: #0070dd; box-shadow: 0 0 8px #0070dd; } .li.q3 img { border-color: #a335ee; box-shadow: 0 0 12px #a335ee; }
.li.q3 { border-color: #a335ee; background: linear-gradient(90deg, rgba(163,53,238,.25), rgba(0,0,0,.45)); }
.li b { font-size: 14px; font-weight: normal; color: #fff; }
.li em { display: block; font-size: 11px; color: #bbb; font-style: normal; }
@keyframes lootIn { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* 战斗求援 */
.bt-reinf { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: 340px; background: rgba(12,8,4,.92); border: 1px solid #8a6a30; border-radius: 6px; padding: 10px; pointer-events: auto; z-index: 5; }
.bt-reinf h4 { margin: 0 0 8px; color: #ffd100; font-size: 15px; text-align: center; font-weight: normal; }
.bt-reinf .rf { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; margin-bottom: 6px; background: linear-gradient(#3a2a14, #22180c); border: 1px solid #6a4a20; border-radius: 4px; cursor: pointer; }
.bt-reinf .rf:hover { border-color: #ffd100; }
.bt-reinf .rf b { color: #fff; font-weight: normal; font-size: 14px; } .bt-reinf .rf span { color: #9fd0ff; font-size: 12px; }
.bt-reinf .rf.x { justify-content: center; color: #bbb; background: rgba(255,255,255,.06); }
.bt-reinf p { color: #bbb; text-align: center; margin: 6px 0 10px; }
.bt-pend { position: absolute; left: 50%; top: 78px; transform: translateX(-50%); color: #9fd0ff; font-size: 14px; text-shadow: 0 1px 3px #000; white-space: nowrap; }
