/* =============================================================================
   BOF มือถือ (โหลดเป็นไฟล์สุดท้าย)
   ทุกกฎขึ้นต้นด้วย html.is-mobile (ติดโดยสคริปต์ใน <head> ของ index.html) → PC ไม่โดนเลย
   ระบบออกแบบ: ตัวอักษร 3 ขนาด · ระยะ 8px · ปุ่ม ≥ 44px · การ์ด 3 ขนาด · 1 หน้า 1 ปุ่มหลักอยู่ล่าง
   ============================================================================= */

/* ---------- 1. Tokens ---------- */
html.is-mobile {
  --m-fs-sm: 13px;
  --m-fs-md: 15px;
  --m-fs-lg: 20px;
  --m-fs-xl: 28px;
  --m-sp: 8px;
  --m-tap: 44px;
  --m-radius: 14px;
  --m-radius-sm: 10px;
  --m-bg: #0b0d18;
  --m-surface: #151827;
  --m-surface-2: #1d2135;
  --m-line: rgba(148, 163, 184, .16);
  --m-text: #eef1fa;
  --m-dim: #9aa3bd;
  --m-gold: #f2c96b;
  --m-gold-ink: #2a1d04;
  --m-accent: #38bdf8;
  --m-danger: #f87171;
  --m-ease: cubic-bezier(.2, .9, .3, 1.15);
  /* การ์ด 3 ขนาด (สัดส่วน 750:1050) */
  --m-card-sm-w: 56px;
  --m-card-md-w: 76px;
  --m-card-lg-w: 104px;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
html.is-mobile body { overscroll-behavior: none; }
html.is-mobile button, html.is-mobile .btn, html.is-mobile [role="button"] { touch-action: manipulation; }

/* ช่องกรอกเล็กกว่า 16px ทำให้ iOS ซูมทั้งหน้าตอนแตะ */
html.is-mobile input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
html.is-mobile select, html.is-mobile textarea { font-size: 16px !important; }

/* กดแล้วยุบ (ปุ่มที่ GSAP ไม่ได้ดูแล) */
html.is-mobile .btn:not(:disabled):active { transform: scale(.96); transition: transform .06s; }

/* ---------- 2. มือถือแนวนอน: ขอให้หมุนจอ ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  html.is-mobile body::after {
    content: '📱↻\A หมุนจอเป็นแนวตั้งเพื่อเล่น';
    white-space: pre; text-align: center; line-height: 1.8;
    position: fixed; inset: 0; z-index: 2147483647;
    display: grid; place-items: center;
    background: var(--m-bg); color: var(--m-gold);
    font: 700 var(--m-fs-lg) / 1.8 var(--font-display, 'Kanit', sans-serif);
  }
}

/* =============================================================================
   2.5 ล็อบบี้: โปรไฟล์อ่านง่าย · ชื่อเด็คแสดงครั้งเดียว · ปุ่มเปลี่ยนเด็คเรียบ ๆ เหนือปุ่มเล่น
   ============================================================================= */
html.is-mobile #lb-auth-bar { height: 52px !important; padding: 4px 14px 4px 6px !important; gap: 10px !important; border-radius: 16px; }
html.is-mobile #lb-auth-bar .lb-auth-avatar { width: 40px; height: 40px; }
html.is-mobile #lb-auth-bar .lb-auth-meta { display: flex !important; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; }
html.is-mobile #lb-auth-bar .lb-auth-name { font-size: var(--m-fs-md); font-weight: 700; max-width: 220px; }
html.is-mobile #lb-auth-bar .lb-auth-sub { font-size: 12px; color: var(--m-dim); }
html.is-mobile #lb-auth-bar .bof-user-title-pill { display: none; } /* ฉายาดูได้ในหน้าโปรไฟล์ */
html.is-mobile #lb-coin-pill { height: 36px; font-size: var(--m-fs-md); }

html.is-mobile #lobby-screen .lb-deck-style { display: none; }
html.is-mobile #lobby-screen .lb-deck-name { font-size: 24px; }
html.is-mobile #lb-deck-picker-btn {
  width: auto !important; min-width: 0; height: var(--m-tap); padding: 0 16px 0 6px !important; gap: 10px;
  border-radius: 999px; background: rgba(255, 255, 255, .06) !important; border: 1px solid rgba(242, 201, 107, .35) !important;
}
html.is-mobile #lb-deck-picker-btn .lb-deck-picker-thumb { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; }
html.is-mobile #lb-deck-picker-btn .lb-deck-picker-info { display: none; }
html.is-mobile #lb-deck-picker-btn .lb-deck-picker-cta { font-size: 0; background: none; padding: 0; border: 0; box-shadow: none; }
html.is-mobile #lb-deck-picker-btn .lb-deck-picker-cta::after { content: 'เปลี่ยนเด็ค ▾'; font: 700 var(--m-fs-sm) var(--font-display, 'Kanit', sans-serif); color: var(--m-gold); }
html.is-mobile #lb-play { min-height: 64px; border-radius: 18px; }
html.is-mobile #lb-play .lb-play-label { font-size: 22px; }
html.is-mobile #lb-play small { font-size: 12px; }
html.is-mobile .lb-menu-item { font-size: 11px !important; gap: 4px; }
html.is-mobile .lb-menu-item svg { width: 22px; height: 22px; }

/* =============================================================================
   3. สนามแข่ง
   ============================================================================= */
html.is-mobile #bof-game-arena {
  --card-h: clamp(70px, 12.4dvh, 104px);
  --card-w: calc(var(--card-h) * .714);
  --hand-h: clamp(84px, 13.4dvh, 116px);
  --hand-w: calc(var(--hand-h) * .714);
  user-select: none; -webkit-user-select: none;
}

/* หัวฝั่งคู่แข่ง */
html.is-mobile #bof-game-arena .side-header-bar { font-size: var(--m-fs-sm); line-height: 1.3; }
html.is-mobile #bof-game-arena .hand-counter-pill { font-size: 12px; padding: 2px 10px; }

