/* =====================================================
   西游战记 · 卡牌对战 —— 样式
   ===================================================== */
:root {
  --bg: #14101f;
  --panel: #221a30;
  --panel2: #2b2140;
  --gold: #e8b93c;
  --text: #e8e2f2;
  --dim: #9a8fb8;
  --red: #e05252;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #2a2044 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
}
.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 通用按钮 ---------- */
.btn {
  background: linear-gradient(180deg, #3a2d5c, #2a2145);
  border: 1px solid #7a6aa8; color: var(--text);
  border-radius: 8px; padding: 10px 18px;
  font-size: 15px; cursor: pointer; font-family: inherit;
  transition: filter .12s, transform .12s;
}
.btn:hover { filter: brightness(1.25); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #c9962e, #a06f1a); border-color: var(--gold); color: #fff; font-weight: bold; }
.btn.danger { border-color: var(--red); color: #ffb3ab; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* ---------- 主菜单 ---------- */
.menu-box { margin: auto; text-align: center; background: #ffffff08; border: 1px solid #ffffff14; border-radius: 16px; padding: 36px 64px; }
.logo { font-size: 64px; }
.menu-box h1 { font-size: 44px; letter-spacing: 10px; color: var(--gold); text-shadow: 0 2px 12px #00000088; }
.subtitle { color: var(--dim); margin: 6px 0 18px; }
.menu-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: center; margin-bottom: 22px; font-size: 15px; }
.menu-stats b { color: var(--gold); }
.name-edit { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 13px; padding: 0 0 0 4px; vertical-align: middle; }
.name-edit:hover { color: var(--gold); }
.menu-btns { display: flex; flex-direction: column; gap: 12px; width: min(250px, 84vw); margin: 0 auto; }
.menu-tab-page { display: none; flex-direction: column; gap: 12px; }
.menu-tab-page.on { display: flex; }
.menu-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: center; gap: 4px;
  background: #161122f2; border-top: 1px solid #ffffff22;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(6px);
}
.menu-tabs .tab-btn {
  flex: 1 1 0; max-width: 190px; min-width: 0; padding: 12px 10px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--dim); font-size: 15px; cursor: pointer; font-family: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .12s, background .12s;
}
.menu-tabs .tab-btn.on { color: #fff; border-bottom-color: var(--gold, #ffb300); background: #ffffff10; }
.menu-tabs .tab-btn:hover { color: #fff; background: #ffffff0d; filter: brightness(1.15); }
.menu-tip { margin-top: 24px; color: var(--dim); font-size: 13px; font-style: italic; }
/* 主菜单避让底部 Tab：内容在「视口 − Tab 高」区域内垂直居中（勿用固定 margin-bottom 覆盖 margin:auto，
   否则顶部 auto 吞掉全部剩余空间、内容被顶到底部） */
#screen-menu { padding: calc(12px + env(safe-area-inset-top)) 0 calc(76px + env(safe-area-inset-bottom)); }

/* ---------- 页面通用 ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; align-items: center; padding: 18px 22px 6px; }
.page-head h2 { font-size: 22px; }
.head-right { display: flex; gap: 14px; align-items: center; }
.page-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; align-items: center; padding: 14px 22px 22px; }
.hint { color: var(--dim); font-size: 13px; }

/* ---------- 角色编队 ---------- */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 14px; padding: 12px 22px; }
.hero-card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 2px solid var(--cc, #555); border-radius: 12px;
  padding: 14px; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.hero-card:hover { transform: translateY(-3px); }
.hero-card.selected { box-shadow: 0 0 0 3px var(--gold), 0 6px 18px #0008; }
.h-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.h-top > div:last-child { min-width: 0; flex: 1; }
.h-icon { font-size: 46px; }
.h-name { font-size: 18px; font-weight: bold; overflow-wrap: anywhere; }
.h-lv { color: var(--gold); font-weight: bold; font-size: 14px; }
.h-cls { font-size: 12px; color: var(--dim); margin-top: 2px; overflow-wrap: anywhere; }
.h-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin-top: 10px; font-size: 13px; }
.h-xp { font-size: 11px; color: #8fa8c8; margin-top: 4px; }
.h-desc { margin-top: 8px; font-size: 12px; color: var(--dim); line-height: 1.55; min-height: 36px; }
.h-skills { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.h-detail { margin-top: 8px; text-align: center; }
.chip { font-size: 11px; background: #0006; border: 1px solid #ffffff22; padding: 2px 6px; border-radius: 8px; color: #cfc6e8; }

/* ---------- 关卡 ---------- */
.stage-list { display: flex; justify-content: center; padding: 12px 22px 30px; }
.stage-btn {
  text-align: left; background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid #5a4a85; border-radius: 10px; padding: 12px 14px;
  color: var(--text); cursor: pointer; font-family: inherit;
  width: 100%; max-width: 480px;
}
.stage-btn:hover:not(.locked) { border-color: var(--gold); }
.stage-btn.locked { opacity: .45; cursor: not-allowed; }
.stage-btn.boss { border-color: #e0525288; }
.s-title { font-weight: bold; font-size: 15px; }
.s-info { font-size: 12px; color: var(--dim); margin-top: 5px; }

/* ---------- 章节战线 ---------- */
.stage-btn.cleared { border-color: #4caf5066; cursor: default; }
.stage-btn.cleared:hover { border-color: #4caf5066; }
.stage-btn.elite { border-color: #b07ee066; }
.stage-btn .s-boss-tag, .stage-btn .s-elite-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 6px; color: #fff; font-weight: bold;
}
.s-boss-tag { background: #e05252; }
.s-elite-tag { background: #9c27b0; }
.chapter-ops { display: flex; gap: 10px; justify-content: center; padding: 4px 22px 30px; flex-wrap: wrap; }
.stage-done-hint { text-align: center; color: var(--dim); padding: 30px 20px; font-size: 14px; line-height: 1.8; }

/* ---------- 每日扫荡 ---------- */
.sweep-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.sweep-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #0005; border: 1px solid #ffffff14; border-radius: 8px;
  padding: 8px 12px; text-align: left;
}
.sweep-chap { font-size: 13px; font-weight: bold; }
.sweep-boss { font-size: 11px; color: var(--dim); font-weight: normal; }
.sweep-reward { font-size: 12px; color: #ffd54f; white-space: nowrap; }
.sweep-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 四象阵图（4 条独立进度线） ---------- */
.sx-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.sx-row {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  background: #0005; border: 1px solid #ffffff14; border-radius: 8px;
  padding: 10px 12px; text-align: left;
}
.sx-head { font-size: 14px; font-weight: bold; }
.sx-info { font-size: 12px; color: var(--dim); line-height: 1.7; overflow-wrap: anywhere; }
.sx-tag { font-size: 11px; font-weight: normal; padding: 1px 6px; border-radius: 6px; vertical-align: 1px; }
.sx-tag.open { color: #7fe08a; border: 1px solid #7fe08a55; }
.sx-tag.lock { color: #ffd54f; border: 1px solid #ffd54f55; }
.sx-row.sx-locked { opacity: 0.72; }
.sx-row .o-btns { justify-content: flex-end; }
@media (max-width: 480px) {
  .sx-row .o-btns { justify-content: center; }
  .sx-row .o-btns .btn { flex: 1; }
}

/* ---------- 关卡试炼面板（每日扫荡 + 各章试炼） ---------- */
.trial-hub { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.trial-sec {
  font-size: 13px; font-weight: bold; color: var(--gold);
  border-bottom: 1px solid #ffffff14; padding-bottom: 4px; margin-top: 4px;
}

/* ---------- 战斗布局 ---------- */
#screen-battle { height: 100vh; overflow: hidden; position: relative; }
#battle-fx { position: absolute; inset: 0; z-index: 10; pointer-events: none; opacity: 0; }
#battle-fx.fx-ult { animation: fxUlt 0.7s; }
#battle-fx.fx-beast { animation: fxBeast 0.7s; }
.battle-top { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 16px; }
#round-label { font-size: 16px; font-weight: bold; color: var(--gold); }
.stage-label { color: var(--dim); font-size: 14px; }
.spacer { flex: 1; }
#battle-inner { display: grid; grid-template-columns: 1fr 250px; gap: 10px; flex: 1; min-height: 0; padding: 0 12px; }
#battlefield { display: flex; flex-direction: column; justify-content: space-evenly; min-height: 0; overflow-y: auto; }
#battlefield::-webkit-scrollbar { width: 6px; }
#battlefield::-webkit-scrollbar-thumb { background: #5a4a8a; border-radius: 3px; }
.field-row { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; min-height: 108px; flex: none; }
.field-divider { height: 2px; background: linear-gradient(90deg, transparent, #ffffff22, transparent); margin: 2px 0; }
#log-panel { background: #0004; border: 1px solid #ffffff10; border-radius: 10px; padding: 10px 12px; overflow-y: auto; }
#log div { font-size: 12px; line-height: 1.8; color: #cfc6e8; }
#log div.hl { color: var(--gold); }
#log div.bad { color: #ff8a80; }
#log div.dim { color: var(--dim); }

/* ---------- 角色卡 ---------- */
.card {
  position: relative; width: 128px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 2px solid var(--cc, #555); border-radius: 10px;
  padding: 8px 8px 10px; text-align: center; user-select: none;
  transition: transform .15s, box-shadow .15s, opacity .3s, filter .3s;
}
.card .portrait { font-size: 44px; line-height: 1.15; filter: drop-shadow(0 2px 4px #0008); }
/* 名称/星数/等阶横向内容多：允许折行，防止窄卡被裁剪（名称长时星数/等阶显示不全） */
.card .cname { font-size: 13px; margin-top: 2px; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.card .cname .clv { font-size: 10px; color: #ffd54f; background: #0008; border: 1px solid #ffd54f44; border-radius: 4px; padding: 0 3px; margin-left: 4px; vertical-align: 1px; }
.card .cname .casc { font-size: 10px; color: #b39ddb; background: #0008; border: 1px solid #b39ddb44; border-radius: 4px; padding: 0 3px; margin-left: 4px; vertical-align: 1px; }
.card .ccls { font-size: 11px; color: var(--dim); }
.card.boss { width: 150px; }
.card.boss .portrait { font-size: 54px; }
.hpbar { position: relative; height: 14px; background: #0008; border-radius: 7px; margin-top: 6px; overflow: hidden; }
.hpfill { height: 100%; background: linear-gradient(90deg, #4caf50, #8bc34a); transition: width .25s; }
.card.enemy .hpfill { background: linear-gradient(90deg, #e05252, #ff8a65); }
.hptext { position: absolute; inset: 0; font-size: 10px; line-height: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
.cbuffs { min-height: 15px; font-size: 11px; margin-top: 2px; color: #ffd54f; }
.card.active { box-shadow: 0 0 0 3px var(--gold), 0 0 18px #e8b93c88; transform: translateY(-4px); }
.card.targetable { cursor: pointer; animation: targetPulse 1s infinite; }
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 2px #ff5252aa; }
  50% { box-shadow: 0 0 0 5px #ff5252ff, 0 0 22px #ff5252; }
}
.card.dead { opacity: .28; filter: grayscale(1); }
.card.hit { animation: shake .3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.card.lunge { animation: lunge .3s; }
@keyframes lunge { 50% { transform: translate(12px, -10px) scale(1.05); } }
.card.enemy.lunge { animation: lungeDown .3s; }
@keyframes lungeDown { 50% { transform: translate(-12px, 10px) scale(1.05); } }
.floater {
  position: absolute; left: 50%; top: 8%; transform: translateX(-50%);
  font-weight: bold; font-size: 16px; pointer-events: none; z-index: 5;
  text-shadow: 0 1px 3px #000; animation: floatUp .9s forwards; white-space: nowrap;
}
.floater.dmg { color: #ff8a80; }
.floater.crit { color: #ffd54f; font-size: 18px; }
.floater.heal { color: #7dffa8; }
.floater.buff { color: #ffd54f; font-size: 13px; }
.floater.poison { color: #b388ff; }
@keyframes floatUp { to { transform: translate(-50%, -44px); opacity: 0; } }
/* 特效浮字慢动画：数值上浮→淡出（比普攻快节奏稍慢，突出大招/治疗） */
.floater.fx-slow { font-size: 19px; text-shadow: 0 1px 4px #000, 0 0 8px currentColor; animation: floatUpSlow 1.35s forwards; }
@keyframes floatUpSlow {
  0% { opacity: 1; transform: translate(-50%, 0) scale(.6); }
  25% { opacity: 1; transform: translate(-50%, -18px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -58px) scale(1); }
}

/* ---------- 战斗特效（大招 / 灵兽 全屏） ---------- */
#screen-battle.fx-shake { animation: fxShake .32s; }
@keyframes fxShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
/* 全屏光效：覆盖层（#battle-fx）静态背景色 + 纯 opacity 脉冲
 * （opacity 在软渲染/硬渲染均可靠，弃用 box-shadow 内阴影——软件渲染下不重绘导致不可见） */
#battle-fx.fx-ult { background: radial-gradient(circle, rgba(255, 236, 180, .55) 0%, rgba(255, 200, 90, .32) 45%, rgba(255, 176, 64, .15) 100%); }
#battle-fx.fx-beast { background: radial-gradient(circle, rgba(190, 225, 255, .5) 0%, rgba(140, 190, 255, .3) 45%, rgba(120, 170, 255, .15) 100%); }
@keyframes fxUlt {
  0% { opacity: 0; }
  22% { opacity: 1; }
  55% { opacity: .55; }
  100% { opacity: 0; }
}
@keyframes fxBeast {
  0% { opacity: 0; }
  22% { opacity: .95; }
  55% { opacity: .5; }
  100% { opacity: 0; }
}

/* ---------- 技能栏 ---------- */
#skill-bar-wrap { background: #0006; border-top: 1px solid #ffffff14; padding: 8px 14px 12px; min-height: 118px; }
#actor-label { font-size: 13px; color: var(--gold); margin-bottom: 6px; min-height: 18px; }
#skill-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.skill-btn {
  min-width: 150px; max-width: 210px; text-align: left;
  background: linear-gradient(180deg, #3a2d5c, #2a2145);
  border: 1px solid #7a6aa8; color: var(--text); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-family: inherit;
}
.skill-btn:hover:not(:disabled) { border-color: var(--gold); }
.skill-btn:disabled { opacity: .45; cursor: not-allowed; }
.skill-btn .s-icon { margin-right: 4px; font-size: 15px; }
.skill-btn .s-name { font-weight: bold; font-size: 14px; }
.skill-btn .s-desc { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; }
.skill-btn .s-cd { display: block; font-size: 11px; color: #ff8a80; margin-top: 2px; }
.skill-btn.pending { border-color: #ff5252; box-shadow: 0 0 10px #ff525288; }
#targeting-hint { color: #ff8a80; font-size: 12px; margin-top: 6px; min-height: 16px; }

/* ---------- 弹层 ---------- */
#overlay { position: fixed; inset: 0; background: #000a; z-index: 50; overflow-y: auto; }
.overlay-box {
  background: linear-gradient(180deg, #2b2140, #1c1730);
  border: 1px solid var(--gold); border-radius: 14px;
  padding: 28px 36px; max-width: 500px; width: 92%; text-align: center;
  margin: 4vh auto; /* 普通文档流：水平居中 + 顶部留白；内容超高时 #overlay 整体滚动，头尾/按钮区必可见（火狐/Chrome 通用） */
}
.overlay-box h2 { color: var(--gold); font-size: 28px; margin-bottom: 12px; }
.o-lines { text-align: left; font-size: 14px; line-height: 2; color: #d8d0ec; margin-bottom: 18px; }
.o-name { margin: 0 0 18px; }
.o-name input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; text-align: center;
  background: #16121f; color: var(--gold); border: 1px solid #5a4a80; border-radius: 10px;
  font-size: 17px; letter-spacing: 1px; outline: none;
}
.o-name input:focus { border-color: var(--gold); }
/* 大乱斗「正在组队的队伍」：按房主名号 / 房间号搜索（输入框 + 搜索按钮同排） */
.o-search { display: flex; gap: 8px; align-items: stretch; margin: 0 0 12px; }
.o-search input {
  flex: 1; min-width: 0; box-sizing: border-box; padding: 8px 12px;
  background: #16121f; color: var(--gold); border: 1px solid #5a4a80; border-radius: 10px;
  font-size: 15px; letter-spacing: 1px; outline: none;
}
.o-search input:focus { border-color: var(--gold); }
.o-search .btn { flex: none; }
.o-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.o-count { font-size: 13px; color: #8fd0ff; margin: -6px 0 14px; }
.o-count.warn { color: #ffb300; }
.o-btns .autonext-btn { opacity: .9; }
.o-btns .autonext-btn.off { opacity: .45; }
/* 帮助面板：内容区自带限高滚动（不依赖外层弹性收缩，滚动位置始终从顶部开始） */
.help-scroll {
  overflow-y: auto; text-align: left; font-size: 14px; line-height: 1.9;
  color: #d8d0ec; margin-bottom: 10px; padding: 0 8px 0 2px;
  max-height: 60vh; min-height: 160px;
}
.help-scroll::-webkit-scrollbar { width: 8px; }
.help-scroll::-webkit-scrollbar-thumb { background: #5a4a8a; border-radius: 4px; }
.help-group { color: var(--gold); font-weight: bold; font-size: 15px; margin: 12px 0 4px; }
.help-group:first-child { margin-top: 0; }
.help-item { margin-bottom: 6px; }
/* 云备份恢复码（长串可折行；点击即复制 → 手指/指针样式 + 虚线底边提示可点） */
.cloud-code {
  font-family: Consolas, Menlo, monospace; color: var(--gold); overflow-wrap: anywhere;
  cursor: pointer; user-select: all; -webkit-user-select: all;
  border-bottom: 1px dashed rgba(255, 215, 120, .55); padding-bottom: 1px;
}
.cloud-code:hover { border-bottom-color: var(--gold); }
.cloud-code:active { opacity: .55; }
/* 更新日志 */
.cl-entry { margin-bottom: 16px; }
.cl-entry:last-child { margin-bottom: 0; }
.cl-head { color: var(--gold); font-weight: bold; font-size: 15px; margin-bottom: 4px; }

/* ---------- 升星（召唤重复英雄攒材料晋级） ---------- */
.h-stage { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #c8b88f; margin-top: 4px; flex-wrap: wrap; overflow-wrap: anywhere; }
.h-lack { color: #ff9b8a; font-size: 11px; }

/* ---------- 响应式适配 ---------- */
/* 宽屏（≥1081 且够高）：主菜单卡片与按钮适度放大，避免大屏上又小又空；
   加高度条件是因为放大后卡片约 730px 高，矮屏（如 1366×768）会溢出被 Tab 遮挡 */
@media (min-width: 1081px) and (min-height: 850px) {
  .menu-box { padding: 44px 76px; }
  .logo { font-size: 76px; }
  .menu-box h1 { font-size: 52px; }
  .subtitle { font-size: 15px; }
  .menu-stats { font-size: 16px; gap: 10px 34px; }
  .menu-btns { width: 300px; gap: 14px; }
  .menu-btns .btn { padding: 13px 20px; font-size: 16px; }
  .menu-tip { font-size: 14px; }
}
/* 中屏（≤1080）：战斗日志下沉到底部，战场全宽 */
@media (max-width: 1080px) {
  #battle-inner { grid-template-columns: 1fr; }
  #log-panel { max-height: 100px; }
}
/* 小屏（≤720）：卡片缩小、面板收紧 */
@media (max-width: 720px) {
  .card { width: 96px; padding: 6px; }
  .card .portrait { font-size: 30px; }
  .card.boss { width: 110px; }
  /* 小屏战斗卡精简：隐藏职业/星级/等阶，仅留名称·等级·血条·能量·状态，缩短卡高 */
  .card .ccls, .card .cstar, .card .casc { display: none; }
  #log-panel { max-height: 76px; }
  .menu-box { padding: 18px 14px; } /* 保留 margin:auto 垂直居中（勿加 margin 覆盖） */
  .logo { font-size: 48px; }
  .menu-stats { font-size: 14px; }
  .hero-grid { padding: 10px 10px; gap: 10px; }
  .filter-bar, .bond-panel { padding-left: 10px; padding-right: 10px; }
  .stage-list { padding: 10px 10px 24px; }
  .chapter-ops { padding: 4px 10px 24px; }
  .page-head { padding: 14px 12px 4px; }
  .page-foot { padding: 10px 12px 16px; }
  .h-icon { font-size: 38px; }
  .skill-btn { min-width: 130px; }
  #skill-bar-wrap { min-height: 108px; }
}
/* 窄屏（≤480）：扫荡/塔行竖排，避免按钮与奖励互相挤压 */
@media (max-width: 480px) {
  .overlay-box { padding: 20px 16px; }
  .overlay-box h2 { font-size: 22px; margin-bottom: 8px; }
  .btn { padding: 8px 13px; font-size: 14px; }
  .stage-btn { padding: 10px 12px; }
  .menu-tabs { padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .menu-tabs .tab-btn { flex: 1 1 0; font-size: 12px; padding: 8px 2px; }
  #screen-menu { padding-bottom: calc(60px + env(safe-area-inset-bottom)); } /* Tab 变小，避让高度同步收紧 */
  .battle-top { padding: 6px 8px; }
  #round-label { font-size: 14px; }
  .stage-label { font-size: 12px; }
  #log-panel { max-height: 56px; }
  .field-row { gap: 8px; min-height: 96px; }
  .sweep-row { flex-direction: column; align-items: stretch; }
  .sweep-reward { white-space: normal; }
  .sweep-btns { justify-content: center; }
  .task-row { flex-wrap: wrap; }
  .skill-btn { min-width: 100px; }
}

/* =====================================================
   西游战记 —— 能量 / 星级样式
   ===================================================== */

/* ---------- 卡牌能量条 ---------- */
.enbar {
  position: relative; height: 9px; background: #0008;
  border-radius: 5px; margin-top: 3px; overflow: hidden;
}
.enfill {
  height: 100%; background: linear-gradient(90deg, #e8b93c, #ffd54f);
  transition: width .25s;
}
.entext {
  position: absolute; inset: 0; font-size: 9px; line-height: 9px;
  color: #fff; text-shadow: 0 1px 2px #000; text-align: center;
}
/* 满能量：卡牌金边闪光 */
.card.en-full { box-shadow: 0 0 0 2px var(--gold), 0 0 16px #e8b93caa; animation: enFull 1.2s infinite; }
@keyframes enFull {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 10px #e8b93c88; }
  50% { box-shadow: 0 0 0 2px #fff2c9, 0 0 22px #ffd54f; }
}

/* ---------- 大招按钮 ---------- */
.skill-btn.ult { border-color: #c9962e; background: linear-gradient(180deg, #4a3a1e, #33270f); }
.skill-btn .s-en { display: block; font-size: 11px; color: #ffd54f; margin-top: 2px; }
/* 能量满 + 冷却完：大招可释放高亮 */
.skill-btn.ult.ready {
  border-color: var(--gold); color: #fff;
  background: linear-gradient(180deg, #6b5418, #4a3a10);
  animation: ultReady 1.4s infinite;
}
@keyframes ultReady {
  0%, 100% { box-shadow: 0 0 6px #e8b93c66; }
  50% { box-shadow: 0 0 18px #ffd54fcc, inset 0 0 8px #ffd54f33; }
}

/* ---------- 星级角标 ---------- */
.h-stars {
  margin-top: 4px; font-size: 13px; letter-spacing: 2px;
  color: var(--sc, #9e9e9e); font-weight: bold;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0;
}
.h-star-name {
  font-size: 10px; color: #000; background: var(--sc, #9e9e9e);
  padding: 1px 7px; border-radius: 8px; font-weight: bold; letter-spacing: 0;
}
/* 🌙/☀ 档单颗月亮/太阳徽章 */
.h-moon {
  font-size: 18px; line-height: 1;
  background: radial-gradient(circle at 50% 35%, #6b84ff55, #2a3a7a88);
  border: 1px solid #8faeff; border-radius: 50%;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 10px #8faeff66;
}
/* 大招技能芯片高亮 */
.chip-ult { border-color: #c9962e; color: #ffd54f; background: #4a3a1e; }

/* =====================================================
   西游战记 —— 玩家等级 / 抽卡 / 剧情 / 过滤样式
   ===================================================== */

/* ---------- 玩家经验条 ---------- */
.menu-xp {
  position: relative; width: min(250px, 78vw); height: 16px;
  background: #0008; border: 1px solid #ffffff22; border-radius: 8px;
  margin: -10px auto 18px; overflow: hidden; text-align: center;
}
.xpfill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #4a9de0, #7fd4ff);
  transition: width .3s;
}
#menu-xp-text {
  position: absolute; inset: 0; font-size: 11px; line-height: 16px;
  color: #fff; text-shadow: 0 1px 2px #000; font-weight: bold;
}

/* ---------- 编队过滤条 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 22px 2px;
}
.f-label { color: var(--dim); font-size: 12px; margin-right: 2px; }
.f-select {
  background: #0006; color: var(--text); border: 1px solid #ffffff22;
  border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer;
  font-family: inherit; max-width: 130px;
}
.f-select:focus { border-color: var(--gold); outline: none; }
.f-select option { background: #221a30; color: var(--text); }
.f-select option:disabled { color: var(--dim); }

/* ---------- 种族羁绊面板 ---------- */
.bond-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 6px 22px 4px; font-size: 12px;
}
.bond-title { color: var(--gold); font-weight: bold; margin-right: 2px; }
.bond-toggle {
  background: transparent; color: var(--dim); border: none;
  font-size: 12px; cursor: pointer; font-family: inherit; padding: 0;
}
.bond-toggle:hover { color: var(--gold); }
.bond-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: #cfc6e8; }
.bond-sum { display: inline-flex; align-items: center; gap: 4px; }
.bond-race { display: flex; align-items: center; gap: 4px; color: #cfc6e8; }
.bond-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--fc, #fff); box-shadow: 0 0 4px var(--fc, #fff);
}
.bond-n { color: var(--dim); }
.bond-row {
  background: #0006; border: 1px solid #ffffff22; border-radius: 10px;
  padding: 2px 8px; color: #cfc6e8;
}
.bond-row.on {
  border-color: var(--fc, var(--gold)); color: #fff;
  background: #000a; box-shadow: 0 0 6px #0008;
}
.bond-row.dim { opacity: .45; }

/* ---------- 每日任务 ---------- */
.task-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: #0005; border: 1px solid #ffffff14; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 6px; text-align: left;
}
.task-row.done { border-color: #4caf50; box-shadow: 0 0 6px #4caf5044; }
.task-row.claimed { opacity: .5; }
.task-name { flex: 1; }
.task-reward { color: #ffd54f; white-space: nowrap; }
.task-state { color: #8bc34a; font-size: 12px; white-space: nowrap; }

/* ---------- 每日答题 ---------- */
.quiz-q {
  font-size: 15px; font-weight: bold; color: #fff;
  margin-bottom: 10px; text-align: left; line-height: 1.5;
}
.quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.quiz-opt {
  background: #0006; border: 1px solid #ffffff22; color: #cfc6e8;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
  cursor: pointer; font-family: inherit; text-align: left;
}
.quiz-opt:hover { border-color: var(--gold); color: #fff; }
.quiz-opts + .o-btns { margin-top: 14px; } /* 选项下方的「关闭」出口 */
.quiz-ans { display: block; font-size: 13px; line-height: 1.7; text-align: left; }
.quiz-ans.right { color: #8bc34a; }
.quiz-ans.wrong { color: #e05252; }

/* ---------- 未拥有英雄 ---------- */
.hero-card.locked { opacity: .38; filter: grayscale(.7); cursor: not-allowed; }
.hero-card.locked:hover { transform: none; }
.h-lock { font-size: 12px; }

/* ---------- 剧情对话 ---------- */
.story-dlg {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  background: #0005; border: 1px solid #ffffff14; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 18px;
  animation: storyIn .25s ease;
}
@keyframes storyIn { from { opacity: 0; transform: translateY(8px); } }
.story-avatar { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 4px #000a); }
.story-who { color: var(--gold); font-weight: bold; margin-bottom: 4px; }
.story-line { color: #e8e2f2; line-height: 1.7; font-size: 14px; }

/* ---------- 抽卡结果 ---------- */
.gacha-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(92px, 100%), 1fr));
  gap: 10px; margin: 6px 0 16px;
}
.gacha-card {
  background: linear-gradient(180deg, #2b2140, #1c1730);
  border: 2px solid var(--cc, var(--sc, #555)); border-radius: 10px;
  padding: 10px 6px; text-align: center;
  animation: gachaIn .4s both;
  cursor: pointer; transition: transform .15s;
}
.gacha-card:hover { transform: translateY(-3px); }
.gacha-card.new { box-shadow: 0 0 14px var(--sc); animation: gachaNew .9s both; }
@keyframes gachaIn { from { transform: scale(.5); opacity: 0; } }
@keyframes gachaNew {
  0% { transform: scale(.6); opacity: 0; }
  40% { transform: scale(1.1); box-shadow: 0 0 24px var(--sc); }
  100% { transform: scale(1); box-shadow: 0 0 14px var(--sc); }
}
.gacha-card .g-icon { font-size: 32px; line-height: 1.2; }
.gacha-card .g-name { font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gacha-card .g-star { font-size: 11px; color: var(--sc); font-weight: bold; letter-spacing: 1px; }
/* 助战挑选迷你卡：品质标签（稀有/史诗/传说 + SR/SSR/SP，口径 = 编队页星级徽章下的稀有度标签，随初始星级固定） */
.gacha-card .g-qual { font-size: 10px; margin-top: 2px; color: #c8b88f; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gacha-card .g-tag { font-size: 10px; margin-top: 4px; color: var(--dim); }
.gacha-card .g-tag.new { color: var(--gold); font-weight: bold; }
.gacha-card.dup { opacity: .72; }
.gacha-card.star1 { --sc: #9e9e9e; }
.gacha-card.star2 { --sc: #4caf50; }
.gacha-card.star3 { --sc: #2196f3; }
.gacha-card.star4 { --sc: #9c27b0; }
.gacha-card.star5 { --sc: #ffb300; }
.gacha-card .g-tag.first { color: #ffd54f; font-weight: bold; }

/* ---------- 助战挑选 ---------- */
.pick-cards { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 6px 0 2px; }
.pick-cards .gacha-card { width: 108px; }
/* 助战候选来源标签（好友名）：紧凑单行，窄屏可折行不溢出 */
.pick-cards .g-tag.friend-src { font-size: 10px; margin-top: 4px; color: #8d6e63; white-space: normal; word-break: break-all; overflow-wrap: anywhere; line-height: 1.25; }
.gacha-card.selected { box-shadow: 0 0 0 3px var(--gold), 0 6px 18px #0008; transform: translateY(-3px); }
.pick-preview {
  background: #0006; border: 1px solid #ffffff22; border-radius: 10px;
  margin: 8px 0 2px; padding: 10px 12px; font-size: 13px; line-height: 1.7;
}
.pick-preview .o-btns { margin-top: 8px; }
.pick-preview .src-line { font-size: 12px; color: #8d6e63; margin-top: 2px; }

/* ---------- 英雄详情 ---------- */
.d-skills { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; max-height: 46vh; overflow-y: auto; }
.d-skill {
  display: flex; gap: 10px; align-items: flex-start;
  background: #221a36; border: 1px solid #3a2f5a; border-radius: 8px; padding: 8px 10px;
}
.d-s-icon { font-size: 22px; line-height: 1.3; }
.d-s-body { flex: 1; min-width: 0; }
.d-s-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.d-s-tag { font-size: 10px; color: #cfc4ea; background: #312751; border-radius: 4px; padding: 1px 6px; }
.d-s-tag.ult { color: #ffd54f; background: #4d3a12; font-weight: bold; }
.d-s-tag.cd { color: var(--dim); background: #262038; }
.d-s-desc { font-size: 12px; color: var(--dim); margin-top: 2px; }
.d-desc { color: var(--dim); font-style: italic; }

/* ---------- 编队引导（强制入队） ---------- */
.hero-card.suggest {
  box-shadow: 0 0 0 3px #ffd54f, 0 0 22px #ffd54f88;
  animation: suggestPulse 1s infinite;
}
@keyframes suggestPulse {
  0%, 100% { box-shadow: 0 0 0 3px #ffd54f, 0 0 12px #ffd54f66; }
  50% { box-shadow: 0 0 0 4px #fff2c9, 0 0 24px #ffd54f; }
}
.h-suggest {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #ffd54f, #c9962e); color: #000;
  font-size: 11px; font-weight: bold; border-radius: 8px;
  padding: 2px 10px; white-space: nowrap; z-index: 2;
  box-shadow: 0 2px 6px #0008;
}
.hero-card { position: relative; }
