/* ==========================================================================
   绝境骰子 · v5 竖向卡牌桌游 & 古羊皮探险卷轴视觉系统 (DICEROGUE v5)
   --------------------------------------------------------------------------
   35% 开阔哥特石拱战场（简洁悬空意图） / 43% 竖向实体卡牌阵（抽弃牌堆） / 22% 饱满大骰盘
   ========================================================================== */

:root {
  --ink-0: #090a0e;
  --ink-1: #12141b;
  --ink-2: #1a1d26;
  --text-bright: #f5efe2;
  --text-main: #ddd3bf;
  --text-muted: #a19582;
  --text-dim: #6f6659;

  --gold-bright: #f5cf82;
  --gold: #d6a44e;
  --gold-glow: rgba(214, 164, 78, 0.38);

  --ember: #e85d3f;
  --ember-bright: #ff7a52;
  --ember-glow: rgba(232, 93, 63, 0.44);

  --frost: #62ccf5;
  --venom: #52d97b;
  --void: #c084fc;

  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif CN", Georgia, "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--ink-0);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.42;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button { font-family: inherit; }
.ui-ico { width: 16px; height: 16px; flex: 0 0 auto; display: block; }
#ico-reroll, #ico-gold, #ico-open-map, #ico-open-deck, #ico-map-hp, #ico-map-gold { display: inline-flex; align-items: center; }

/* ==========================================================================
   1. 全屏地牢背景、动态火光与全屏 Canvas 特效层
   ========================================================================== */
.world-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(180deg, rgba(8, 9, 13, 0.42) 0%, rgba(8, 9, 13, 0.16) 36%, rgba(12, 10, 9, 0.72) 56%, rgba(9, 8, 8, 0.95) 100%),
    url('./art/bg-table.jpg');
  background-size: cover;
  background-position: center 40%;
}

.torch-glow {
  position: fixed;
  top: 5%;
  width: 280px;
  height: 340px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, rgba(255, 148, 56, 0.24) 0%, rgba(255, 105, 35, 0.06) 45%, transparent 72%);
  animation: torch-flicker 3.6s ease-in-out infinite;
}
.torch-left { left: -75px; }
.torch-right { right: -75px; animation-delay: -1.7s; }

#battle-fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }

.vignette-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0; transition: opacity 220ms var(--ease-out); }
.vignette-hurt { background: radial-gradient(ellipse at center, transparent 42%, rgba(210, 28, 28, 0.56) 100%); }
.vignette-hurt.flash { opacity: 1; }
.vignette-lowhp { background: radial-gradient(ellipse at center, transparent 54%, rgba(175, 22, 22, 0.34) 100%); }
.vignette-lowhp.active { opacity: 1; animation: lowhp-beat 1.7s ease-in-out infinite; }
.vignette-void { background: radial-gradient(ellipse at center, transparent 46%, rgba(126, 34, 206, 0.44) 100%); }
.vignette-void.active { opacity: 1; }

#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }

/* ==========================================================================
   2. 开场标题帷幕（含开发者署名）
   ========================================================================== */
.title-curtain {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(24, 18, 16, 0.42) 0%, rgba(7, 8, 12, 0.92) 78%),
    url('./art/bg-table.jpg') center/cover no-repeat;
  transition: opacity 380ms var(--ease-out), transform 380ms var(--ease-out);
}
.title-curtain.hidden { opacity: 0; transform: scale(1.03); pointer-events: none; }