/* ฝั่งคู่แข่งสูงเท่าที่ใช้จริง ฝั่งเรารับพื้นที่ที่เหลือ */
html.is-mobile #bof-game-arena .ai-mat-half { flex: 0 0 auto; }
html.is-mobile #bof-game-arena .player-mat-half { flex: 1 1 auto; justify-content: space-evenly; }
html.is-mobile #bof-game-arena .mat-grid-row { grid-template-columns: 46px minmax(0, 1fr) 46px; flex: 0 0 auto; }

/* กองการ์ด: ตัดป้ายภาษาไทยยาวทิ้ง เหลือป้ายสั้น DECK / DROP / DARK ตัวใหญ่ขึ้น */
html.is-mobile #bof-game-arena .mat-side-col .info-box { width: 46px !important; height: calc(var(--card-h) * .78) !important; justify-content: flex-end !important; }
html.is-mobile #bof-game-arena .mat-side-col .pile-label { display: none; }
html.is-mobile #bof-game-arena .deck-count-badge { font-size: 11px !important; font-weight: 800; padding: 2px 5px !important; border-radius: 6px; }

/* ช่องบนสนาม */
html.is-mobile #bof-game-arena .board-slots .slot,
html.is-mobile #bof-game-arena .center-leader-stack .slot,
html.is-mobile #bof-game-arena .leader-card-slot {
  width: var(--card-w) !important; max-width: var(--card-w) !important;
  height: var(--card-h) !important; min-height: var(--card-h) !important;
}
html.is-mobile #bof-game-arena .slot { color: rgba(226, 232, 240, .28); font-size: 11px !important; }
/* การ์ดบนสนามเล็ก: ซ่อนชื่อ (ดูรูป + แตะค้างดูรายละเอียด) ให้ค่าพลังเด่นแทน */
html.is-mobile #bof-game-arena .slot .card .card-name { display: none !important; }
html.is-mobile #bof-game-arena .leader-card-slot .card .card-name { font-size: 9px !important; }
html.is-mobile #bof-game-arena .slot .card .card-power {
  font-size: 12px !important; font-weight: 800; padding: 2px 4px !important;
}
html.is-mobile #bof-game-arena .leader-hp-badge { font-size: 12px; padding: 2px 7px; }

/* เป้าหมายที่กดได้: กรอบเรืองแสงเต้นช้า ๆ */
html.is-mobile #bof-game-arena .slot.valid-target,
html.is-mobile #bof-game-arena .slot.attack-target,
html.is-mobile #bof-game-arena .leader-card-slot.attack-target { outline: 2px solid var(--m-gold); outline-offset: 2px; }
html.is-mobile #bof-game-arena .slot.attack-target,
html.is-mobile #bof-game-arena .leader-card-slot.attack-target { outline-color: var(--m-danger); }

/* ---------- มือ ---------- */
html.is-mobile #bof-game-arena .hand-dock { position: relative; }
html.is-mobile #bof-game-arena .hand-dock-label { position: absolute; top: -22px; right: 4px; z-index: 6; padding: 0; }
html.is-mobile #bof-game-arena .hand-dock-label > span { display: none; }
html.is-mobile #bof-game-arena .hand-shuffle-btn { min-height: 30px; padding: 0 12px; font-size: 12px; border-radius: 999px; }
html.is-mobile #bof-game-arena .hand-row {
  height: calc(var(--hand-h) + 18px) !important; min-height: calc(var(--hand-h) + 18px) !important;
  padding: 10px 8px 4px !important; gap: 8px !important;
  scroll-snap-type: x proximity; scroll-padding-inline: 8px;
}
html.is-mobile #bof-game-arena .hand-row .card { width: var(--hand-w) !important; height: var(--hand-h) !important; scroll-snap-align: start; }
html.is-mobile #bof-game-arena .hand-row .card .card-name { font-size: 10px !important; }
html.is-mobile #bof-game-arena .hand-row .card .card-power { font-size: 11px !important; font-weight: 800; }
html.is-mobile #player-hand .card.selected-hand { --lift: -12px; box-shadow: 0 0 0 2px var(--m-gold), 0 10px 22px rgba(242, 201, 107, .45); }

/* ---------- แถบควบคุม: ล่างสุด ระยะนิ้วโป้ง ---------- */
html.is-mobile #bof-game-arena .mat-divider-zone { order: 3; }
html.is-mobile #bof-game-arena .center-bar { padding: 8px !important; gap: 8px !important; border-radius: var(--m-radius) !important; background: rgba(15, 18, 32, .94); }
html.is-mobile #bof-game-arena .turn-phase-group { gap: 8px; flex: 1 1 auto; min-width: 0; }
html.is-mobile #bof-game-arena .quota-badges { flex: 0 0 auto; gap: 6px; flex-wrap: nowrap; }
html.is-mobile #bof-game-arena #turn-indicator { font-size: var(--m-fs-sm); }
html.is-mobile #bof-game-arena .phase-pill { font-size: 12px; padding: 2px 10px; }
html.is-mobile #bof-game-arena .quota-badges span { font-size: 12px; padding: 2px 8px; }
html.is-mobile #bof-game-arena .control-btn-group { gap: 8px; }
html.is-mobile #bof-game-arena .control-btn-group .btn { height: var(--m-tap) !important; min-height: var(--m-tap); border-radius: 12px; }
html.is-mobile #bof-game-arena #btn-toggle-sound { flex: 0 0 var(--m-tap) !important; width: var(--m-tap) !important; font-size: 18px !important; }

html.is-mobile .live-battle-ticker {
  padding: 5px 10px !important;
  margin: 0 !important;
  gap: 6px !important;
  border-radius: 8px !important;
  height: var(--m-tap) !important;
}
html.is-mobile .ticker-badge {
  font-size: 10px !important;
  padding: 2px 6px !important;
}
html.is-mobile .ticker-content {
  font-size: 11.5px !important;
}
html.is-mobile .ticker-history-hint {
  font-size: 10.5px !important;
}
html.is-mobile #fx-card-cutin-banner {
  top: 30% !important;
  padding: 10px 14px !important;
  gap: 12px !important;
  min-width: 280px !important;
  border-radius: 14px !important;
}
html.is-mobile #fx-card-cutin-banner img {
  width: 56px !important;
  height: 78px !important;
}
html.is-mobile .cutin-info-title {
  font-size: 15px !important;
}
html.is-mobile .cutin-info-sub {
  font-size: 11.5px !important;
}

