/* ================================================================
   CCtd - Poker Maze Wall-Tower Defense Modern Design System
   ================================================================ */

:root {
  --bg-primary: #f4efe6;          /* 暖米色古宣纸底色 */
  --bg-secondary: #fbf9f4;        /* 纯净绢帛白 */
  --bg-card: #ffffff;             /* 象牙白卡片 */
  --bg-hover: #ede7dc;            /* 浅木米色悬浮 */
  --border-color: #d8d0bf;        /* 宋锦淡墨细边框 */
  --text-main: #27221d;           /* 端庄玄墨黑 */
  --text-sub: #57534e;            /* 古铜深墨灰 (高对比可读) */
  --accent-gold: #92400e;         /* 汉印金箔 / 熟铜金 (高对比深琥珀) */
  --accent-blue: #1e40af;         /* 正色藏青 / 靛蓝 (沉稳内敛) */
  --accent-green: #166534;        /* 正色松柏绿 / 墨玉苍翠 (庄重大气) */
  --accent-red: #b91c1c;          /* 汉印朱砂赤 (高对比正朱砂) */
  --accent-purple: #6b21a8;       /* 紫檀 (高对比深紫檀) */
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(194, 120, 3, 0.08) 0px, transparent 55%),
    radial-gradient(at 100% 100%, rgba(30, 64, 175, 0.04) 0px, transparent 55%),
    linear-gradient(rgba(39, 34, 29, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 34, 29, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 0 8px 16px 8px;
}

/* 顶部导航与首领战况统一 HUD (吸顶常驻，电脑模式居中顶栏) */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 70;
  width: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: column;
  background: rgba(251, 249, 244, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(216, 208, 191, 0.85);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 6px 14px 4px 14px;
  margin-bottom: 6px;
  box-shadow: 0 4px 18px rgba(70, 55, 30, 0.07);
}

.top-nav-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(216, 208, 191, 0.6);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #c27803 0%, #c53030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  display: none !important;
}

/* 顶栏左侧：只读战局状态文字 (开放式无边框设计，严禁方框/圆圈闭环图形，彻底杜绝误认成按钮) */
.resource-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  padding-right: 8px;
  border-right: 1px solid rgba(180, 168, 146, 0.65);
}

.res-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 1px 2px;
  border-radius: 0;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: none;
  color: var(--text-main);
  cursor: default;
}

.res-pill + .res-pill::before {
  content: '·';
  color: #b5aa96;
  margin-right: 4px;
  font-weight: 900;
}

.res-pill .res-icon {
  font-size: 11px;
  opacity: 0.92;
}

.res-pill.boss { color: #991b1b; border-bottom-color: rgba(197, 48, 48, 0.45); }
.res-pill.round { color: #1e3a8a; border-bottom-color: rgba(30, 64, 175, 0.4); }
.res-pill.pieces { display: none !important; }
.res-pill.lives { color: #991b1b; border-bottom-color: rgba(220, 38, 38, 0.45); }

/* 顶栏右侧：可点击快捷功能按钮组 (高对比 3D 凸起按键质感) */
.nav-actions-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-act-btn {
  padding: 2.5px 7px;
  font-size: 11px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  white-space: nowrap;
}

.nav-btn-gold {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%) !important;
  border-color: #f59e0b !important;
  border-bottom-color: #b45309 !important;
  color: #92400e !important;
}

.nav-btn-gold:hover {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%) !important;
  color: #78350f !important;
}

.nav-btn-blue {
  background: linear-gradient(180deg, #f0f7ff 0%, #dbeafe 100%) !important;
  border-color: #60a5fa !important;
  border-bottom-color: #2563eb !important;
  color: #1e40af !important;
}

.nav-btn-blue:hover {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%) !important;
  color: #1e3a8a !important;
}

.btn-count-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 900;
  opacity: 0.92;
  margin-left: 1px;
}

/* 首领紧凑血条 (内嵌于 Top HUD) */
.boss-strip {
  width: 100%;
  padding: 4px 2px 2px 2px;
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 0;
}

.boss-strip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  margin-bottom: 3px;
  position: relative;
  z-index: 2;
}

.boss-name {
  font-weight: 800;
  color: #c53030;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.3px;
}

.boss-hp-box {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
}

.boss-hp-val {
  font-weight: 800;
  color: var(--text-main);
}

.boss-bar-container {
  position: relative;
  height: 6px;
  background: #e7e2d6;
  border: 1px solid #d8d0bf;
  border-radius: 3px;
  overflow: hidden;
}

.boss-bar-chip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #c27803 0%, #c53030 100%);
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 0 2px 2px 0;
}

.boss-bar-current {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #15803d 0%, #166534 100%);
  transition: width 0.08s ease, background 0.3s;
  border-radius: 0 2px 2px 0;
}

/* ================================================================
   电脑版/桌面模式双列并排工作台布局 (PC Mode Game Layout)
   ================================================================ */
.game-layout {
  width: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin: 0 auto;
  position: relative;
}

/* 主工作区 (左侧迷宫战场与部署托盘) */
.main-wrapper {
  width: 580px;
  max-width: 580px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 0 20px 0;
}

/* 迷宫状态提示行 (开放式底部细虚线，无闭环方框) */
.maze-prompt {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(180, 83, 9, 0.35);
  border-radius: 0;
  padding: 2px 4px 3px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  text-align: center;
  cursor: default;
}

/* 画布容器 (电脑端 560x560 像素级原生精细呈现) */
.canvas-wrapper {
  position: relative;
  background: #faf8f3;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 3px;
  box-shadow: 0 6px 20px rgba(60, 45, 20, 0.08), inset 0 0 10px rgba(0, 0, 0, 0.02);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 560px;
  height: 560px;
  max-width: 560px;
  max-height: 560px;
  aspect-ratio: 1 / 1;
}

.canvas-wrapper::before,
.canvas-wrapper::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: #c27803;
  pointer-events: none;
  z-index: 10;
}
.canvas-wrapper::before {
  top: 5px; left: 5px;
  border-top: 2px solid #c27803;
  border-left: 2px solid #c27803;
}
.canvas-wrapper::after {
  bottom: 5px; right: 5px;
  border-bottom: 2px solid #c27803;
  border-right: 2px solid #c27803;
}

