/* ===== 秘境远征 H5 —— 样式（移植自小程序 WXSS，rpx→px 按 1rpx=0.5px 换算） ===== */

/* ---- 基础与外框（对应 app.wxss 的 page 选择器） ---- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: #0b0817;
  color: #e8e4f2;
  font-size: 14px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: #171226;
  position: relative;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
}
.page { min-height: 100dvh; }
.tab-page { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.page-body { padding: 10px 12px 30px; }

/* ---- H5 顶部导航（替代小程序系统导航栏） ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 8px;
  background: #1d1730;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 1;
  color: #ffd76e;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.nav-back:active { background: rgba(255, 255, 255, 0.08); }
.nav-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; color: #f0ecfa; }
.nav-ghost { width: 36px; }

/* ---- H5 底部标签栏（对应 app.json tabBar） ---- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  display: flex;
  background: #1d1730;
  border-top: 1px solid #000;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 70;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0 6px;
  font-size: 18px;
  color: #8f8aa3;
  cursor: pointer;
  user-select: none;
}
.tab-item span { font-size: 11px; }
.tab-item.on { color: #ffd76e; }

/* ---- H5 轻提示（对应 wx.showToast icon:none） ---- */
.toast {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  background: rgba(20, 14, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e8e4f2;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ---- H5 对话框（对应 wx.showModal） ---- */
.modal-popup { width: 310px; text-align: center; }
.modal-title { font-size: 17px; font-weight: 700; color: #ffe9b8; margin-bottom: 12px; }
.modal-content { font-size: 14px; color: #b9b2cf; margin-bottom: 22px; white-space: pre-line; }
.modal-btns { display: flex; gap: 14px; }
.modal-btns .btn { flex: 1; }

/* ===== 通用设计系统（app.wxss） ===== */
.panel {
  background: rgba(38, 29, 62, 0.72);
  border: 1px solid rgba(255, 215, 110, 0.14);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #2b2246, #3a2c5e);
  color: #d8d2ea;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.08s ease, opacity 0.2s;
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(135deg, #ffd76e, #f0a13a);
  color: #402a08;
  border: none;
  box-shadow: 0 3px 10px rgba(240, 161, 58, 0.35);
}
.btn.danger {
  background: linear-gradient(135deg, #ff7a6e, #e0473f);
  color: #fff;
  border: none;
}
.btn.ghost { background: rgba(255, 255, 255, 0.08); }
.btn.disabled { opacity: 0.4; pointer-events: none; }
.btn.sm { padding: 6px 13px; font-size: 13px; border-radius: 17px; }

.res-bar { display: flex; align-items: center; gap: 7px; }
.chip {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  padding: 4px 9px;
  font-size: 12px;
  color: #ffe9b8;
  white-space: nowrap;
}

/* 品质体系 */
.r0 { --rq: #b8bcc4; }
.r1 { --rq: #57d364; }
.r2 { --rq: #3aa3ff; }
.r3 { --rq: #c06cff; }
.r4 { --rq: #ff9a2e; }

/* 弹窗 */
.mask {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(8, 5, 16, 0.78);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup {
  width: 310px;
  max-height: 80vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #2b2248, #201838);
  border: 1px solid rgba(255, 215, 110, 0.25);
  border-radius: 14px;
  padding: 18px 16px;
  animation: popIn 0.25s ease;
}

/* 动画 */
@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.7); opacity: 0; }
  15% { transform: translateY(-5px) scale(1.15); opacity: 1; }
  100% { transform: translateY(-60px) scale(1); opacity: 0; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 杂项 */
.divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 10px 0; }
.tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  color: #b9b2cf;
}

/* ===== 卡牌组件（components/card） ===== */
.bcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(170deg, #322852, #241c3e);
  border: 1px solid var(--rq, #b8bcc4);
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  box-sizing: border-box;
  transition: transform 0.12s ease, opacity 0.2s;
}
.bcard.battle.md { width: 86px; min-height: 116px; padding: 7px 5px 6px; }
.bcard.battle.md .emoji { font-size: 28px; margin-top: 4px; }
.bcard.battle.md .name { font-size: 12px; margin-top: 2px; }
.bcard.battle.md .desc { font-size: 9px; line-height: 1.35; margin-top: 3px; min-height: 37px; }
.bcard.battle.sm { width: 70px; min-height: 98px; padding: 5px 4px; }
.bcard.battle.sm .emoji { font-size: 22px; }
.bcard.battle.sm .name { font-size: 10.5px; }
.bcard.battle.sm .desc { font-size: 8px; }

.bcard.collect.sm { width: 79px; height: 100px; padding: 6px 4px; }
.bcard.collect.md { width: 100px; height: 125px; padding: 8px 5px; }
.bcard.collect .emoji { font-size: 31px; margin-top: 5px; }
.bcard.collect .name { font-size: 12px; margin-top: 4px; font-weight: 600; }

.cost {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 22px;
  height: 22px;
  border-radius: 0 0 9px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 2;
}
.cost.ok { background: linear-gradient(135deg, #6ee7ff, #3a7bff); color: #062038; }
.cost.no { background: #55506a; color: #b9b2cf; }

.emoji { line-height: 1.2; }
.name {
  color: #f0ecfa;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92%;
}
.desc { color: #b9b2cf; text-align: center; }
.badges {
  position: absolute;
  top: 3px;
  right: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.unaffordable { opacity: 0.55; filter: grayscale(0.5); }
.dim { opacity: 0.45; filter: grayscale(0.8); }
.hand-item .bcard.battle.md:active { transform: translateY(-6px) scale(1.04); }

/* ===== 英雄面板组件（components/hero-panel） ===== */
.panel-hero {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(20, 14, 38, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.panel-hero.active {
  border-color: rgba(255, 215, 110, 0.55);
  box-shadow: 0 0 24px rgba(255, 200, 90, 0.18);
}
.avatar-wrap { position: relative; }
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4d3d78, #241c3e);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
/* 三档交替类名，保证连续受击（含一次+2的多段伤）都能重触发动画 */
.avatar.shake-0 { animation: shake 0.4s ease; }
.avatar.shake-1 { animation: shake 0.4s ease; }
.avatar.shake-2 { animation: shake 0.4s ease; }
.block-chip {
  position: absolute;
  right: -7px;
  bottom: -3px;
  background: #3d4f8a;
  border: 1px solid #8fb0ff;
  color: #dbe7ff;
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 5px;
  font-weight: 700;
}
.panel-hero .info { flex: 1; min-width: 0; }
.top-row { display: flex; justify-content: space-between; align-items: center; }
.hname { font-size: 13px; font-weight: 600; color: #f0ecfa; }
.counts { display: flex; gap: 5px; }
.mini { font-size: 10px; color: #9d96b8; }
.hpbar {
  position: relative;
  height: 13px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 7px;
  margin: 4px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hpfill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, #ff5c5c, #ff8a5c);
  transition: width 0.35s ease;
}
.panel-hero.player .hpfill { background: linear-gradient(90deg, #4cd97b, #a8e063); }
.hptext {
  position: absolute;
  width: 100%;
  text-align: center;
  font-size: 9px;
  line-height: 13px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.bottom-row { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.orb-row { display: flex; gap: 3px; flex-wrap: nowrap; }
.orb {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.orb.lit {
  background: radial-gradient(circle at 35% 35%, #bfe9ff, #3aa3ff);
  border-color: #7cc4ff;
  box-shadow: 0 0 4px rgba(90, 180, 255, 0.8);
}
.buffs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.buff {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 1px 4px;
  color: #e8e4f2;
}
/* 敌方面板镜像：头像在右 */
.panel-hero.enemy { flex-direction: row-reverse; }
.panel-hero.enemy .top-row { flex-direction: row-reverse; }
.panel-hero.enemy .bottom-row { flex-direction: row-reverse; }

/* ===== 主城页（pages/home） ===== */
.home {
  min-height: 100%;
  padding: 10px 12px 20px;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 0%, #2b2050 0%, #171226 55%);
}
.res-bar.wrap { justify-content: flex-start; flex-wrap: wrap; }
.title-banner { text-align: center; margin: 15px 0 13px; }
.game-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #ffe9b8, #f0a13a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.game-sub { font-size: 10px; color: #8f8aa3; letter-spacing: 3px; margin-top: 3px; }
.team-card { display: flex; align-items: center; gap: 12px; }
.team-emoji { font-size: 32px; letter-spacing: 3px; }
.team-name { font-size: 16px; font-weight: 700; color: #f0ecfa; }
.team-power { font-size: 13px; color: #b9b2cf; margin: 4px 0 2px; }
.power-num { color: #ffd76e; font-weight: 800; font-size: 15px; }
.team-progress { font-size: 11px; color: #8f8aa3; }
.daily {
  position: relative;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.daily.glow { border-color: rgba(255, 215, 110, 0.5); animation: pulse 2s infinite; }
.daily-title { font-size: 15px; font-weight: 700; color: #ffe9b8; }
.daily-desc { font-size: 11px; color: #8f8aa3; }
.dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5c5c;
  box-shadow: 0 0 6px rgba(255, 92, 92, 0.8);
}
.entry-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.entry {
  width: calc(50% - 5px);
  box-sizing: border-box;
  background: rgba(38, 29, 62, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px 13px;
  transition: transform 0.1s;
  cursor: pointer;
}
.entry:active { transform: scale(0.97); }
.entry.main {
  background: linear-gradient(135deg, rgba(240, 161, 58, 0.25), rgba(38, 29, 62, 0.72));
  border-color: rgba(240, 161, 58, 0.5);
}
.entry.gacha {
  background: linear-gradient(135deg, rgba(192, 108, 255, 0.22), rgba(38, 29, 62, 0.72));
  border-color: rgba(192, 108, 255, 0.45);
}
.entry-emoji { font-size: 28px; }
.entry-name { font-size: 16px; font-weight: 700; margin-top: 6px; color: #f0ecfa; }
.entry-sub { font-size: 11px; color: #8f8aa3; margin-top: 3px; }

/* ===== 冒险关卡页（pages/campaign） ===== */
.campaign-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.head-title-xl { font-size: 17px; font-weight: 800; color: #45e6ff; letter-spacing: 2px; }
.head-power { font-size: 12px; color: #8fb3d9; }
.pnum { color: #45e6ff; font-weight: 800; font-size: 15px; }
.team-page .pnum { color: #ffd76e; }

.chapter { margin-bottom: 17px; }
.chapter.locked { opacity: 0.5; }
.ch-head { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.ch-emoji {
  font-size: 26px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, rgba(20, 32, 64, 0.9), rgba(10, 16, 34, 0.8));
  border: 1px solid rgba(69, 230, 255, 0.25);
  border-radius: 3px;
}
.ch-info { flex: 1; }
.ch-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.ch-desc { font-size: 11px; color: #5f7ba3; margin-top: 2px; }
.ch-progress { font-size: 13px; color: #45e6ff; font-weight: 700; }

.lv-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.lv-node {
  position: relative;
  width: calc(33.33% - 6px);
  box-sizing: border-box;
  background: linear-gradient(160deg, rgba(20, 32, 64, 0.85), rgba(10, 16, 34, 0.75));
  border: 1px solid rgba(69, 230, 255, 0.14);
  border-radius: 3px;
  padding: 10px 5px 7px;
  text-align: center;
  transition: transform 0.1s, box-shadow 0.2s;
  cursor: pointer;
}
.lv-node:active { transform: scale(0.96); box-shadow: 0 0 10px rgba(45, 217, 255, 0.25); }
.lv-node.locked { opacity: 0.45; }
.lv-node.boss {
  width: calc(66.66% - 4px);
  background: linear-gradient(135deg, rgba(224, 71, 63, 0.2), rgba(16, 26, 52, 0.88));
  border-color: rgba(255, 110, 110, 0.45);
}
.lv-emoji { font-size: 26px; }
.lv-name {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lv-stars { font-size: 9px; letter-spacing: 1px; margin-top: 1px; }
.lv-rec { font-size: 10px; margin-top: 3px; }
.lv-rec.ok { color: #3ce08d; }
.lv-rec.warn { color: #ff8a8a; }
.footer-tip { text-align: center; color: #46587a; font-size: 12px; margin-top: 5px; letter-spacing: 2px; }

/* 无尽回廊 */
.endless {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(45, 217, 255, 0.12), rgba(16, 26, 52, 0.9));
  border-color: rgba(45, 217, 255, 0.45);
  transition: transform 0.1s;
  cursor: pointer;
}
.endless:active { transform: scale(0.98); }
.endless-emoji {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px;
}
.endless-info { flex: 1; min-width: 0; }
.endless-title { font-size: 15px; font-weight: 700; color: #9fe8ff; letter-spacing: 1px; }
.endless-sub { font-size: 11px; color: #5f7ba3; margin-top: 3px; }
.endless-arrow { font-size: 12px; font-weight: 700; border-radius: 3px; padding: 4px 10px; white-space: nowrap; }
.endless-arrow.ok { color: #041220; background: linear-gradient(135deg, #2dd9ff, #3d7bff); }
.endless-arrow.warn { color: #ff8a8a; border: 1px solid rgba(255, 110, 110, 0.5); }
.endless-locked { font-size: 12px; color: #46587a; text-align: center; }

/* ===== 阵容页（pages/team） ===== */
.team-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.stat-panel { display: flex; justify-content: space-around; margin-bottom: 10px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.stat-num { font-size: 15px; font-weight: 700; color: #f0ecfa; }
.stat-label { font-size: 11px; color: #8f8aa3; }
.slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(38, 29, 62, 0.72);
  border: 1px solid var(--rq, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  padding: 10px 11px;
  transition: transform 0.1s;
  cursor: pointer;
}
.slot:active { transform: scale(0.98); }
.slot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 11px;
  background: radial-gradient(circle at 35% 30%, #4d3d78, #241c3e);
  border: 1px solid var(--rq, rgba(255, 255, 255, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.slot-avatar.empty { opacity: 0.6; }
.slot-info { flex: 1; min-width: 0; }
.slot-label { font-size: 11px; color: #8f8aa3; }
.slot-name { font-size: 15px; font-weight: 700; margin-top: 2px; }
.slot-sub { font-size: 11px; color: #8f8aa3; margin-top: 2px; }
.slot-stats { font-size: 11px; color: #b9b2cf; margin-top: 2px; }
.slot-arrow { font-size: 20px; color: #6f6987; }
.deck-panel { margin-top: 12px; }
.deck-title { font-size: 14px; font-weight: 700; }
.deck-hint { font-size: 10px; color: #8f8aa3; margin: 3px 0 8px; }
.deck-scroll { width: 100%; overflow-x: auto; white-space: nowrap; }
.deck-row { display: inline-flex; gap: 7px; padding: 3px 1px 5px; }
.deck-item { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.deck-count { font-size: 11px; color: #ffd76e; font-weight: 700; }
.picker-popup { display: flex; flex-direction: column; max-height: 76vh; }
.picker-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.picker-list { max-height: 52vh; overflow-y: auto; }
.picker-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--rq, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  padding: 8px 9px;
  margin-bottom: 7px;
  cursor: pointer;
}
.picker-row:active { background: rgba(255, 255, 255, 0.07); }
.picker-emoji {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: radial-gradient(circle at 35% 30%, #4d3d78, #241c3e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.picker-info { flex: 1; min-width: 0; }
.picker-name { font-size: 14px; font-weight: 600; }
.picker-sub { font-size: 11px; color: #8f8aa3; margin-top: 2px; }
.picker-stats { font-size: 11px; color: #b9b2cf; margin-top: 1px; }
.equipped-tag {
  font-size: 10px;
  color: #ffd76e;
  border: 1px solid rgba(255, 215, 110, 0.5);
  border-radius: 7px;
  padding: 2px 6px;
  white-space: nowrap;
}
.picker-btns { display: flex; gap: 8px; justify-content: center; margin-top: 5px; }

/* ===== 图鉴页（pages/collection） ===== */
.coll-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.coll-head .head-title-xl { color: #ffd76e; }
.head-sub { font-size: 12px; color: #b9b2cf; }
.tab-bar { display: flex; gap: 6px; margin-bottom: 11px; }
.tab {
  padding: 5px 14px;
  border-radius: 15px;
  font-size: 13px;
  color: #9d96b8;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  user-select: none;
}
.tab.on {
  color: #402a08;
  font-weight: 700;
  background: linear-gradient(135deg, #ffd76e, #f0a13a);
  border-color: transparent;
}
.grid { display: flex; flex-wrap: wrap; gap: 9px; }
.grid-item {
  position: relative;
  width: calc(25% - 7px);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.badge.lv {
  font-size: 9px;
  color: #ffd76e;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 5px;
  padding: 1px 4px;
}
.count-tag {
  position: absolute;
  top: -4px;
  right: -2px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #e0473f;
  border-radius: 8px;
  padding: 1px 5px;
  z-index: 3;
}
.lock-tag { margin-top: 3px; font-size: 10px; color: #6f6987; }
.type-tag { margin-top: 3px; font-size: 10px; color: #8f8aa3; }

/* ===== 卡牌详情页（pages/card-detail） ===== */
.detail { padding-bottom: 10px; }
.hero-card {
  background: linear-gradient(170deg, #322852, #241c3e);
  border: 2px solid var(--rq, #b8bcc4);
  border-radius: 13px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  padding: 23px 15px 18px;
  text-align: center;
  margin-bottom: 12px;
}
.hero-emoji { font-size: 60px; }
.hero-name { font-size: 20px; font-weight: 800; margin-top: 7px; }
.hero-rarity { font-size: 12px; color: var(--rq, #b9b2cf); margin-top: 4px; }
.hero-lv { font-size: 13px; color: #ffd76e; margin-top: 4px; font-weight: 700; }
.hero-desc { font-size: 12px; color: #b9b2cf; margin-top: 7px; }
.detail .panel { margin-bottom: 11px; }
.panel-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.stat-row { display: flex; justify-content: space-between; gap: 6px; }
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 9px 4px;
}
.s-label { font-size: 11px; color: #8f8aa3; }
.s-val { font-size: 16px; font-weight: 800; color: #f0ecfa; }
.s-next { font-size: 11px; color: #6ee78a; }
.skill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--rq, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  padding: 7px 8px;
  margin-bottom: 6px;
}
.skill-cost {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6ee7ff, #3a7bff);
  color: #062038;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.skill-info { flex: 1; min-width: 0; }
.skill-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.skill-desc { font-size: 11px; color: #9d96b8; margin-top: 2px; }
.up-cost { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cost-chip {
  font-size: 12px;
  color: #ffe9b8;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 7px;
  padding: 3px 8px;
}
.star-tip { font-size: 11px; color: #8f8aa3; margin-bottom: 8px; }
.not-owned-tip { font-size: 13px; color: #b9b2cf; }
.gold-text { color: #ffd76e; }

/* ===== 抽卡页（pages/gacha） ===== */
.gacha-page {
  min-height: 100%;
  padding: 10px 12px 30px;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 0%, #341f4e 0%, #171226 60%);
}
.gacha-stage { text-align: center; padding: 25px 0 15px; }
.gacha-orb { font-size: 70px; animation: floatOrb 3s ease-in-out infinite; }
@keyframes floatOrb {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.gacha-title { font-size: 20px; font-weight: 800; color: #e8d5ff; margin-top: 8px; letter-spacing: 3px; }
.gacha-sub { font-size: 11px; color: #8f8aa3; margin-top: 5px; }
.pity-panel { display: flex; flex-direction: column; gap: 4px; margin-bottom: 13px; }
.pity-item { font-size: 12px; color: #b9b2cf; }
.pull-btns { display: flex; gap: 10px; margin-bottom: 13px; }
.pull { flex: 1; flex-direction: column; gap: 4px; padding: 14px 0; }
.pull.single { background: linear-gradient(135deg, #3a7bff, #6ee7ff); color: #fff; }
.pull.multi { background: linear-gradient(135deg, #ffd76e, #f0a13a); color: #402a08; }
.pull-name { font-size: 17px; font-weight: 800; }
.pull-cost { font-size: 11px; opacity: 0.85; }
.tips { display: flex; flex-direction: column; gap: 4px; }
.tip-line { font-size: 11px; color: #8f8aa3; }
.gacha-result-popup { width: 330px; }
.g-title { text-align: center; font-size: 17px; font-weight: 800; color: #ffd76e; margin-bottom: 12px; }
.g-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.g-cell {
  position: relative;
  width: 58px;
  height: 75px;
  border-radius: 7px;
  background: linear-gradient(170deg, #322852, #241c3e);
  border: 1px solid var(--rq, #b8bcc4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  animation: popIn 0.25s ease;
}
.g-cell.show.r4 { box-shadow: 0 0 12px rgba(255, 154, 46, 0.55); }
.g-cell.show.r3 { box-shadow: 0 0 9px rgba(192, 108, 255, 0.5); }
.g-back { font-size: 25px; opacity: 0.5; }
.g-emoji { font-size: 26px; }
.g-name {
  font-size: 10px;
  max-width: 52px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.new-tag {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e0473f;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 5px;
  padding: 1px 5px;
  animation: pulse 1.2s infinite;
}
.g-btns { display: flex; gap: 9px; margin-top: 15px; }
.g-btns .btn { flex: 1; }

/* ===== 战斗页（pages/battle） ===== */
.page-battle {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 6px 10px calc(env(safe-area-inset-bottom) + 6px);
}
.page-battle.theme-forest { background: linear-gradient(180deg, #1b2b1f, #171226 55%, #12181a); }
.page-battle.theme-crypt { background: linear-gradient(180deg, #1c1a2c, #171226 55%, #14101e); }
.page-battle.theme-wasteland { background: linear-gradient(180deg, #33200f, #171226 55%, #1c1410); }
.page-battle.theme-abyss { background: linear-gradient(180deg, #30101c, #171226 55%, #160a14); }
.page-battle.theme-endless { background: linear-gradient(180deg, #12203a, #171226 55%, #0d1626); }

/* 顶栏 */
.top-bar { display: flex; align-items: center; gap: 7px; padding: 3px 2px 6px; }
.battle-back {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  color: #ffd76e;
  cursor: pointer;
  user-select: none;
}
.lv-name { font-size: 15px; font-weight: 700; color: #ffd76e; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-num { font-size: 12px; color: #9d96b8; white-space: nowrap; }
.tool-btn {
  font-size: 11px;
  color: #d8d2ea;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  padding: 3px 9px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.tool-btn.warn { color: #ff9a9a; }

/* 英雄区 */
.zone { position: relative; }
.floats-layer {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 30px;
  z-index: 5;
  pointer-events: none;
}
.player-zone .floats-layer { top: auto; bottom: -2px; }
.float {
  position: absolute;
  font-size: 17px;
  font-weight: 800;
  animation: floatUp 1s ease forwards;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}
.float.dmg { color: #ff6b5c; }
.float.dot { color: #b96bff; }
.float.heal { color: #6ee78a; }
.float.blockf { color: #8fb0ff; font-size: 14px; }
.float.card { color: #ffe9b8; font-size: 13px; }

/* 中部 */
.field {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 60px;
}
.played-slot { min-height: 0; }
.played-card {
  position: relative;
  width: 110px;
  padding: 8px 7px 7px;
  box-sizing: border-box;
  text-align: center;
  background: linear-gradient(170deg, #3a2c5e, #241c3e);
  border: 1px solid var(--rq, #b8bcc4);
  border-radius: 9px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  z-index: 6;
  pointer-events: none;
}
.played-card.pc-0 { animation: cardIn 0.22s ease; }
.played-card.pc-1 { animation: cardIn 0.22s ease; }
@keyframes cardIn {
  from { transform: translateX(60px) scale(0.7); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
.pc-cost {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 20px;
  height: 20px;
  border-radius: 0 0 8px 0;
  background: linear-gradient(135deg, #ff8a9a, #e0473f);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pc-emoji { font-size: 32px; }
.pc-name { font-size: 13px; font-weight: 700; margin-top: 2px; }
.pc-desc { font-size: 9.5px; color: #b9b2cf; margin-top: 3px; line-height: 1.4; }
.banner {
  font-size: 17px;
  font-weight: 800;
  color: #ffd76e;
  text-shadow: 0 0 10px rgba(255, 200, 90, 0.5);
  animation: popIn 0.25s ease;
  letter-spacing: 2px;
}
.log-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0.75;
}
.log-line {
  font-size: 10px;
  color: #a49dc0;
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 手牌区 */
.hand-zone { margin-top: 5px; }
.hand-scroll { width: 100%; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.hand-scroll::-webkit-scrollbar { display: none; }
.hand-row { display: inline-flex; gap: 7px; padding: 4px 2px; }
.hand-item { display: inline-block; cursor: pointer; }
.hand-empty {
  display: inline-flex;
  align-items: center;
  height: 116px;
  color: #6f6987;
  font-size: 13px;
  padding: 0 15px;
}
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 3px;
}
.energy-text { font-size: 15px; font-weight: 800; color: #7cc4ff; }
.end-btn {
  padding: 8px 26px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 700;
  color: #402a08;
  background: linear-gradient(135deg, #ffd76e, #f0a13a);
  box-shadow: 0 3px 10px rgba(240, 161, 58, 0.4);
  transition: opacity 0.2s, transform 0.1s;
  cursor: pointer;
  user-select: none;
}
.end-btn:active { transform: scale(0.96); }
.end-btn.off { opacity: 0.35; pointer-events: none; }

/* 结算 */
.result-popup { text-align: center; }
.result-title { font-size: 22px; font-weight: 800; margin-bottom: 5px; }
.result-title.win { color: #ffd76e; text-shadow: 0 0 12px rgba(255, 200, 90, 0.45); }
.result-title.lose { color: #ff7a6e; }
.result-stars { font-size: 22px; margin-bottom: 8px; letter-spacing: 4px; }
.reward-list { display: flex; flex-direction: column; gap: 5px; margin: 5px 0; }
.reward-item {
  font-size: 14px;
  color: #ffe9b8;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 7px;
  padding: 5px 10px;
}
.first-clear { color: #ffd76e; font-size: 12px; margin-top: 3px; }
.repeat-tip { color: #8f8aa3; font-size: 11px; margin-top: 3px; }
.result-tip { color: #b9b2cf; font-size: 13px; margin: 10px 0; }
.result-btns { display: flex; gap: 10px; margin-top: 15px; }
.result-btns .btn { flex: 1; }