/* ปุ่มเฟส = ปุ่มหลัก */
html.is-mobile #bof-game-arena #btn-pass-turn-inline {
  flex: 1 1 0 !important; min-width: 0;
  font-size: var(--m-fs-md) !important; font-weight: 800;
  white-space: normal; line-height: 1.15; text-overflow: clip;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
html.is-mobile #bof-game-arena #btn-pass-turn-inline:disabled { opacity: .55; box-shadow: none; }

/* การ์ดล่าสุดของคู่แข่ง: รูปอย่างเดียว */
html.is-mobile #bof-game-arena #btn-last-card-pill { flex: 0 0 var(--m-tap) !important; width: var(--m-tap); padding: 0 !important; justify-content: center; }
html.is-mobile #bof-game-arena #btn-last-card-pill .last-card-pill-meta { display: none; }
html.is-mobile #bof-game-arena #btn-last-card-pill .last-card-pill-img { width: 28px; height: 38px; border-radius: 4px; object-fit: cover; }

/* ยอมแพ้: ไอคอนอย่างเดียว ไม่แย่งสายตา (ชื่อปุ่มยังอ่านได้ด้วย screen reader) */
html.is-mobile #bof-game-arena #btn-surrender-match { flex: 0 0 var(--m-tap) !important; width: var(--m-tap); padding: 0 !important; font-size: 20px !important; }
html.is-mobile #bof-game-arena #btn-surrender-match .sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* =============================================================================
   4. หน้าต่างเลือก/ยืนยันระหว่างเกม (#custom-choice-modal) → แผ่นเลื่อนขึ้นจากล่าง
   (ยกเว้นจอชนะ/แพ้ .um-end ที่เป็นเต็มจอ)
   ============================================================================= */
html.is-mobile #custom-choice-modal:not(.um-end) { align-items: flex-end !important; padding: 0 !important; }
html.is-mobile #custom-choice-modal:not(.um-end) .modal-box {
  width: 100% !important; max-width: none !important; max-height: 86dvh !important;
  margin: 0 !important; border-radius: 22px 22px 0 0 !important;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  overflow-y: auto !important; overscroll-behavior: contain;
  animation: m-sheet-up .32s var(--m-ease) both;
}
/* ที่จับด้านบน บอกว่าเป็นแผ่นเลื่อน */
html.is-mobile #custom-choice-modal:not(.um-end) .modal-box::before {
  content: ''; display: block; width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 4px; background: rgba(255, 255, 255, .22);
}
@keyframes m-sheet-up { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
html.is-mobile #custom-choice-modal:not(.um-end) .um-choice-icon { width: 48px !important; height: 48px !important; font-size: 24px !important; margin: 0 auto 6px !important; }
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-title { font-size: 17px !important; line-height: 1.3; margin: 0; }
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-desc { font-size: var(--m-fs-sm) !important; line-height: 1.45; margin: 6px 0 12px !important; }
/* ยืนยันการ์ด: รูปซ้าย ความสามารถขวา */
html.is-mobile #custom-choice-modal .um-card-row { flex-direction: row !important; align-items: flex-start !important; gap: 12px; margin: 0 0 14px; }
html.is-mobile #custom-choice-modal .um-card-row img { width: 96px !important; height: auto !important; flex: 0 0 96px; border-radius: 8px; }
html.is-mobile #custom-choice-modal .um-ability { padding: 10px 12px; font-size: var(--m-fs-sm); line-height: 1.5; }
/* ปุ่ม: เต็มกว้าง · ถ้ามี 2 ปุ่ม (ยืนยัน/ยกเลิก) วางข้างกัน ยืนยันอยู่ขวา (นิ้วโป้งขวา) */
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-buttons { gap: 8px !important; }
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-buttons .btn { min-height: 48px; font-size: var(--m-fs-md) !important; border-radius: 14px; }
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-buttons:has(> .btn:nth-child(2):last-child) { flex-direction: row-reverse !important; }
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-buttons:has(> .btn:nth-child(2):last-child) > .btn:first-child { flex: 2 1 0; }
html.is-mobile #custom-choice-modal:not(.um-end) #choice-modal-buttons:has(> .btn:nth-child(2):last-child) > .btn:last-child { flex: 1 1 0; }

/* =============================================================================
   5. หน้าจัดเด็ค: เลย์เอาต์มือถือแบบแท็บสลับมุมมอง (Segmented Tabs) · หัวกะทัดรัด · แถบสรุปด่วนลอยล่าง
   ============================================================================= */
html.is-mobile #deck-builder-modal .deck-builder-box {
  padding: 0 10px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  max-height: 94dvh;
  width: 100vw !important;
  max-width: 100vw !important;
  border-radius: 16px 16px 0 0 !important;
  margin-top: auto !important;
  overflow-y: auto !important;
}

html.is-mobile #deck-builder-modal .deck-builder-header {
  position: sticky; top: 0; z-index: 35;
  margin: 0 -10px 8px; padding: 10px 12px 8px;
  background: rgba(17, 20, 32, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  display: flex !important;
  flex-direction: column !important;
  gap: 8px; text-align: left;
}

html.is-mobile #deck-builder-modal .deck-builder-header > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

html.is-mobile #deck-builder-modal .deck-builder-header h2 {
  font-size: 16px;
  line-height: 1.25;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

html.is-mobile #deck-builder-modal .deck-builder-header p { display: none; }
html.is-mobile #deck-builder-modal .dbt-hint { display: none; }

/* แถวปุ่มใน Header: จัดอัตโนมัติ + บันทึก + ปิด (1 แถวพอดี) */
html.is-mobile #deck-builder-modal .deck-builder-header > div:last-child {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  gap: 6px !important;
  width: 100%;
}

html.is-mobile #deck-builder-modal #deck-status-text {
  display: none !important;
}