#gameCanvas {
  background: #faf8f3;
  border-radius: 7px;
  display: block;
  cursor: pointer;
  touch-action: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
}

/* 路径热力图图例栏 (左侧只读图例 + 右侧凸起胶囊开关按钮) */
.heat-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px;
  font-size: 11px;
  color: #645d53;
}

.heat-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 0;
  box-shadow: none;
  cursor: default;
  min-width: 0;
}

.heat-lbl {
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 700;
  color: #6b6358;
}

.heat-bar {
  width: 68px;
  height: 6px;
  border-radius: 3px;
  border: 1px solid rgba(39, 34, 29, 0.15);
  background: linear-gradient(90deg, #1e40af, #d97706, #ea580c, #b91c1c);
}

.heat-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-pill-toggle {
  border-radius: 999px !important;
  padding: 2.5px 9px !important;
  font-weight: 800 !important;
}

#btn-toggle-board-view {
  background: linear-gradient(180deg, #fffbeb 0%, #fde68a 100%);
  border-color: #b45309;
  border-bottom: 2.5px solid #92400e;
  color: #78350f;
}

#btn-toggle-board-view.active {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #2563eb;
  border-bottom: 2.5px solid #1e40af;
  color: #1e3a8a;
}

/* 积木与待放塔合并托盘栏 (放在同一行，节省大量纵向空间) */
.deploy-shelf {
  width: 100%;
  display: flex;
  gap: 6px;
  align-items: stretch;
  box-sizing: border-box;
}

