/* กลุ่มควบคุมการต่อสู้บนคอม (เมาส์) — 5 ต.ค. · combat-pc.js · ตรวจด้วย tools/check-pc-hud.mjs
 *
 * ⚠️ ทำไม: เดิมไม้ตาย (ult-hud.js) · ปุ่ม AUTO + ป้ายโหมดเป้า (auto-attack.js) เป็นของ position:absolute คนละไฟล์
 *    แปะข้างแถบช่องลัด แต่ละชิ้นคิดตำแหน่งเอง → ไม้ตายลอยทับป้าย "🎯 ทุกตัว" ทุกขนาดจอ · ชนแถบเมนูขวาล่างที่ 1280–1366 ·
 *    จอแคบ (≤1100) แถบช่องลัดเด้งไปลอยกลางจอ (bottom 246px) ทับตัวละคร (ผู้ใช้ 5 ต.ค. "ตำแหน่งชนกัน")
 * ผัง: แถบช่องลัด #hotbar = แถว flex แถวเดียวที่เป็นเจ้าของทั้งกลุ่ม
 *        [ ไม้ตาย (R) ] [ 1 … 9 ][หน้า] [ AUTO (Q · ปิด WASD = A) / 🎯 โหมดเป้า ]
 *      ไม้ตายเป็นปุ่มกลมใหญ่ติดหัวแถว (ปุ่มเด่นสุด) · AUTO กับโหมดเป้าซ้อนกันเป็นคอลัมน์เล็กท้ายแถว (คู่กัน ไม่ลอย)
 *      ลูกถูก renderHotbar กวาดแล้วแปะกลับท้ายแถวเสมอ → จัดลำดับด้วย order ไม่พึ่งลำดับใน DOM
 *    กว้าง: อยู่ระหว่างขอบขวาแชทกับขอบซ้ายแถบเมนู (combat-pc.js วัดจริง → --cb-l / --cb-r · ขนาดเต็มของแถว --cb-w) แล้วจัดกลางช่องนั้น
 *           ช่องลัดหดได้ 44 → 34px · ถ้ายังไม่พอ (หน้าต่างแคบ) ทั้งแถวขึ้นไปวางเหนือแถบเมนูชิดขวา (.cb-stack) ไม่ทับแชท
 * จอสัมผัสไม่โดนไฟล์นี้ (ทุกกฎขึ้นต้น html:not(.touch-ui)) — ผังจอสัมผัสอยู่ ui-touch.css/ui-root.js */

html:not(.touch-ui) body #hotbar {
  top: auto; bottom: 16px; left: var(--cb-l, calc(var(--chat-w) + 28px)); right: var(--cb-r, calc(var(--menu-w) + 24px));
  width: min(var(--cb-w, 600px), 100vw - var(--cb-l, 400px) - var(--cb-r, 340px)); max-width: none; margin: 0 auto; transform: none;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 3px; box-sizing: border-box;
}
html:not(.touch-ui) body #hotbar .slot { flex: 0 1 44px; width: 44px; min-width: 34px; max-width: 44px; }
html:not(.touch-ui) body #hotbar .hb-page { flex: 0 0 22px; width: 22px; }

/* หน้าต่างแคบ: เหนือแถบเมนู ชิดขวา (ขอบซ้ายไม่เกินแชท) — combat-pc.js ใส่คลาสเมื่อช่องระหว่างแชทกับเมนูไม่พอ */
html:not(.touch-ui) body #hotbar.cb-stack {
  left: auto; right: var(--cb-stack-r, 12px); bottom: var(--cb-stack-b, 92px); margin: 0;
  width: min(var(--cb-w, 600px), 100vw - var(--cb-l, 300px) - 12px);
}
/* เมนู "เพิ่มเติม" เด้งเหนือแถบเมนู — ตอนกลุ่มต่อสู้ขึ้นไปอยู่ตรงนั้น ให้เมนูเด้งเหนือกลุ่มแทน */
html:not(.touch-ui).hud-more.cb-stacked body #hud #menu { bottom: var(--cb-menu-b, 160px); }

/* ── ไม้ตาย: หัวแถว ใหญ่กว่าช่องลัด ยื่นขึ้นเหนือแถบเล็กน้อย (margin ติดลบไม่ดันความสูงแถบ) ── */
html:not(.touch-ui) body #hotbar > #ult-btn {
  order: -1; position: relative; left: auto; right: auto; top: auto; bottom: auto;
  flex: 0 0 56px; width: 56px; height: 56px; margin: -12px 5px 0 1px; align-self: flex-end;
}
html:not(.touch-ui) body #hotbar > #ult-btn .ult-key {
  min-width: 18px; height: 18px; padding: 0 3px; font: 700 12px/18px var(--font); box-sizing: border-box; text-align: center;
}

/* ── AUTO + โหมดเป้า: คอลัมน์เล็กท้ายแถว สูงเท่าช่องลัด ── */
html:not(.touch-ui) body #hotbar > #auto-wrap {
  order: 10; position: relative; left: auto; bottom: auto;
  flex: 0 0 auto; width: 96px; margin: 0 0 0 6px;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 3px;
}
html:not(.touch-ui) body #hotbar #auto-atk-pc {
  width: 100%; height: 24px; min-height: 0; padding: 0 5px 0 7px; gap: 4px; justify-content: flex-start; border-radius: 8px;
  font: 700 13px/1 var(--font-head, var(--font)); box-sizing: border-box;
}
html:not(.touch-ui) body #hotbar #auto-atk-pc .sw { font-size: 13px; }
html:not(.touch-ui) body #hotbar #auto-atk-pc .tx { flex: 1; text-align: left; }
html:not(.touch-ui) body #hotbar #auto-atk-pc .dot { flex: none; }
/* ปุ่มลัดบอกบนปุ่ม (แบบเลขบนช่องลัด) — ไม่ต้องเปิด tooltip ก็รู้ว่ากด A */
html:not(.touch-ui) body #hotbar .cb-key {
  display: inline-block; flex: none; min-width: 15px; height: 15px; padding: 0 2px; border-radius: 4px; box-sizing: border-box;
  font: 700 11px/15px var(--font); font-style: normal; text-align: center; text-shadow: none;
  background: #fffdf6; color: #6b4510; border: 1px solid #c4a064;
}
html:not(.touch-ui) body #hotbar #auto-tag-pc {
  width: 100%; max-width: none; height: 21px; padding: 0 6px; justify-content: center; box-sizing: border-box;
  font: 600 13px/1 var(--font); overflow: hidden; text-overflow: ellipsis;
}