html.is-mobile #deck-builder-modal #btn-reset-deck { display: none; } /* ซ่อนปุ่มล้างในหัวเพื่อประหยัดที่ */
html.is-mobile #deck-builder-modal #btn-default-deck {
  min-height: 38px;
  font-size: 11.5px !important;
  padding: 0 6px !important;
  white-space: nowrap;
  border-radius: 8px;
}

html.is-mobile #deck-builder-modal #btn-save-start {
  min-height: 38px;
  font-size: 12px !important;
  font-weight: 700;
  padding: 0 10px !important;
  border-radius: 8px;
  white-space: nowrap;
}

html.is-mobile #deck-builder-modal #btn-close-deck-builder {
  min-height: 38px;
  padding: 0 10px !important;
  font-size: 12px !important;
  border-radius: 8px;
}

/* แถบสลับมุมมองบนมือถือ (Mobile Segmented Nav Tabs) */
html.is-mobile .deck-mobile-nav-tabs {
  display: flex !important;
  background: #090c14;
  border: 1.5px solid #1e293b;
  border-radius: 12px;
  padding: 4px;
  gap: 6px;
  margin: 6px 0 10px;
}

html.is-mobile .deck-mobile-tab-btn {
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  font-family: 'Kanit', sans-serif;
}

html.is-mobile .deck-mobile-tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45);
}

html.is-mobile .dmt-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #cbd5e1;
}

html.is-mobile .dmt-badge.is-complete {
  background: #10b981;
  color: #ffffff;
}

html.is-mobile .dmt-badge.is-incomplete {
  background: #ef4444;
  color: #ffffff;
}

/* แถบสล็อต/ชื่อ/โค้ดบนมือถือ */
html.is-mobile #bof-deck-slots-toolbar { padding: 8px 10px !important; margin-bottom: 6px; border-radius: 10px; }
html.is-mobile #bof-deck-slots-toolbar .deck-code-actions-row { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 6px !important; padding: 0 !important; border: 0 !important; background: none !important; }
html.is-mobile #bof-deck-slots-toolbar .deck-slot-choice-group { display: contents !important; }
html.is-mobile #bof-deck-slots-toolbar .deck-slot-choice-group label,
html.is-mobile #bof-deck-slots-toolbar #select-builder-deck-slot,
html.is-mobile #bof-deck-slots-toolbar .deck-slot-fx-select,
html.is-mobile #bof-deck-slots-toolbar .deck-name-edit-group label { display: none !important; }
html.is-mobile #bof-deck-slots-toolbar #btn-reopen-slot-picker { grid-column: 2; grid-row: 1; height: 40px; margin: 0 !important; padding: 0 10px; font-size: 12px; white-space: nowrap; border-radius: 8px; }
html.is-mobile #bof-deck-slots-toolbar .deck-name-edit-group { grid-column: 1; grid-row: 1; margin: 0 !important; padding: 0 !important; min-width: 0; }
html.is-mobile #bof-deck-slots-toolbar .deck-name-edit-group input { width: 100%; height: 40px; padding: 0 10px; border-radius: 8px; font-size: 13.5px !important; }
html.is-mobile #bof-deck-slots-toolbar .deck-code-share-group { grid-column: 1 / -1; display: grid !important; grid-template-columns: minmax(0, 1fr) 40px 40px; gap: 6px; margin: 0 !important; }
html.is-mobile #bof-deck-slots-toolbar .deck-code-share-group input { width: 100%; min-width: 0; height: 40px; font-size: 12.5px !important; border-radius: 8px; }
html.is-mobile #bof-deck-slots-toolbar .deck-code-btn { width: 40px; height: 40px; padding: 0 !important; margin: 0 !important; font-size: 0 !important; border-radius: 8px; }
html.is-mobile #bof-deck-slots-toolbar .deck-code-btn.is-copy::before { content: '📋'; font-size: 16px; }
html.is-mobile #bof-deck-slots-toolbar .deck-code-btn.is-import::before { content: '📥'; font-size: 16px; }

/* โครงสร้างแยกมุมมองตามแท็บบนมือถือ */
html.is-mobile #deck-builder-modal .deck-builder-split-layout {
  display: flex !important;
  flex-direction: column !important;
  gap: 0;
}

/* เมื่อเลือกแท็บ "คลังการ์ด": ซ่อนฝั่งตัวเด็ค แสดงฝั่งคลังการ์ด */
html.is-mobile #deck-builder-modal .deck-builder-split-layout[data-mobile-tab="collection"] .deck-builder-left-col {
  display: none !important;
}

html.is-mobile #deck-builder-modal .deck-builder-split-layout[data-mobile-tab="collection"] .deck-builder-right-col {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

/* เมื่อเลือกแท็บ "การ์ดในเด็ค": แสดงฝั่งตัวเด็ค ซ่อนฝั่งคลังการ์ด */
html.is-mobile #deck-builder-modal .deck-builder-split-layout[data-mobile-tab="deck"] .deck-builder-left-col {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

html.is-mobile #deck-builder-modal .deck-builder-split-layout[data-mobile-tab="deck"] .deck-builder-right-col {
  display: none !important;
}

/* แถบลีดเดอร์แบบกะทัดรัด (แสดงเฉพาะในแท็บคลังการ์ดบนมือถือ) */
html.is-mobile .mobile-current-leader-bar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(37,99,235,0.18) 0%, rgba(15,23,42,0.92) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  padding: 6px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

html.is-mobile .mclb-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

html.is-mobile .mclb-label {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

html.is-mobile .mclb-thumb {
  width: 28px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}

html.is-mobile .mclb-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.is-mobile .mclb-change-btn {
  font-size: 11px !important;
  padding: 4px 10px !important;
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  border-radius: 6px;
  white-space: nowrap;
}

/* ฝั่งซ้าย (ตัวเด็ค) บนมือถือ */
html.is-mobile #deck-builder-modal .deck-left-panel {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 10px;
}

html.is-mobile #deck-builder-modal .active-leader-preview-box {
  padding: 8px 10px;
  gap: 10px;
}

html.is-mobile #deck-builder-modal .alp-thumb {
  width: 48px;
  height: 66px;
}

html.is-mobile #deck-builder-modal .alp-name {
  font-size: 14px;
}

html.is-mobile #deck-builder-modal .leader-picker-dropdown {
  max-height: 240px;
  padding: 6px;
}