/* 积木与塔按组排列容器 (积木1|塔1，积木2|塔2) */
.pair-dock-container {
  width: 100%;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px 6px;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.pair-groups-container {
  display: flex;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.pair-group-card {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  background: #fdfbf7;
  border: 1.5px solid #d8d0bf;
  border-radius: 8px;
  padding: 6px 6px;
  gap: 8px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  transition: all 0.2s;
}

.pair-group-card.active {
  border-color: #b45309;
  background: #fffbeb;
  box-shadow: 0 0 0 1.5px rgba(180, 83, 9, 0.25);
}

.pair-group-card.complete {
  border-color: #166534;
  background: #f0fdf4;
}

.pair-group-card.empty {
  border: 1.5px dashed #d6cfc2;
  background: #faf7f2;
  align-items: center;
  justify-content: center;
}

.pair-empty-text {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #a8a29e;
  font-size: 10px;
  font-weight: 700;
  padding: 6px 2px;
}

.pair-group-badge {
  position: absolute;
  top: -7px;
  left: 6px;
  font-size: 8.5px;
  font-weight: 800;
  padding: 0 4px;
  background: #f5f0e6;
  border: 1px solid #c4b5a0;
  border-radius: 3px;
  color: #78350f;
  line-height: 13px;
  z-index: 2;
  white-space: nowrap;
}

/* 积木按钮：独立实体卡片按钮，与塔按钮边界清晰分离 */
.pair-block-side {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  padding: 4px 6px;
  border-radius: 6px;
  background: #ffffff;
  border: 1.5px solid #d5cfc4;
  border-left: 3.5px solid #64748b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.18s ease;
}

.pair-block-side:active {
  cursor: grabbing;
  transform: translateY(1px);
}

.pair-block-side:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  border-left-color: #2563eb;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.pair-divider {
  display: none;
}

/* 积木旋转微调小钮 (专门方便手机触摸点击，免除手机无快捷键/无右键困扰) */
.pair-block-rotate-btn {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.pair-block-rotate-btn:hover,
.pair-block-rotate-btn:active {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
  transform: scale(1.08);
}

/* 塔按钮：独立实体卡片按钮，军阵铜橙风格，与积木形成鲜明对比 */
.pair-tower-side {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-left: 3.5px solid #b45309;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: grab;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.18s ease;
}

.pair-tower-side .tower-chip-main {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.pair-tower-side.selected {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
  border-left-color: #d97706 !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4), 0 3px 8px rgba(180, 83, 9, 0.25) !important;
  transform: translateY(-1px);
}

.pair-tower-side:active {
  cursor: grabbing;
  transform: translateY(1px);
}

.pair-tower-side:hover {
  background: #fffbeb;
  border-color: #d97706;
  border-left-color: #b45309;
  box-shadow: 0 2px 5px rgba(180, 83, 9, 0.18);
  transform: translateY(-1px);
}

.pair-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.pair-item-title {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.pair-item-sub {
  font-size: 8.5px;
  color: #78350f;
  font-weight: 700;
}

.pair-item-atk {
  font-size: 9.5px;
  color: #b91c1c;
  font-weight: 900;
}

.pair-item-status {
  font-size: 8px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.pair-block-side.unplaced .pair-item-status,
.pair-tower-side.unplaced .pair-item-status {
  color: #1e40af;
  font-weight: 700;
}

/* 放完积木后积木按钮呈现淡色/半透明/低饱和度，直观提示已放置完毕 */
.pair-block-side.placed {
  opacity: 0.45;
  filter: grayscale(0.45);
  background: rgba(245, 242, 235, 0.45);
  border: 1px dashed #d1c9ba;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s ease;
}

.pair-block-side.placed:hover {
  opacity: 0.85;
  filter: none;
  background: rgba(180, 168, 146, 0.22);
  border-color: rgba(30, 64, 175, 0.4);
}

.pair-block-side.placed .pair-item-title {
  color: #8c8275;
}

.pair-block-side.placed .pair-item-sub {
  color: #a8a29e;
}

.pair-block-side.placed .pair-item-status {
  color: #6b7280;
  font-weight: 600;
}

.pair-block-side.placed .block-cell-dot.filled {
  background: #9ca3af;
  box-shadow: none;
}

.pair-block-side.placed:hover .block-cell-dot.filled {
  background: #2563eb;
}

/* 塔放置后同样呈现淡色/半透明/低饱和度，与积木放置后状态一致，点击可收回微调 */
.pair-tower-side.placed {
  opacity: 0.45;
  filter: grayscale(0.5);
  background: rgba(245, 242, 235, 0.45);
  border: 1px dashed #d1c9ba;
  border-left: 3px solid #d97706;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s ease;
}

.pair-tower-side.placed:hover {
  opacity: 0.85;
  filter: none;
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-left: 3.5px solid #b45309;
  box-shadow: 0 2px 5px rgba(180, 83, 9, 0.18);
  transform: translateY(-1px);
}

.pair-tower-side.placed .pair-item-title {
  color: #8c8275;
}

.pair-tower-side.placed .pair-item-status {
  color: #166534;
  font-weight: 600;
}

.pair-tower-undo-btn {
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 800;
  border-radius: 3px;
  border: 1px solid #d97706;
  background: #fef3c7;
  color: #92400e;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.pair-tower-undo-btn:hover {
  background: #fde68a;
  transform: scale(1.05);
}

/* 积木物品栏 Dock */
.dock-container {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px 6px;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.dock-container.drag-over {
  border-color: #166534 !important;
  box-shadow: 0 0 14px rgba(22, 101, 52, 0.25) !important;
  background: rgba(22, 101, 52, 0.06) !important;
}

.dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  padding: 0 2px;
}

.dock-title {
  font-weight: 800;
  color: var(--text-sub);
}

.dock-status {
  color: var(--accent-gold);
  font-weight: 700;
}

.block-dock {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.block-card {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 7px;
  padding: 3px 5px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* 没用的积木：正色藏青，沉稳庄重 */
.block-card.unplaced,
.block-card:not(.placed) {
  border-color: rgba(30, 64, 175, 0.7);
  background: linear-gradient(135deg, #f0f4f8 0%, #ffffff 100%);
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.12);
}

.block-card.unplaced .block-title,
.block-card:not(.placed) .block-title {
  color: #172554;
}

.block-card.unplaced .block-status-tag,
.block-card:not(.placed) .block-status-tag {
  color: #1e40af;
  font-weight: 700;
}

.block-card:active {
  cursor: grabbing;
}

.block-card.active-selected {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 12px rgba(194, 120, 3, 0.45) !important;
}

/* 本轮已用的积木：淡色/暗色已完成状态，一目了然 */
.block-card.placed {
  opacity: 0.55;
  filter: grayscale(0.4);
  background: #f5f2eb;
  border: 1px dashed #d1c9ba;
  box-shadow: none;
}

.block-card.placed:hover {
  opacity: 0.85;
  filter: none;
  border-color: rgba(30, 64, 175, 0.5);
}

.block-card.placed .block-title,
.block-card.placed .block-title-atk,
.block-card.placed .block-status-tag {
  color: #8c8275;
}

.block-card.placed .block-cell-dot.filled {
  background: #9ca3af;
  box-shadow: none;
}

.block-preview-box {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 0px;
  padding: 1px;
  flex-shrink: 0;
}

.block-cell-dot {
  border-radius: 0;
}

.block-cell-dot.filled {
  background: linear-gradient(180deg, #d6cfc2 0%, #b8afa0 100%);
  border: 1px solid #57534e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.block-cell-dot.filled.conn-u { border-top-color: rgba(87, 83, 78, 0.25); }
.block-cell-dot.filled.conn-d { border-bottom-color: rgba(87, 83, 78, 0.25); }
.block-cell-dot.filled.conn-l { border-left-color: rgba(87, 83, 78, 0.25); }
.block-cell-dot.filled.conn-r { border-right-color: rgba(87, 83, 78, 0.25); }

.tower-mini-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
}

.block-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.block-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-title-atk {
  color: #92400e;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 9.5px;
  margin-left: 2px;
}

.block-status-tag {
  font-size: 8.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 待放塔托盘已完全整合至上方成对卡槽中，隐藏外置的冗余旧托盘框 */
.tower-tray {
  display: none !important;
}

.tower-tray-list {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  align-items: stretch;
}

.tower-tray-chip {
  flex: 1;
  min-width: 0;
  padding: 3px 4px;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  border: 1.5px solid #d8d0bf;
  background: #ffffff;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  transition: all 0.2s;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

/* 没用的塔：亮色高亮金黄微光，提示玩家拖到迷宫墙格 */
.tower-tray-chip.unplaced,
.tower-tray-chip:not(.placed) {
  border-color: rgba(217, 119, 6, 0.8);
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
  color: #78350f;
}

.tower-tray-chip.unplaced .tower-chip-title,
.tower-tray-chip:not(.placed) .tower-chip-title {
  color: #78350f;
}

.tower-tray-chip.unplaced .tower-chip-status,
.tower-tray-chip:not(.placed) .tower-chip-status {
  color: #b45309;
  font-weight: 700;
}

.tower-tray-chip:hover {
  border-color: #d97706;
  background: #fef3c7;
}

.tower-tray-chip.selected {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 12px rgba(194, 120, 3, 0.45) !important;
}

/* 本轮已用的塔：淡色/暗色已入驻状态 */
.tower-tray-chip.placed {
  opacity: 0.55;
  filter: grayscale(0.4);
  border: 1px dashed #d1c9ba;
  background: #f5f2eb;
  box-shadow: none;
  color: #8c8275;
}

.tower-tray-chip.placed:hover {
  opacity: 0.85;
  filter: none;
  border-color: rgba(22, 101, 52, 0.4);
}

.tower-tray-chip.placed .tower-chip-title,
.tower-tray-chip.placed .tower-chip-atk {
  color: #8c8275;
}

.tower-tray-chip.placed .tower-chip-status {
  color: #166534;
  font-weight: 600;
}

.tower-chip-title {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.tower-chip-atk {
  color: #92400e;
  font-family: var(--font-mono);
  font-weight: 800;
}

.tower-chip-status {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
}

.tower-chip-undo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #d97706;
  background: #fef3c7;
  color: #92400e;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s;
}

.tower-chip-undo-btn:hover {
  background: #fde68a;
  border-color: #b45309;
  transform: scale(1.05);
}

.tower-empty-hint {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  color: #78716c;
  border: none;
  background: transparent;
  padding: 4px;
  min-height: 32px;
  text-align: center;
  cursor: default;
}


/* 轮廓次级大按钮 (3D 凸起按键质感) */
.btn-outline {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 0%, #f0f5ff 100%);
  border: 1.5px solid rgba(30, 64, 175, 0.45);
  border-bottom: 3px solid rgba(30, 64, 175, 0.7);
  color: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.10), inset 0 1px 0 #ffffff;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn-outline:hover {
  background: linear-gradient(180deg, #f8fbff 0%, #e0ebff 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(30, 64, 175, 0.16), inset 0 1px 0 #ffffff;
}

.btn-outline:active {
  transform: translateY(1px);
  border-bottom-width: 1.5px;
  box-shadow: 0 1px 3px rgba(30, 64, 175, 0.10);
}

/* 统一选牌/牌型信息条 */
.unified-bar {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.eval-info-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  gap: 8px;
}

.eval-name {
  font-weight: 800;
  color: #b45309;
}

/* 算力数值只读文字 (开放式无边框排版，不带方框/圆圈闭环) */
.eval-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #44403c;
}

.eval-stats span {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  cursor: default;
  white-space: nowrap;
}

.eval-stats span + span::before {
  content: '·';
  color: #b5aa96;
  margin-right: 6px;
  font-weight: 900;
}

/* 出牌阶段积木形状预览 (开放式分隔线，无外包方框) */
.eval-piece-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 5px 0 2px 0;
  background: transparent;
  border: none;
  border-top: 1px dashed #dcd3c0;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
}

.eval-piece-preview-box {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 0;
  display: grid;
  gap: 0px;
  padding: 1px;
  flex-shrink: 0;
}

.eval-piece-text {
  font-size: 11px;
  color: #1e40af;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eval-breakdown-line {
  display: flex;
  gap: 10px;
  font-size: 11px;
}

.breakdown-tag {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #c9bda6;
  padding: 1px 2px;
  border-radius: 0;
  color: #4b5563;
  cursor: default;
}

.breakdown-tag.placeholder {
  border-color: rgba(148, 163, 184, 0.3);
  color: #9ca3af;
}

/* 预览确认条 */
.preview-bar {
  background: #ffffff;
  border: 1.5px solid var(--accent-blue);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-blue);
}

.preview-dmg {
  font-size: 12px;
  font-weight: 700;
  color: #166534;
}

.preview-btns {
  display: flex;
  gap: 8px;
}

/* 手牌区 */
.hand-container {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.hand-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hand-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-sub);
}

.hand-actions {
  display: flex;
  gap: 4px;
}

.cards-strip {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 76px;
}

/* 扑克单牌 (Balatro-style tactile elevation and watermark) */
.poker-card {
  width: 48px;
  height: 70px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 4px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.poker-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45);
  border-color: #94a3b8;
}

.poker-card:active {
  transform: translateY(-2px) scale(0.97);
}

.poker-card.selected {
  transform: translateY(-8px) scale(1.04);
  border: 2px solid var(--accent-gold);
  box-shadow: 0 8px 18px rgba(251, 191, 36, 0.45), 0 0 10px rgba(251, 191, 36, 0.4);
}

.card-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  opacity: 0.10;
  pointer-events: none;
  filter: blur(0.3px);
  user-select: none;
  z-index: 1;
}

.poker-card.played-locked {
  border: 2px solid #166534;
  box-shadow: 0 0 12px rgba(22, 101, 52, 0.4);
  transform: translateY(-4px);
  position: relative;
}

.poker-card.played-locked::after {
  content: "已出牌";
  position: absolute;
  top: -7px;
  right: -5px;
  background: #166534;
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  position: relative;
  z-index: 2;
}

.card-corner.top-left { align-self: flex-start; }
.card-corner.bottom-right { align-self: flex-end; transform: rotate(180deg); }

.card-rank {
  font-size: 11.5px;
  font-weight: 900;
  font-family: var(--font-family);
}

.card-suit {
  font-size: 9.5px;
}

.card-center {
  align-self: center;
  font-size: 17px;
  position: relative;
  z-index: 2;
}

/* 底部全局大按钮与通用立体按键系统 */
.control-row {
  width: 100%;
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.btn-main {
  flex: 2;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border: 1px solid #15803d;
  border-bottom: 3.5px solid #0f4c25;
  cursor: pointer;
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.btn-main.btn-cta-amber {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  border-color: #d97706;
  border-bottom-color: #92400e;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-main.btn-ready {
  animation: btnReadyPulse 2.2s infinite ease-in-out;
}

@keyframes btnReadyPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

.btn-main:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1.5px);
}

.btn-main:active:not(:disabled) {
  transform: translateY(1.5px);
  border-bottom-width: 1.5px;
}

/* 禁用态大按钮：内凹宣纸灰槽，不再与深色背景混淆 */
.btn-main:disabled {
  background: #e4ddd0 !important;
  color: #8c8275 !important;
  border: 1px dashed #c5bba6 !important;
  border-bottom: 1.5px solid #bfb49d !important;
  text-shadow: none !important;
  box-shadow: inset 0 1.5px 3px rgba(60, 45, 20, 0.07) !important;
  cursor: not-allowed;
  transform: none;
  filter: none;
  animation: none;
}

/* 通用次级按钮：实体键帽 3D 凸起底唇，一眼区分于平底图标标签 */
.btn-small {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 0%, #f3ede0 100%);
  border: 1px solid #c2b59b;
  border-bottom: 2.5px solid #96876b;
  color: var(--text-main);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(60, 45, 20, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn-xs {
  padding: 2.5px 7px;
  font-size: 10.5px;
}

.btn-small:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #e8dfd0 100%);
  border-color: var(--accent-blue);
  border-bottom-color: #1e3a8a;
  color: var(--accent-blue);
  transform: translateY(-1px);
  box-shadow: 0 3px 7px rgba(30, 64, 175, 0.14), inset 0 1px 0 #ffffff;
}

.btn-small:active:not(:disabled) {
  transform: translateY(1px);
  border-bottom-width: 1px;
  box-shadow: 0 1px 2px rgba(60, 45, 20, 0.08);
}

.btn-small.active {
  background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
  border-color: #92400e;
  border-bottom: 2.5px solid #5c2808;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 7px rgba(146, 64, 14, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-small:disabled {
  background: #eae3d5 !important;
  border-color: #d4cbb8 !important;
  border-bottom: 1px solid #c7bda8 !important;
  color: #9c9488 !important;
  box-shadow: none !important;
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

/* 手牌栏连体排序切换器 (点数 / 花色) */
.segmented-group {
  display: inline-flex;
  align-items: center;
  background: #e9e2d4;
  padding: 1.5px;
  border-radius: 7px;
  border: 1px solid #cfc4ae;
  box-shadow: inset 0 1px 2px rgba(60, 45, 20, 0.08);
}

.segmented-group .seg-btn {
  border-radius: 5px;
  border: 1px solid transparent;
  border-bottom-width: 1px;
  background: transparent;
  box-shadow: none;
  color: #6b6358;
  padding: 2px 7px;
}

.segmented-group .seg-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-main);
  transform: none;
}

.segmented-group .seg-btn.active {
  background: linear-gradient(180deg, #ffffff 0%, #fef3c7 100%);
  border: 1px solid #d97706;
  border-bottom: 2px solid #92400e;
  color: #92400e;
  box-shadow: 0 1px 3px rgba(146, 64, 14, 0.2);
}

/* 换牌核心动作按钮：高亮靛蓝立体按键，与普通排序按钮显著拉开层级 */
.btn-action-swap:not(:disabled) {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  border-bottom: 2.5px solid #1d4ed8;
  color: #1d4ed8;
  font-weight: 800;
}

.btn-action-swap:hover:not(:disabled) {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a8a;
}

.btn-confirm-green {
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%) !important;
  border-color: #15803d !important;
  border-bottom: 2.5px solid #0f4c25 !important;
  color: #ffffff !important;
}

/* Toast 顶部通知条提示容器 (从顶部轻柔降下，绝不遮挡底部操作按键) */
.toast-container {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: 90%;
  max-width: 480px;
}

.toast-item {
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid #b45309;
  color: #78350f;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(70, 55, 30, 0.16), 0 1px 3px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: toastDropIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  text-align: center;
  line-height: 1.35;
}

.toast-item.toast-fadeout {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toastDropIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ================================================================
   电脑模式：出牌构筑工坊 (常驻展开，非遮罩弹窗)
   ================================================================ */

/* 半透明古风宣纸暗色遮罩 (电脑模式彻底移除，保证棋盘与所有操作直接可见) */
.drawer-scrim {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 出牌构筑工坊容器：融入主排版流，常驻展开 */
/* 出牌构筑工坊 (电脑端右侧列并排常驻展开，不遮挡迷宫画布，无弹窗遮罩) */
.hand-drawer {
  position: sticky;
  top: 76px;
  width: 540px;
  max-width: 560px;
  flex-shrink: 0;
  transform: none !important;
  background: rgba(253, 251, 247, 0.98);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(216, 208, 191, 0.85);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(70, 55, 30, 0.08);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: opacity 0.25s ease, border-color 0.2s ease;
}

/* 电脑模式常驻直接展开：禁止 transform 移出屏幕 */
.hand-drawer.expanded,
.hand-drawer.minimized {
  transform: none !important;
  display: flex !important;
}

/* 战斗隐匿态：平滑半透明过渡，避免布局跳跃 */
.hand-drawer.hidden-battle {
  transform: none !important;
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.25);
}

/* 工坊头部 */
.drawer-header {
  padding: 6px 12px;
  cursor: default;
  user-select: none;
  background: #f4efe6;
  border-bottom: 1px solid #e7e2d6;
  border-radius: 10px 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-header:hover {
  background: #f4efe6;
}

.drawer-pill-handle {
  display: none !important;
}

.drawer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
}

/* 抽屉左侧状态文字 (开放式无边框文字，不带任何方框/胶囊闭环图形) */
.drawer-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 0 2px;
  border-radius: 0;
  background: transparent;
  color: #1e40af;
  border: none;
  box-shadow: none;
  cursor: default;
}

/* 抽屉右侧折叠按钮：电脑模式隐藏 */
.btn-drawer-toggle {
  display: none !important;
}

/* 工坊内部内容区 (自然自适应高度，无滚动条截断) */
.drawer-content {
  padding: 8px 12px 10px 12px;
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-content::-webkit-scrollbar {
  width: 5px;
}
.drawer-content::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}

/* 通用模态弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(39, 34, 29, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 16px 40px rgba(70, 55, 30, 0.18);
  text-align: center;
  color: var(--text-main);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 18px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 响应式调整 (小屏/折叠屏降级为单列纵向排版，保持平铺展开) */
@media (max-width: 899px) {
  .game-layout {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .top-nav {
    max-width: 560px;
    padding: 6px 10px 4px 10px;
  }
  .main-wrapper {
    width: 100%;
    max-width: 560px;
  }
  .canvas-wrapper {
    width: 100%;
    max-width: 560px;
    height: auto;
    max-height: min(560px, calc(100vh - 245px));
  }
  .hand-drawer {
    position: static;
    transform: none !important;
    width: 100%;
    max-width: 560px;
    margin-top: 6px;
  }
}

@media (max-width: 600px) {
  body { padding: 4px; }
  .poker-card { width: 44px; height: 68px; padding: 2px; }
  .card-rank { font-size: 10px; }
  .card-suit { font-size: 8px; }
  .card-center { font-size: 14px; }
}

/* Balatro 牌堆矩阵与卡牌列表 */
.deck-matrix-wrapper {
  width: 100%;
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
}

.deck-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: center;
  min-width: 480px;
}

.deck-matrix-table th,
.deck-matrix-table td {
  padding: 3px 2px;
  border: 1px solid #e7e2d6;
}

.deck-matrix-table th {
  color: var(--text-sub);
  font-weight: 800;
  background: #f4efe6;
  font-size: 11px;
}

.deck-matrix-cell {
  height: 24px;
  font-weight: 800;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.deck-matrix-cell.present {
  background: rgba(39, 34, 29, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(39, 34, 29, 0.12);
}

.deck-matrix-cell.present.suit-red {
  color: #b91c1c;
  font-weight: 900;
  background: rgba(185, 28, 28, 0.11);
  border-color: rgba(185, 28, 28, 0.35);
}

.deck-matrix-cell.present.suit-black {
  color: #0f172a;
  font-weight: 900;
  background: rgba(15, 23, 42, 0.11);
  border-color: rgba(15, 23, 42, 0.35);
}

.deck-matrix-cell.missing {
  color: #94a3b8;
  background: transparent;
  opacity: 0.45;
}

.deck-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
  padding: 6px;
  background: #fbf9f4;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.deck-mini-card {
  width: 42px;
  height: 60px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1.5px solid #94a3b8;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px;
  box-shadow: 0 2px 5px rgba(70, 55, 30, 0.16);
  flex-shrink: 0;
  user-select: none;
}

.deck-mini-card .card-rank {
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1;
}

.deck-mini-card .card-suit {
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.deck-mini-card .card-center {
  font-size: 15px;
  font-weight: 800;
  align-self: center;
  line-height: 1;
}

/* ================================================================ */
/* 流派秘宝三选一奖励弹窗与卡片设计 (Roguelike Reward Modal & Cards) */
/* ================================================================ */

.reward-modal-content {
  background: radial-gradient(circle at 50% 10%, #ffffff 0%, #f7f4ec 100%);
  border: 1.5px solid rgba(194, 120, 3, 0.4);
  box-shadow: 0 20px 48px rgba(70, 55, 30, 0.2), 0 0 24px rgba(194, 120, 3, 0.1);
  border-radius: 16px;
  max-width: 680px;
  width: 95%;
  padding: 20px;
  text-align: center;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main);
}

.reward-modal-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.btn-reroll-reward {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  background: #f4efe6;
  border: 1px solid #d8d0bf;
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
}

.btn-skip-reward {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-sub);
  background: transparent;
  border: 1px dashed #d8d0bf;
  border-radius: 8px;
  cursor: pointer;
}

.passives-modal-content {
  max-width: 580px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  text-align: left;
}

.passives-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.passives-list-scroll {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deck-modal-content {
  max-width: 640px;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  text-align: left;
}

.deck-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.deck-modal-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-passives-accent {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%) !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
  border-bottom: 2.5px solid #b45309 !important;
  border-radius: 999px !important;
  padding: 3.5px 10px !important;
}

.btn-passives-accent:hover {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%) !important;
  color: #78350f !important;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes modalPopIn {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.reward-modal-badge {
  display: inline-block;
  padding: 2px 4px;
  border-radius: 0;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--accent-gold);
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(217, 119, 6, 0.5);
  text-transform: uppercase;
  cursor: default;
}

.reward-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 640px) {
  .reward-cards-container {
    grid-template-columns: 1fr;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
  }
}

.reward-card {
  --arch-color: #c27803;
  background: #ffffff;
  border: 1.5px solid #d8d0bf;
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.reward-card:hover {
  transform: translateY(-4px);
  border-color: var(--arch-color);
  box-shadow: 0 10px 22px rgba(70, 55, 30, 0.15);
}

.reward-card.tier-1 {
  border-left: 4px solid #64748b;
}

.reward-card.tier-2 {
  border-left: 4px solid #818cf8;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
}

.reward-card.tier-3 {
  border-left: 4px solid #f59e0b;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.22);
  position: relative;
  overflow: hidden;
}

.reward-card.tier-3::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.12), transparent);
  transform: skewX(-25deg);
  animation: shineGlow 3.5s infinite;
  pointer-events: none;
}

