/* ============================================================
   css/gwent.css — 百局牌谈 · 界面样式
   移动优先；≥760px 桌面档放大；≥1100px 宽屏档。
   卡面 SVG 一律 width:100%;height:auto，由容器控制大小。
   ============================================================ */

/* ---------- 基础 ---------- */
.gw-svg { display: block; width: 100%; height: auto; }
.gw-lobby, .gw-collection, .gw-shop, .gw-deck, .gw-battle-mod { --gw-paper: #fdf3dc; --gw-cream: #fff6e3; --gw-ink: #6b4a2f; }

/* 通用小按钮（卡上内嵌） */
.gw-mini-btn { border: none; cursor: pointer; font-family: inherit; }

/* ============================================================
   大厅
   ============================================================ */
.gw-lobby .gb-modal-body { align-items: stretch; }
.gw-lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.gw-lobby-title { font-size: 1.25rem; color: var(--pink-deep); font-weight: 700; }
.gw-lobby-sub { font-size: 0.78rem; color: var(--text-soft); font-weight: 400; margin-left: 6px; }
.gw-lobby-coins { background: #fff3d6; border: 2px solid #e8c96a; border-radius: 999px; padding: 3px 12px; font-size: 0.9rem; color: #8a6d1f; font-weight: 700; }
.gw-lobby-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gw-menu-btn { font-size: 0.82rem; padding: 8px 4px; }
.gw-lobby-stats { font-size: 0.85rem; color: var(--text-soft); background: var(--gw-cream); border-radius: 10px; padding: 6px 10px; text-align: center; }
.gw-lobby-stats b { color: var(--pink-deep); }
.gw-npc-list { display: flex; flex-direction: column; gap: 10px; }
.gw-npc-card { display: flex; align-items: center; gap: 10px; background: var(--gw-cream); border: 2px solid #e8d8b8; border-radius: 14px; padding: 8px 10px; }
.gw-npc-card.gw-locked { opacity: 0.72; filter: saturate(0.5); }
.gw-npc-ava { width: 52px; height: 52px; flex: none; }
.gw-npc-info { flex: 1; min-width: 0; }
.gw-npc-name { font-weight: 700; color: var(--gw-ink); font-size: 0.95rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gw-npc-diff { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; color: #fff; font-weight: 400; }
.gw-diff-休闲 { background: #7fb069; }
.gw-diff-老练 { background: #e0a32e; }
.gw-diff-大师 { background: #c94438; }
.gw-npc-meta { font-size: 0.76rem; color: var(--text-soft); margin-top: 2px; }
.gw-npc-rw { color: #8a7a3a; }
.gw-npc-lock { font-size: 0.74rem; color: #b06a4a; margin-top: 3px; }
.gw-npc-fight { flex: none; font-size: 0.85rem; padding: 8px 14px; }

/* ============================================================
   规则说明
   ============================================================ */
.gw-rules { max-width: 560px; text-align: left; font-size: 0.9rem; line-height: 1.7; color: var(--gw-ink); align-self: center; }
.gw-rules h4 { margin: 12px 0 4px; color: var(--pink-deep); font-size: 1rem; }
.gw-rules p { margin: 4px 0; }
.gw-rules ul { margin: 4px 0; padding-left: 20px; }

/* ============================================================
   派系标签页 / 卡片网格（图鉴 & 商店 & 组卡共用）
   ============================================================ */
.gw-fact-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.gw-fact-tab { font-size: 0.8rem; padding: 6px 12px; }
.gw-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; width: 100%; }
.gw-card-grid--sm { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.gw-col-progress { font-size: 0.85rem; color: var(--text-soft); text-align: center; }
.gw-col-progress b { color: var(--pink-deep); }
.gw-col-cell, .gw-shop-cell, .gw-pool-cell { position: relative; border-radius: 10px; transition: transform 0.12s ease; }
.gw-col-cell:active, .gw-shop-cell:active, .gw-pool-cell:active { transform: scale(0.96); }
.gw-col-locked .gw-card-svg, .gw-shop-max .gw-card-svg { filter: grayscale(0.85) opacity(0.55); }
.gw-col-leader, .gw-col-count, .gw-col-lock { position: absolute; right: 2px; bottom: 2px; font-size: 0.66rem; background: rgba(61, 47, 31, 0.82); color: #fff6e3; border-radius: 6px; padding: 1px 5px; }
.gw-col-lock { font-size: 0.8rem; background: none; }

/* 卡片详情浮层 */
.gw-overlay { position: absolute; inset: 0; background: rgba(61, 47, 31, 0.55); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 14px; }
.gw-detail-card { background: var(--gw-paper); border: 3px solid var(--gw-ink); border-radius: 16px; padding: 12px; display: flex; gap: 12px; max-width: 420px; width: 100%; position: relative; max-height: 100%; overflow-y: auto; }
.gw-detail-close { position: absolute; top: 6px; right: 8px; border: none; background: #f6e2d6; color: #8a6a55; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; z-index: 2; }
.gw-detail-art { width: 128px; flex: none; }
.gw-detail-info { flex: 1; min-width: 0; }
.gw-detail-info h4 { margin: 0 0 4px; color: var(--gw-ink); font-size: 1.05rem; }
.gw-detail-meta { font-size: 0.8rem; color: var(--text-soft); margin-bottom: 6px; }
.gw-detail-desc { font-size: 0.82rem; color: #7a6a52; line-height: 1.5; margin-bottom: 8px; }
.gw-detail-abs { display: flex; flex-direction: column; gap: 5px; }
.gw-ab-row { display: flex; align-items: flex-start; gap: 6px; font-size: 0.78rem; color: var(--gw-ink); line-height: 1.45; }
.gw-ab-ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.gw-detail-own { margin-top: 8px; font-size: 0.82rem; color: #8a7a3a; }
.gw-detail-own b { color: var(--pink-deep); }

/* ============================================================
   商店
   ============================================================ */
.gw-shop .gb-modal-body { align-items: stretch; }
.gw-shop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; }
.gw-shop-balance { background: #fff3d6; border: 2px solid #e8c96a; border-radius: 999px; padding: 3px 12px; font-size: 0.88rem; color: #8a6d1f; font-weight: 700; flex: none; }
.gw-shop-hint { font-size: 0.74rem; color: var(--text-soft); }
.gw-shop-packs { width: 100%; }
.gw-pack { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #fff3d6, #ffe9b8); border: 2px dashed #e0a32e; border-radius: 14px; padding: 10px 12px; }
.gw-pack-done { border-style: solid; opacity: 0.75; }
.gw-pack-info { flex: 1; font-size: 0.92rem; color: var(--gw-ink); }
.gw-shop-cell { position: relative; display: flex; flex-direction: column; }
.gw-shop-type { position: absolute; top: 3px; left: 3px; z-index: 3; font-size: 0.6rem; padding: 1px 6px; border-radius: 6px; background: rgba(61, 47, 31, 0.78); color: #fff6e3; }
.gw-shop-type--hero { background: #b8860b; }
.gw-shop-type--weather { background: #4a7a9a; }
.gw-shop-type--special { background: #7a5a8a; }
.gw-shop-name { font-size: 0.72rem; font-weight: 700; color: var(--gw-ink); text-align: center; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-shop-brief { font-size: 0.64rem; color: var(--text-soft); text-align: center; min-height: 0.9em; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.gw-shop-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 3px; min-height: 26px; }
.gw-shop-own { font-size: 0.72rem; color: var(--text-soft); flex: none; }
.gw-shop-buy { font-size: 0.72rem; padding: 4px 8px; white-space: nowrap; }
.gw-shop-done { font-size: 0.7rem; color: #7fb069; font-weight: 700; flex: none; }
.gw-shop-max { opacity: 0.85; }
.gw-shop-flash { animation: gw-shop-flash 1.1s ease; }
@keyframes gw-shop-flash { 0% { box-shadow: 0 0 0 3px #7fb069; border-radius: 10px; } 70% { box-shadow: 0 0 0 3px #7fb06988; } 100% { box-shadow: none; } }
.gw-dt-price-why { color: #a08a6a; font-size: 0.74rem; }

/* ============================================================
   组卡编辑器：桌面双栏（卡池左 / 当前卡组+校验右），手机纵排可折叠
   ============================================================ */
.gw-deck .gb-modal-body { align-items: stretch; }
.gw-deck-leader { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.gw-deck-leader-label { font-size: 0.8rem; color: var(--text-soft); align-self: center; flex: none; }
.gw-leader-pick { border: 2px solid transparent; background: none; border-radius: 10px; width: 76px; flex: none; cursor: pointer; padding: 2px; font-size: 0.68rem; color: var(--gw-ink); }
.gw-leader-pick.on { border-color: var(--pink-deep); background: #fff3d6; }
.gw-deck-body { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.gw-deck-side { display: flex; flex-direction: column; gap: 8px; flex: none; }
.gw-deck-pool { flex: 1; min-height: 180px; overflow-y: auto; }
.gw-deck-pool-title { font-size: 0.78rem; color: var(--text-soft); margin-bottom: 6px; }
.gw-pool-none { filter: grayscale(0.9) opacity(0.5); }
.gw-pool-can { cursor: pointer; box-shadow: 0 0 0 2px #7fb06966; }
.gw-pool-row { font-size: 0.68rem; color: var(--text-soft); text-align: center; margin-top: 2px; }
.gw-pool-why { position: absolute; left: 0; right: 0; bottom: 22px; font-size: 0.62rem; color: #fff; background: rgba(61, 47, 31, 0.78); border-radius: 6px; padding: 1px 3px; text-align: center; pointer-events: none; }
.gw-pool-neu { outline: 2px dashed #c9a86a66; outline-offset: 1px; }
.gw-deck-cur-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.gw-deck-cur-title { font-size: 0.85rem; color: var(--gw-ink); font-weight: 700; }
.gw-deck-cur-title b { color: var(--pink-deep); }
.gw-deck-cur-fold { border: none; background: #f3e3c3; color: #7a5c2e; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 0.8rem; line-height: 1; transition: transform 0.2s ease; }
.gw-deck-cur.open .gw-deck-cur-fold { transform: rotate(180deg); }
.gw-deck-cur-stats { font-size: 0.72rem; color: var(--text-soft); }
.gw-deck-cur-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; overflow-y: auto; }
.gw-deck-cur-item { display: flex; align-items: center; gap: 3px; background: var(--gw-cream); border: 1px solid #e0d0b0; border-radius: 8px; padding: 2px 4px 2px 8px; font-size: 0.72rem; color: var(--gw-ink); }
.gw-deck-cur-max { font-style: normal; font-size: 0.6rem; background: #e8c96a; color: #6b4a2f; border-radius: 5px; padding: 0 4px; margin-left: 4px; }
.gw-deck-minus { border: none; background: #f0d8c8; color: #a05a3a; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 0; }
.gw-deck-check { font-size: 0.8rem; border-radius: 10px; padding: 6px 10px; }
.gw-deck-err { background: #fbe4e0; color: #b0432f; }
.gw-deck-ok { background: #e4f2dc; color: #4a7a3a; }
.gw-deck-dirty { font-size: 0.7rem; color: #8a6d1f; background: #fff3d6; border-radius: 8px; padding: 3px 8px; margin-top: 4px; }
.gw-deck-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.gw-deck-btns .gb-btn { font-size: 0.82rem; }
/* 桌面双栏：当前卡组区固定右侧 */
@media (min-width: 760px) {
    .gw-deck-body { flex-direction: row-reverse; align-items: stretch; }
    .gw-deck-side { width: 268px; flex: none; }
    .gw-deck-cur-list { max-height: 240px; }
    .gw-deck-cur-fold { display: none; }
}
/* 手机纵排：卡组列表默认折叠，点标题展开 */
@media (max-width: 759px) {
    .gw-deck-cur-list { max-height: 0; padding: 0; overflow: hidden; transition: max-height 0.2s ease; }
    .gw-deck-cur.open .gw-deck-cur-list { max-height: 168px; }
}

/* ============================================================
   对战
   布局预算：六排 + 双信息条 + 中央行 + 手牌 + 操作条用 flex 弹性分配，
   任何视口高度都不裁切（rows 弹性伸缩、其余自然高度）。
   ============================================================ */
.gw-battle-mod .gb-modal-body { padding: 0; overflow: hidden; display: block; align-items: initial; touch-action: manipulation; flex: 1 1 auto; min-height: 0; }
.gw-battle { height: 100%; min-height: 0; display: flex; flex-direction: column; background: url('../assets/gwent/board/board_bg.webp') center/cover no-repeat, linear-gradient(180deg, #3d3226, #574634 30%, #6b5944 70%, #4a3d2e); color: #fff6e3; position: relative; }

/* 双方信息条（紧凑两行：名字+宝石 / 总战力） */
.gw-side { display: flex; align-items: center; gap: 8px; padding: 3px 10px; flex: none; }
.gw-side--opp { background: linear-gradient(180deg, rgba(61, 47, 31, 0.55) 0%, rgba(61, 47, 31, 0.2) 70%, transparent 100%); }
.gw-side--me { background: linear-gradient(0deg, rgba(61, 47, 31, 0.55) 0%, rgba(61, 47, 31, 0.2) 70%, transparent 100%); }
.gw-side-ava { width: 38px; height: 38px; flex: none; border-radius: 50%; overflow: hidden; border: 2px solid #e8d8b8; background: #fff6e3; }
.gw-side-meta { flex: 1; min-width: 0; }
.gw-side-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gw-side-name { font-size: 0.82rem; font-weight: 700; text-shadow: 0 1px 2px rgba(61, 47, 31, 0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-passed { font-size: 0.68rem; background: #c94438; border-radius: 6px; padding: 1px 6px; margin-left: 4px; font-weight: 400; }
.gw-side-gems { display: flex; gap: 3px; flex: none; }
.gw-gem { width: 15px; height: 15px; }
.gw-gem-lost { opacity: 0.45; }
.gw-side-total { font-size: 0.72rem; color: #e8d8b8; text-shadow: 0 1px 2px rgba(61, 47, 31, 0.75); }
.gw-side-total b { font-size: 0.95rem; color: #ffd9a0; }
.gw-turn-you { color: #a8e6a0; }

/* 战斗排：弹性伸缩的六排，卡牌不裁切、行内横向滚动兜底 */
.gw-rows { display: flex; flex-direction: column; gap: 3px; padding: 0 6px; flex: 1 1 0; min-height: 0; }
.gw-row { display: flex; align-items: center; gap: 6px; background: rgba(255, 248, 235, 0.18); border: 1px solid rgba(255, 246, 227, 0.28); border-radius: 8px; min-height: 38px; flex: 1 1 0; padding: 2px 4px; box-shadow: inset 0 0 14px rgba(61, 47, 31, 0.18); overflow: hidden; }
.gw-row--close { background: rgba(224, 90, 78, 0.14); }
.gw-row--ranged { background: rgba(127, 196, 224, 0.14); }
.gw-row--siege { background: rgba(244, 195, 77, 0.13); }
.gw-row-pickable { outline: 2px dashed #a8e6a0; cursor: pointer; animation: gw-row-pulse 1s infinite; }
.gw-unit--target { outline: 2px dashed #a8e6a0; outline-offset: 2px; cursor: pointer; animation: gw-row-pulse 1s infinite; }
@keyframes gw-row-pulse { 50% { outline-color: #fff6e3; } }
.gw-row-label { flex: none; width: 44px; font-size: 0.7rem; font-weight: 700; color: #fff8ec; display: flex; flex-direction: column; align-items: center; line-height: 1.15; gap: 1px; text-shadow: 0 1px 2px rgba(61, 47, 31, 0.9); }
.gw-row-ic { width: 17px; height: 17px; filter: drop-shadow(0 1px 1px rgba(61, 47, 31, 0.8)); }
.gw-row-nm { letter-spacing: 1px; }
.gw-row-pw { font-size: 0.95rem; font-weight: 700; color: #ffd9a0; text-shadow: 0 1px 2px rgba(61, 47, 31, 0.85); }
.gw-row-units { display: flex; gap: 3px; overflow-x: auto; overflow-y: visible; flex: 1; padding: 1px 0; scrollbar-width: thin; min-width: 0; align-items: center; }
.gw-unit { position: relative; width: 42px; flex: none; cursor: pointer; transition: transform 0.12s ease; }
.gw-unit:active { transform: scale(0.92); }
.gw-unit-pw { position: absolute; left: -3px; top: -4px; background: #fff6e3; color: #6b4a2f; font-size: 0.68rem; font-weight: 700; border-radius: 6px; padding: 0 4px; border: 1px solid #6b4a2f; z-index: 2; }
.gw-unit-hero { position: absolute; right: -2px; top: -4px; color: #f4c34d; font-size: 0.8rem; z-index: 2; text-shadow: 0 0 3px #6b4a2f; }
.gw-unit-dead { animation: gw-fade-out 0.4s forwards; }
@keyframes gw-fade-out { to { opacity: 0; transform: scale(0.6) rotate(8deg); } }
.gw-unit-new { animation: gw-pop-in 0.3s; }
@keyframes gw-pop-in { from { opacity: 0; transform: translateY(10px) scale(0.7); } }

/* 中央行：天气 | 比分 | 最新提示，一行放完；下行事件日志 */
.gw-mid { flex: none; padding: 2px 8px; display: flex; flex-direction: column; gap: 1px; }
.gw-mid-line { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.gw-weather { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; flex: none; max-width: 44%; }
.gw-weather-none { font-size: 0.78rem; font-weight: 600; color: rgba(255, 246, 227, 0.92); display: inline-flex; align-items: center; gap: 4px; text-shadow: 0 1px 2px rgba(61, 47, 31, 0.9); }
.gw-weather-none .gw-wic { opacity: 0.95; }
.gw-wchip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 600; color: #fff6e3; background: rgba(255, 246, 227, 0.2); border: 1px solid rgba(255, 246, 227, 0.28); border-radius: 999px; padding: 2px 9px; text-shadow: 0 1px 2px rgba(61, 47, 31, 0.9); }
.gw-wic { width: 14px; height: 14px; }
.gw-roundbar { flex: 1; font-size: 0.84rem; font-weight: 600; color: #f3e8cf; text-align: center; white-space: nowrap; text-shadow: 0 1px 3px rgba(61, 47, 31, 0.95); }
.gw-roundbar b { color: #ffd9a0; font-size: 1rem; }
.gw-lead-you b:first-of-type, .gw-lead-opp b:last-of-type { color: #a8e6a0; }
.gw-note { flex: none; max-width: 34%; font-size: 0.7rem; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255, 246, 227, 0.55); transition: color 0.2s ease; }
.gw-note.on { color: #ffe9b8; text-shadow: 0 0 6px rgba(244, 195, 77, 0.45); }
.gw-note--p1.on { color: #ffd9a0; }
.gw-note--p2.on { color: #cfe6ff; }
.gw-ticker { flex: none; min-height: 16px; display: flex; flex-direction: column; gap: 0; font-size: 0.64rem; color: rgba(255, 246, 227, 0.72); text-align: center; }
.gw-tick { animation: gw-tick-in 0.25s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes gw-tick-in { from { opacity: 0; transform: translateY(4px); } }

/* 手牌 */
.gw-hand-wrap { flex: none; height: 128px; display: flex; align-items: flex-end; overflow: hidden; background: linear-gradient(0deg, rgba(61, 47, 31, 0.45) 0%, rgba(61, 47, 31, 0.12) 55%, transparent 100%); }
.gw-hand { display: flex; gap: 5px; overflow-x: auto; padding: 4px 8px 2px; width: 100%; scrollbar-width: thin; }
.gw-hcard { width: 74px; flex: none; cursor: pointer; transition: transform 0.12s ease; position: relative; }
.gw-hcard.on { transform: translateY(-10px); }
.gw-hcard.on .gw-hcard-svg { filter: drop-shadow(0 0 6px #ffd9a0); }
.gw-hcard:active { transform: scale(0.94); }
.gw-hcard--rd.on .gw-hcard-svg { filter: drop-shadow(0 0 6px #a8e6a0); }
.gw-rd-flag { position: absolute; top: -4px; right: -4px; background: #7fb069; color: #fff; font-size: 0.62rem; border-radius: 6px; padding: 0 5px; z-index: 2; }
.gw-hand-passed { font-size: 0.78rem; color: rgba(255, 246, 227, 0.6); text-align: center; width: 100%; padding: 20px 0; }

/* ============================================================
   拖拽出牌：手牌交互 / 浮动 ghost / 落点高亮
   竖向拖动手牌=出牌，横向滑动=翻阅手牌（touch-action: pan-x）
   ============================================================ */
.gw-hcard { touch-action: pan-x; }
@media (hover: hover) {
  .gw-hcard:hover { transform: translateY(-8px); }
  .gw-hcard:hover .gw-hcard-svg { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); }
}
.gw-hcard.gw-dragging { opacity: 0.28; transform: scale(0.9); }
.gw-drag-ghost { position: fixed; left: 0; top: 0; width: 74px; transform: translate(-50%, -50%) rotate(-4deg) scale(1.08); pointer-events: none; z-index: 9999; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5)); will-change: left, top; }
body.gw-dragging-body { user-select: none; -webkit-user-select: none; cursor: grabbing; }

/* 落点高亮：armed=可放入（呼吸脉冲 + 徽标），over=正悬停其上 */
.gw-row.gw-drop-armed { outline: 2.5px dashed rgba(168, 230, 160, 1); outline-offset: -2px; background: rgba(168, 230, 160, 0.3); position: relative; cursor: copy; animation: gw-armed-pulse 1.1s ease-in-out infinite; }
.gw-row.gw-drop-armed .gw-row-label { color: #c9f2bd; }
.gw-row.gw-drop-armed::after { content: '可放置'; position: absolute; top: 3px; right: 6px; font-size: 0.62rem; font-weight: 700; color: #3f5a34; background: #a8e6a0; border-radius: 999px; padding: 1px 7px; pointer-events: none; box-shadow: 0 1px 3px rgba(61, 47, 31, 0.4); }
@keyframes gw-armed-pulse { 50% { outline-color: rgba(255, 246, 227, 0.95); background: rgba(168, 230, 160, 0.4); } }
.gw-row.gw-drop-over { outline: 3px solid #a8e6a0; outline-offset: -3px; background: rgba(168, 230, 160, 0.42); box-shadow: inset 0 0 14px rgba(168, 230, 160, 0.6); }
.gw-row.gw-drop-over::after { content: '放到这里'; background: #c9f2bd; }
.gw-unit.gw-drop-armed { outline: 2.5px dashed rgba(244, 195, 77, 1); outline-offset: 1px; cursor: copy; animation: gw-armed-pulse-u 1.1s ease-in-out infinite; }
@keyframes gw-armed-pulse-u { 50% { outline-color: rgba(255, 246, 227, 0.95); } }
.gw-unit.gw-drop-over { outline: 3px solid #f4c34d; outline-offset: 1px; box-shadow: 0 0 12px rgba(244, 195, 77, 0.8); }

/* 操作条 */
.gw-actions { display: flex; gap: 6px; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: center; background: rgba(61, 47, 31, 0.5); }
.gw-actions .gb-btn { font-size: 0.8rem; padding: 8px 12px; }
.gw-act-play { animation: gw-pop-in 0.2s; }
.gw-mulligan-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 0.8rem; width: 100%; }
/* 领袖技能不可用时的原因提示（移动端无 hover，常驻显示） */
.gw-act-leader.gw-disabled { opacity: 0.5; cursor: not-allowed; }
.gw-leader-hint { width: 100%; font-size: 0.7rem; color: #ffe0a0; background: rgba(201, 68, 56, 0.22); border: 1px solid rgba(255, 224, 160, 0.4); border-radius: 8px; padding: 4px 8px; text-align: center; line-height: 1.3; }

/* 浮层：选择器 / 结算 / 确认 */
.gw-picker, .gw-confirm, .gw-settle, .gw-inspect, .gw-leader-panel { background: var(--gw-paper); border: 3px solid var(--gw-ink); border-radius: 16px; padding: 14px; max-width: 460px; width: 100%; max-height: 100%; overflow-y: auto; color: var(--gw-ink); text-align: center; }
.gw-picker h4, .gw-confirm h4, .gw-settle h4 { margin: 0 0 8px; font-size: 1.05rem; color: var(--pink-deep); }
.gw-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 8px 0; }
.gw-picker-cell { cursor: pointer; border-radius: 8px; border: 2px solid transparent; transition: transform 0.12s ease; }
.gw-picker-cell:active { transform: scale(0.94); }
.gw-picker-cell.on { border-color: var(--pink-deep); }
.gw-pick-w { font-size: 0.78rem; display: inline-flex; align-items: center; gap: 4px; }
.gw-leader-panel { display: flex; flex-direction: column; gap: 6px; }
.gw-leader-art { width: 110px; margin: 0 auto; }
.gw-leader-btns { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.gw-d2 { display: flex; gap: 10px; text-align: left; }
.gw-d2-col { flex: 1; min-width: 0; }
.gw-d2-col h5 { margin: 4px 0; font-size: 0.76rem; color: var(--text-soft); }
.gw-d2-col .gw-picker-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); max-height: 220px; overflow-y: auto; }
.gw-peek-panel .gw-picker-cell { cursor: default; }
.gw-peek-panel .gw-picker-cell:active { transform: none; }
.gw-peek-nm { font-size: 0.68rem; color: var(--text-soft); margin-top: 2px; }

/* 结算 */
.gw-settle-score { font-size: 2.2rem; font-weight: 700; color: var(--gw-ink); margin: 4px 0; }
.gw-settle-win { font-size: 1rem; margin-bottom: 4px; }
.gw-settle-gems { font-size: 0.8rem; color: var(--text-soft); margin-bottom: 10px; }
.gw-settle--win { background: linear-gradient(180deg, #fff8e0, #ffe9b8); border-color: #e0a32e; }
.gw-settle--lose { background: linear-gradient(180deg, #fdf0ea, #f8e0d8); border-color: #c9786e; }
.gw-settle--draw { background: linear-gradient(180deg, #f2f6fa, #e2ecf4); border-color: #7a95a8; }
.gw-end-rounds { font-size: 0.82rem; color: var(--text-soft); margin: 6px 0; }
.gw-end-round { padding: 1px 0; }
.gw-end-reward { font-size: 0.95rem; color: #8a6d1f; font-weight: 700; background: #fff3d6; border-radius: 10px; padding: 5px 10px; display: inline-block; margin-bottom: 10px; }
.gw-end-norw { color: #a08a6a; background: #f2ece0; }
.gw-end-btns { display: flex; gap: 8px; justify-content: center; }

/* 单位检视 */
.gw-inspect { display: flex; gap: 10px; text-align: left; max-width: 380px; }
.gw-inspect-art { width: 96px; flex: none; }
.gw-inspect h4 { margin: 0 0 4px; font-size: 1rem; color: var(--gw-ink); }
.gw-inspect .gw-detail-abs { margin: 6px 0; }
.gw-inspect-ok { font-size: 0.8rem; }

/* ============================================================
   桌面档（≥760px）
   ============================================================ */
@media (min-width: 760px) {
    .gw-battle-mod .gb-modal-card { width: min(880px, 94vw); max-height: calc(100dvh - 28px); }
    .gw-unit { width: 54px; }
    .gw-hcard { width: 88px; }
    .gw-drag-ghost { width: 88px; }
    .gw-row { min-height: 48px; }
    .gw-row-label { width: 48px; font-size: 0.72rem; }
    .gw-side-ava { width: 44px; height: 44px; }
    .gw-hand-wrap { height: 152px; }
    .gw-ticker { font-size: 0.7rem; }
    .gw-roundbar { font-size: 0.82rem; }
    .gw-roundbar b { font-size: 1rem; }
    .gw-note { font-size: 0.74rem; }
    .gw-npc-ava { width: 64px; height: 64px; }
    .gw-card-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
    .gw-detail-art { width: 150px; }
}
@media (min-width: 1100px) {
    .gw-battle-mod .gb-modal-card { width: min(1020px, 94vw); }
    .gw-unit { width: 60px; }
    .gw-hcard { width: 96px; }
    .gw-drag-ghost { width: 96px; }
    .gw-row { min-height: 54px; }
    .gw-hand-wrap { height: 164px; }
}

/* 矮横屏（笔记本 768 高以内）：压缩行高保手牌 */
@media (max-height: 620px) {
    .gw-row { min-height: 34px; }
    .gw-unit { width: 38px; }
    .gw-hcard { width: 66px; }
    .gw-hand-wrap { height: 116px; }
    .gw-side-ava { width: 30px; height: 30px; }
}

/* ============================================================
   手机竖屏紧凑模式：修复牌面显示不足
   触发：窄屏竖屏，或竖屏可用高度不足
   目标：
   1. 弹窗真正占满屏幕，消灭上下棕色留白；
   2. 顶部信息条、战斗排、中央行全面压缩；
   3. 手牌区高度弹性，保证在任何竖屏下完整可见；
   4. 操作条紧凑，避免压住手牌。
   ============================================================ */
@media (max-width: 560px) {
    /* 弹窗占满全屏 */
    .gb-modal.gw-battle-mod { padding: 0; align-items: stretch; justify-content: stretch; }
    .gw-battle-mod .gb-modal-card {
        width: 100vw;
        height: 100dvh;
        height: 100vh; /* 老内核兜底 */
        max-height: 100dvh;
        max-height: 100vh;
        border-radius: 0;
    }
    .gw-battle-mod .gb-modal-head { padding: 8px 12px 4px; }
    .gw-battle-mod .gb-modal-head h3 { font-size: 1rem; }

    /* 双方信息条 */
    .gw-side { padding: 2px 8px; gap: 6px; }
    .gw-side-ava { width: 28px; height: 28px; border-width: 1px; }
    .gw-side-line1 { gap: 5px; }
    .gw-side-name { font-size: 0.76rem; }
    .gw-passed { font-size: 0.58rem; padding: 0 3px; margin-left: 2px; }
    .gw-side-gems { gap: 2px; }
    .gw-gem { width: 11px; height: 11px; }
    .gw-side-total { font-size: 0.62rem; }
    .gw-side-total b { font-size: 0.78rem; }

    /* 战斗排：减小行高、字号、间距，让六排在矮屏下也不占太多高度 */
    .gw-rows { gap: 2px; padding: 0 4px; }
    .gw-row { min-height: 28px; gap: 4px; padding: 1px 3px; }
    .gw-row-label { width: 34px; font-size: 0.58rem; gap: 0; }
    .gw-row-ic { width: 13px; height: 13px; }
    .gw-row-pw { font-size: 0.78rem; }
    .gw-row-units { gap: 2px; padding: 0; }
    .gw-unit { width: 36px; }
    .gw-unit-pw { font-size: 0.58rem; padding: 0 3px; top: -3px; left: -2px; }
    .gw-unit-hero { font-size: 0.68rem; top: -3px; right: -2px; }

    /* 中央行 */
    .gw-mid { padding: 1px 6px; gap: 0; }
    .gw-mid-line { min-height: 18px; gap: 4px; }
    .gw-weather { gap: 3px; max-width: 50%; }
    .gw-weather-none { font-size: 0.66rem; gap: 2px; }
    .gw-wchip { font-size: 0.62rem; padding: 1px 6px; }
    .gw-wic { width: 12px; height: 12px; }
    .gw-roundbar { font-size: 0.74rem; }
    .gw-roundbar b { font-size: 0.86rem; }
    .gw-note { font-size: 0.58rem; max-width: 36%; }
    .gw-ticker { min-height: 14px; font-size: 0.6rem; }

    /* 手牌区：高度弹性，优先保证完整可见；牌宽度适当缩小以横向多露几张 */
    .gw-hand-wrap {
        height: auto;
        min-height: 92px;
        max-height: 34vh;
    }
    .gw-hand { padding: 3px 6px 1px; gap: 4px; }
    .gw-hcard { width: 62px; }
    .gw-hcard.on { transform: translateY(-6px); }
    .gw-rd-flag { font-size: 0.56rem; padding: 0 4px; top: -3px; right: -3px; }

    /* 操作条 */
    .gw-actions { padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); gap: 4px; flex-wrap: nowrap; }
    .gw-actions .gb-btn { font-size: 0.74rem; padding: 6px 10px; }
    .gw-mulligan-bar { font-size: 0.72rem; gap: 5px; }
    .gw-leader-hint { font-size: 0.6rem; padding: 3px 6px; }

    /* 拖拽 ghost 同步缩小 */
    .gw-drag-ghost { width: 62px; }

    /* NPC 台词气泡在竖屏下不挡战斗排 */
    .gw-say { top: 46px; left: 6px; max-width: min(280px, 72vw); font-size: 0.74rem; padding: 5px 10px; }
}

/* ============================================================
   统一卡牌详情组件（图鉴/商店/组卡/手牌共用）
   ============================================================ */
#gw-dt-ov { position: fixed; inset: 0; z-index: 2100; background: rgba(30, 22, 12, 0.55); display: none; align-items: center; justify-content: center; padding: 16px; }
/* NPC 台词气泡：pointer-events:none 不挡操作，自动淡出 */
.gw-say { position: absolute; top: 52px; left: 10px; max-width: min(320px, 78vw); z-index: 30; pointer-events: none;
  background: rgba(255, 248, 236, 0.95); color: #4a3a2a; border: 2px solid #6b4a2f; border-radius: 12px;
  padding: 6px 12px; font-size: 0.8rem; line-height: 1.35; box-shadow: 0 6px 16px rgba(40, 26, 10, 0.3);
  opacity: 0; transform: translateY(-6px); transition: opacity 0.25s ease, transform 0.25s ease; }
.gw-say.on { opacity: 1; transform: translateY(0); }
.gw-detail-card { position: relative; display: flex; gap: 18px; max-width: 640px; width: 100%; max-height: 86vh; overflow: auto; background: var(--paper, #fff8ec); border: 3px solid #6b4a2f; border-radius: 18px; padding: 18px; box-shadow: 0 14px 40px rgba(40, 26, 10, 0.35); }
.gw-detail-art { flex: 0 0 200px; align-self: flex-start; }
.gw-dt-art-bitmap img.gw-dt-art-img { width: 200px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; border: 2.5px solid #6b4a2f; background: #fff; }
.gw-detail-info { flex: 1; min-width: 0; }
.gw-detail-info h4 { margin: 2px 0 6px; font-size: 1.25rem; color: #4a3a2a; }
.gw-detail-meta { font-size: 0.85rem; color: #8a7355; margin-bottom: 8px; }
.gw-dt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.gw-dt-tag { font-size: 0.74rem; padding: 2px 9px; border-radius: 999px; background: #f3e3c3; border: 1.5px solid #c9a86a; color: #7a5c2e; }
.gw-detail-abs { margin: 6px 0; }
.gw-ab-row { font-size: 0.86rem; color: #4a3a2a; padding: 3px 0; border-bottom: 1px dashed #e3d3b3; }
.gw-ab-row:last-child { border-bottom: none; }
.gw-dt-role, .gw-dt-hint { font-size: 0.85rem; color: #5c4a30; margin: 6px 0; padding: 7px 10px; border-radius: 10px; background: #f6ecd8; }
.gw-dt-hint { background: #eef3e2; }
.gw-dt-role b, .gw-dt-hint b { display: inline-block; margin-right: 8px; color: #9a7a3a; font-size: 0.76rem; }
.gw-dt-flavor { margin-top: 10px; font-size: 0.82rem; color: #a08a66; font-style: italic; }
.gw-dt-actions { margin-top: 10px; }
@media (max-width: 640px) {
    .gw-detail-card { flex-direction: column; align-items: center; padding: 14px; }
    .gw-detail-art { flex: none; }
    .gw-dt-art-bitmap img.gw-dt-art-img { width: min(240px, 62vw); }
    .gw-detail-info { width: 100%; }
}

/* ---- 手牌 ℹ 徽标 + 悬停轻提示 ---- */
.gw-hcard { position: relative; }
.gw-hcard-info { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #6b4a2f; background: rgba(255, 248, 236, 0.92); color: #6b4a2f; font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.gw-hcard-info:hover { background: #f3e3c3; }
.gw-hand-tip { display: none; position: fixed; z-index: 1900; max-width: 260px; background: #fff8ec; border: 2px solid #6b4a2f; border-radius: 12px; padding: 8px 11px; font-size: 0.8rem; color: #4a3a2a; box-shadow: 0 8px 22px rgba(40, 26, 10, 0.25); pointer-events: none; }
.gw-hand-tip b { display: block; margin-bottom: 4px; color: #7a5c2e; }
.gw-hand-tip div { padding: 1px 0; }
.gw-hand-tip-hint { margin-top: 4px; color: #5c7a3a; }

/* ---- 组卡筛选条 + 单元格 ℹ ---- */
.gw-deck-filterbar { display: none; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.gw-deck-filterbar.on { display: flex; }
.gw-df-q { flex: 1 1 140px; min-width: 120px; padding: 6px 10px; border: 2px solid #c9a86a; border-radius: 10px; background: #fffdf6; color: #4a3a2a; }
.gw-df-sel { padding: 6px 8px; border: 2px solid #c9a86a; border-radius: 10px; background: #fffdf6; color: #4a3a2a; }
.gw-pool-cell { position: relative; }
.gw-pool-info, .gw-shop-info { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #6b4a2f; background: rgba(255, 248, 236, 0.92); color: #6b4a2f; font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; z-index: 3; }
.gw-pool-info:hover, .gw-shop-info:hover { background: #f3e3c3; }
.gw-pool-empty { grid-column: 1 / -1; text-align: center; color: #a08a66; padding: 24px 0; }
@media (max-width: 760px) {
    .gw-hcard-info { width: 24px; height: 24px; font-size: 13px; }
}

/* ---- 餐厅 NPC 挑战面板（gwent-challenge） ---- */
.gw-chal-mod .gb-modal-card { max-width: 460px; }
.gw-chal { padding: 4px 2px 2px; color: #4a3a2a; }
.gw-chal-npc { display: flex; gap: 12px; align-items: center; padding: 10px; background: #fff8e8; border: 2px solid #e6cfa0; border-radius: 14px; }
.gw-chal-ava { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%; border: 2px solid #c9a86a; background: #fffdf6; }
.gw-chal-ninfo { min-width: 0; }
.gw-chal-ninfo > b { font-size: 1.08rem; color: #5a3d22; }
.gw-chal-deckname { font-size: 0.82rem; color: #8a6a3a; margin-top: 2px; }
.gw-chal-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.gw-chal-fac { font-size: 0.72rem; color: #fff; padding: 1px 9px; border-radius: 999px; }
.gw-chal-style { font-size: 0.74rem; color: #6b4a2f; background: #f3e7cd; padding: 1px 9px; border-radius: 999px; }
.gw-chal-rec { font-size: 0.76rem; color: #a0562f; margin-top: 5px; }
.gw-chal-sec { margin-top: 12px; }
.gw-chal-h { font-size: 0.86rem; font-weight: 700; color: #6b4a2f; margin-bottom: 6px; }
.gw-chal-decks { display: flex; flex-wrap: wrap; gap: 8px; }
.gw-chal-deck { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.gw-chal-deck i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,0.15); }
.gw-chal-deck--on { border-color: #c98f3a; background: #fbeccd; font-weight: 700; }
.gw-chal-mydeck { margin-top: 8px; font-size: 0.82rem; color: #4a3a2a; background: #fffdf6; border: 1.5px dashed #d9c39a; border-radius: 10px; padding: 7px 10px; }
.gw-chal-rules .gb-note { line-height: 1.55; }
.gw-chal-btns { display: flex; gap: 10px; margin-top: 14px; }
.gw-chal-btns .gb-btn { flex: 1; }
@media (max-width: 560px) {
    .gw-chal-mod .gb-modal-card { max-width: 94vw; }
    .gw-chal-npc { gap: 10px; }
    .gw-chal-ava { width: 54px; height: 54px; flex-basis: 54px; }
}