.title-art-wings { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 4vw; pointer-events: none; overflow: hidden; }
.title-wing { width: min(32vw, 400px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; opacity: 0.6; mask-image: radial-gradient(circle, #000 42%, transparent 74%); -webkit-mask-image: radial-gradient(circle, #000 42%, transparent 74%); }
.title-wing img { width: 100%; height: 100%; object-fit: cover; }

.title-center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 32px; max-width: 560px; }
.title-emblem { font-size: 12px; font-weight: 700; letter-spacing: 0.44em; color: var(--gold); margin-bottom: 10px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9); }
.title-main {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(48px, 7.2vw, 78px);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.08;
  background: linear-gradient(180deg, #fff5dc 0%, #f0c26b 48%, #b57b28 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.85));
}
.title-sub { margin: 14px 0 30px; font-size: 15px; letter-spacing: 0.14em; color: var(--text-main); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9); }
.title-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 250px; }
.title-actions button { width: 100%; }
.title-records { margin-top: 20px; font-size: 13px; color: var(--text-muted); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

.title-credits {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(10, 9, 12, 0.74);
  border: 1px solid rgba(214, 164, 78, 0.36);
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   3. 暗黑古羊皮探险卷轴地图（100% 实心节点 + 精确裁切路径 + 主角棋子 + 魔龙浮雕）
   ========================================================================== */
.map-screen {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 30%, rgba(28, 22, 17, 0.94) 0%, rgba(8, 7, 10, 0.99) 78%);
  padding-top: var(--safe-top);
  transition: opacity 280ms var(--ease-out), transform 280ms var(--ease-out);
}
.map-screen.hidden { opacity: 0; transform: translateY(16px); pointer-events: none; }

.map-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px;
  background: rgba(12, 10, 13, 0.9);
  border-bottom: 1.5px solid rgba(214, 164, 78, 0.34);
}
.map-header-left, .map-header-right, .map-status-pills { display: flex; align-items: center; gap: 10px; }
.map-title-group { display: flex; flex-direction: column; line-height: 1.2; }
.map-title { font-family: var(--font-display); font-size: 19px; font-weight: 800; color: var(--gold-bright); letter-spacing: 0.06em; }
.map-subtitle { font-size: 12px; color: var(--text-muted); }

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(14, 13, 17, 0.88);
  border: 1px solid rgba(214, 164, 78, 0.32);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-bright);
}
.hp-pill { color: #ff7c7c; border-color: rgba(239, 83, 80, 0.45); }
.gold-pill { color: var(--gold-bright); border-color: rgba(214, 164, 78, 0.52); }
.floor-pill { color: var(--text-main); }

.map-legend {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 7px 16px;
  background: rgba(14, 12, 14, 0.72);
  border-bottom: 1px solid rgba(214, 164, 78, 0.12);
  font-size: 12px;
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.legend-item .ui-ico { width: 14px; height: 14px; }
.legend-item.tone-battle   { color: #ff9c80; }
.legend-item.tone-elite    { color: #f5cf82; }
.legend-item.tone-campfire { color: #6ee7a0; }
.legend-item.tone-shop     { color: #7dd3fc; }
.legend-item.tone-event    { color: #d8b4fe; }
.legend-item.tone-treasure { color: #fde047; }
.legend-item.tone-boss     { color: #ff5d6c; }

.map-scroll-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 12px calc(36px + var(--safe-bottom));
}
.map-canvas-host { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; height: auto; }

/* 卷轴上下古铜轴杆 */
.map-scroll-rod {
  flex: 0 0 auto;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8a642c 0%, #d8ab5b 35%, #66471c 75%, #2b1d0c 100%);
  border: 1px solid rgba(255, 232, 180, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 6;
}
.rod-top { margin-bottom: -5px; }
.rod-bottom { margin-top: -5px; }

/* 手绘古羊皮卷画布 */
.map-canvas {
  flex: 0 0 auto;
  position: relative;
  background-image:
    linear-gradient(180deg, rgba(16, 12, 10, 0.34) 0%, rgba(18, 14, 11, 0.16) 50%, rgba(16, 12, 10, 0.38) 100%),
    url('./art/map-scroll.jpg');
  background-size: 100% auto;
  background-repeat: repeat-y;
  background-position: top center;
  border-left: 2px solid rgba(214, 164, 78, 0.42);
  border-right: 2px solid rgba(214, 164, 78, 0.42);
  box-shadow: inset 0 0 64px rgba(0, 0, 0, 0.72), 0 22px 60px rgba(0, 0, 0, 0.82);
}
.map-svg { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.map-nodes-layer { position: absolute; inset: 0; z-index: 4; }

/* 三段地貌分区横纹 */
.map-zone-divider {
  position: absolute;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214, 164, 78, 0.28), transparent);
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 1;
}
.map-zone-divider span {
  transform: translateY(-10px);
  padding: 1px 8px;
  border-radius: 4px;
  background: rgba(18, 14, 11, 0.72);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(214, 164, 78, 0.62);
}

.map-floor-tick {
  position: absolute;
  left: 12px;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 800;
  color: rgba(214, 164, 78, 0.54);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 2;
}

.map-edge {
  fill: none;
  stroke: rgba(208, 174, 116, 0.34);
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
}
.map-edge.traversed {
  stroke: #e8b55a;
  stroke-width: 3.6;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 6px rgba(232, 181, 90, 0.6));
}
.map-edge.next-edge {
  stroke: #ffe09a;
  stroke-width: 3.4;
  stroke-dasharray: 8 4;
  filter: drop-shadow(0 0 10px rgba(255, 224, 154, 0.85));
}

/* 100% 不透明实心圆章节点（绝不镂空透出连线！） */
.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
  z-index: 4;
}
.map-node-ring {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  /* 实心不透明暗石古铜底盘 */
  background: radial-gradient(circle at 35% 28%, #312722 0%, #1d1715 62%, #120e0e 100%);
  border: 2.2px solid #594a3c;
  color: var(--text-main);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 232, 185, 0.16);
  transition: transform 160ms var(--ease-spring), box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.map-node-ring .ui-ico { width: 22px; height: 22px; }
.map-node-label {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(14, 11, 10, 0.78);
  font-size: 10.5px;
  font-weight: 700;
  color: #b5a68e;
  white-space: nowrap;
}

/* 各房间鲜明不透明实心底色与边框 */
.map-node.tone-battle   .map-node-ring { background: radial-gradient(circle at 35% 28%, #3c2220 0%, #1c1111 100%); border-color: #9e4838; color: #ff9c80; }
.map-node.tone-elite    .map-node-ring { background: radial-gradient(circle at 35% 28%, #473419 0%, #1f170d 100%); border-color: #c9943d; color: #f5cf82; }
.map-node.tone-campfire .map-node-ring { background: radial-gradient(circle at 35% 28%, #1a3827 0%, #0e1d15 100%); border-color: #3f9c64; color: #6ee7a0; }
.map-node.tone-shop     .map-node-ring { background: radial-gradient(circle at 35% 28%, #183447 0%, #0d1a24 100%); border-color: #3a8ec2; color: #7dd3fc; }
.map-node.tone-event    .map-node-ring { background: radial-gradient(circle at 35% 28%, #351f47 0%, #190f24 100%); border-color: #8c52c2; color: #d8b4fe; }
.map-node.tone-treasure .map-node-ring { background: radial-gradient(circle at 35% 28%, #4b3d16 0%, #211a0b 100%); border-color: #d6ad33; color: #fde047; }

/* Boss 魔龙浮雕大圆章 */
.map-node.tone-boss .map-node-ring {
  width: 76px;
  height: 76px;
  padding: 3px;
  background: linear-gradient(145deg, #f5cf82 0%, #b8291e 50%, #2b0912 100%);
  border: 2.5px solid #ff7a52;
  box-shadow: 0 0 28px rgba(255, 92, 62, 0.55), 0 10px 26px rgba(0, 0, 0, 0.88);
  overflow: hidden;
}
.map-boss-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* 未到达节点用压暗色相而非透明度（彻底不透底！） */
.map-node.locked .map-node-ring { filter: brightness(0.68) saturate(0.62); }
.map-node.locked .map-node-label { color: #7d705e; }

.map-node.visited .map-node-ring {
  background: radial-gradient(circle at 35% 30%, #2a2219 0%, #15110e 100%);
  border-color: #9e7736;
  color: #a8864c;
}
.map-clear-stamp {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9e2a22;
  border: 1.5px solid #f5cf82;
  color: #fff4d6;
  font-size: 10px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* 当前所在位置：绝境行者迷你棋子 */
.map-node.current .map-node-ring {
  border-color: #fff2cc;
  box-shadow: 0 0 0 3px rgba(214, 164, 78, 0.48), 0 0 24px var(--gold-glow);
}
.map-hero-pawn {
  position: absolute;
  top: -12px;
  right: -16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(145deg, #fff2cc, #c9943d);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85);
  z-index: 8;
  animation: pawn-bob 2s ease-in-out infinite;
}
.map-hero-pawn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.map-node.available { cursor: pointer; z-index: 6; }
.map-node.available .map-node-ring {
  filter: brightness(1.12);
  border-color: #ffe29e;
  box-shadow: 0 0 0 3px rgba(245, 207, 130, 0.4), 0 0 26px rgba(245, 207, 130, 0.78);
  animation: node-beacon 1.6s ease-in-out infinite;
}
.map-node.available:hover .map-node-ring { transform: scale(1.15); }
.map-node.available .map-node-label { color: #fff5dc; font-weight: 800; background: rgba(24, 17, 11, 0.92); }

/* ==========================================================================
   4. 主战斗全屏视口：悬浮顶栏
   ========================================================================== */
.game-viewport {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

.stage-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 22px 4px;
}
.topbar-left, .topbar-center, .topbar-right { display: flex; align-items: center; gap: 8px; }
.brand-crest { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: 0.06em; color: var(--gold-bright); }
.brand-best { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.top-gold { padding: 3px 10px; font-size: 12.5px; }

.medallion-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: radial-gradient(circle at 35% 30%, #2a2420 0%, #141214 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.45);
  color: var(--gold-bright);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.medallion-btn:hover { transform: translateY(-1px); border-color: var(--gold-bright); }
.medallion-btn .ui-ico { width: 15px; height: 15px; }

.btn-map-pill {
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #33271a 0%, #1a1410 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.58);
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.btn-map-pill:hover { transform: translateY(-1px); box-shadow: 0 0 14px var(--gold-glow); }

.turn-plaque {
  padding: 4px 13px;
  border-radius: 999px;
  background: rgba(14, 12, 15, 0.84);
  border: 1.5px solid rgba(214, 164, 78, 0.42);
  color: var(--gold-bright);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.turn-plaque.warn { border-color: #fbbf24; color: #fde047; }
.turn-plaque.danger { border-color: var(--void); color: #f0abfc; background: #240c3c; animation: pulse 1.3s ease-in-out infinite; }

.mod-seal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(12, 11, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  max-width: 280px;
}
.mod-gem { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; flex: 0 0 auto; }
.mod-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   5. 上半部 (~35%)：爽朗哥特石拱战场 + 魔物身侧简洁悬空意图（无刻意弹窗盒）
   ========================================================================== */
.battle-arena {
  flex: 0 0 auto;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 28px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(160px, 0.65fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 16px;
}

.combatant-wing { display: flex; align-items: center; gap: 16px; }
.enemy-wing { justify-content: flex-end; }

.portrait-frame {
  position: relative;
  flex: 0 0 auto;
  width: 142px;
  height: 142px;
  border-radius: 16px;
  padding: 3px;
  background: linear-gradient(145deg, #d8ab5b 0%, #5b411e 48%, #261c12 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.76);
}
.enemy-frame {
  width: 158px;
  height: 158px;
  background: linear-gradient(145deg, #c2513e 0%, #451e1d 50%, #191216 100%);
  cursor: pointer;
}
.enemy-frame.elite-frame {
  background: linear-gradient(145deg, #f5ce78 0%, #99641d 50%, #2a1a0c 100%);
  box-shadow: 0 0 28px rgba(245, 206, 120, 0.42), 0 12px 32px rgba(0, 0, 0, 0.78);
}
.enemy-frame.boss-p2-frame {
  background: linear-gradient(145deg, #ff4d6d 0%, #9333ea 55%, #1e0a2e 100%);
  box-shadow: 0 0 36px rgba(244, 63, 94, 0.62), 0 12px 32px rgba(0, 0, 0, 0.85);
}

.portrait-img { width: 100%; height: 100%; object-fit: cover; border-radius: 13px; display: block; background: #0d0f14; transition: filter 160ms var(--ease-out), transform 220ms var(--ease-out), opacity 360ms var(--ease-out); }
.hero-img { animation: subtle-breathe 4.4s ease-in-out infinite; }
.monster-img { animation: monster-breathe 3.4s ease-in-out infinite; }
.portrait-frame.hit-flash .portrait-img { filter: brightness(2.7) saturate(0.25); transform: scale(0.94); }
.portrait-frame.hero-lunge { animation: hero-lunge 320ms var(--ease-out); }
.portrait-frame.enemy-lunge { animation: enemy-lunge 380ms var(--ease-out); }
.portrait-frame.enemy-defeated .portrait-img { opacity: 0; transform: scale(0.75) translateY(10px); }

.armor-crest {
  position: absolute;
  bottom: -10px;
  right: -10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 999px;
  background: linear-gradient(145deg, #275a8a, #102a46);
  border: 2px solid var(--frost);
  color: #e0f6ff;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.72), 0 0 14px rgba(98, 204, 245, 0.45);
  font-weight: 900;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.armor-crest-ico .ui-ico { width: 16px; height: 16px; color: var(--frost); }
.armor-crest-thorns { font-size: 11px; color: var(--gold-bright); }

/* 魔物身侧简洁悬空意图（杀戮尖塔感：大图标 + 醒目数字 + 可选破招小条） */
.enemy-stage-unit {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.intent-badge {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(44, 15, 18, 0.96) 0%, rgba(20, 9, 12, 0.98) 100%);
  border: 1.8px solid var(--ember-bright);
  color: #fff6e8;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.8), 0 0 18px rgba(232, 93, 63, 0.36);
  cursor: pointer;
  transition: transform 140ms var(--ease-out);
}
.intent-badge:hover { transform: translateX(-50%) scale(1.06); }
.intent-badge.intent-def {
  background: linear-gradient(180deg, rgba(16, 40, 60, 0.96) 0%, rgba(10, 20, 32, 0.98) 100%);
  border-color: var(--frost);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.78), 0 0 16px rgba(98, 204, 245, 0.32);
}
.intent-badge.intent-debuff {
  background: linear-gradient(180deg, rgba(46, 18, 70, 0.96) 0%, rgba(20, 9, 34, 0.98) 100%);
  border-color: var(--void);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.78), 0 0 18px rgba(192, 132, 252, 0.4);
}
.intent-badge.intent-stunned {
  background: linear-gradient(180deg, rgba(58, 42, 14, 0.96) 0%, rgba(24, 18, 8, 0.98) 100%);
  border-color: var(--gold-bright);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.78), 0 0 20px var(--gold-glow);
}
.intent-badge-main { display: flex; align-items: center; gap: 6px; }
.intent-ico .ui-ico { width: 22px; height: 22px; color: var(--ember-bright); }
.intent-badge.intent-def .intent-ico .ui-ico { color: var(--frost); }
.intent-badge.intent-debuff .intent-ico .ui-ico { color: var(--void); }
.intent-badge.intent-stunned .intent-ico .ui-ico { color: var(--gold-bright); }
.intent-num { font-size: 24px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.intent-sub { font-size: 10.5px; font-weight: 700; color: #ffd4c4; white-space: nowrap; }
.intent-badge.intent-def .intent-sub { color: #cdeeff; }
.intent-badge.intent-debuff .intent-sub { color: #ebd2ff; }
.intent-badge.intent-stunned .intent-sub { color: #fef08a; }
.intent-break {
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(245, 207, 130, 0.2);
  border: 1px solid rgba(245, 207, 130, 0.55);
  color: #fde68a;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.combatant-vitals { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.combatant-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.enemy-head-align { justify-content: flex-end; gap: 10px; }
.combatant-name { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text-bright); text-shadow: 0 3px 12px rgba(0, 0, 0, 0.92); white-space: nowrap; }
.combatant-role { font-size: 12.5px; color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.enemy-tier { font-size: 12.5px; font-weight: 700; color: var(--gold-bright); white-space: nowrap; }

.sculpted-bar {
  position: relative;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(180deg, #0b0a0e 0%, #17151b 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.44);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.bar-ghost { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #fde68a, #f59e0b); transition: width 540ms cubic-bezier(0.22, 1, 0.36, 1) 140ms; }
.bar-fill { position: relative; height: 100%; transition: width 160ms var(--ease-out); }
.hero-fill { background: linear-gradient(180deg, #ef5350 0%, #b71c1c 58%, #7f1010 100%); }
.enemy-fill { background: linear-gradient(180deg, #e85d3f 0%, #ad2219 60%, #6e100d 100%); }
.boss-p2 .enemy-fill { background: linear-gradient(180deg, #f43f5e 0%, #9333ea 100%); }
.bar-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff8ea; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95); }

.hero-loadout-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 34px; }
.potion-belt { display: flex; align-items: center; gap: 6px; }
.potion-slot {
  height: 32px; padding: 0 9px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(14, 12, 16, 0.72); border: 1.5px dashed rgba(214, 164, 78, 0.25); color: var(--text-dim); font-size: 11px; font-weight: 700; white-space: nowrap;
}
.potion-slot.filled { border-style: solid; cursor: pointer; color: var(--text-bright); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6); transition: transform 140ms var(--ease-out); }
.potion-slot.filled:hover { transform: translateY(-2px); }
.potion-slot.tone-accent { border-color: var(--ember-bright); background: rgba(153, 39, 24, 0.48); color: #ffd9cc; }
.potion-slot.tone-frost  { border-color: var(--frost); background: rgba(20, 74, 114, 0.5); color: #dcf6ff; }
.potion-slot.tone-gold   { border-color: var(--gold-bright); background: rgba(112, 74, 22, 0.5); color: #fef3c7; }
.potion-slot.tone-venom  { border-color: var(--venom); background: rgba(20, 83, 45, 0.52); color: #dcfce7; }
.potion-slot .ui-ico { width: 14px; height: 14px; }

.relic-pedestal { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.relic-chip {
  width: 32px; height: 32px; border-radius: 8px; padding: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #3a2b16 0%, #18130d 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.65); color: var(--gold-bright); cursor: pointer;
}
.relic-chip .relic-ico { width: 17px; height: 17px; }
.relic-chip.pulse { animation: relic-pop 420ms var(--ease-spring); }

.enemy-buffs { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 26px; flex-wrap: wrap; }
.status-pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; border: 1.5px solid currentColor; background: rgba(10, 10, 14, 0.84); }
.status-pill.armor { color: var(--frost); }
.status-pill.poison { color: var(--venom); }
.status-pill.vuln { color: var(--ember-bright); }
.status-pill.dodge { color: var(--void); }
.status-pill.weak { color: var(--gold-bright); }

.arena-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.combat-ribbon {
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(10, 9, 12, 0.52);
  border: 1px solid rgba(214, 164, 78, 0.16);
  font-size: 12px;
  color: var(--text-main);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
  max-width: 280px;
}

/* ==========================================================================
   6. 中下牌桌：竖向实体卡牌阵（~43%）+ 饱满绒布大骰盘（~22%）
   ========================================================================== */
.tabletop-surface {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(20, 16, 13, 0.84) 0%, rgba(11, 9, 9, 0.96) 100%);
  box-shadow: 0 -14px 38px rgba(0, 0, 0, 0.68);
}
.brass-rail {
  height: 2.5px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(138, 101, 40, 0.5) 12%, rgba(244, 204, 124, 0.85) 50%, rgba(138, 101, 40, 0.5) 88%, transparent 100%);
}

/* 抽牌堆 + 竖向卡牌主舞台 + 弃牌堆 */
.cards-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 20px 6px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pile-badge {
  flex: 0 0 auto;
  width: 58px;
  height: 76px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: linear-gradient(165deg, #27201c 0%, #141112 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.42);
  box-shadow: 3px 3px 0 #1b1512, 6px 6px 14px rgba(0, 0, 0, 0.65);
  color: var(--gold-bright);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.pile-badge:hover { transform: translateY(-3px); border-color: #fff2cc; }
.pile-num { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.pile-lbl { font-size: 11px; color: var(--text-muted); font-weight: 700; }

.cards-rail {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: visible;
  display: flex;
  align-items: center;
}
.board-area {
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  padding: 8px 6px;
}

/* ---------- 真正竖向实体桌游卡牌 (约 2:3 比例) ---------- */
.card {
  position: relative;
  flex: 0 0 auto;
  width: 174px;
  min-height: 236px;
  display: flex;
  flex-direction: column;
  padding: 10px 11px;
  border-radius: 13px;
  background:
    radial-gradient(ellipse at 50% 24%, color-mix(in srgb, var(--cat-color) 16%, transparent) 0%, transparent 62%),
    linear-gradient(175deg, #26201c 0%, #161314 64%, #100e10 100%);
  border: 1.8px solid rgba(214, 164, 78, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 194, 0.16),
    inset 0 0 0 3px rgba(8, 7, 9, 0.48),
    0 10px 24px rgba(0, 0, 0, 0.62);
  cursor: pointer;
  overflow: hidden;
  transition: transform 170ms var(--ease-spring), border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out), opacity 160ms var(--ease-out);
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, transparent, var(--cat-color), transparent);
}
.card[data-cat="atk"]  { --cat-color: var(--ember-bright); }
.card[data-cat="def"]  { --cat-color: var(--frost); }
.card[data-cat="dice"] { --cat-color: var(--gold-bright); }
.card[data-cat="util"] { --cat-color: var(--venom); }

.card:hover:not(.invalid-target):not(.sealed) {
  transform: translateY(-8px) scale(1.03);
  border-color: rgba(245, 207, 130, 0.72);
  z-index: 8;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.75), 0 0 18px rgba(214, 164, 78, 0.22);
}
.card.valid-target {
  transform: translateY(-4px);
  border-color: var(--cat-color);
  box-shadow: 0 0 0 1.5px var(--cat-color), 0 0 24px color-mix(in srgb, var(--cat-color) 36%, transparent), 0 12px 26px rgba(0, 0, 0, 0.68);
}
.card.drag-over {
  transform: translateY(-12px) scale(1.06);
  border-color: var(--gold-bright);
  z-index: 12;
  box-shadow: 0 0 0 2.5px var(--gold-bright), 0 0 34px var(--gold-glow), 0 18px 34px rgba(0, 0, 0, 0.8);
}
.card.invalid-target { opacity: 0.36; filter: saturate(0.42); }
.card.card-triggered { animation: card-flash 280ms var(--ease-out); }

.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}
.card-tag-mini {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.cond-chip {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(8, 7, 9, 0.82);
  border: 1px solid color-mix(in srgb, var(--cat-color) 55%, transparent);
  color: var(--cat-color);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

/* 卡牌中央纹章画框区（竖向卡牌灵魂！） */
.card-emblem-box {
  position: relative;
  height: 62px;
  margin-bottom: 7px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--cat-color) 24%, #141112) 0%, #0d0b0d 82%);
  border: 1px solid color-mix(in srgb, var(--cat-color) 32%, rgba(214, 164, 78, 0.22));
  color: var(--cat-color);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.78);
}
.card-emblem-box .card-ico {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--cat-color) 55%, transparent));
}
.card-innate-tag {
  position: absolute;
  top: 4px;
  left: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(214, 164, 78, 0.24);
  border: 1px solid rgba(214, 164, 78, 0.55);
  color: var(--gold-bright);
  font-size: 9.5px;
  font-weight: 800;
}
.debuff-tag {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}
.debuff-tag.frozen { background: rgba(12, 42, 66, 0.92); border: 1px solid var(--frost); color: var(--frost); }
.debuff-tag.rusted { background: rgba(58, 30, 8, 0.92); border: 1px solid #f59e0b; color: #fbbf24; }

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin-bottom: 4px;
  text-align: center;
}
.card-name {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-lvl { font-size: 12px; font-weight: 900; color: var(--gold-bright); flex: 0 0 auto; }

.card-desc {
  flex: 1;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.38;
  text-align: center;
  margin-bottom: 6px;
}

.charge-track { height: 5px; border-radius: 999px; background: rgba(6, 5, 8, 0.85); overflow: hidden; margin-bottom: 6px; }
.charge-fill { height: 100%; background: linear-gradient(90deg, var(--gold-bright), var(--ember-bright)); transition: width 220ms var(--ease-out); }

/* 竖向卡牌底部雕刻骰子凹槽 + 实时收益预览条 */
.card-socket-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 6px 5px;
  border-radius: 8px;
  background: rgba(7, 6, 9, 0.72);
  border: 1px solid rgba(214, 164, 78, 0.18);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.82);
}
.socket-wells { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.socket-well {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(18, 15, 14, 0.88);
  border: 1.5px dashed rgba(214, 164, 78, 0.28);
  color: rgba(214, 164, 78, 0.36);
  font-size: 10px;
}
.card.valid-target .socket-well.open-well {
  border-style: solid;
  border-color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 14%, #120f0f);
  color: var(--cat-color);
}
.card-preview {
  width: 100%;
  text-align: center;
  padding: 2px 6px;
  border-radius: 5px;
  background: linear-gradient(145deg, var(--cat-color), color-mix(in srgb, var(--cat-color) 76%, #000));
  color: #120d08;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card.sealed { opacity: 0.54; filter: grayscale(0.8); }
.card.sealed::after {
  content: "已封印";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(-35deg, rgba(10,8,12,0.8), rgba(10,8,12,0.8) 10px, rgba(136,24,24,0.42) 10px, rgba(136,24,24,0.42) 14px);
  color: #fecaca;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  z-index: 6;
}
.card.frozen { border-color: var(--frost); }
.card.rusted { border-color: #d97706; }

/* ---------- 命运共鸣触发浮条（豹子/顺子） ---------- */
.resonance-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2px 16px 4px;
}
.btn-resonance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b87c24 0%, #f5cf82 50%, #c98628 100%);
  border: 1.5px solid #fff4d4;
  color: #1b1106;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(245, 207, 130, 0.72), 0 4px 12px rgba(0, 0, 0, 0.6);
  animation: end-glow 1.3s ease-in-out infinite;
}
.btn-resonance:hover { filter: brightness(1.08); transform: scale(1.03); }

/* ---------- 底部饱满厚实绒布大骰盘（~22% 舒适操控区） ---------- */
.command-deck {
  flex: 0 0 auto;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 6px 26px calc(14px + var(--safe-bottom));
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 185px;
  align-items: center;
  gap: 18px;
}
.deck-left { display: flex; flex-direction: column; gap: 4px; }
.deck-tip { font-size: 11px; color: var(--text-dim); text-align: center; }

.velvet-tray {
  position: relative;
  min-height: 84px;
  padding: 12px 20px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  background: radial-gradient(ellipse at 50% 40%, #2d181e 0%, #190e12 72%, #11090c 100%);
  border: 2px solid rgba(214, 164, 78, 0.46);
  box-shadow: inset 0 6px 22px rgba(0, 0, 0, 0.9), inset 0 0 0 3px rgba(9, 7, 8, 0.65), 0 6px 22px rgba(0, 0, 0, 0.65);
}
.hand-empty-hint { font-size: 13px; color: var(--text-muted); }

.btn-iron, .btn-gilded {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out), filter 140ms var(--ease-out), opacity 140ms var(--ease-out);
}
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn-iron {
  background: linear-gradient(180deg, #2d292a 0%, #181619 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.44);
  color: var(--text-bright);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 5px 14px rgba(0, 0, 0, 0.55);
}
.btn-iron:hover:not(:disabled) { border-color: var(--gold-bright); filter: brightness(1.12); }
.btn-iron:active:not(:disabled), .btn-gilded:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.iron-count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: rgba(214, 164, 78, 0.22); border: 1px solid rgba(214, 164, 78, 0.5); color: var(--gold-bright); font-size: 12px; font-variant-numeric: tabular-nums; }
.btn-gilded {
  background: linear-gradient(180deg, #f16a43 0%, #c4361d 55%, #8a1f10 100%);
  border: 1.5px solid #f7c774;
  color: #fff9ee;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 238, 196, 0.55), 0 5px 18px rgba(196, 54, 29, 0.48);
}
.btn-gilded:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 0 24px rgba(241, 106, 67, 0.64); }
.btn-gilded-lg { min-height: 54px; font-size: 17px; letter-spacing: 0.12em; }
.btn-block { width: 100%; }
.btn-end-ready { animation: end-glow 1.6s ease-in-out infinite; }
.btn-iron:disabled, .btn-gilded:disabled { opacity: 0.36; cursor: not-allowed; transform: none; box-shadow: none; }

/* ==========================================================================
   7. 饱满立体大骰子（58px 抓握手感回归！）
   ========================================================================== */
.die-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }

.die {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  padding: 9px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border-radius: 13px;
  cursor: grab;
  touch-action: none;
  background: linear-gradient(145deg, #fffaf0 0%, #e4d6be 62%, #bfa988 100%);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.85) inset, 0 -3px 0 rgba(88, 66, 38, 0.36) inset, 0 8px 18px rgba(0, 0, 0, 0.64);
  transition: transform 150ms var(--ease-spring), box-shadow 150ms var(--ease-out), opacity 140ms var(--ease-out);
}
.die:active { cursor: grabbing; }
.dot { width: 9.5px; height: 9.5px; border-radius: 50%; align-self: center; justify-self: center; background: radial-gradient(circle at 32% 32%, #3d3124, #120d08); }
.die[data-val="1"] > .dot:nth-child(1) { grid-area: 2/2; width: 12px; height: 12px; background: radial-gradient(circle at 32% 32%, #ff6b52, #9e1612); }
.die[data-val="2"] > .dot:nth-child(1) { grid-area: 1/1; } .die[data-val="2"] > .dot:nth-child(2) { grid-area: 3/3; }
.die[data-val="3"] > .dot:nth-child(1) { grid-area: 1/1; } .die[data-val="3"] > .dot:nth-child(2) { grid-area: 2/2; } .die[data-val="3"] > .dot:nth-child(3) { grid-area: 3/3; }
.die[data-val="4"] > .dot:nth-child(1) { grid-area: 1/1; } .die[data-val="4"] > .dot:nth-child(2) { grid-area: 1/3; } .die[data-val="4"] > .dot:nth-child(3) { grid-area: 3/1; } .die[data-val="4"] > .dot:nth-child(4) { grid-area: 3/3; }
.die[data-val="5"] > .dot:nth-child(1) { grid-area: 1/1; } .die[data-val="5"] > .dot:nth-child(2) { grid-area: 1/3; } .die[data-val="5"] > .dot:nth-child(3) { grid-area: 2/2; } .die[data-val="5"] > .dot:nth-child(4) { grid-area: 3/1; } .die[data-val="5"] > .dot:nth-child(5) { grid-area: 3/3; }
.die[data-val="6"] > .dot:nth-child(1) { grid-area: 1/1; } .die[data-val="6"] > .dot:nth-child(2) { grid-area: 1/3; } .die[data-val="6"] > .dot:nth-child(3) { grid-area: 2/1; } .die[data-val="6"] > .dot:nth-child(4) { grid-area: 2/3; } .die[data-val="6"] > .dot:nth-child(5) { grid-area: 3/1; } .die[data-val="6"] > .dot:nth-child(6) { grid-area: 3/3; }

.die.type-iron { background: linear-gradient(145deg, #742823 0%, #421412 60%, #240a0a 100%); }
.die.type-iron .dot { background: radial-gradient(circle at 30% 30%, #fde68a, #d97706); }
.die.type-frost { background: linear-gradient(145deg, #dcf6ff 0%, #7dd3fc 56%, #0284c7 100%); }
.die.type-frost .dot { background: radial-gradient(circle at 30% 30%, #ffffff, #0c4a6e); }
.die.type-void { background: linear-gradient(145deg, #3b1373 0%, #1c0b38 64%, #0a0417 100%); box-shadow: 0 0 0 1.5px rgba(192,132,252,0.55) inset, 0 8px 18px rgba(88,28,135,0.6); }
.die.type-void .dot { background: radial-gradient(circle at 30% 30%, #f5d0fe, #a855f7); }
.die.type-corrupt { background: linear-gradient(145deg, #3b0764 0%, #14532d 74%, #052e16 100%); animation: corrupt-pulse 1.5s ease-in-out infinite; }
.die.type-corrupt .dot { background: radial-gradient(circle at 30% 30%, #bef264, #22c55e); }

.die.selected { transform: translateY(-10px) scale(1.1); box-shadow: 0 0 0 2.5px var(--gold-bright), 0 0 26px var(--ember-glow), 0 14px 24px rgba(0,0,0,0.72); z-index: 6; }
.die.locked { box-shadow: 0 0 0 2.5px var(--gold-bright), 0 8px 18px rgba(0,0,0,0.65); }
.die.dragging-source { opacity: 0.22; transform: scale(0.88); }
.die.rolling { animation: dice-tumble 360ms var(--ease-spring) backwards; }

.die-type-mark { position: absolute; bottom: -5px; left: -5px; padding: 0 5px; height: 17px; border-radius: 5px; background: #141112; border: 1px solid rgba(214, 164, 78, 0.55); color: var(--gold-bright); font-size: 10px; font-weight: 800; line-height: 15px; pointer-events: none; z-index: 7; }
.die-lock-btn { position: absolute; top: -8px; right: -8px; width: 23px; height: 23px; border-radius: 50%; border: 1.5px solid rgba(214, 164, 78, 0.52); background: #1c1816; color: var(--text-muted); display: grid; place-items: center; padding: 0; cursor: pointer; z-index: 8; }
.die-lock-btn.active { background: var(--gold-bright); border-color: #fff2cc; color: #1a1208; }
.die-lock-btn .ui-ico { width: 12px; height: 12px; }

.socket-well .die { width: 26px; height: 26px; padding: 3.5px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.55); pointer-events: none; cursor: default; }
.socket-well .die .dot { width: 4px; height: 4px; }
.socket-well .die[data-val="1"] > .dot:nth-child(1) { width: 5.5px; height: 5.5px; }
.stored-die-wrap { position: relative; display: inline-flex; }
.bonus-text { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none; padding: 0 3px; border-radius: 3px; background: rgba(11, 10, 14, 0.92); border: 1px solid rgba(214, 164, 78, 0.45); font-size: 9px; font-weight: 800; color: var(--gold-bright); white-space: nowrap; }

/* ==========================================================================
   8. 弹窗、黑市、牌库检视、飘字与 Toast
   ========================================================================== */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(6, 6, 10, 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal.active { display: flex; animation: fade-in 200ms var(--ease-out); }

.modal-box {
  width: 100%; max-width: 500px; max-height: calc(100dvh - 34px); overflow-y: auto; padding: 22px 22px 20px; border-radius: 16px;
  background: radial-gradient(ellipse at 50% 0%, rgba(214, 164, 78, 0.13) 0%, transparent 60%), linear-gradient(180deg, #1f1a18 0%, #121012 100%);
  border: 1.5px solid rgba(214, 164, 78, 0.48); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85); animation: modal-in 240ms var(--ease-spring);
  scrollbar-width: thin; scrollbar-color: rgba(214, 164, 78, 0.42) transparent;
}
.modal-box-wide { max-width: 580px; }
.modal-ornament { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.28em; color: var(--gold); margin-bottom: 4px; }
.modal-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 23px; font-weight: 800; text-align: center; color: var(--text-bright); }
.modal-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-muted); text-align: center; }

.option-list { display: flex; flex-direction: column; gap: 9px; }
.option { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px; background: linear-gradient(160deg, #27211e 0%, #191516 100%); border: 1.5px solid rgba(214, 164, 78, 0.24); color: var(--text-bright); text-align: left; cursor: pointer; transition: transform 140ms var(--ease-out), border-color 140ms var(--ease-out); }
.option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--gold-bright); }
.option:disabled { opacity: 0.42; cursor: not-allowed; }
.option-ico { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; background: rgba(232, 93, 63, 0.16); border: 1px solid rgba(232, 93, 63, 0.35); color: var(--ember-bright); }
.option-ico.gold  { background: rgba(214, 164, 78, 0.18); border-color: rgba(214, 164, 78, 0.45); color: var(--gold-bright); }
.option-ico.frost { background: rgba(98, 204, 245, 0.16); border-color: rgba(98, 204, 245, 0.42); color: var(--frost); }
.option-ico.venom { background: rgba(82, 217, 123, 0.16); border-color: rgba(82, 217, 123, 0.42); color: var(--venom); }
.option-ico.void  { background: rgba(192, 132, 252, 0.16); border-color: rgba(192, 132, 252, 0.42); color: var(--void); }
.option-ico svg { width: 20px; height: 20px; }
.option-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.option-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.option strong { font-size: 14px; color: var(--text-bright); }
.option small { font-size: 12px; color: var(--text-muted); line-height: 1.38; }
.option-tag { font-size: 11px; font-weight: 800; color: var(--gold-bright); white-space: nowrap; }
.option-price { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; background: rgba(214, 164, 78, 0.18); border: 1px solid rgba(214, 164, 78, 0.48); color: var(--gold-bright); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.option-price.cant-afford { color: #ff7c7c; border-color: rgba(255, 124, 124, 0.45); background: rgba(153, 27, 27, 0.25); }

.shop-balance { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; font-size: 14px; font-weight: 800; color: var(--gold-bright); }
.modal-footer-actions { margin-top: 14px; display: flex; gap: 10px; }
.modal-footer-actions button { flex: 1; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.summary-cell { padding: 10px 8px; border-radius: 10px; background: rgba(10, 9, 12, 0.65); border: 1px solid rgba(214, 164, 78, 0.22); text-align: center; }
.summary-num { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold-bright); }
.summary-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.rules-list { display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.62; color: var(--text-main); }
.rules-list strong { color: var(--gold-bright); }
.rules-list code { padding: 1px 5px; border-radius: 4px; background: rgba(214, 164, 78, 0.16); color: var(--gold-bright); }

.float-num { position: fixed; transform: translate(-50%, -50%); font-weight: 900; font-size: 22px; font-variant-numeric: tabular-nums; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.92); pointer-events: none; white-space: nowrap; animation: float-up 860ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.float-num.crit { font-size: 29px; color: #fde047; }
.float-num.dmg { color: #ff7a52; }
.float-num.armor { color: var(--frost); }
.float-num.heal { color: var(--venom); }
.float-num.poison { color: #86efac; font-size: 18px; }
.float-num.hurt { color: #ff4757; font-size: 24px; }
.float-num.info { color: var(--gold-bright); font-size: 17px; }

.drag-ghost { position: fixed; pointer-events: none; z-index: 150; transform: translate(-50%, -50%) scale(1.14) rotate(-6deg); filter: drop-shadow(0 14px 26px rgba(0,0,0,0.72)); }
.fly-die { position: fixed; pointer-events: none; z-index: 140; transition: transform 230ms cubic-bezier(0.22, 1, 0.36, 1), opacity 230ms ease-out; }

.toast-host { position: fixed; left: 50%; bottom: calc(108px + var(--safe-bottom)); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 8px 16px; border-radius: 999px; background: rgba(20, 17, 18, 0.94); border: 1.5px solid rgba(214, 164, 78, 0.52); color: var(--text-bright); font-size: 13px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75); white-space: nowrap; animation: toast-in 220ms var(--ease-spring); }
.toast.out { animation: toast-out 180ms var(--ease-out) forwards; }

.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: rgba(214, 164, 78, 0.42) transparent; }
.scroll-y::-webkit-scrollbar, .modal-box::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb, .modal-box::-webkit-scrollbar-thumb { background: rgba(214, 164, 78, 0.38); border-radius: 999px; }
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ==========================================================================
   9. 响应式布局（平板 & 390px 手机端丝滑横滑竖向卡牌）
   ========================================================================== */
@media (max-width: 960px) {
  .battle-arena { grid-template-columns: 1fr 1fr; padding: 6px 14px 10px; gap: 8px 12px; }
  .arena-center { grid-column: 1 / -1; order: 3; }
  .portrait-frame { width: 92px; height: 92px; border-radius: 13px; }
  .enemy-frame { width: 100px; height: 100px; }
  .intent-badge { top: -12px; left: -24px; padding: 4px 9px; }
  .intent-num { font-size: 19px; }
  .intent-ico .ui-ico { width: 17px; height: 17px; }
  .combatant-name { font-size: 16px; }
  .cards-stage { padding: 8px 10px 4px; gap: 8px; }
  .pile-badge { width: 42px; height: 64px; }
  .pile-num { font-size: 16px; }
  .card { width: 146px; min-height: 204px; padding: 8px 9px; }
  .card-emblem-box { height: 48px; }
  .card-emblem-box .card-ico { width: 26px; height: 26px; }
  .command-deck { grid-template-columns: 1fr 1fr; padding: 6px 14px calc(10px + var(--safe-bottom)); gap: 8px; }
  .velvet-tray { grid-column: 1 / -1; order: -1; min-height: 70px; padding: 8px 10px; gap: 11px; }
  .deck-tip { display: none; }
  .map-header { flex-wrap: wrap; padding: 10px 14px; }
}

@media (max-width: 560px) {
  .stage-topbar { padding: 6px 10px 4px; gap: 5px; flex-wrap: wrap; }
  .topbar-center { order: 3; width: 100%; justify-content: center; flex-wrap: nowrap; }
  .turn-plaque { font-size: 11px; padding: 3px 9px; }
  .mod-seal { font-size: 11px; padding: 3px 9px; min-width: 0; }
  .brand-crest { display: none; }
  .medallion-btn { width: 31px; height: 31px; }
  .btn-map-pill { height: 31px; padding: 0 9px; font-size: 11.5px; }
  .combatant-wing { flex-direction: column; align-items: stretch; gap: 5px; }
  .hero-wing .portrait-frame { align-self: flex-start; width: 76px; height: 76px; }
  .enemy-wing { flex-direction: column-reverse; }
  .enemy-stage-unit { align-self: flex-end; }
  .enemy-frame { width: 84px; height: 84px; }
  .intent-badge { top: -10px; left: auto; right: 70px; padding: 4px 8px; }
  .intent-num { font-size: 17px; }
  .intent-sub { font-size: 9.5px; }
  .armor-crest { padding: 2px 7px; font-size: 12px; bottom: -8px; right: -8px; }
  .potion-slot { height: 26px; padding: 0 6px; font-size: 10px; }
  .relic-chip { width: 26px; height: 26px; }
  .relic-chip .relic-ico { width: 14px; height: 14px; }
  .cards-stage { padding: 6px 8px 4px; gap: 6px; }
  .pile-badge { width: 34px; height: 56px; border-radius: 8px; }
  .pile-num { font-size: 14px; }
  .pile-lbl { font-size: 9.5px; }
  .board-area { gap: 9px; padding: 6px 4px; }
  .card { width: 132px; min-height: 186px; padding: 7px 8px; }
  .card-emblem-box { height: 42px; margin-bottom: 5px; }
  .card-emblem-box .card-ico { width: 24px; height: 24px; }
  .card-name { font-size: 13px; }
  .card-desc { font-size: 10.5px; }
  .socket-well { width: 25px; height: 25px; }
  .die { width: 48px; height: 48px; padding: 7px; border-radius: 11px; }
  .dot { width: 8px; height: 8px; }
  .btn-iron, .btn-gilded { min-height: 44px; font-size: 14px; }
  .title-credits { font-size: 12px; padding: 5px 14px; }
  .map-node-ring { width: 42px; height: 42px; }
  .map-node-ring .ui-ico { width: 18px; height: 18px; }
  .map-node.tone-boss .map-node-ring { width: 64px; height: 64px; }
  .map-node-label { font-size: 9.5px; }
  .map-floor-tick { left: 6px; font-size: 10px; }
}

/* ==========================================================================
   10. 动效关键帧
   ========================================================================== */
@keyframes torch-flicker { 0%,100% { opacity: 0.72; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes subtle-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes monster-breathe { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.035); } }
@keyframes hero-lunge { 0% { transform: translateX(0); } 38% { transform: translateX(18px) scale(1.05); } 100% { transform: translateX(0); } }
@keyframes enemy-lunge { 0% { transform: translateX(0); } 38% { transform: translateX(-20px) scale(1.07); } 100% { transform: translateX(0); } }
@keyframes dice-tumble { 0% { opacity: 0; transform: translateY(16px) rotate(-28deg) scale(0.65); } 65% { opacity: 1; transform: translateY(-3px) rotate(6deg) scale(1.05); } 100% { opacity: 1; transform: none; } }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, -15%) scale(0.75); } 18% { opacity: 1; transform: translate(-50%, -60%) scale(1.12); } 100% { opacity: 0; transform: translate(-50%, -185%) scale(0.96); } }
@keyframes card-flash { 0% { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 26px var(--gold-glow); } 100% { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.62); } }
@keyframes end-glow { 0%,100% { box-shadow: 0 0 0 1px var(--gold-bright), 0 4px 16px rgba(241,106,67,0.45); } 50% { box-shadow: 0 0 0 2px #fff2cc, 0 0 26px rgba(241,106,67,0.82); } }
@keyframes node-beacon { 0%,100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(245,207,130,0.34), 0 0 18px rgba(245,207,130,0.68); } 50% { transform: scale(1.08); box-shadow: 0 0 0 5px rgba(245,207,130,0.54), 0 0 28px rgba(245,207,130,0.92); } }
@keyframes pawn-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes relic-pop { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes lowhp-beat { 0%,100% { opacity: 0.45; } 50% { opacity: 0.95; } }
@keyframes corrupt-pulse { 0%,100% { box-shadow: 0 0 0 1.5px rgba(74,222,128,0.55) inset, 0 0 12px rgba(168,85,247,0.38); } 50% { box-shadow: 0 0 0 2px rgba(74,222,128,0.92) inset, 0 0 22px rgba(168,85,247,0.78); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.anim-shake { animation: shake 340ms var(--ease-out); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