.reward-card.rarity-rare {
  border-color: #a855f7;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.16);
}

.reward-card.rarity-divine {
  border-color: #f59e0b;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.24);
}

.reward-rarity-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 1px 0;
  background: transparent !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  cursor: default;
}

@keyframes shineGlow {
  0% { left: -100%; }
  35% { left: 200%; }
  100% { left: 200%; }
}

.reward-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.reward-arch-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 1px 0;
  border-radius: 0;
  background: transparent !important;
  border: none;
  border-bottom: 2px solid currentColor;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.reward-tier-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 1px 0;
  border-radius: 0;
  background: transparent !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.reward-tier-badge.tier-1 {
  color: #64748b;
}

.reward-tier-badge.tier-2 {
  color: #4f46e5;
}

.reward-tier-badge.tier-3 {
  color: #b45309;
}

.upgrade-tag {
  color: #166534;
  font-weight: 900;
  margin-right: 2px;
}

.reward-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.reward-card-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-sub);
  flex: 1;
  margin-bottom: 14px;
  min-height: 38px;
}

.btn-reward-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.btn-reward-select:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* ================================================================ */
/* 已激活流派秘宝一览面板 (Passives Inspector) */
/* ================================================================ */

.passive-item-card {
  --arch-color: #c27803;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--arch-color);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.passive-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.passive-item-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.passive-item-desc {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.4;
}

