:root {
  --bg: #0b0e14;
  --panel: #131a26;
  --panel2: #0f1522;
  --text: #e9eef7;
  --muted: #a9b3c7;
  --accent: #7c5cff;
  --danger: #ff4d6d;
  --ok: #38d9a9;
  --border: rgba(255, 255, 255, 0.12);
}

html, body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1200px 800px at 50% -200px, rgba(124, 92, 255, 0.45), transparent 60%),
    linear-gradient(180deg, #070a10 0%, var(--bg) 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(19, 26, 38, 0.85);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.field select {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
}

.contestBanner {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.22);
  border-radius: 10px;
}
.contestBanner strong {
  color: var(--ok);
  font-weight: 600;
}
.contestBanner .tag-unclaimed {
  color: #74c0fc;
}
.contestBanner .tag-player {
  color: var(--ok);
}
.contestBanner .tag-enemy {
  color: var(--danger);
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.btn.primary {
  border-color: rgba(124, 92, 255, 0.5);
  background: rgba(124, 92, 255, 0.18);
}
.btn.secondary {
  background: rgba(255, 255, 255, 0.04);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.content {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.pane {
  background: rgba(19, 26, 38, 0.85);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.panelTitle {
  font-weight: 700;
  margin-bottom: 10px;
}

.entity {
  background: rgba(15, 21, 34, 0.7);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}

.lifeHeroGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lifeLayout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 58%) minmax(0, 42%);
  gap: 10px;
  height: calc(100dvh - 86px);
  min-height: 0;
}

.lifeTopPane,
.lifeBottomPane {
  min-height: 0;
  overflow: hidden;
}

.lifeTopSplit {
  display: grid;
  grid-template-columns: minmax(460px, 52%) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  height: 100%;
}

.lifeTopLeft,
.lifeTopRight {
  min-width: 0;
}

.lifeHeroGrid--stack {
  grid-template-columns: 1fr;
}

.lifeHeroCard {
  background: rgba(15, 21, 34, 0.7);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

.entityTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.entityName { font-weight: 700; }
.entityPortrait {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.lifePortraitImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.lifeHeroArtWrap {
  margin-top: 10px;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
}

.lifeHeroArtWrap--portrait {
  aspect-ratio: 3 / 4;
  margin-top: 0;
}

.lifeHeroArtImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resources--compact {
  gap: 6px 10px;
}

.resources {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.res {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.res .value { color: var(--text); font-weight: 700; }
.icon {
  width: 18px;
  height: 18px;
  opacity: 0.95;
  /* 适配深色背景：把深色/黑色图标反相成浅色 */
  filter: brightness(0) invert(1);
}
.statusRow {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.talismansRow {
  display: flex;
  gap: 12px;
}
.taliSlot {
  flex: 1;
  min-height: 52px;
  height: auto;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
}
.taliSlot:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.taliSlot:not(:disabled) {
  opacity: 1;
}
.taliSlot .taliText {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  pointer-events: none;
}
.taliSlotIcon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
.taliSlotTextCol {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.taliSlotName {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.taliSlotCd {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.taliSlotCd--ready {
  color: var(--ok);
}
.taliSlotCd--cooldown {
  color: #f6c978;
}
.taliSlot:disabled .taliSlotCd--ready {
  color: rgba(56, 217, 169, 0.55);
}
.taliSlot:disabled .taliSlotCd--cooldown {
  color: rgba(246, 201, 120, 0.65);
}
.taliSlot:disabled .taliSlotName {
  color: rgba(233, 238, 247, 0.72);
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* 短时提示：不能打出牌 / 不能结束回合等（非日志区） */
.userHintToast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  transform: translate3d(-50%, 16px, 0);
  max-width: min(92vw, 440px);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 650;
  text-align: center;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(18, 24, 36, 0.94);
  border: 1px solid rgba(124, 145, 190, 0.35);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  z-index: 10050;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s;
}

.userHintToast.userHintToast--visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(-50%, 0, 0);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  justify-content: flex-start;
  min-height: 168px;
}

@media (max-width: 1200px) {
  .lifeTopSplit {
    grid-template-columns: 1fr;
  }

  .lifeMap {
    min-height: 280px;
  }
}

/* 手牌：接近扑克牌 2.5×3.5（5:7），适配竖屏手机 */
.cardBtn {
  box-sizing: border-box;
  width: min(31vw, 120px);
  aspect-ratio: 5 / 7;
  height: auto;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.cardBtn:disabled,
.cardBtn.isDisabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cardBtn:not(:disabled):not(.isDisabled) {
  cursor: grab;
}

.cardBtn:not(:disabled):not(.isDisabled):active {
  cursor: grabbing;
}

/* 图鉴/调试：与手牌同结构的 div，非按钮 */
.cardBtn--catalog {
  cursor: default;
  pointer-events: none;
}

.pileModalList.allCardsCatalog {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

.allCardsCatalogCell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: min(31vw, 120px);
}

.allCardsCatalogId {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  word-break: break-all;
}

.cardFace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  gap: 6px;
}

.cardArt {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(124, 92, 255, 0.34), transparent 60%),
    radial-gradient(100% 80% at 100% 100%, rgba(56, 217, 169, 0.3), transparent 58%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.cardArt.has-image {
  background: rgba(0, 0, 0, 0.25);
}

.cardArtImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cardArtFallback {
  position: absolute;
  left: 8px;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.cardArt.has-image .cardArtFallback {
  display: none;
}

.cardName {
  font-weight: 800;
  font-size: 11px;
  line-height: 1.2;
  margin: 0;
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.cardMeta {
  font-size: 8px;
  color: var(--muted);
  line-height: 1.25;
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  word-break: break-word;
}

.cardEffectText {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  margin-top: 1px;
  padding-right: 1px;
}

.cardEffectLine {
  font-size: 8px;
  color: var(--text);
  line-height: 1.38;
  margin-bottom: 3px;
  opacity: 0.92;
  word-break: break-word;
}

.cardTags {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.2;
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.cardTagsRow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 0;
}

.cardTagBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(56, 217, 169, 0.24));
  color: #eef3ff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cardTagsRow .cardTagBadge:nth-child(2n) {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.32), rgba(255, 186, 92, 0.24));
}

.cardTagsRow .cardTagBadge:nth-child(3n) {
  background: linear-gradient(135deg, rgba(116, 192, 252, 0.34), rgba(56, 217, 169, 0.22));
}

.cardTagBadge--attack,
.cardTagBadge--martial {
  border-color: rgba(255, 120, 100, 0.45);
  background: linear-gradient(135deg, rgba(255, 90, 80, 0.4), rgba(180, 40, 50, 0.28));
}

.cardTagBadge--spell {
  border-color: rgba(150, 120, 255, 0.45);
  background: linear-gradient(135deg, rgba(130, 110, 255, 0.4), rgba(80, 60, 200, 0.28));
}

.cardTagBadge--control {
  border-color: rgba(255, 200, 120, 0.45);
  background: linear-gradient(135deg, rgba(255, 180, 90, 0.38), rgba(200, 120, 40, 0.26));
}

.cardTagBadge--defense {
  border-color: rgba(120, 200, 255, 0.45);
  background: linear-gradient(135deg, rgba(90, 170, 255, 0.38), rgba(40, 100, 200, 0.26));
}

.cardTagBadge--burn,
.cardTagBadge--combo {
  border-color: rgba(255, 140, 80, 0.5);
  background: linear-gradient(135deg, rgba(255, 120, 60, 0.42), rgba(200, 60, 20, 0.28));
}

.cardEffectSummary {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 700;
  color: rgba(235, 240, 255, 0.88);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cardCostRow {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  flex-shrink: 0;
}
.costIcon {
  width: 12px; height: 12px; opacity: 0.9;
  /* 适配深色背景：把深色/黑色图标反相成浅色 */
  filter: brightness(0) invert(1);
}

.pileCardMetaLine {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}

.pileCardEffects {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  max-height: 140px;
  overflow-y: auto;
}

.pileCardMore {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.actionsRow {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

/* ===== Life Map (Prototype) ===== */
.lifeMapRow {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.lifeMap {
  margin-top: 0;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.lifeMap.is-dragOver {
  box-shadow: inset 0 0 0 3px rgba(124, 92, 255, 0.55);
}

.lifeMapGrid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    radial-gradient(800px 480px at 40% 10%, rgba(124, 92, 255, 0.12), transparent 60%),
    radial-gradient(620px 420px at 80% 80%, rgba(56, 217, 169, 0.10), transparent 60%);
  background-size: 24px 24px, 24px 24px, auto, auto;
  background-position: 0 0, 0 0, 0 0, 0 0;
  pointer-events: none;
}

.lifeMapLegend {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(7, 10, 16, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.lifeMapLegend .legendRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legendDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legendDot-location {
  background: rgba(255, 212, 59, 0.9);
}

.legendDot-hero {
  background: rgba(74, 222, 128, 0.9);
}

.legendDot-talisman {
  background: rgba(255, 107, 107, 0.95);
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.75);
}
.legendDot-enemy-base {
  background: rgba(186, 230, 253, 0.95);
}

.lifeMapLocationMarker {
  position: absolute;
  transform: translate3d(-50%, -50%, 0);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.lifeMapLocationMarkerPoint {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 212, 59, 0.9);
  box-shadow: 0 0 10px rgba(255, 212, 59, 0.8);
  margin: 0 auto 3px;
}

.lifeMapLocationMarkerLabel {
  background: rgba(7, 10, 16, 0.9);
  border-radius: 999px;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.lifeMapMarker {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate3d(0, 0, 0);
  transition: transform 520ms cubic-bezier(0.18, 0.86, 0.18, 1);
  pointer-events: none;
}

.lifeMapMarker .markerAvatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

.lifeMapMarker .markerLabel {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-shadow: 0 6px 18px rgba(0,0,0,0.45);
  white-space: nowrap;
}

.lifeMapMarker.marker-jackie .markerAvatar { border-color: rgba(116, 192, 252, 0.35); }
.lifeMapMarker.marker-uncle .markerAvatar { border-color: rgba(255, 212, 59, 0.35); }
.lifeMapMarker.marker-tohru .markerAvatar { border-color: rgba(81, 207, 102, 0.35); }
.lifeMapMarker.marker-enemy-base .markerAvatar {
  border-color: rgba(186, 230, 253, 0.45);
  background: rgba(186, 230, 253, 0.16);
}

.lifeMapMarker.marker-talisman {
  z-index: 3;
  transition: transform 520ms cubic-bezier(0.18, 0.86, 0.18, 1), opacity 260ms ease;
  opacity: 0.92;
  display: none;
}

.lifeMapMarker.marker-talisman .markerAvatar {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  border: 1px solid rgba(255, 107, 107, 0.38);
  background: radial-gradient(70% 70% at 30% 20%, rgba(255, 107, 107, 0.35), rgba(255, 255, 255, 0.05));
  box-shadow:
    0 14px 34px rgba(0,0,0,0.35),
    0 0 18px rgba(255, 107, 107, 0.45);
  animation: talismanPulse 1.6s ease-in-out infinite;
}

.lifeMapMarker.marker-talisman .markerLabel {
  color: rgba(255, 214, 214, 0.95);
}

@keyframes talismanPulse {
  0% { transform: translate3d(0,0,0) scale(1); filter: brightness(1); }
  55% { transform: translate3d(0,-2px,0) scale(1.06); filter: brightness(1.12); }
  100% { transform: translate3d(0,0,0) scale(1); filter: brightness(1); }
}
.noPlayHint {
  color: var(--muted);
  font-size: 12px;
  flex: 1;
  margin-left: 8px;
}
.noPlayHint:not(.visible) { visibility: hidden; }
.turnInfo { color: var(--muted); }

.log {
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 200px;
  overflow: auto;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.logLine { margin-bottom: 6px; }

@media (min-width: 900px) {
  /* 生活页等仍可用宽屏双列；对战页保持单列竖屏逻辑 */
  .content:not(.battle-screen) {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }

  .content.lifeLayout {
    grid-template-columns: 1fr;
  }
}

/*
 * 战斗主界面：上半格斗横版（共享背景 + 双角色血条头像）；下半出牌区；拖放手牌至上半出牌。
 */
html.battle-root,
html.battle-root body {
  min-height: 100%;
}

html.battle-root body {
  overflow-x: hidden;
  overflow-y: auto;
}

.battle-app {
  --battle-card-w: 142px;
  --battle-pad: 12px;
  --fight-strip-min-h: min(420px, 48vh);
  --battle-bars-max-w: 320px;
  --battle-portrait-w: 72px;
  --battle-fighter-gap: 10px;
  max-width: min(100%, 1400px);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.battle-topbar {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 12px;
}

.battle-brand {
  width: 100%;
  min-height: 14px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(124, 92, 255, 0.5),
    rgba(56, 217, 169, 0.35),
    rgba(255, 77, 109, 0.25)
  );
}

.battle-screen.content {
  margin-top: 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.battle-screen .pane {
  padding: var(--battle-pad);
  border-radius: 12px;
}

.battle-pane--banner {
  flex: 0 0 auto;
}

.battle-contestBanner {
  margin: 0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

.battle-contestBanner-opponent {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, rgba(235, 238, 245, 0.72));
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.battle-contestBanner-opponent strong {
  color: var(--text, #f3f5fa);
  font-weight: 800;
}

.battle-contestBanner-meta {
  font-weight: 700;
  color: rgba(255, 200, 140, 0.92);
}

.battle-contestBanner-main {
  display: block;
  margin-top: 2px;
}

/* ---------- 上半：格斗横版（同背景双角色） ---------- */
.battle-fightStrip {
  position: relative;
  flex: 1 1 auto;
  min-height: var(--fight-strip-min-h);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.battle-fightStrip.is-dragOver {
  box-shadow: inset 0 0 0 3px rgba(124, 92, 255, 0.65);
}

.battle-fightBg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, #1e2436 0%, #12161f 38%, #2a1c18 72%, #0f0c0b 100%),
    radial-gradient(120% 80% at 50% 100%, rgba(255, 140, 66, 0.12), transparent 55%);
}

.battle-fightFloor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  z-index: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* 全幅背景 + 两侧立绘（占位图，日后可换序列帧 / FX） */
.battle-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.battle-stageBg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.battle-stageActors {
  position: absolute;
  inset: 0;
}

.battle-stageActor {
  position: absolute;
  bottom: 4%;
  height: min(52%, 240px);
  width: auto;
  max-width: 38%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55));
  transition: transform 0.12s ease-out, filter 0.12s ease-out;
}

.battle-stageActor--player {
  left: 3%;
}

.battle-stageActor--enemy {
  right: 3%;
  transform: scaleX(-1);
}

.battle-stageActor--player[data-pose="hit"] {
  animation: battle-stage-shake 0.22s ease-out;
}

@keyframes battle-stage-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.battle-stageActor--enemy[data-pose="hit"] {
  animation: battle-stage-shake-enemy 0.22s ease-out;
}

@keyframes battle-stage-shake-enemy {
  0%,
  100% {
    transform: scaleX(-1) translateX(0);
  }
  25% {
    transform: scaleX(-1) translateX(-6px);
  }
  75% {
    transform: scaleX(-1) translateX(6px);
  }
}

/* 符咒主动：格斗区快闪（图标 + 名称） */
.battle-talismanCastFx {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: min(200px, 48vw);
  pointer-events: none;
  animation: battle-talismanCastFx-float 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.battle-talismanCastFx--player {
  left: 8%;
  bottom: 18%;
}

.battle-talismanCastFx--enemy {
  right: 8%;
  bottom: 18%;
}

.battle-talismanCastFx-inner {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.battle-talismanCastFx-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 120, 0.92);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(255, 170, 70, 0.55);
  animation: battle-talismanCastFx-pulse 0.85s ease-out forwards;
}

.battle-talismanCastFx--enemy .battle-talismanCastFx-ring {
  border-color: rgba(186, 160, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(150, 120, 255, 0.52);
}

.battle-talismanCastFx-icon {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.55));
}

.battle-talismanCastFx-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  letter-spacing: 0.03em;
  color: rgba(255, 248, 235, 0.95);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 0 12px rgba(0, 0, 0, 0.55);
}

@keyframes battle-talismanCastFx-float {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.72);
  }
  14% {
    opacity: 1;
    transform: translateY(0) scale(1.05);
  }
  72% {
    opacity: 1;
    transform: translateY(-4px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-18px) scale(0.92);
  }
}

@keyframes battle-talismanCastFx-pulse {
  0% {
    transform: scale(0.82);
    opacity: 0.65;
  }
  40% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

/* 出牌结算：漂浮数字 / 短标签 */
.battle-floatFx {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  font-weight: 900;
  font-size: clamp(15px, 3.6vw, 20px);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(0, 0, 0, 0.55);
  animation: battle-floatFx-rise 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.battle-floatFx--player {
  left: 8%;
  bottom: 30%;
}

.battle-floatFx--enemy {
  right: 8%;
  bottom: 30%;
  text-align: right;
}

.battle-floatFx--damage {
  color: #ff6b6b;
}

.battle-floatFx--heal {
  color: #5fe0a4;
}

.battle-floatFx--shield {
  color: #7ec8ff;
}

.battle-floatFx--draw {
  color: #e0c46a;
  font-size: clamp(13px, 3.2vw, 17px);
}

.battle-floatFx--ap {
  color: #ffd28a;
  font-size: clamp(13px, 3.2vw, 17px);
}

.battle-floatFx--mp {
  color: #c4a8ff;
  font-size: clamp(13px, 3.2vw, 17px);
}

.battle-floatFx--status {
  color: #ffb86c;
  font-size: clamp(12px, 3vw, 16px);
  max-width: min(200px, 52vw);
}

.battle-floatFx--dot {
  color: #ff9ed2;
  font-size: clamp(12px, 3vw, 16px);
}

@keyframes battle-floatFx-rise {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.86);
  }
  12% {
    opacity: 1;
    transform: translateY(0) scale(1.06);
  }
  70% {
    opacity: 1;
    transform: translateY(-6px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scale(0.94);
  }
}

.battle-fightHud {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  /* 左右各 3/8，中间留 1/4 */
  grid-template-columns: 3fr 2fr 3fr;
  gap: 8px 0;
  align-items: end;
  padding: 14px 16px 18px;
  min-height: 0;
}

.battle-fightSpacer {
  grid-column: 2;
  align-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  max-width: 100%;
  min-width: 0;
}

.battle-intelLine {
  width: 100%;
  max-width: min(280px, 42vw);
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.battle-fighter--player {
  grid-column: 1;
  justify-self: start;
}

.battle-fighter--enemy {
  grid-column: 3;
  justify-self: end;
}

.battle-fighter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.battle-fighter--enemy {
  align-items: stretch;
  text-align: left;
}

.battle-fighterCore {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--battle-fighter-gap);
  width: 100%;
  min-width: 0;
}

.battle-fighterInfo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.battle-fighterNameRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.battle-fighterName {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.battle-miniRes {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.battle-miniResItem {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.battle-miniIcon {
  width: 15px;
  height: 15px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.battle-barStack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: var(--battle-bars-max-w);
}

.battle-shieldRow,
.battle-hpRow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: var(--battle-bars-max-w);
}

.battle-shieldBarTrack,
.battle-hpBarTrack {
  flex: 1;
  min-width: 0;
  height: 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.battle-hpBarTrack {
  height: 16px;
}

.battle-shieldBarFill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(116, 192, 252, 0.85), rgba(186, 230, 253, 0.95));
  transition: width 0.2s ease-out;
}

.battle-hpBarFill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 0.2s ease-out;
}

.battle-hpBarFill--player {
  background: linear-gradient(90deg, rgba(56, 217, 169, 0.9), rgba(81, 207, 102, 0.95));
}

.battle-hpBarFill--enemy {
  background: linear-gradient(90deg, rgba(255, 107, 107, 0.95), rgba(250, 82, 82, 0.9));
}

.battle-shieldNum {
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #a5d8ff;
  min-width: 2ch;
}

.battle-hpNums {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 5.5ch;
  text-align: left;
}

.battle-hpSep {
  opacity: 0.55;
  margin: 0 1px;
}

.battle-fighterPortrait {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.battle-actorStage-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.battle-cardStrip {
  flex: 0 1 auto;
  min-height: 0;
  position: relative;
  isolation: isolate;
}

.battle-dragPlayHint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  position: absolute;
  z-index: 5000;
  left: 0;
  top: 0;
  display: none;
  max-width: min(320px, 70vw);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
}

.battle-pane--command {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.battle-commandBody {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.battle-statusChips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  margin: 6px 0 0;
  padding: 6px 4px;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.battle-statusChip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}

.battle-statusChip-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.battle-statusChip-num {
  line-height: 1;
}

.battle-statusChip--buff {
  border-color: rgba(56, 217, 169, 0.5);
  background: rgba(56, 217, 169, 0.1);
}

.battle-statusChip--control {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.12);
}

.battle-statusChip--debuff {
  border-color: rgba(255, 77, 109, 0.5);
  background: rgba(255, 77, 109, 0.08);
}

.battle-statusChip--dot {
  border-color: rgba(255, 186, 92, 0.55);
  background: rgba(255, 186, 92, 0.08);
}

.battle-statusChip--hot {
  border-color: rgba(64, 201, 151, 0.65);
  background: rgba(64, 201, 151, 0.12);
}

.battle-resources {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 6px;
}

.battle-res {
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  padding: 4px 2px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  min-width: 0;
}

.battle-res .icon {
  width: 20px;
  height: 20px;
  margin: 0 auto;
}

.battle-statValue {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.battle-talismansRow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.battle-talismansRow .taliSlot {
  min-height: 48px;
  border-radius: 10px;
  padding: 5px 8px;
}

.battle-talismansRow .taliSlot .taliText {
  min-height: 36px;
  gap: 8px;
}

.battle-talismansRow .taliSlotIcon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.battle-talismansRow .taliSlotName {
  font-size: 12px;
}

.battle-talismansRow .taliSlotCd {
  font-size: 10px;
}

.battle-pileRow {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.battle-pileRow .pillStatBtn {
  justify-content: center;
  min-width: 0;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
}

.battle-pileRow .pillStatValue {
  font-size: 14px;
}

.battle-handZone {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.battle-commandSide {
  flex: 0 0 164px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.battle-commandSide .battle-endTurn {
  width: 100%;
  min-width: 0;
}

.battle-handToolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.battle-handLabel {
  font-weight: 800;
  font-size: 13px;
}

.battle-handScrollHint {
  font-size: 11px;
  color: var(--muted);
}

.battle-hand {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
  padding: 8px 2px 10px;
  flex: 0 0 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
  /* 覆盖全局 .hand min-height，避免撑出整页滚动 */
  /* 手牌：底部横排；过多时 .is-overlap 叠放，非整槽横向滚动 */
}

.battle-hand .cardBtn {
  width: var(--battle-card-w);
  flex: 0 0 var(--battle-card-w);
  padding: 8px 9px;
  position: relative;
  background: var(--panel);
  user-select: none;
  -webkit-user-drag: element;
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out;
}

/* 手牌过多时才重叠展示（由 JS 判定添加 is-overlap 类） */
.battle-hand.is-overlap {
  gap: 0;
  position: relative;
}

.battle-hand.is-overlap .cardBtn {
  position: absolute;
  bottom: 0;
  margin-left: 0;
  will-change: left, transform;
}

.battle-hand.is-overlap .cardBtn + .cardBtn {
  margin-left: 0;
}

/* 悬浮提起并置顶，方便确定要拖拽的卡 */
.battle-hand .cardBtn:hover {
  z-index: 1000;
  transform: translateY(-8px);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
}

.battle-hand .cardName {
  font-size: 12px;
}

.battle-hand .cardCostRow {
  font-size: 10px;
}

.battle-hand .cardTags {
  font-size: 9px;
}

.battle-actionsRow {
  flex: 0 0 auto;
  margin-top: 4px;
  padding-top: 12px;
  align-items: center;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.battle-endTurn {
  min-height: 44px;
  width: auto;
  min-width: 140px;
  padding-left: 20px;
  padding-right: 20px;
  font-size: 15px;
  font-weight: 700;
}

.battle-turnInfo {
  font-size: 14px;
  text-align: center;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.battle-actionsRow .noPlayHint {
  grid-column: 1;
  text-align: left;
  font-size: 13px;
  min-height: 1.25em;
  min-width: 160px;
}

.battle-actionsRow .battle-turnInfo {
  grid-column: 2;
}

@media (max-width: 900px) {
  .battle-app {
    --battle-card-w: 112px;
    --battle-pad: 10px;
    --fight-strip-min-h: 280px;
    max-width: 100%;
    padding: 10px 12px;
  }

  .battle-fightHud {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .battle-commandBody {
    flex-direction: column;
  }

  .battle-commandSide {
    flex: 0 0 auto;
  }

  .battle-talismansRow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .battle-pileRow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .battle-actionsRow {
    flex-direction: column;
    align-items: stretch;
  }

  .battle-endTurn {
    width: 100%;
  }

  .battle-turnInfo {
    margin-left: 0;
    text-align: center;
    width: 100%;
  }

  .battle-actionsRow .noPlayHint {
    flex: none;
    text-align: center;
  }

  .battle-fighterName {
    font-size: 16px;
  }
}

@media (min-width: 901px) and (max-height: 720px) {
  .battle-app {
    --fight-strip-min-h: 300px;
  }
}

.cardTooltip {
  position: fixed;
  z-index: 9999;
  max-width: 320px;
  pointer-events: none; /* 不抢鼠标事件，避免影响卡牌的 hover */
  background: rgba(10, 14, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  display: none;
  transform: translateZ(0);
}

.cardTooltip.visible {
  display: block;
}

/* 状态图钉说明：可点击浮层内文字，不影响下层卡牌的 hover 逻辑 */
.cardTooltip.cardTooltip--statusEffect {
  pointer-events: auto;
  max-width: min(340px, 92vw);
}

.cardTooltipTitle {
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.15;
}

.cardTooltipTitle--talisman {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cardTooltipTitleText {
  display: inline-block;
}

.cardTooltipTalismanIconWrap {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.cardTooltipTalismanIcon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.cardTooltipTalismanIconEmoji {
  display: none;
  font-size: 18px;
  line-height: 1;
}

.cardTooltipMeta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.cardTooltipLine {
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 4px;
}

.cardTooltipLine .muted {
  color: var(--muted);
}

.cardTooltipHint {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.pileInfoRow {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pillStatBtn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pillStatBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pillStatValue {
  color: var(--text);
  font-weight: 900;
}

.pileModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.pileModalOverlay.visible {
  display: flex;
}

.pileModalBody {
  width: min(720px, 92vw);
  max-height: 82vh;
  overflow: auto;
  background: rgba(10, 14, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.5);
  padding: 12px;
}

.helpModalBody {
  width: min(820px, 94vw);
}

.pileModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.pileModalTitle {
  font-weight: 900;
  font-size: 14px;
}

.pileModalList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.helpModalList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.helpSection {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px;
}

.helpSectionTitle {
  font-weight: 900;
  margin-bottom: 8px;
  font-size: 13px;
}

.helpGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

@media (min-width: 720px) {
  .helpGrid {
    grid-template-columns: 220px 1fr;
    align-items: baseline;
    column-gap: 12px;
  }
}

.helpKey {
  color: var(--muted);
  font-size: 12px;
}

.helpVal {
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.pileCardItem {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px;
}

.pileCardNameRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pileCardName {
  font-weight: 900;
}

.pileCardId {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pileCardMeta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* 调试弹层：低于帮助/牌堆弹窗 (9998)，高于页面内容；FAB 始终在最上 */
.prototype-debug-overlay.pileModalOverlay {
  z-index: 9997;
}

.prototype-debug-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.prototype-debug-log-title {
  margin-top: 4px;
  margin-bottom: 6px;
}

.prototype-debug-body .log {
  max-height: min(220px, 28vh);
}

.prototype-debug-fab {
  position: fixed;
  z-index: 10001;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, calc(8px + env(safe-area-inset-bottom, 0px)));
  left: auto;
  top: auto;
  min-width: 52px;
  min-height: 52px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(30, 40, 58, 0.92);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.prototype-debug-fab:active {
  cursor: grabbing;
}

.prototype-debug-fab.is-open {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.22);
}

html:has(body.life-root) {
  height: 100%;
}

body.life-root {
  height: 100%;
  overflow: hidden;
  --battle-card-w: 142px;
}

body.life-root .app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.life-root .topbar {
  flex: 0 0 auto;
}

body.life-root .content.lifeLayout {
  flex: 1 1 auto;
  min-height: 0;
}

body.life-root .lifeHeroGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

body.life-root .lifeHeroCard {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.life-root .entityPortrait {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

body.life-root .entityName {
  font-size: 14px;
}

body.life-root .resources {
  margin-top: 6px;
  gap: 4px 8px;
}

body.life-root .res {
  font-size: 12px;
}

body.life-root .lifeHeroHud {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

body.life-root .lifeHeroHudTopRow {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

body.life-root .lifeHeroHudPortrait.battle-fighterPortrait {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

body.life-root .lifeHeroHudName.battle-fighterName {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.1;
}

body.life-root .lifeHeroHudMeta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 4px;
}

body.life-root .lifeHeroHudAttrs.battle-miniRes {
  flex: 0 1 auto;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
  row-gap: 4px;
  column-gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

body.life-root .lifeHeroHudAttrs .battle-miniResItem {
  gap: 2px;
  flex-shrink: 0;
}

/* 属性行图标放大；血条旁图标略小，避免抢视觉 */
body.life-root .lifeHeroHudAttrs .battle-miniIcon {
  width: 18px;
  height: 18px;
}

body.life-root .lifeHeroHudBars .battle-miniIcon {
  width: 15px;
  height: 15px;
}

body.life-root .lifeHeroHudAttrs .battle-miniResItem {
  cursor: help;
}

body.life-root .lifeHeroHudBars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding-left: 0;
}

body.life-root .lifeHeroHud .battle-shieldRow,
body.life-root .lifeHeroHud .battle-hpRow {
  max-width: none;
  width: 100%;
}

body.life-root .lifeHeroHud .battle-shieldBarTrack {
  height: 9px;
}

body.life-root .lifeHeroHud .battle-hpBarTrack {
  height: 12px;
}

body.life-root .lifeHeroHud .battle-hpNums,
body.life-root .lifeHeroHud .battle-shieldNum {
  font-size: 11px;
}

body.life-root .lifeHeroHud .battle-statusChips {
  margin: 0;
  min-height: 34px;
  padding: 4px 3px;
  gap: 4px;
}

body.life-root .lifeHeroHud .battle-statusChip {
  padding: 3px 8px 3px 5px;
  font-size: 12px;
}

body.life-root .lifeHeroHud .battle-statusChip-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  body.life-root {
    --battle-card-w: 112px;
  }
}

body.life-root .lifeBottomPane.battle-cardStrip.battle-pane--command {
  flex: 0 1 auto;
  min-height: 0;
  position: relative;
  isolation: isolate;
}

body.life-root .life-commandHeader {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.life-root .life-commandHeader .panelTitle {
  margin-bottom: 0;
}

body.life-root .lifeOpenContestBtn {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 6px;
}

body.life-root .life-commandMeta {
  margin: 0;
  line-height: 1.4;
}

body.life-root .lifeBottomPane .battle-commandBody {
  flex: 1 1 auto;
  min-height: 0;
}

body.life-root .lifeBottomPane .battle-hand .cardBtn {
  user-select: none;
  -webkit-user-drag: element;
}

body.life-root .lifeBottomPane .battle-hand {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

body.life-root .lifeBottomPane .battle-actionsRow {
  margin-top: 0;
}

