* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #1e2a44; color: #f4f0e4; font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
[hidden] { display: none !important; }
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; overflow: hidden; transform-origin: 0 0; }
#gl { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 界面层按 844×390 设计，由 main.js 按比例缩放 */
#ui { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#hud, #pops, #toasts, #banner { pointer-events: none !important; }
#hud button, #hud #acts, #hud #fc { pointer-events: auto; }

.card { background: rgba(18, 26, 48, .84); border: 1px solid rgba(214, 190, 120, .55); border-radius: 8px; }
#hud { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
#hud-tl { position: absolute; left: 8px; left: max(8px, env(safe-area-inset-left)); top: 8px; padding: 5px 10px; max-width: 250px; font-size: 12px; line-height: 1.5; }
#hud-turn { font-size: 13px; color: #ffe08a; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow { display: flex; gap: 8px; align-items: baseline; }
#hud-phase.p { color: #8ab4ff; } #hud-phase.e { color: #ff8a7a; }
#hud-goal { color: #d8d0b8; }
#hud-demo { color: #9fe8a0; }
#hud-tr { position: absolute; right: 8px; right: max(8px, env(safe-area-inset-right)); top: 8px; display: flex; gap: 8px; }
.tb { min-width: 48px; height: 36px; padding: 0 8px; font-size: 13px; background: rgba(18, 26, 48, .84); border: 1px solid rgba(214, 190, 120, .6); border-radius: 7px; }
.tb.on { background: #b3641e; border-color: #ffcf7a; }

#duel { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 270px; display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: rgba(10, 14, 28, .88); border-radius: 8px; border: 1px solid rgba(214, 190, 120, .5); }
.ds { flex: 1; font-size: 12px; line-height: 1.35; }
.ds b { display: block; } .ds.p b { color: #8ab4ff; } .ds.e b { color: #ff8a7a; }
.ds i { display: block; height: 6px; background: #333; border-radius: 3px; overflow: hidden; }
.ds i em { display: block; height: 100%; background: #58d26a; transition: width .2s; }
.ds.e i em { background: #ff5a4a; }
.vs { font-weight: 900; color: #ffd86a; font-size: 13px; }

/* 右侧：行动菜单 / 战斗预测（同一位置，不同时出现） */
#acts { position: absolute; right: 8px; right: max(8px, env(safe-area-inset-right)); top: 54px; width: 124px; display: flex; flex-direction: column; gap: 8px; }
.act { min-height: 36px; padding: 4px 8px; font-size: 15px; font-weight: 700; background: rgba(244, 238, 220, .95); color: #1e2a44; border: 2px solid #c8a86a; border-radius: 8px; text-align: center; line-height: 1.1; }
.act small { display: block; font-size: 10px; font-weight: 400; color: #5a5040; }
.act.kf { outline: 3px solid #ffd23a; }
#fc { position: absolute; right: 8px; right: max(8px, env(safe-area-inset-right)); top: 54px; width: 230px; padding: 6px; background: rgba(12, 18, 36, .92); border: 1px solid rgba(214, 190, 120, .6); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.fs { flex: 1; min-width: 0; font-size: 12px; }
.fs b { display: block; font-size: 13px; } .fs.p b { color: #8ab4ff; } .fs.e b { color: #ff8a7a; }
.fs small { display: block; color: #d8d0b8; font-size: 11px; height: 15px; white-space: nowrap; overflow: hidden; }
.fs ul { list-style: none; margin-top: 3px; }
.fs li { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, .08); padding: 1px 2px; font-weight: 700; }
.fs li span { font-weight: 400; color: #b8b0a0; }
.fbtn { width: 100%; display: flex; gap: 6px; }
.fbtn button { flex: 1; min-height: 38px; border-radius: 7px; border: 1px solid #8fa6d8; background: #2a3e72; font-size: 14px; }
.fbtn button.primary { background: #b8402e; border-color: #ffb08a; font-weight: 700; }

#info { position: absolute; left: 8px; left: max(8px, env(safe-area-inset-left)); bottom: 8px; width: 250px; padding: 5px 9px; font-size: 12px; line-height: 1.45; }
.ih { display: flex; gap: 6px; align-items: baseline; }
.ih b { font-size: 15px; } .ih.p b { color: #8ab4ff; } .ih.e b { color: #ff8a7a; }
.ih span { color: #d8d0b8; } .ih em { font-style: normal; background: #8a1d1d; padding: 0 5px; border-radius: 4px; font-size: 11px; }
.ih em.ready { background: #2e64c8; } .ih em.done { background: #5a5c66; color: #d8d8e0; }
.ihp { display: flex; align-items: center; gap: 6px; }
.ihp i { flex: 1; height: 6px; background: #333; border-radius: 3px; overflow: hidden; }
.ihp em { display: block; height: 100%; background: #58d26a; }
.ist { color: #e8e0cc; } .iw { color: #ffe08a; } .ter { color: #a8c8a0; }
#hud-br { position: absolute; right: 8px; right: max(8px, env(safe-area-inset-right)); bottom: 8px; display: flex; gap: 10px; }
.bb { height: 46px; min-width: 84px; padding: 0 12px; font-size: 15px; font-weight: 700; background: rgba(18, 26, 48, .88); border: 2px solid rgba(214, 190, 120, .7); border-radius: 9px; }
.bb.end { min-width: 108px; background: rgba(150, 50, 36, .92); border-color: #ffb08a; }
#keyhint { position: absolute; left: 270px; right: 230px; bottom: 10px; text-align: center; font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; line-height: 1.4; }

.pop { position: absolute; transform: translate(-50%, -50%); font-size: 22px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 #000, 0 0 4px #000; animation: up 1.1s ease-out forwards; white-space: nowrap; }
.pop.dmg { color: #fff; } .pop.crit { color: #ffd23a; font-size: 26px; } .pop.miss { color: #c8d8ff; font-size: 17px; } .pop.heal { color: #7dff9a; } .pop.exp { color: #ffe08a; font-size: 15px; }
@keyframes up { 0% { opacity: 0; margin-top: 8px; } 15% { opacity: 1; margin-top: 0; } 100% { opacity: 0; margin-top: -34px; } }
#banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; padding: 10px 0; background: linear-gradient(90deg, transparent, rgba(12, 18, 36, .85) 25%, rgba(12, 18, 36, .85) 75%, transparent); }
#banner b { display: block; font-size: 30px; letter-spacing: 6px; color: #ffe08a; }
#banner small { font-size: 15px; color: #d8d0b8; }
#banner.show { animation: ban 1.1s ease-out; }
@keyframes ban { 0% { opacity: 0; transform: scaleY(.3); } 20% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
#toasts { position: absolute; left: 50%; top: 54px; transform: translateX(-50%); width: 380px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { padding: 6px 12px; background: rgba(12, 18, 36, .9); border: 1px solid rgba(214, 190, 120, .6); border-radius: 8px; font-size: 13px; line-height: 1.5; text-align: center; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }

#talk { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(640px, 92%); min-height: 92px; padding: 10px 16px 12px; background: rgba(12, 18, 36, .94); border: 2px solid #c8a86a; border-radius: 10px; z-index: 30; cursor: pointer; }
#talk b { display: inline-block; padding: 1px 10px; border-radius: 4px; font-size: 14px; margin-bottom: 4px; background: #2e5ab8; }
#talk b.foe { background: #a83a2a; }
#talk p { font-size: 16px; line-height: 1.6; }
#talk-skip { position: absolute; right: 8px; top: 6px; padding: 2px 10px; font-size: 12px; background: transparent; border: 1px solid rgba(255, 255, 255, .4); border-radius: 5px; }
#talk .more { position: absolute; right: 14px; bottom: 6px; font-style: normal; color: #ffd86a; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
#lvup { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 260px; padding: 10px 14px; background: rgba(12, 18, 36, .96); border: 2px solid #ffd86a; border-radius: 10px; z-index: 31; }
#lvup h3 { color: #ffe08a; font-size: 16px; margin-bottom: 6px; }
#lvup ul { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 14px; }
#lvup li { display: flex; gap: 6px; } #lvup li span { width: 34px; color: #b8b0a0; } #lvup li.up { color: #7dff9a; } #lvup li i { font-style: normal; color: #ffd23a; font-weight: 700; }
#lvup p { margin-top: 6px; text-align: center; font-size: 12px; color: #b8b0a0; }

/* 菜单与面板 */
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 12px; z-index: 20; }
.overlay.dim { background: rgba(6, 10, 20, .6); }
#menu { background: linear-gradient(180deg, rgba(10, 16, 34, .25), rgba(10, 16, 34, .7)); }
.menu-box { margin: auto; width: 100%; max-width: 460px; padding: 14px 18px; background: rgba(18, 26, 48, .93); border: 1px solid rgba(214, 190, 120, .65); border-radius: 12px; text-align: center; }
.menu-box.wide { max-width: 620px; }
.menu-box h1 { font-size: 40px; letter-spacing: 8px; color: #ffe08a; text-shadow: 0 3px 0 #6a3a10; line-height: 1.2; }
.menu-box h2 { font-size: 20px; color: #ffe08a; margin-bottom: 8px; }
.menu-box h3 { font-size: 15px; color: #ffe08a; margin: 8px 0 4px; text-align: left; }
.menu-box p { font-size: 13px; line-height: 1.6; margin: 4px 0; }
.sub { color: #d8d0b8; }
.btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.btns.col { flex-direction: column; }
.btns > * { flex: 1; }
.btns button { min-height: 42px; padding: 6px 10px; border-radius: 8px; border: 1px solid #8fa6d8; background: #2a3e72; font-size: 15px; }
.btns button.primary { background: #3a5aa8; border-color: #ffd86a; font-weight: 700; }
.btns button small { display: block; font-size: 11px; color: #d8d0b8; font-weight: 400; }
.menu-promo { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px !important; }
.fd-promo-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 4px 12px; border-radius: 18px; border: 1px solid #fb7299; background: rgba(251, 114, 153, .16); color: #ffd0de; font-size: 13px; text-decoration: none; }
.foot { color: #9a94a8; font-size: 11px !important; }
.hint { color: #b8b0a0; }
.warn { color: #ffb08a; }
.gold { color: #ffe08a; font-weight: 700; }
.stars { font-size: 30px !important; color: #ffd23a; letter-spacing: 4px; }
.sum { list-style: none; font-size: 13px; line-height: 1.7; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; font-size: 14px; }
.seg { display: flex; gap: 4px; }
.seg button { min-width: 52px; min-height: 36px; padding: 2px 10px; border-radius: 6px; border: 1px solid #6f86b8; background: #22305a; font-size: 13px; }
.seg button.on { background: #3a5aa8; border-color: #ffd86a; }
#vol { width: 160px; }
.help { text-align: left; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tabs button { min-height: 34px; padding: 2px 10px; border-radius: 6px; border: 1px solid #6f86b8; background: #22305a; font-size: 13px; }
.tabs button.on { background: #3a5aa8; border-color: #ffd86a; }
.shop, .units { list-style: none; text-align: left; font-size: 13px; }
.shop li { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.shop li span { flex: 1; } .shop li em { font-style: normal; color: #b8b0a0; font-size: 12px; }
.shop li button { min-width: 86px; min-height: 34px; border-radius: 6px; border: 1px solid #8fa6d8; background: #2a3e72; font-size: 13px; }
.units li { padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); line-height: 1.5; }
.units small { color: #c8c0b0; }

#loading { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #1e2a44; z-index: 50; }
.ld-title { font-size: 36px; letter-spacing: 8px; color: #ffe08a; }
#ld-retry { padding: 8px 20px; border-radius: 8px; border: 1px solid #8fa6d8; background: #2a3e72; }

/* 过场动画：电影黑边、标题卡、字幕 */
#cine { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 25; cursor: pointer; }
#cine .bar { position: absolute; left: 0; right: 0; height: 13%; background: #000; transition: height .5s; }
#cine .bar.top { top: 0; } #cine .bar.bot { bottom: 0; height: 22%; }
#cine.black { background: #000; }
#cine-skip { position: absolute; right: 12px; top: 8px; height: 30px; padding: 0 12px; font-size: 13px; color: #ddd; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .35); border-radius: 15px; z-index: 2; }
#cine-cap { position: absolute; left: 0; right: 0; top: 34%; text-align: center; z-index: 2; pointer-events: none; }
#cine-cap b { display: block; font-size: 44px; letter-spacing: 12px; color: #ffe8a8; text-shadow: 0 0 18px rgba(255, 190, 90, .6), 0 3px 0 #5a3010; font-family: "STKaiti", "KaiTi", "PingFang SC", serif; }
#cine-cap small { display: block; margin-top: 6px; font-size: 16px; letter-spacing: 6px; color: #f0e0c0; text-shadow: 0 1px 4px #000; }
#cine-cap.show { animation: capin 2.6s ease-out forwards; }
#cine-hint { position: absolute; left: 12px; top: 12px; font-size: 12px; letter-spacing: 1px; color: rgba(255, 255, 255, .5); z-index: 2; pointer-events: none; }
@keyframes capin { 0% { opacity: 0; transform: scale(1.08); letter-spacing: 20px; } 25% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
#cine-sub { position: absolute; left: 0; right: 0; bottom: 3%; height: 17%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; z-index: 2; pointer-events: none; animation: fadein .25s; }
#cine-who { font-size: 14px; color: #ffd86a; letter-spacing: 2px; margin-bottom: 2px; }
#cine-text { font-size: 17px; line-height: 1.5; color: #fff; max-width: 86%; text-shadow: 0 1px 3px #000; }
#cine-sub.nar #cine-text { color: #e8dcc0; font-style: italic; }

/* 战斗画面：下方两块信息条（左敌右我），点画面加速 */
#arena { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 24; cursor: pointer; }
#ar-flash { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #fff; opacity: 0; pointer-events: none; }
#ar-pops { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
#ar-pops .pop { font-size: 30px; } #ar-pops .pop.crit { font-size: 34px; } #ar-pops .pop.miss { font-size: 22px; }
#ar-tip { position: absolute; right: 12px; right: max(12px, env(safe-area-inset-right)); top: 10px; font-size: 12px; color: rgba(255, 255, 255, .75); text-shadow: 0 1px 3px #000; pointer-events: none; }
.ar-bot { position: absolute; left: 8px; left: max(8px, env(safe-area-inset-left)); right: 8px; right: max(8px, env(safe-area-inset-right)); bottom: 6px; display: flex; gap: 8px; pointer-events: none; }
.ar-side { flex: 1; min-width: 0; padding: 5px 12px 7px; border-radius: 10px 10px 6px 6px; border: 2px solid; line-height: 1.35; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.ar-side.p { background: linear-gradient(180deg, rgba(46, 92, 190, .94), rgba(18, 38, 92, .96)); border-color: #8ab4ff; }
.ar-side.e { background: linear-gradient(180deg, rgba(178, 50, 40, .94), rgba(86, 18, 14, .96)); border-color: #ff9a8a; }
.ar-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-nm b { font-size: 17px; margin-right: 8px; } .ar-nm small { color: #f0e4c8; font-size: 12px; }
.ar-st { display: flex; align-items: baseline; gap: 4px; margin: 2px 0 3px; font-size: 12px; }
.ar-st span { color: #e0d6c0; } .ar-st b { color: #fff; font-size: 14px; min-width: 30px; }
.ar-hp { display: flex; align-items: center; gap: 8px; }
.ar-hp > b { font-size: 22px; min-width: 32px; text-align: right; } .ar-hp small { color: #e0d6c0; font-size: 12px; }
.ar-hp i { position: relative; flex: 1; height: 12px; background: #1a1418; border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; overflow: hidden; }
.ar-hp i em, .ar-hp i u { position: absolute; left: 0; top: 0; bottom: 0; }
.ar-hp i u { background: #fff4d0; opacity: .9; transition: width .5s ease-in .3s; }
.ar-hp i em { background: linear-gradient(180deg, #a8f6b2, #3cb85a); transition: width .2s; }
.ar-side.e .ar-hp i em { background: linear-gradient(180deg, #ffb0a0, #e0483a); }
.ar-hp i::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0, 0, 0, .35) calc(10% - 1px) 10%); }
#fader { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #000; opacity: 0; pointer-events: none !important; transition: opacity .16s; z-index: 40; }
#fader.on { opacity: 1; }

.units .mini { min-width: 52px; min-height: 30px; margin-left: 6px; padding: 0 8px; font-size: 12px; border-radius: 6px; border: 1px solid #6f86b8; background: #22305a; }
.units .mini.on { background: #3a5aa8; border-color: #ffd86a; }
.units .mini.gold { background: #8a6a1a; border-color: #ffd86a; }
#lvup .promo { text-align: left; font-size: 13px; color: #e8dcc0; margin: 0 0 6px; }
#lvup .promo b { color: #ffd86a; }