/* 算力推演标签强化 (无闭环方框，采用底边线强调) */
.breakdown-tag.bonus {
  background: transparent;
  color: #166534;
  border: none;
  border-bottom: 2px solid #22c55e;
  font-weight: 800;
}

.breakdown-tag.final-tag {
  background: transparent;
  color: #92400e;
  border: none;
  border-bottom: 2px solid #d97706;
  font-weight: 900;
}

/* 塔模式：每轮 13 张手牌，牌面略缩小让手机上一屏尽量放下 */
body.tower-mode .cards-strip {
  gap: 4.5px;
  min-height: 0;
}

body.tower-mode .poker-card {
  width: 48px;
  height: 70px;
  padding: 3.5px;
  border-radius: 6px;
}

body.tower-mode .poker-card.selected {
  transform: translateY(-10px) scale(1.06);
}

body.tower-mode .card-watermark {
  font-size: 26px;
  opacity: 0.09;
}

body.tower-mode .poker-card .card-rank {
  font-size: 11px;
}

body.tower-mode .poker-card .card-center {
  font-size: 16px;
}

/* ================================================================
   出战组预告条 (当前轮 + 后 2 轮：可点击路线聚焦卡片按钮) & 5 槽位实时战况 HUD
   ================================================================ */
.wave-preview-bar {
  width: 100%;
  display: flex;
  gap: 6px;
  margin-bottom: 3px;
}

