/* แก้ UX จากรีวิวทั้งเกม (27 ก.ย. · 7 ขนาดจอ) — ที่เดียวสำหรับรอบนี้ โหลดท้ายสุด */

/* 3. แถวบัฟจองความสูงไว้เสมอ — เดิมบัฟขึ้น/หมดแล้วชิปเพชร+แถบเป้าหมายกระโดดลง ~25–30px ตรงจังหวะที่นิ้วกำลังแตะ
      ไอคอนมือถือเดิม 21px เลขเวลา 8px อ่านไม่ออก → 26px · เลขเวลา 12px (กรอบไอคอนเล็ก ใหญ่กว่านี้บังรูป) */
html body #basic #b-buffs { min-height: 37px; }
html.touch-ui body #basic #b-buffs { min-height: 38px; }
html.touch-ui body .bfbadge { width: 26px !important; height: 38px !important; background-size: 26px 26px !important; }
html.touch-ui body .bfbadge b { font-size: 12px !important; line-height: 13px !important; padding: 0 3px !important; }

/* 9. ข้อความแจ้ง (toast) บนมือถือ: เดิมตัวใหญ่ 28px ลอยกลางจอที่ 24% ทับหน้าต่าง/ตัวละคร ("เฟรมตก เปิดโหมดลื่น" ฯลฯ)
      → เล็กลง อยู่แถบบนใต้แนวมินิแมป · ไม่รับการแตะ */
html.touch-ui body #toast { font-size: 18px; top: calc(env(safe-area-inset-top, 0px) + 122px); max-width: 86vw; white-space: normal; text-align: center; pointer-events: none; }
html.touch-ui.land body #toast { font-size: 16px; top: calc(max(env(safe-area-inset-top, 0px) + 12px, var(--hz-tc-b, 0px) + 8px)); }

/* 10. ปุ่มเล็กเกินในหน้าช่างคราฟ (−/+ กว้าง 30px) และปุ่ม "เริ่มตีบวก" (สูง 28px) — คอม ≥ 40px · มือถือ ≥ 44px
       ตัวอักษรในสองหน้านี้ (11.5px) ขึ้นเป็น 13px ตามกฎ (ไม่ได้อยู่ในหน้าต่างที่สแกนรอบแรก) */
html body .cw-n button { min-width: 40px; min-height: 40px; font-size: 16px; }
html body .cw-n button[data-n="max"] { font-size: 13px; }
html body #rw-start, html body #cw-go { min-height: 40px; }
html.touch-ui body .cw-n button, html.touch-ui body #rw-start, html.touch-ui body #cw-go { min-height: 44px; }
html.touch-ui body .cw-n button:not([data-n="max"]) { min-width: 44px; }
html body .rw-mat-tx span, html body .rw-gold span, html body .cw-sub, html body .cw-mat-nm { font-size: 13px; }

/* 2. กล่องยืนยันซื้อ: เดิมกลางร้าน — ปุ่ม "ซื้อ" ในกล่องห่างจากปุ่มซื้อเดิม (ขวาล่าง) กดซ้ำแล้วพลาด
      → ชิดขวาล่างของร้าน ปุ่ม "ซื้อ" มาอยู่ใกล้ตำแหน่งเดิมใต้นิ้ว (กันแตะพื้นหลังปิดใน 0.4 วิแรก: shop-window.js) */
html body #windows .shop-modal { place-items: end; padding: 14px; }

/* แถบเล็งสกิล (มือถือ): พื้นขั้นต่ำเดิม 158px (ui-kit.css) คิดจากแผงก่อนจองแถวบัฟ — แผงตอนนี้จบที่ ~162px
   → 172px (ใช้เฉพาะตอน --hud-b ยังไม่ถูกวัด · เล่นจริง ui.js วัดขอบล่างแผงให้เอง) */
html.touch-ui body #hud #aim-bar.touch { top: max(var(--aim-top, 0px), calc(var(--hud-b, 80px) + 8px), calc(var(--map-b, 0px) + 8px), 172px); }
html.touch-ui.land body #hud #aim-bar.touch { top: max(8px, var(--aim-top, 8px)); }

/* 5. แถบ EXP มือถือ (ui.js updateMe สร้าง #xp-strip) — บาง 5px ชิดขอบล่างเหนือ safe-area · ตัวเลข % เล็กชิดขวาอ่านได้ 13px
      คอมมีแถว Base Lv ในแผงอยู่แล้ว → ซ่อน */
#xp-strip { display: none; }
html.touch-ui body #xp-strip {
  display: block; position: fixed; left: 0; right: 0; bottom: env(safe-area-inset-bottom, 0px); height: 5px; z-index: 7;
  background: rgba(20, 26, 38, .55); pointer-events: none;
}
html.touch-ui body #xp-strip i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e8b64a, #ffd98a); transition: width .4s ease-out; }
html.touch-ui body #xp-strip span {
  position: absolute; right: 8px; bottom: 7px; font: 700 13px/1 var(--font-head, inherit); color: #fff6dc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7); opacity: .85;
}
html.touch-ui.chat-open body #xp-strip, html.touch-ui.menu-open body #xp-strip { display: none; }

/* แนวนอน: ปุ่ม ☰ 💬 เรียงเป็นแถวเสมอ (เดิมเป็นแถวเฉพาะจอสูง ≤375px)
   จอ 844×390 เรียงตั้งแล้วปุ่มแชทจบที่ y 308 ทับฐานจอยที่เริ่ม y 286 — แตะแชทโดนจอย/แตะจอยโดนแชท
   แถบเป้าหมายหลบไปขวาของแถวนี้เองอยู่แล้ว (ui.js placeGoal) */
html.touch-ui.land body #hud #fabs { flex-direction: row; }