html.is-mobile #deck-builder-modal .leader-picker-dropdown .card-pool-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px !important;
}

html.is-mobile #deck-builder-modal .deck-current-list-items {
  max-height: calc(100dvh - 330px);
  min-height: 160px;
  gap: 4px;
}

html.is-mobile #deck-builder-modal .deck-list-row-item {
  padding: 5px 8px;
  border-radius: 6px;
}

html.is-mobile #deck-builder-modal .dlr-thumb {
  width: 32px;
  height: 44px;
}

html.is-mobile #deck-builder-modal .dlr-name {
  font-size: 12px;
}

html.is-mobile #deck-builder-modal .dlr-count-badge {
  font-size: 11px;
  padding: 2px 7px;
}

html.is-mobile #deck-builder-modal .dlr-remove-icon {
  font-size: 15px;
  padding: 4px;
}

html.is-mobile .deck-mobile-go-collection-btn {
  display: block !important;
  width: 100%;
  margin-top: 10px;
  height: 44px;
  background: #0284c7;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

/* ฝั่งขวา (คลังการ์ด) บนมือถือ */
html.is-mobile #deck-builder-modal .deck-filter-panel {
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

html.is-mobile #deck-builder-modal .deck-filter-themes-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
  flex: 1 1 auto;
}

html.is-mobile #deck-builder-modal .deck-filter-sub-row {
  display: contents;
}

html.is-mobile #deck-builder-modal .deck-filter-dropdown {
  flex: 1 1 auto;
}

html.is-mobile #deck-builder-modal .deck-filter-panel .fx-select-btn {
  width: 100%;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

html.is-mobile #deck-builder-modal .deck-filter-themes-row .fx-select-menu,
html.is-mobile #deck-builder-modal .deck-filter-dropdown .fx-select-menu-sm {
  width: min(320px, calc(100vw - 32px));
  max-height: 50dvh;
}

html.is-mobile #deck-builder-modal .deck-search-wrap {
  width: 100%;
}

html.is-mobile #deck-builder-modal .deck-search-input {
  height: 38px;
  font-size: 13.5px !important;
  border-radius: 8px;
}

html.is-mobile #deck-builder-modal .deck-filter-stats {
  font-size: 11px;
  text-align: right;
  padding: 0 4px;
}

/* กริดแสดงการ์ดในคลังบนมือถือ */
html.is-mobile #deck-builder-modal .card-pool-scroll-area {
  max-height: none;
  overflow: visible;
  padding-bottom: 50px; /* เว้นที่ให้แถบลอยด้านล่าง */
}

html.is-mobile #deck-builder-modal .card-pool-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)) !important;
  gap: 8px 5px !important;
  padding: 4px 0 !important;
}

html.is-mobile #deck-builder-modal .pool-item {
  min-width: 0;
  gap: 3px;
}

html.is-mobile #deck-builder-modal .card-pool-grid .card {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 750 / 1050;
  border-radius: 6px;
}

html.is-mobile #deck-builder-modal .card-pool-grid .card .card-name {
  font-size: 8px !important;
  padding: 1px 2px;
}

html.is-mobile #deck-builder-modal .count-badge {
  width: 100%;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  padding: 3px 0;
  text-align: center;
  border-radius: 999px;
}

html.is-mobile #deck-builder-modal .restricted-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 4px;
  max-width: 100%;
  text-align: center;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* แถบลอยล่างจอสำหรับมือถือ (Mobile Floating Bottom Bar) */
html.is-mobile .deck-mobile-bottom-bar {
  display: flex !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  margin: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(11, 13, 24, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.55);
}

html.is-mobile .dmbb-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

html.is-mobile .dmbb-count {
  font-size: 13.5px;
  font-weight: 800;
  color: #4ade80;
}

html.is-mobile .dmbb-hint {
  font-size: 10px;
  color: #94a3b8;
}

html.is-mobile .dmbb-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

html.is-mobile .dmbb-btn-view {
  min-height: 38px;
  padding: 0 12px !important;
  font-size: 12px !important;
  font-weight: 600;
  background: #334155 !important;
  color: #f8fafc !important;
  border-radius: 8px;
  border: 1px solid #475569;
}

html.is-mobile .dmbb-btn-save {
  min-height: 38px;
  padding: 0 14px !important;
  font-size: 12.5px !important;
  font-weight: 700;
  background: #16a34a !important;
  color: #ffffff !important;
  border-radius: 8px;
}

html.is-mobile .dmbb-btn-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #475569 !important;
}

/* =============================================================================
   6. ร้านค้า: เต็มจอแบบแอป · หัวกะทัดรัด · แท็บติดบนเมื่อเลื่อน
   ============================================================================= */
html.is-mobile #bof-shop-dialog {
  width: 100vw !important; max-width: none !important; height: 100dvh !important; max-height: none !important;
  margin: 0 !important; border-radius: 0 !important; inset: 0;
}
html.is-mobile #bof-shop-dialog .bof-shop-panel {
  height: 100% !important; max-height: none !important; border-radius: 0 !important;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  overscroll-behavior: contain;
}
/* หัว: ชื่อ + ปิด / กระเป๋าเงิน + ปุ่มโค้ด อยู่แถวเดียว */
html.is-mobile #bof-shop-dialog .sh-top { display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px !important; }
html.is-mobile #bof-shop-dialog #bof-shop-title { grid-column: 1; grid-row: 1; font-size: var(--m-fs-lg) !important; margin: 0; }
html.is-mobile #bof-shop-dialog .sh-wallet { grid-column: 1 / 3; grid-row: 2; gap: 6px; }
html.is-mobile #bof-shop-dialog .sh-wallet > span { height: 36px; padding: 0 12px; }
html.is-mobile #bof-shop-dialog .sh-wallet small { display: none; }
html.is-mobile #bof-shop-dialog #bof-shop-code-toggle { grid-column: 3; grid-row: 2; height: 36px; }
html.is-mobile #bof-shop-dialog #bof-shop-close { grid-column: 3; grid-row: 1; position: static !important; width: 40px; height: 40px; justify-self: end; }
/* แท็บติดบน */
html.is-mobile #bof-shop-dialog .sh-tabs {
  position: sticky; top: calc(-10px - env(safe-area-inset-top, 0px)); z-index: 20; margin: 10px -14px 0 !important; padding: 0 14px;
  background: rgba(17, 19, 34, .97); box-shadow: 0 8px 14px -10px rgba(0, 0, 0, .7);
}
html.is-mobile #bof-shop-dialog .sh-tab { min-height: 56px !important; font-size: 12px !important; gap: 3px !important; }
html.is-mobile #bof-shop-dialog .sh-packs-info,
html.is-mobile #bof-shop-dialog .sh-dupe-note { font-size: 12px !important; line-height: 1.45; color: var(--m-dim); }