.wave-preview-card {
  flex: 1;
  background: linear-gradient(180deg, #ffffff 0%, #f6f1e5 100%);
  border: 1px solid #c9bda6;
  border-bottom: 2.5px solid #9e8f73;
  border-radius: 7px;
  padding: 4px 6px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  font-size: 10.5px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(60, 45, 20, 0.08), inset 0 1px 0 #ffffff;
}

.wave-preview-card:hover {
  border-color: #d97706;
  border-bottom-color: #92400e;
  background: linear-gradient(180deg, #fffdf5 0%, #fef3c7 100%);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 9px rgba(180, 83, 9, 0.16), inset 0 1px 0 #ffffff;
}

.wave-preview-card:active {
  transform: translateY(1px);
  border-bottom-width: 1px;
}

.wave-preview-card.active {
  border-color: #b45309;
  border-bottom: 2.5px solid #78350f;
  background: linear-gradient(180deg, #fefce8 0%, #fde68a 100%);
  box-shadow: 0 0 0 1.5px #b45309, 0 3px 8px rgba(180, 83, 9, 0.22);
}

.wave-preview-card.current {
  border-left: 3.5px solid #b91c1c;
}

.wpc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  line-height: 1.2;
}

.wpc-round {
  color: #1e40af;
  font-size: 10px;
}

.wpc-tag {
  font-size: 9.5px;
  padding: 0 1px;
  border-radius: 0;
  background: transparent;
  color: #57534e;
  font-weight: 800;
  white-space: nowrap;
  border: none;
  border-bottom: 1.5px solid transparent;
}

.wpc-tag.flight {
  background: transparent;
  color: #0369a1;
  border: none;
  border-bottom: 1.5px solid rgba(2, 132, 199, 0.55);
}

.wpc-tag.pass {
  background: transparent;
  color: #b45309;
  border: none;
  border-bottom: 1.5px solid rgba(217, 119, 6, 0.65);
}

.wpc-tag.ground {
  background: transparent;
  color: #78716c;
  border: none;
}

.wpc-boss {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: #1c1917;
  font-size: 11px;
}

.wpc-boss-hp {
  color: #b91c1c;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
}

.wpc-minions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #78716c;
  font-size: 9.5px;
  line-height: 1.1;
}

.wpc-action-hint {
  font-size: 9px;
  font-weight: 800;
  color: #1d4ed8;
  background: rgba(30, 64, 175, 0.09);
  border: 1px solid rgba(30, 64, 175, 0.25);
  padding: 1px 4.5px;
  border-radius: 6px;
  white-space: nowrap;
}

.wave-preview-card.active .wpc-action-hint {
  color: #ffffff;
  background: #b45309;
  border-color: #92400e;
}

/* 顶部出战组 5 槽位实时战况 (4小怪 + 1首领：开放式无边框文字+底进度条，绝不套方框) */
.wave-slots-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-top: 2px;
  width: 100%;
}

