/* 百兵诀 · 基础样式 + 启动页 + 战斗 HUD（大厅样式见 lobby.css） */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #15100c; color: #f3e6c8;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font-family: inherit; }
[hidden] { display: none !important; }
#app { position: fixed; inset: 0; max-width: 560px; margin: 0 auto; overflow: hidden; background: #15100c; }
.screen { position: absolute; inset: 0; }
:root {
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --content-top: calc(var(--safe-top) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ink: #1b120d; --ink2: #2a1d15; --paper: #f3e6c8; --paper2: #e3cfa2; --red: #c8342b; --red2: #8e1f19;
  --gold: #e8b04a; --gold2: #b8801e; --jade: #3fa37a; --jade2: #25704f; --blue: #3f7fd0;
  --panel: rgba(34, 24, 18, .92); --panel2: #3a2a1f; --line: rgba(232, 176, 74, .35);
  --kai: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "STSong", serif;
}
.kai { font-family: var(--kai); }
.stroke { text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 1px 1px 0 var(--ink), -1px -1px 0 var(--ink); }

/* ---------- 按钮 ---------- */
.btn { position: relative; border: 2px solid var(--ink); border-radius: 10px; padding: 8px 16px; font-size: 15px; font-weight: 900; color: #fff; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 3px 0 var(--ink); transition: transform .06s, filter .1s; letter-spacing: 1px; white-space: nowrap; }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25), 0 1px 0 var(--ink); }
.btn:disabled { filter: grayscale(.85) brightness(.75); pointer-events: none; }
.btn-gold { background: linear-gradient(#ffe39a, var(--gold) 50%, var(--gold2)); color: #3b1f06; text-shadow: 0 1px 0 rgba(255,255,255,.45); }
.btn-red { background: linear-gradient(#ff7a6a, var(--red) 55%, var(--red2)); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.btn-jade { background: linear-gradient(#7fe0b0, var(--jade) 55%, var(--jade2)); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.btn-blue { background: linear-gradient(#8fc0ff, var(--blue) 55%, #24539a); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.btn-gray { background: linear-gradient(#a59a8a, #75695a 55%, #54493d); }
.btn-ink { background: linear-gradient(#4a3a2c, #2a1d15); color: var(--paper); border-color: var(--gold2); }
.btn-xl { font-size: 22px; padding: 12px 40px; border-radius: 14px; font-family: var(--kai); letter-spacing: 6px; }
.btn-sm { font-size: 12px; padding: 4px 10px; border-radius: 8px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 2px 0 var(--ink); }
.dot-red::after { content: ''; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: #ff3b3b; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ink); }

/* ---------- 弹窗 / 提示 ---------- */
.mask { position: fixed; inset: 0; background: rgba(8,5,3,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; animation: fadeIn .15s; }
.modal { width: 100%; max-width: 420px; max-height: calc(100vh - 40px - var(--safe-top) - var(--safe-bottom)); display: flex; flex-direction: column;
  background: linear-gradient(#3a2a1f, #251a13); border: 2px solid var(--gold2); border-radius: 16px; box-shadow: 0 0 0 3px var(--ink), 0 18px 40px rgba(0,0,0,.6); overflow: hidden; animation: popIn .18s; }
.modal-head { position: relative; padding: 12px 44px; text-align: center; background: linear-gradient(90deg, transparent, rgba(200,52,43,.55), transparent); border-bottom: 1px solid var(--line); }
.modal-title { font-family: var(--kai); font-size: 21px; font-weight: 900; color: #ffe8b0; letter-spacing: 3px; text-shadow: 0 2px 0 var(--ink); }
.modal-close { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); background: var(--red); color: #fff; font-weight: 900; cursor: pointer; }
.modal-body { padding: 14px; overflow-y: auto; flex: 1; }
.modal-body::-webkit-scrollbar { display: none; }
.modal-foot { display: flex; gap: 10px; justify-content: center; padding: 10px 14px 14px; border-top: 1px solid rgba(232,176,74,.18); }
.confirm-text { text-align: center; font-weight: 700; line-height: 1.7; white-space: pre-line; }
#toast-root { position: fixed; left: 0; right: 0; top: 38%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 99; }
.toast { background: rgba(20,12,8,.92); border: 1px solid var(--gold2); color: #ffe8b0; padding: 9px 18px; border-radius: 20px; font-weight: 700; font-size: 14px; max-width: 86%; text-align: center; animation: toastIn .2s; }
@keyframes fadeIn { from { opacity: 0 } }
@keyframes popIn { from { transform: scale(.85); opacity: 0 } }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0 } }
body.api-busy::before { content: ''; position: fixed; top: 0; left: 0; height: 3px; width: 40%; background: linear-gradient(90deg, transparent, var(--gold), transparent); z-index: 100; animation: busy 1s linear infinite; }
@keyframes busy { from { transform: translateX(-100%) } to { transform: translateX(260%) } }

/* ---------- 奖励 ---------- */
.rewards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rw { position: relative; width: 70px; min-height: 78px; border-radius: 12px; border: 2px solid var(--qc, rgba(255,255,255,.25)); background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.12), rgba(0,0,0,.35));
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 2px 4px; box-shadow: inset 0 0 12px color-mix(in srgb, var(--qc, #000) 35%, transparent); }
.rw i { font-style: normal; font-size: 28px; line-height: 1; }
.rw img { width: 38px; height: 38px; object-fit: contain; }
.rw.frag img { filter: drop-shadow(0 0 3px #ffd24a); }
.rw-name { font-size: 11px; font-weight: 700; margin-top: 3px; text-align: center; line-height: 1.2; color: var(--paper); }
.rw-n { position: absolute; right: 4px; top: 2px; font-size: 12px; color: #ffe39a; text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink); }

/* ---------- 启动页 ---------- */
.boot { display: flex; flex-direction: column; align-items: center; overflow: hidden;
  background: radial-gradient(ellipse 90% 55% at 50% 38%, #4a2616 0%, #22130c 55%, #0c0705 100%); }
.boot-ink { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 80% 11%, rgba(214,58,40,.95) 0 40px, rgba(214,58,40,.3) 44px, transparent 84px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 160' preserveAspectRatio='none'%3E%3Cpath d='M0 160V92l40-34 34 22 50-56 44 40 30-20 52 46 40-32 46 28 42-38 22 18v94z' fill='%23000' fill-opacity='.45'/%3E%3Cpath d='M0 160v-40l56-24 42 20 64-36 48 32 44-16 60 28 46-22 40 16v42z' fill='%23000' fill-opacity='.6'/%3E%3C/svg%3E") bottom / 100% 42% no-repeat; }
#boot-art { position: relative; width: min(74vw, 300px); height: min(74vw, 300px); margin-top: calc(var(--content-top) + 18px); }
.boot-logo { position: relative; margin-top: -26px; text-align: center; }
.boot-logo span { display: block; font-family: var(--kai); font-size: 70px; font-weight: 900; letter-spacing: 12px; padding-left: 12px; line-height: 1.1;
  background: linear-gradient(180deg, #fff6d6 0%, #ffd97a 45%, #e39a2e 72%, #a8621a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #4a1006) drop-shadow(0 0 18px rgba(255,170,70,.35)); }
.boot-logo small { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; font-family: var(--kai); font-size: 16px; letter-spacing: 5px; color: #f6dfae;
  text-shadow: 0 2px 4px rgba(0,0,0,.8); }
.boot-logo small::before, .boot-logo small::after { content: ''; width: 34px; height: 1px; background: linear-gradient(90deg, transparent, #e8b04a); }
.boot-logo small::after { transform: scaleX(-1); }
.boot-bottom { position: absolute; bottom: calc(var(--safe-bottom) + 16px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 20px; }
#boot-status { font-weight: 800; font-size: 14px; color: #ffe8b0; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,.9); }
#boot-status.err { color: #ff9a8a; }
.boot-bar { width: 66%; max-width: 280px; height: 8px; background: rgba(0,0,0,.55); border: 1px solid rgba(232,176,74,.6); border-radius: 6px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b8241c, #e8b04a, #ffe39a); transition: width .2s; }
.boot-tip { font-size: 10px; line-height: 1.6; text-align: center; color: rgba(243,226,190,.5); }
.maint-root { position: fixed; inset: 0; z-index: 90; background: rgba(8,5,3,.85); display: flex; align-items: center; justify-content: center; padding: 20px; }
.maint-box { background: var(--panel); border: 2px solid var(--gold2); border-radius: 16px; padding: 24px; text-align: center; max-width: 340px; }
.maint-ic { font-size: 48px; } .maint-t { font-family: var(--kai); font-size: 24px; margin: 6px 0; } .maint-msg { line-height: 1.6; margin-bottom: 6px; } .maint-sub { opacity: .6; font-size: 12px; margin-bottom: 14px; }

/* ============================== 战斗 ============================== */
.battle { background: #0d0806; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--content-top) + 6px) 8px 4px; display: flex; align-items: center; gap: 6px;
  background: linear-gradient(rgba(10,6,4,.85), rgba(10,6,4,0)); pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-pause { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--ink); background: linear-gradient(#5a4230, #2a1d15); color: var(--paper); font-weight: 900; font-size: 14px; flex: none; }
.hud-hp { flex: 1; min-width: 0; }
.bar { position: relative; height: 14px; border-radius: 8px; background: rgba(0,0,0,.6); border: 2px solid var(--ink); overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; transition: width .12s; }
.bar > em { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.55); transition: width .6s .2s; }
.bar > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 900; font-style: normal; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000; }
.hp-bar > i { background: linear-gradient(#ff8a7a, #d8322a); }
.exp-bar { height: 7px; margin-top: 3px; border-width: 1.5px; }
.exp-bar > i { background: linear-gradient(90deg, #7ff0d0, #3fa37a); }
.hud-lv { flex: none; min-width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); background: radial-gradient(#ffe39a, var(--gold2)); color: #3b1f06; font-weight: 900; font-size: 13px;
  display: flex; align-items: center; justify-content: center; }
.hud-stage { flex: none; text-align: center; font-family: var(--kai); font-weight: 900; font-size: 15px; line-height: 1.1; color: #ffe8b0; text-shadow: 0 2px 0 var(--ink); }
.hud-stage small { display: block; font-family: inherit; font-size: 10px; color: var(--gold); letter-spacing: 1px; }
.hud-gold { flex: none; font-weight: 900; font-size: 12px; background: rgba(0,0,0,.5); border-radius: 12px; padding: 3px 8px; }
.boss-bar { position: absolute; left: 12%; right: 12%; top: calc(var(--content-top) + 50px); text-align: center; pointer-events: none; }
.boss-bar .name { font-family: var(--kai); font-size: 16px; font-weight: 900; color: #ffb0a0; text-shadow: 0 2px 0 var(--ink); letter-spacing: 2px; }
.boss-bar .bar { height: 12px; }
.boss-bar .bar > i { background: linear-gradient(#ff5a4a, #8e1f19); }
.boss-bar .brk { height: 5px; margin: 3px 12% 0; border-width: 1px; }
.boss-bar .brk > i { background: linear-gradient(90deg, #ffd24a, #ff8a2a); }
.boss-bar.phase2 .bar > i { background: linear-gradient(#c05aff, #4a1a8a); }
.hud-br { position: absolute; right: 10px; bottom: calc(var(--safe-bottom) + 18px); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.skill-btn { position: relative; width: 66px; height: 66px; border-radius: 50%; border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #5a4230, #1b120d); box-shadow: 0 0 0 2px var(--gold2), 0 4px 10px rgba(0,0,0,.5); cursor: pointer; }
.skill-btn img { width: 44px; height: 44px; }
.skill-btn .cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(0,0,0,.7) var(--p, 0%), transparent 0); }
.skill-btn .lbl { position: absolute; bottom: -12px; font-size: 11px; font-weight: 900; white-space: nowrap; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000; color: #ffe8b0; }
.skill-btn .ring { position: absolute; inset: -7px; border-radius: 50%; background: conic-gradient(#ff5ad0 var(--c, 0%), rgba(255,255,255,.12) 0); -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%); mask: radial-gradient(circle, transparent 62%, #000 63%); }
.skill-btn.ready { animation: comboGlow .8s infinite alternate; }
@keyframes comboGlow { to { box-shadow: 0 0 0 2px #ff5ad0, 0 0 22px #ff5ad0; } }
.skill-btn.ult { width: 58px; height: 58px; font-size: 26px; }
.skill-btn.ult .ico { font-size: 26px; }
.skill-btn.ult.aff { box-shadow: 0 0 0 2px #ffd24a, 0 0 14px rgba(255,200,80,.7); }
.hud-temp { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 14px); background: rgba(40,10,5,.8); border: 2px solid #ffb347; border-radius: 14px;
  padding: 4px 12px; font-weight: 900; font-size: 13px; color: #ffe39a; pointer-events: none; }
.hud-tip { position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none; font-family: var(--kai); font-size: 18px; font-weight: 900; color: #fff6d8;
  text-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(0,0,0,.8); animation: tipIn .3s; }
@keyframes tipIn { from { transform: scale(1.4); opacity: 0 } }

/* 战斗覆盖层：选卡 / 事件 / 暂停 / 复活 / 结算 */
#overlay { position: absolute; inset: 0; pointer-events: none; }
#overlay > * { pointer-events: auto; }
.ov { position: absolute; inset: 0; background: rgba(8,5,3,.8); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--content-top) + 10px) 12px calc(var(--safe-bottom) + 14px); animation: fadeIn .2s; }
.ov-title { font-family: var(--kai); font-size: 30px; font-weight: 900; letter-spacing: 6px; color: #ffe8b0; text-shadow: 0 3px 0 #8e1f19, 0 0 18px rgba(232,176,74,.5); }
.ov-sub { font-size: 13px; color: var(--paper2); margin: 4px 0 14px; text-align: center; line-height: 1.6; }
.cards { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 380px; }
.card { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--qc); cursor: pointer;
  background: linear-gradient(100deg, color-mix(in srgb, var(--qc) 30%, #2a1d15), #20150f 70%); box-shadow: 0 0 0 2px var(--ink), 0 0 14px color-mix(in srgb, var(--qc) 40%, transparent);
  animation: cardIn .3s backwards; transition: transform .08s; }
.card:active { transform: scale(.97); }
.card:nth-child(2) { animation-delay: .06s; } .card:nth-child(3) { animation-delay: .12s; }
@keyframes cardIn { from { transform: translateX(40px); opacity: 0 } }
.card-ic { width: 54px; height: 54px; flex: none; border-radius: 12px; border: 2px solid var(--ink); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--qc) 55%, #fff), color-mix(in srgb, var(--qc) 60%, #000));
  display: flex; align-items: center; justify-content: center; font-size: 28px; }
.card-ic img { width: 44px; height: 44px; }
.card-main { flex: 1; min-width: 0; }
.card-name { font-family: var(--kai); font-size: 19px; font-weight: 900; color: #fff; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-q { font-family: inherit; font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 8px; background: var(--qc); color: #1b120d; }
.card-tag { font-family: inherit; font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 8px; background: #c8342b; color: #fff; border: 1px solid #ffb0a0; }
.card-desc { font-size: 12px; color: var(--paper2); margin-top: 3px; line-height: 1.45; }
.card-eff { font-size: 12px; color: #9ff0c8; margin-top: 2px; font-weight: 700; }
.card-pips { display: flex; gap: 3px; margin-top: 4px; }
.card-pips i { width: 12px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); }
.card-pips i.on { background: var(--gold); } .card-pips i.new { background: #9ff0c8; animation: pip .6s infinite alternate; }
@keyframes pip { to { opacity: .3 } }
.ov-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }
.build-strip { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 12px; max-width: 380px; }
.build-strip span { font-size: 11px; padding: 2px 7px; border-radius: 8px; background: rgba(255,255,255,.08); border: 1px solid var(--qc, rgba(255,255,255,.2)); }
.npc { width: 110px; height: 110px; margin-bottom: 6px; }
.result-box { width: 100%; max-width: 380px; background: var(--panel); border: 2px solid var(--gold2); border-radius: 16px; padding: 16px; text-align: center; box-shadow: 0 0 0 3px var(--ink); }
.result-stat { display: flex; justify-content: space-around; margin: 10px 0 14px; }
.result-stat div { font-size: 12px; color: var(--paper2); } .result-stat b { display: block; font-size: 22px; color: #ffe8b0; font-family: var(--kai); }
.mastery-row { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12px; margin-top: 6px; }
.mastery-row img { width: 26px; height: 26px; }
.pause-list { display: flex; flex-direction: column; gap: 10px; width: 220px; }