/* =============================================================================
   7. หน้าต่างทั้งหมด → แผ่นเลื่อนขึ้นจากล่าง (bottom sheet)
   ============================================================================= */
html.is-mobile .m-hide { display: none !important; }

/* <dialog> ในล็อบบี้ (ยกเว้นร้านค้าที่เป็นเต็มจอ) */
html.is-mobile #lobby-screen dialog:not(#bof-shop-dialog) {
  width: 100vw !important; max-width: none !important; margin: auto 0 0 !important; max-height: 92dvh !important;
  border-radius: 22px 22px 0 0 !important; animation: m-sheet-up .32s var(--m-ease) both;
}
html.is-mobile #lobby-screen dialog > .lb-dialog-panel,
html.is-mobile #bof-auth-dialog > .bof-auth-panel {
  width: 100% !important; max-width: none !important; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 22px 22px 0 0 !important; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
}
html.is-mobile #lb-howto-dialog, html.is-mobile #lb-join-dialog { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important; }

/* หน้าต่างของเกม (.modal-overlay) */
html.is-mobile :is(#ai-setup-modal, #pvp-room-modal, #combat-log-modal, #zone-viewer-modal) { align-items: flex-end !important; padding: 0 !important; }
html.is-mobile :is(#ai-setup-modal, #pvp-room-modal, #combat-log-modal, #zone-viewer-modal) > .modal-box {
  width: 100% !important; max-width: none !important; max-height: 90dvh !important; margin: 0 !important;
  border-radius: 22px 22px 0 0 !important; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  overscroll-behavior: contain; animation: m-sheet-up .32s var(--m-ease) both;
}

/* ตั้งค่าบอท: ความยากแสดงคำอธิบายเฉพาะข้อที่เลือก · เด็ค 2 คอลัมน์ ไม่มีคำอธิบาย · ปุ่มเริ่มติดล่าง */
html.is-mobile #ai-setup-modal .ai-setup-header h2 { font-size: var(--m-fs-lg); }
html.is-mobile #ai-setup-modal .ai-setup-header p { display: none; }
html.is-mobile #ai-setup-modal .ai-setup-sec-title { font-size: var(--m-fs-sm); margin-bottom: 8px; }
html.is-mobile #ai-setup-modal .ai-diff-grid { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
html.is-mobile #ai-setup-modal .ai-diff-card { padding: 10px 6px !important; min-height: 64px; text-align: center; }
html.is-mobile #ai-setup-modal .ai-diff-top { flex-direction: column; align-items: center; gap: 4px; }
html.is-mobile #ai-setup-modal .ai-diff-badge { font-size: var(--m-fs-md); }
html.is-mobile #ai-setup-modal .ai-diff-reward { font-size: 11px; }
html.is-mobile #ai-setup-modal .ai-diff-desc { display: none; }
html.is-mobile #ai-setup-modal .ai-deck-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html.is-mobile #ai-setup-modal .ai-deck-card { min-height: 56px; padding: 8px !important; gap: 8px; align-items: center; }
html.is-mobile #ai-setup-modal .ai-deck-card.is-random-card { grid-column: 1 / -1; }
html.is-mobile #ai-setup-modal .ai-deck-thumb { width: 36px !important; height: 36px !important; border-radius: 50%; object-fit: cover; object-position: top; }
html.is-mobile #ai-setup-modal .ai-deck-meta strong { font-size: var(--m-fs-sm); line-height: 1.25; }
html.is-mobile #ai-setup-modal .ai-deck-meta small { font-size: 11px; }
html.is-mobile #ai-setup-modal .ai-deck-meta span { display: none; }
html.is-mobile #ai-setup-modal .ai-setup-footer {
  position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); z-index: 5;
  margin: 12px -16px calc(-16px - env(safe-area-inset-bottom, 0px)); padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 1fr 2fr; gap: 8px; background: rgba(17, 19, 34, .97);
}
html.is-mobile #ai-setup-modal .ai-start-btn { order: 2; min-height: 48px; font-size: var(--m-fs-md); margin: 0 !important; }
html.is-mobile #ai-setup-modal .ai-cancel-btn { order: 1; min-height: 48px; margin: 0 !important; }

/* =============================================================================
   8. ภารกิจ (js/quests.js): ปุ่มข้างโปรไฟล์ → แผ่นล่าง · ชาร์ดข้างเหรียญ
   ============================================================================= */
html.is-mobile .lb-side > #lb-quests { display: none; }
html.is-mobile #lb-auth-bar { grid-column: 1 / -1 !important; justify-self: stretch; margin-right: 72px; min-width: 0; }
html.is-mobile .lb-quest-btn {
  grid-column: 2; grid-row: 2; justify-self: end; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 64px; height: 52px; border-radius: 16px; border: 1px solid rgba(243, 201, 105, .55);
  background: linear-gradient(160deg, rgba(60, 50, 20, .9), rgba(18, 22, 50, .92)); color: #ffe39a;
  font: 600 11px var(--font-display, 'Kanit', sans-serif); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); touch-action: manipulation;
}
html.is-mobile .lb-quest-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
html.is-mobile .lb-quest-btn:active { transform: scale(.95); }
html.is-mobile .lb-quest-btn .qb-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  background: #ff5d73; color: #fff; font: 700 11px/20px var(--font-display, 'Kanit', sans-serif); box-shadow: 0 0 0 2px #0b0d1a;
  animation: m-badge-pop 2s ease-in-out infinite;
}
html.is-mobile .lb-quest-btn .qb-count[hidden] { display: none; }
@keyframes m-badge-pop { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.25); } }
html.is-mobile #lb-coin-pill { padding: 0 10px !important; gap: 4px !important; font-size: 14px !important; }
html.is-mobile #lb-coin-pill .lb-shard { margin-left: 4px; padding-left: 6px; }