.wave-slot-item {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 1px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 9.5px;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  cursor: default;
  transition: opacity 0.15s ease;
}

.wave-slot-item.boss-slot {
  flex: 1.35;
  background: transparent;
  border: none;
}

.wave-slot-item.boss-slot .wave-slot-text {
  color: #b91c1c;
}

.wave-slot-item.dead {
  opacity: 0.38;
  background: transparent;
  border: none;
}

.wave-slot-item.leaked {
  background: transparent;
  border: none;
}

.wave-slot-item.leaked .wave-slot-text,
.wave-slot-item.leaked .wave-slot-hp {
  color: #dc2626;
}

.wave-slot-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #44403c;
  font-weight: 700;
  line-height: 1.1;
}

.wave-slot-hp {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: #78716c;
}

.wave-slot-bar-bg {
  width: 100%;
  height: 3px;
  background: #e7e2d6;
  border-radius: 1.5px;
  overflow: hidden;
}

.wave-slot-bar-fill {
  height: 100%;
  background: #15803d;
  transition: width 0.08s ease;
}

.wave-slot-bar-fill.boss-fill {
  background: #dc2626;
}

/* ================================================================
   三国战役 UI 样式 (Campaign Mode UI)
   ================================================================ */
.res-pill.chapter {
  color: #1e293b;
  font-weight: 800;
  white-space: nowrap;
}

.nav-btn-faction {
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%) !important;
  border-color: #94a3b8 !important;
  border-bottom-color: #64748b !important;
  color: #1e293b !important;
  font-weight: 700;
}

.nav-btn-faction:hover {
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%) !important;
}

/* 阵营选择弹窗专用最高层级：确保在战役章节弹窗(1000)之上高亮展示 */
#factionModal {
  z-index: 1100;
}

#passivesModal {
  z-index: 1100;
}

.faction-modal-content {
  max-width: 680px;
  width: 95%;
  text-align: left;
}

.faction-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.faction-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.faction-card {
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
  position: relative;
}

.faction-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.faction-card.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px var(--accent-gold), 0 6px 16px rgba(180, 83, 9, 0.15);
}

.faction-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.faction-seal {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: #ffffff;
}

.faction-title-box {
  display: flex;
  flex-direction: column;
}

.faction-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.faction-lord {
  font-size: 12px;
  color: var(--text-sub);
}

.faction-routes {
  font-size: 11.5px;
  color: var(--text-sub);
  line-height: 1.5;
  background: #f8fafc;
  padding: 8px;
  border-radius: 6px;
  border: 1px dashed var(--border-color);
}

.faction-stats {
  font-size: 11px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}

.chapter-modal-content {
  max-width: 520px;
  width: 92%;
  text-align: center;
}

.chapter-modal-badge {
  font-size: 13px;
  font-weight: 900;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.chapter-roster-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: left;
}

.chapter-roster-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-main);
}

.chapter-roster-item .cri-round {
  font-weight: 800;
  color: var(--text-sub);
  width: 48px;
}

.chapter-roster-item .cri-boss {
  font-weight: 700;
  flex: 1;
}

.chapter-roster-item .cri-tag {
  font-size: 11px;
  color: #64748b;
}

/* ================================================================
   移动端与触控交互全方位深度适配 (Mobile UI & UX Adaptation)
   ================================================================ */

@media (max-width: 540px) {
  /* 1. 基础视口与安全边距 */
  body {
    padding: max(4px, env(safe-area-inset-top)) 4px calc(max(14px, env(safe-area-inset-bottom)) + 6px) 4px;
    overscroll-behavior-y: contain;
  }

  .main-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0 2px 24px 2px !important;
  }

  /* 2. 吸顶 HUD 顶栏双行自适应排版 */
  .top-nav {
    padding: max(4px, env(safe-area-inset-top)) 6px 5px 6px;
    border-radius: 0 0 10px 10px;
    margin-bottom: 4px;
  }

  .top-nav-main {
    flex-wrap: wrap;
    gap: 4px 6px;
    padding-bottom: 3px;
    align-items: center;
  }

  .brand-title {
    order: 1;
    flex-shrink: 0;
  }

  .logo-text {
    font-size: 13.5px;
  }

  .resource-group {
    order: 2;
    flex: 1;
    justify-content: flex-end;
    gap: 5px;
    padding-right: 0;
    border-right: none;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .resource-group::-webkit-scrollbar {
    display: none;
  }

  .res-pill {
    font-size: 10.5px;
    padding: 1px 0;
  }

  .res-pill + .res-pill::before {
    margin-right: 2px;
  }

  .nav-actions-group {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding-top: 3px;
    border-top: 1px dashed rgba(216, 208, 191, 0.55);
  }

  .nav-act-btn {
    flex: 1;
    min-height: 28px;
    padding: 2px 4px;
    font-size: 10px;
    justify-content: center;
    border-radius: 5px;
  }

  /* 3. 首领与波次槽位微调 */
  .boss-strip {
    padding: 2px 0 1px 0;
  }

  .boss-strip-row {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .wave-slots-row {
    gap: 4px;
    margin-top: 3px;
  }

  .wave-slot-item {
    font-size: 8.5px;
    padding: 0;
  }

  /* 4. 波次 3 轮预告条 */
  .wave-preview-bar {
    gap: 4px;
    margin-bottom: 2px;
  }

  .wave-preview-card {
    padding: 3px 4px;
    font-size: 9.5px;
  }

  /* 5. 棋盘画布 */
  .canvas-wrapper {
    padding: 2px;
    border-radius: 8px;
  }

  /* 6. 热力图工具栏 */
  .heat-toolbar {
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 0;
  }

  .heat-legend {
    font-size: 9.5px;
    gap: 4px;
  }

  .heat-bar {
    width: 50px;
    height: 5px;
  }

  .heat-actions {
    gap: 4px;
  }

  .btn-pill-toggle {
    font-size: 9.5px !important;
    padding: 2px 7px !important;
  }

  /* 7. 积木与塔出战组卡槽：单列纵向排列，每组铺满横向空间 */
  .pair-groups-container {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .pair-group-card {
    width: 100%;
    padding: 6px 6px;
    gap: 6px;
  }

  .pair-block-side,
  .pair-tower-side {
    padding: 4px 6px;
  }

  .pair-item-title {
    font-size: 9.5px;
  }

  .pair-item-sub {
    font-size: 8.5px;
  }

  .pair-item-status {
    font-size: 8px;
  }

  /* 8. 底部大控制栏 */
  .control-row {
    margin-top: 6px;
    margin-bottom: 6px;
    gap: 6px;
    position: relative;
    z-index: 5;
  }

  .control-row .btn-main {
    min-height: 44px;
    font-size: 13.5px;
    padding: 8px 10px;
  }

  .control-row .btn-small {
    min-height: 44px;
    font-size: 11.5px;
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 9. 出牌工坊 */
  .hand-drawer {
    border-radius: 12px;
  }

  .drawer-content {
    padding: 6px 8px 10px 8px;
    max-height: none;
    overflow: visible;
    gap: 8px;
  }

  .drawer-header {
    padding: 6px 12px 8px 12px;
  }

  .drawer-title {
    font-size: 12.5px;
  }

  /* 手牌单行紧凑排列，彻底杜绝换行折断，小屏自适应滑动 */
  .cards-strip,
  body.tower-mode .cards-strip {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 3px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 10px 2px;
    scrollbar-width: none;
  }

  .cards-strip::-webkit-scrollbar,
  body.tower-mode .cards-strip::-webkit-scrollbar {
    display: none;
  }

  .poker-card,
  body.tower-mode .poker-card {
    width: 36px;
    height: 56px;
    padding: 2px 2px;
    border-radius: 5px;
    flex-shrink: 0;
  }

  .poker-card .card-rank {
    font-size: 10px;
  }

  .poker-card .card-suit {
    font-size: 8.5px;
  }

  .poker-card .card-center {
    font-size: 13.5px;
  }

  .poker-card.selected,
  body.tower-mode .poker-card.selected {
    transform: translateY(-8px) scale(1.06);
  }

  /* 手牌栏工具条 */
  .hand-toolbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .hand-title {
    font-size: 11.5px;
    width: 100%;
    margin-bottom: 2px;
  }

  .hand-actions {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .hand-actions .btn-small {
    flex: 1;
    padding: 3px 4px;
    font-size: 10.5px;
    justify-content: center;
  }

  /* 10. 所有弹窗手机尺寸与滚动限制 */
  .modal-content {
    max-width: 95% !important;
    width: 95% !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px !important;
  }

  .reward-cards-container {
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: 55vh;
  }

  .reward-card {
    padding: 12px 10px;
  }

  .deck-modal-content {
    padding: 12px 10px !important;
  }

  .faction-list-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* 针对更小屏幕 (如 375px 及以下) 进一步精简 */
@media (max-width: 380px) {
  .logo-text {
    font-size: 12px;
  }

  .res-pill {
    font-size: 9.5px;
  }

  .poker-card,
  body.tower-mode .poker-card {
    width: 34px;
    height: 52px;
  }

  .poker-card .card-center {
    font-size: 12px;
  }
}