/* ปุ่มภารกิจเรืองแสงเมื่อมีของให้รับ (วงแสงเป็น pseudo: animate แค่ transform/opacity) */
html.is-mobile .lb-quest-btn.is-hot::before {
  content: ''; position: absolute; inset: -3px; border-radius: 18px; border: 2px solid rgba(255, 227, 154, .85);
  box-shadow: 0 0 14px rgba(243, 201, 105, .55); animation: m-hot 1.8s ease-out infinite; pointer-events: none;
}
@keyframes m-hot { 0% { opacity: 1; transform: scale(.96); } 100% { opacity: 0; transform: scale(1.15); } }

/* แผ่นภารกิจ: หัว (ที่จับ · ตรา · ปิด) กับแท็บอยู่กับที่ · เลื่อนเฉพาะรายการ */
html.is-mobile #lobby-screen #lb-quests-dialog > .lb-dialog-panel {
  display: flex; flex-direction: column; max-height: 88dvh; overflow: hidden; padding: 0 14px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  background:
    radial-gradient(120% 40% at 0% 0%, rgba(243, 201, 105, .16), transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(140, 110, 255, .14), transparent 60%),
    linear-gradient(175deg, #1c2250, #0f1229 70%);
  border-color: rgba(243, 201, 105, .6);
  touch-action: pan-y;
}
html.is-mobile #lb-quests-dialog .qb-dialog-slot { flex: 1 1 auto; min-height: 0; display: flex; }
html.is-mobile #lb-quests-dialog #lb-quests { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; width: 100%; }
html.is-mobile #lb-quests-dialog #lb-quests > * { flex-shrink: 0; }
html.is-mobile #lb-quests-dialog #lb-quests > .qb-list { flex: 1 1 auto; min-height: 0; }
html.is-mobile #lb-quests-dialog .qb-grab { display: block; width: 44px; height: 5px; margin: 8px auto 6px; border-radius: 99px; background: rgba(255, 255, 255, .28); }
html.is-mobile #lb-quests-dialog .qb-head { padding-bottom: 2px; touch-action: none; cursor: grab; }
html.is-mobile #lb-quests-dialog .qb-head h3 { font-size: 22px; }
html.is-mobile #lb-quests-dialog .qb-emblem { width: 44px; height: 44px; }
html.is-mobile #lb-quests-dialog .qb-timer { font-size: var(--m-fs-sm); }
html.is-mobile #lb-quests-dialog .qb-close {
  display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03) 70%);
  border: 1px solid rgba(243, 201, 105, .45); color: #ffe39a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1), background-color .2s; touch-action: manipulation;
}
html.is-mobile #lb-quests-dialog .qb-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
html.is-mobile #lb-quests-dialog .qb-close:active { transform: scale(.88) rotate(90deg); background-color: rgba(243, 201, 105, .18); }
html.is-mobile #lb-quests-dialog .qb-wallet {
  display: flex; gap: 10px; margin: 10px 0 0; touch-action: none;
  font: 700 var(--m-fs-md) var(--font-display, 'Kanit', sans-serif);
}
html.is-mobile #lb-quests-dialog .qb-wallet span { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 12px; background: rgba(6, 8, 20, .5); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5); }
html.is-mobile #lb-quests-dialog .qb-wallet svg { width: 18px; height: 18px; }
html.is-mobile #lb-quests-dialog .qb-w-coin { color: #ffe39a; }
html.is-mobile #lb-quests-dialog .qb-w-shard { color: #d9c8ff; }
html.is-mobile #lb-quests-dialog .qb-tabs button { min-height: var(--m-tap); font-size: var(--m-fs-md); }
html.is-mobile #lb-quests-dialog .qb-bonus { font-size: var(--m-fs-sm); padding: 6px 10px; }
html.is-mobile #lb-quests-dialog .qb-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
html.is-mobile #lb-quests-dialog .qb-ico { width: 40px; height: 40px; }
html.is-mobile #lb-quests-dialog .qb-ico svg { width: 22px; height: 22px; }
html.is-mobile #lb-quests-dialog .qb-title { font-size: var(--m-fs-md); }
html.is-mobile #lb-quests-dialog .qb-rew { font-size: var(--m-fs-sm); }
html.is-mobile #lb-quests-dialog .qb-claim { min-width: 60px; min-height: var(--m-tap); font-size: var(--m-fs-md); }
html.is-mobile #lb-quests-dialog .qb-claim-all { min-height: 50px; font-size: var(--m-fs-md); }

/* ============================================================================
   (9) หน้าวิธีเล่น + วิดีโอคอมโบ (css/howto.css)
   ============================================================================ */
html.is-mobile #lb-howto-dialog.lb-howto-wide { width: 100vw !important; border-radius: 20px 20px 0 0; border-bottom: 0; }
html.is-mobile #lb-howto-dialog.lb-howto-wide { padding-left: 12px !important; padding-right: 12px !important; }
html.is-mobile #lb-howto-dialog .lb-howto-header { margin: 0 -12px; padding: 14px 12px 8px; }
html.is-mobile #lb-howto-dialog .lb-howto-tab { font-size: var(--m-fs-sm); padding: 6px 4px; }
html.is-mobile #lb-howto-dialog .lb-combo-card { padding: 10px; border-radius: 14px; }
html.is-mobile #lb-howto-dialog .cr-title { font-size: var(--m-fs-md); }
html.is-mobile #lb-howto-dialog .cr-caption { font-size: var(--m-fs-md); min-height: 56px; }
html.is-mobile #lb-howto-dialog .cr-stage { border-radius: 10px; }
html.is-mobile #lb-howto-dialog .lb-howto-header { padding: 10px 12px 8px; }
html.is-mobile #lb-howto-dialog .lb-howto-header h2 { font-size: 19px !important; }
html.is-mobile #lb-howto-dialog .bof-auth-close-x { min-width: 40px; min-height: 40px; }
html.is-mobile #lb-howto-dialog .lb-howto-tabs { margin-bottom: 10px; padding: 4px; }
html.is-mobile #lb-howto-dialog .lb-howto-tab { min-height: 40px; }
html.is-mobile .howto-deckbar { margin: 0 -12px 8px; padding: 4px 12px 2px; border-radius: 0; }
html.is-mobile .howto-deckbar::before { border-radius: 0; }
html.is-mobile .howto-deckbar::after { border-radius: 0; }
html.is-mobile .howto-deck-arrow { width: 36px; height: 36px; margin-top: -20px; }
html.is-mobile #lb-howto-dialog .lb-combo-deck-pill { min-height: 44px; padding: 3px 12px 3px 3px; font-size: 13px; gap: 6px; }
html.is-mobile #lb-howto-dialog .lb-combo-deck-pill img { width: 34px; height: 34px; }
html.is-mobile #lb-howto-dialog .lb-combo-content-box { gap: 10px; }
html.is-mobile #lb-howto-dialog .lb-combo-overview { padding: 10px 12px; }
html.is-mobile #lb-howto-dialog .lb-combo-overview strong { font-size: 15px; }
html.is-mobile #lb-howto-dialog .lb-combo-overview p { font-size: 13px; line-height: 1.5; }
html.is-mobile #lb-howto-dialog .lb-combo-card { gap: 8px; }
html.is-mobile #lb-howto-dialog .cr-caption { font-size: 14px; min-height: 52px; padding: 8px 10px; }
html.is-mobile #lb-howto-dialog .cr-controls { gap: 4px; }
html.is-mobile #lb-howto-dialog .cr-dots { margin-left: 2px; gap: 3px; }
html.is-mobile #lb-howto-dialog .lb-combo-practice-btn.cr-practice { min-height: 44px; font-size: 14px !important; }
html.is-mobile #lb-howto-dialog .lb-steps li { font-size: 14px; line-height: 1.55; }

/* ============================================================================
   10. แถบโค้ชโหมดฝึก (#bof-tutorial-coach-bar) — ย่อเหลือป้ายขั้น + หัวข้อ แตะเพื่อกาง (js/tutorial-coach.js)
   ============================================================================ */
html.is-mobile #bof-tutorial-coach-bar {
  width: calc(100vw - 16px);
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 10px 9px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
html.is-mobile .bof-coach-step-badge { font-size: 11px; }
html.is-mobile .bof-coach-prog { margin: 6px 0 4px; }
html.is-mobile .bof-coach-title { font-size: 13.5px; }
html.is-mobile .bof-coach-desc { font-size: 13px; line-height: 1.5; margin-top: 4px; }
html.is-mobile .bof-coach-actions { flex-direction: row; gap: 6px; }
html.is-mobile .bof-coach-btn { flex: 1; min-height: 38px; font-size: 12.5px !important; padding: 6px 4px !important; justify-content: center; gap: 6px; }
html.is-mobile .bof-guided-pointer-badge { font-size: 10.5px; }

/* =============================================================================
   HUD v2 บนมือถือ (css/hud.css): หน้าจบเกมกะทัดรัด · ประวัติการต่อสู้เป็นแผ่นล่าง · ไม่ใช้ blur/เงาหนัก
   ============================================================================= */
html.is-mobile #bof-game-arena .quota-badges span { gap: 4px; }
html.is-mobile #bof-game-arena #btn-pass-turn-inline { gap: 6px; }
html.is-mobile #custom-choice-modal.um-end .um-emblem { width: 92px; height: 92px; font-size: 44px; margin-bottom: 4px; }
html.is-mobile #custom-choice-modal.um-end .um-end-word { font-size: clamp(40px, 13vw, 64px); }
html.is-mobile .um-end-panel { margin-top: 10px; padding: 16px 14px 14px; border-radius: 18px; }
html.is-mobile #custom-choice-modal.um-end .um-end-panel #choice-modal-title { font-size: 18px; }
html.is-mobile #custom-choice-modal.um-end .um-end-panel #choice-modal-desc { font-size: 13px; margin-bottom: 10px; }
html.is-mobile .um-stat-tile { padding: 7px 4px; }
html.is-mobile .um-stat-tile b { font-size: 18px; }
html.is-mobile #custom-choice-modal.um-end #choice-modal-buttons .btn { min-height: var(--m-tap); width: 100%; }
html.is-mobile #combat-log-modal .cl-v2 { width: 100% !important; max-height: 88dvh !important; border-radius: 22px 22px 0 0 !important; border-bottom: 0 !important; }
html.is-mobile #combat-log-modal .cl-v2::before {
  content: ''; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 999px; background: rgba(255, 255, 255, .22); flex: none;
}
html.is-mobile .cl-head { padding: 8px 14px 10px; }
html.is-mobile .combat-filter-btn { height: 36px; }
html.is-mobile #combat-log-list { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* ============================================================================
   11. มือถือ: Dropdown ตัวกรอง / เลือกเด็ค / วิธีเล่น / ห้องทดลองสกิล
   ============================================================================ */
html.is-mobile #deck-builder-modal .deck-builder-box {
  display: block !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow-y: auto !important;
  padding-bottom: 76px !important;
}
html.is-mobile #deck-builder-modal .deck-slot-fx-select .fx-select-menu-sm {
  width: min(320px, calc(100vw - 32px));
}
html.is-mobile .fx-select-menu {
  max-width: calc(100vw - 28px);
  max-height: 55dvh;
}
html.is-mobile #lb-deck-picker-dialog .lb-slot-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
html.is-mobile #lb-howto-dialog .hw-rule-card {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
}
html.is-mobile #lb-howto-dialog .hw-step-num {
  width: 30px;
  height: 30px;
  font-size: 14px;
}
html.is-mobile #bof-sandbox-modal .bof-sandbox-box {
  width: calc(100vw - 12px) !important;
  padding: 12px !important;
}
html.is-mobile #bof-sandbox-modal .bof-sb-card-item {
  flex: 0 0 82px;
}
