*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* 🔤 ฟอนต์กลางของ UI ใหม่ = ฟอนต์เกม (เจ้าของ 2026-10-15 "ปรับให้ทั้งระบบใช้ฟ้อนเดียวกัน") — ใช้ใน font shorthand: font:700 12px var(--gf) */
:root { --gf: 'Courier New', monospace; }
html { height: 100%; }
body {
  width: 100%; height: 100%;
  background: #f8f9fa;
  font-family: 'Courier New', monospace;
  color: #1f2937;
  overflow-x: hidden;
  display: flex; flex-direction: column;
}

/* ── Loading ─────────────────────────────────────────────── */
#loading-screen { display: flex; align-items: center; justify-content: center; height: 100vh; background: #f8f9fa; }
.loading-box { text-align: center; }
.loading-title { font-size: 32px; color: #d97706; margin-bottom: 14px; letter-spacing: 2px; }
.loading-sub { font-size: 14px; color: #4b5563; }

/* ── Game / Logout screens ───────────────────────────────── */
#game-screen, #logout-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* ── Map wrap ────────────────────────────────────────────── */
.map-wrap {
  position: relative;
  width: 100%;
  background: #0d1117;
  flex: 1 1 auto;   /* กินพื้นที่ที่เหลือทั้งหมดลงไปถึงเมนู (log ย้ายเข้า panel แล้ว) */
  min-height: 0;
  overflow: hidden;
}
#gameCanvas, #emptyCanvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* JS sets width/height style */
}

/* ── Minimap ─────────────────────────────────────────────── */
#minimapCanvas {
  position: absolute;
  top: 5px; right: 5px;
  width: 84px; height: 84px;
  border: 1px solid #4b5563;
  border-radius: 4px;
  background: #050a05;
}

/* ── Status Panel (top) ──────────────────────────────────── */
.status-panel {
  flex-shrink: 0;
  background: #1e293b;
  color: #f1f5f9;
  padding: 6px 10px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 10vh; max-height: 15vh;
}
.status-row1 { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; } /* 🧷 ไม่ตัดบรรทัด — ชื่อแมพยาว (เช่น เวียดนาม) ใช้ … แทนดัน G ตกแถว (เจ้าของแจ้ง 2026-09-20) */
.sp-name { font-weight: bold; font-size: 13px; color: #7dd3fc; flex: 1 1 auto; min-width: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-badge {
  font-size: 11px; font-weight: bold; padding: 2px 7px;
  border-radius: 10px; white-space: nowrap;
}
.sp-badge.lv   { background: #334155; color: #cbd5e1; }
.sp-badge.zone { background: #0e7490; color: #cffafe; flex: 0 1 auto; min-width: 0; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; } /* ยาวเกิน = … */
.sp-badge.lv, .sp-badge.gold { flex: 0 0 auto; }
.sp-badge.gold { background: #78350f; color: #fde68a; }

.status-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; }
.sp-bar-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sp-bar-wrap .sp-bar { flex: 1; min-width: 0; }
.sp-bar-label { font-size: 10px; color: #cbd5e1; width: 30px; flex-shrink: 0; font-weight: 600; } /* สว่างขึ้น — สีเดิม #475569 กลืนพื้นเข้ม */
.sp-bar {
  flex: 1; height: 10px; background: #334155;
  border-radius: 5px; overflow: hidden;
}
.sp-bar-fill { height: 100%; border-radius: 5px; transition: width 0.3s; }
.hp-fill  { background: #22c55e; }
.exp-fill { background: #f59e0b; }
.sp-bar-text { font-size: 10px; color: #cbd5e1; white-space: nowrap; min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; } /* จุ 9999/9999 · ชิดขวา + เลขความกว้างเท่ากัน → คอลัมน์บน-ล่างตรงกัน */

.status-row3 { display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: nowrap; overflow: hidden; }
/* ชิปแคปซูลบรรทัดเดียว (design A) — กันข้อความหักบรรทัดในช่อง */
.sp-ammo {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: #e2e8f0;
  background: #334155; border-radius: 999px;
  padding: 2px 9px; white-space: nowrap;
}
.sp-rail { gap: 4px; }
/* ⚙️ เมนูตั้งค่า (docs/settings-menu-design.md): ปุ่มที่ย้ายเข้าเมนูแล้วซ่อนจากหน้าจอปกติ · body.set-menu ใส่โดย JS เมื่อ SETTINGS_MENU_ON */
body.set-menu #zoom-mode-btn, body.set-menu #quality-btn, body.set-menu #wide-btn, body.set-menu #fs-btn { display: none !important; } /* 🔊 ปุ่มเปิด/ปิดเสียงกลับมาแสดงบนจอ (เจ้าของ 2026-10-17 "ขอปุ่มปิดเสียงด้วยนะครับ") — ยังอยู่ในหน้าตั้งค่าด้วย */
body.set-nodpad .dpad-overlay { display: none !important; }
/* 🧹 แถบบนเป็นระเบียบ (เจ้าของ 2026-10-05) — ⚠️ มือถือ (ไม่ใช่ body.wide): ขนาด/ระยะของชิปและป้ายคงเดิมทุกอย่าง (เจ้าของ "ระวังบน mobile") เปลี่ยนแค่ไอคอน + จุดสีขั้นกระสุน + สีตัวเลข
   จอกว้าง (body.wide) ถึงจะปรับความสูง/ระยะ/เส้นคั่น */
.sp-ammo { font-variant-numeric: tabular-nums; }
.sp-ammo svg { flex: 0 0 auto; }
.sp-tdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(15,23,42,.7); flex: 0 0 auto; }
.sp-num { font-weight: 700; color: #f1f5f9; }
.sp-cap { color: #94a3b8; }
body.wide .sp-ammo { height: 20px; box-sizing: border-box; padding: 0 9px; gap: 4px; border: 1px solid #475569; line-height: 1; }
body.wide .sp-tdot { width: 8px; height: 8px; }
body.wide .sp-cap { font-size: 10px; }
body.wide .sp-badge { display: inline-block; height: 20px; box-sizing: border-box; padding: 0 8px; line-height: 20px; vertical-align: middle; }
body.wide .status-row2 { gap: 3px 22px; }
body.wide .sp-bar-label { width: auto; min-width: 26px; }
body.wide .sp-bar-text { min-width: 0; padding-left: 2px; }
body.wide .status-row3 { gap: 6px; padding-left: 14px; border-left: 1px solid #334155; }
#hud-rail-bar-wrap {
  display: inline-block; width: 38px; height: 6px;
  background: #334155; border-radius: 3px; overflow: hidden; vertical-align: middle;
}
#hud-rail-bar {
  display: block; height: 100%; width: 0%;
  background: #38bdf8; border-radius: 3px; transition: width 0.3s;
}

/* ── HUD (legacy — kept for any remaining refs) ──────────── */
.hud-tl { display: none; }
.hud-tr { display: none; }
.hud-badge {
  background: rgba(255,255,255,0.90);
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: #374151;
  white-space: nowrap;
  font-weight: bold;
}
.hud-badge.green  { color: #15803d; border-color: #86efac; background: rgba(240,253,244,0.92); }
.hud-badge.yellow { color: #92400e; border-color: #fcd34d; background: rgba(255,251,235,0.92); }
.hud-badge.gold   { color: #b45309; border-color: #fbbf24; background: rgba(255,251,235,0.92); }
.hud-badge.cyan   { color: #0e7490; border-color: #67e8f9; background: rgba(236,254,255,0.92); }

.hud-tr {
  position: absolute;
  top: 82px; right: 5px;
  display: flex; flex-direction: column; gap: 3px; align-items: flex-end;
}
.ammo-badge {
  background: rgba(255,255,255,0.90);
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: #374151;
  font-weight: bold;
}

/* ── Zoom buttons ────────────────────────────────────────── */
.zoom-btns {
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
}
.zoom-btn {
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.88);
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151; font-size: 15px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
}
.zoom-btn.sm { font-size: 11px; }
.zoom-btn:hover { background: #f3f4f6; }
.zoom-btn:active { transform: scale(0.93); }

/* ── D-Pad (overlay บนแผนที่ — โชว์เฉพาะตอน AUTO OFF ผ่าน class 'show') ── */
.dpad-overlay {
  position: absolute;
  right: 8px; bottom: 82px; /* ลอยเหนือชุดปุ่ม .map-auto-wrap (เหลือ 3 ปุ่ม ~72px หลังย้ายเสียง+ตัดแผงรัศมีออก 2026-07-14) กัน D-pad ทับปุ่ม AUTO */
  display: none;
  z-index: 10;
}
.dpad-overlay.show { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dpad-row { display: flex; gap: 3px; justify-content: center; }
.dpad-btn {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(209,213,219,0.75); border-radius: 8px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none;
}
.dpad-btn.center { background: rgba(241,245,249,0.55); color: #475569; }
.dpad-btn.active { background: #2563eb; color: #fff; border-color: #1d4ed8; }
.dpad-btn:active { transform: scale(0.92); }
.spot-select-wrap {
  position: absolute;
  left: 6px; bottom: 6px;
  z-index: 10;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
}
.spot-row { display: flex; align-items: center; gap: 4px; }
.mlog-row { display: flex; align-items: center; gap: 4px; }
.boss-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; max-width: 240px; } /* ปุ่ม MVP shortcut เรียงต่อกันเหนือปุ่ม LOG (ว่างไม่มีบอส = ไม่กินที่) */
.mlog-toggle {
  background: rgba(15,23,42,0.82); color: #d1fae5;
  border: 1px solid #4ade80; border-radius: 7px;
  padding: 2px 9px; font-size: 10px; font-weight: 700; cursor: pointer;
}
.mlog-toggle.off { color: #94a3b8; border-color: #475569; }
.mlog-toggle:active { transform: scale(0.95); }
#spot-select {
  background: rgba(15,23,42,0.82);
  color: #d1fae5;
  border: 1px solid #4ade80;
  border-radius: 8px;
  padding: 4px 6px;      /* 🌙 OFF ย้ายไปใต้ minimap → spot-row เหลือ dropdown+PVP+BOSS ขยายคืนได้ (2026-07-15) */
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 150px;      /* ขยายคืน (เหลือ 2 ปุ่มข้าง) — กันชื่อโซนยาวดันปุ่มตกจอ */
  height: 26px;
}
.map-auto-wrap {
  position: absolute;
  right: 5px; bottom: 6px;                 /* ชิดขวาตรงกับปุ่ม OFFLINE/PVP (right:5px) */
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; /* flex-end = ชิดขวา */
  z-index: 10;
}
.bot-toggle-btn {
  width: 84px; padding: 4px 0;             /* กว้างเท่า OFFLINE/PVP (84px) */
  background: #16a34a; color: #fff;
  border: none; border-radius: 8px;
  font-size: 10px; font-weight: bold; cursor: pointer;
}
.bot-toggle-btn:active { transform: scale(0.95); }
/* ✨ กระพริบก่อนจาง — ชิป 🎉 ตัวคูณ (แผงขวาปิด) + ป้าย ×1.5 ปุ่มลัด PREMIUM (เจ้าของ 2026-09-29) · opacity ล้วน ไม่มีแสง/glow */
@keyframes xhBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
#prem-quick-btn { display: none; }                               /* 🅿️ ทางลัด PREMIUM — เฉพาะตอนซ่อนเมนูล่าง (เมนูล่างมีปุ่ม PREMIUM อยู่แล้ว) */
body.ui-hide-b #prem-quick-btn { display: block; }
/* (แผงปุ่มรัศมี 100-300 .explore-radius-* / .er-btn ถอดออก 2026-07-14 — เหลือ #er-current ปุ่มเดียวกดวนค่า) */

/* ── Battle Log (อยู่ใน panel-log แล้ว — panel มีกรอบ/พื้นให้เอง) ── */
#event-log {
  height: min(55vh, 420px);
  overflow-y: auto;
  padding: 6px 0;
  font-size: 12px;
  line-height: 1.9;
}

/* ── Mini log ลอยบนแผนที่ (ซ้ายล่าง เหนือบล็อก spot-select) ── */
#mini-log {
  position: absolute;
  left: 6px; bottom: 62px; /* เหนือปุ่ม LOG + combobox */
  z-index: 9;
  pointer-events: none;
  /* 📜 กรอบนิ่ง (เจ้าของ 2026-10-09 "มันกระเด้งไปมาตามข้อความ ช่วย fix ขนาดให้นิ่งๆ" → แบบ ก): กว้าง/สูงคงที่ · ทุกแถบกว้างเท่ากรอบ สูงเท่ากัน · บรรทัดใหม่อยู่ล่างสุด ของเก่าเลื่อนขึ้นทีละช่อง
     สูง = 6 แถบ × 16px + ช่องไฟ 5 × 2px · กว้างจริง JS ตั้งให้ (ช่องเลือกโซน × 1.5) ค่านี้เป็นค่าตั้งต้น · ตัวกรอบมองไม่เห็น ไม่มีข้อความ = ไม่มีอะไรบังแผนที่ */
  width: 285px; height: 106px; justify-content: flex-end; overflow: hidden; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 2px; /* ปัก bottom ไว้ → บล็อกโตขึ้นด้านบน · บรรทัดใหม่สุดอยู่ล่าง (ติด combobox) เหมือน log หลัก */
  max-width: 95%; /* fallback — JS sync ให้ = combobox ×1.5 ใน _pushMiniLine (เจ้าของสั่งกว้างขึ้น 2026-08-23) */
}
#mini-log .ml-line {
  font-size: 11px; color: #fff;
  background: rgba(15,23,42,0.45);
  border-radius: 6px; padding: 0 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  opacity: 1; transition: opacity .7s;
  white-space: nowrap; overflow: hidden;
  flex: none; height: 16px; line-height: 16px; box-sizing: border-box; /* 📜 สูงเท่ากันทุกแถบ — ไอคอนในบรรทัดดันความสูงไม่ได้ */
  display: flex; align-items: center; gap: 6px;
}
#mini-log .ml-line .ml-t { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* ข้อความ — ยาวเกินตัดท้ายด้วย … */
#mini-log .ml-line .ml-r { flex: none; margin-left: auto; white-space: nowrap; }                                          /* ตัวเลข/จำนวน — ชิดขวาเสมอ */
#mini-log .ml-line img, #mini-log .ml-line svg { max-height: 14px; flex: none; }
#mini-log .ml-line.fade { opacity: 0; }
/* แถบสีซ้ายตามหมวดเหตุการณ์ (โทนเดียวกับ log ใหญ่) */
#mini-log .ml-mvp, #mini-log .ml-kill, #mini-log .ml-mon_atk, #mini-log .ml-dead { border-left: 3px solid #ef4444; }
#mini-log .ml-dodge, #mini-log .ml-level   { border-left: 3px solid #f59e0b; }
#mini-log .ml-heal, #mini-log .ml-loot     { border-left: 3px solid #22c55e; }
#mini-log .ml-combat                        { border-left: 3px solid #fb923c; }
#mini-log .ml-deliver, #mini-log .ml-premium { border-left: 3px solid #a855f7; }
#mini-log .ml-muted                         { border-left: 3px solid #94a3b8; }
.log-kill    { color: #dc2626; font-weight: bold; }
.log-levelup { color: #d97706; font-weight: bold; }
.log-heal    { color: #16a34a; }
.log-dead    { color: #991b1b; font-weight: bold; }
.log-retreat { color: #ea580c; }
.log-drop    { color: #7c3aed; }
.log-premium { color: #7c3aed; font-style: italic; padding-left: 8px; }
.log-default { color: #4b5563; }
.log-drone   { color: #7c3aed; font-weight: 500; }
.log-cat     { color: #d97706; font-weight: 500; }

/* ── Market ──────────────────────────────────────────────── */
.mkt-mode-sw { display:flex; gap:2px; background:#f4f5f7; border-radius:10px; padding:3px; margin-bottom:14px; }
.mkt-mode-sw button { flex:1; padding:6px 0; font-size:12px; border:none; background:transparent; color:#4b5563; cursor:pointer; border-radius:8px; transition:background .15s,color .15s; }
.mkt-mode-sw button.on { background:#2563eb; color:#fff; font-weight:500; }
.mkt-tabs { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:10px; }
.mkt-tab { font-size:11px; padding:4px 11px; border-radius:20px; border:1px solid #94a3b8; background:#f9fafb; color:#4b5563; cursor:pointer; white-space:nowrap; transition:background .15s,color .15s,border-color .15s; }
.mkt-tab.on { background:#2563eb; color:#fff; border-color:#2563eb; font-weight:500; }
.mkt-tab-lock { opacity:.45; cursor:default; background:#f6f6f7; color:#c4c4c8; }
.mkt-catbar { margin-bottom:10px; }
.mkt-cat-sel { width:100%; box-sizing:border-box; font-size:13px; padding:7px 10px; border-radius:8px; border:1px solid #d1d5db; background:#f9fafb; color:#111827; cursor:pointer; }
.mkt-cat-sel:focus { outline:none; border-color:#93c5fd; }
.mkt-inv-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; max-height:200px; overflow-y:auto; margin-bottom:10px; }
.mkt-mod-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; max-height:230px; overflow-y:auto; margin-bottom:10px; }
.mkt-icard { border:1.5px solid #94a3b8; border-bottom-width:3px; border-radius:9px; padding:8px 4px 6px; text-align:center; cursor:pointer; background:#fafafa; position:relative; transition:border-color .15s,transform .12s,box-shadow .12s; }
.mkt-icard:hover { border-color:#93c5fd; transform:translateY(-1px); box-shadow:0 3px 8px rgba(0,0,0,.07); }
.mkt-icard.sel { border-color:#2563eb; background:#eff6ff; }
.mkt-icard .ico { font-size:20px; display:block; }
.mkt-icard .nm  { font-size:9px; color:#4b5563; line-height:1.2; margin-top:2px; }
.mkt-icard .qt  { position:absolute; top:2px; right:4px; font-size:9px; font-weight:700; color:#111; }
.mkt-icard::after { content:''; position:absolute; top:5px; left:5px; width:7px; height:7px; border-radius:50%; background:#6b7280; }
.mkt-r-white  { border-bottom-color:#6b7280 !important; }
.mkt-r-green  { border-bottom-color:#22c55e !important; }
.mkt-r-blue   { border-bottom-color:#3b82f6 !important; }
.mkt-r-purple { border-bottom-color:#a855f7 !important; }
.mkt-r-gold   { border-bottom-color:#eab308 !important; }
.mkt-r-red    { border-bottom-color:#ef4444 !important; }
.mkt-r-green::after  { background:#22c55e; }
.mkt-r-blue::after   { background:#3b82f6; }
.mkt-r-purple::after { background:#a855f7; }
.mkt-r-gold::after   { background:#eab308; }
.mkt-r-red::after    { background:#ef4444; }
.mkt-legend { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:9px; background:#fafafa; border-radius:8px; padding:7px 8px; }
.mkt-legend .mkt-lg-t { font-size:10px; color:#6b7280; }
.mkt-lg { display:inline-flex; align-items:center; gap:3px; font-size:10px; color:#4b5563; }
.mkt-lg i { width:8px; height:8px; border-radius:50%; display:inline-block; }
.mkt-empty { text-align:center; padding:22px 12px; color:#4b5563; }
.mkt-empty .ei { font-size:34px; }
.mkt-empty .et { font-size:13px; font-weight:500; color:#374151; margin-top:6px; }
.mkt-empty .ed { font-size:11px; color:#6b7280; margin-top:2px; }
.mkt-detail { display:flex; gap:10px; background:#f9fafb; border-radius:8px; padding:10px; margin-bottom:10px; }
.mkt-detail .dico { font-size:30px; flex-shrink:0; }
.mkt-detail .dname { font-size:13px; font-weight:600; color:#111; }
.mkt-detail .ddesc { font-size:11px; color:#4b5563; margin-top:2px; }
.mkt-frow { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.mkt-frow label { font-size:12px; color:#4b5563; white-space:nowrap; min-width:70px; }
.mkt-frow input { flex:1; font-size:13px; padding:5px 8px; border-radius:6px; border:1px solid #d1d5db; background:#fff; }
.mkt-hint { font-size:10px; color:#4b5563; margin-bottom:8px; }
.mkt-net { display:flex; align-items:center; justify-content:space-between; background:#f0fdf4; border-radius:6px; padding:7px 10px; margin-bottom:10px; font-size:12px; color:#15803d; }
.mkt-net strong { font-size:14px; }
.mkt-crows { background:#f9fafb; border-radius:8px; padding:8px 10px; margin-bottom:10px; }
.mkt-crow { display:flex; justify-content:space-between; font-size:12px; padding:4px 0; border-bottom:1px solid #f3f4f6; }
.mkt-crow:last-child { border:none; }
.mkt-crow .cv { font-weight:600; }
.mkt-crow .cr { color:#dc2626; }
.mkt-crow .cg { color:#16a34a; }
.mkt-listing { display:flex; align-items:center; gap:8px; background:#f9fafb; border:1px solid #94a3b8; border-radius:8px; padding:8px 10px; margin-bottom:5px; cursor:pointer; }
.mkt-listing:hover { border-color:#93c5fd; background:#eff6ff; }
.mkt-listing .lico { font-size:22px; flex-shrink:0; }
.mkt-listing .lname { font-size:12px; font-weight:600; color:#111; }
.mkt-listing .lmeta { font-size:10px; color:#4b5563; }
.mkt-listing .lprice { text-align:right; margin-left:auto; }
.mkt-listing .lp { font-size:13px; font-weight:700; color:#b45309; }
.mkt-listing .lq { font-size:10px; color:#4b5563; }
.mkt-listings-wrap { max-height:260px; overflow-y:auto; }
.mkt-sbar { display:flex; gap:6px; margin-bottom:8px; }
.mkt-sbar input { flex:1; font-size:12px; padding:5px 8px; border-radius:6px; border:1px solid #d1d5db; background:#f9fafb; }
.mkt-gold { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:500; color:#92400e; background:#fffaf0; border:1px solid #fde9c8; border-radius:12px; padding:9px 12px; margin-bottom:12px; }
.mkt-note { font-size:10px; color:#4b5563; margin-bottom:8px; }
.mkt-big-ok { text-align:center; padding:14px 0 8px; }
.mkt-big-ok .oi { font-size:40px; }
.mkt-big-ok .ot { font-size:14px; font-weight:600; color:#111; margin-top:4px; }
.mkt-big-ok .od { font-size:11px; color:#4b5563; margin-top:2px; }
.mkt-recv { display:flex; gap:10px; align-items:center; background:#f0fdf4; border-radius:8px; padding:10px; margin:8px 0; }
.mkt-recv .rico { font-size:32px; }
.mkt-recv .rname { font-size:13px; font-weight:600; color:#111; }
.mkt-recv .rdesc { font-size:11px; color:#4b5563; margin-top:2px; }
.mkt-badge-ok { display:inline-block; font-size:10px; padding:2px 8px; border-radius:20px; background:#dcfce7; color:#15803d; margin-top:4px; }
.mkt-badge-list { display:inline-block; font-size:10px; padding:2px 8px; border-radius:20px; background:#eff6ff; color:#1d4ed8; margin-top:4px; }
.mkt-badge-new { display:inline-block; font-size:9px; padding:1px 6px; border-radius:20px; background:#fef3c7; color:#92400e; font-weight:600; vertical-align:middle; }
.mkt-banner-new { font-size:11px; background:#fef9c3; color:#854d0e; border:1px solid #fde047; border-radius:6px; padding:6px 10px; margin-bottom:8px; text-align:center; }
.mkt-banner-dup { font-size:11px; background:#f0f9ff; color:#0369a1; border:1px solid #bae6fd; border-radius:6px; padding:6px 10px; margin-bottom:8px; text-align:center; }
.mkt-my-row { display:flex; align-items:center; gap:8px; border:1px solid #94a3b8; border-radius:8px; padding:7px 10px; margin-bottom:5px; }
.mkt-my-row .mico { font-size:20px; flex-shrink:0; }
.mkt-my-row .minfo { flex:1; }
.mkt-my-row .mname { font-size:12px; font-weight:600; color:#111; }
.mkt-my-row .mmeta { font-size:10px; color:#4b5563; }
.mkt-btn-cancel { font-size:11px; padding:3px 8px; background:#fee2e2; color:#dc2626; border:1px solid #fca5a5; border-radius:6px; cursor:pointer; }
.mkt-hfilter { display:flex; gap:5px; padding:7px 10px; flex-wrap:wrap; border-bottom:1px solid #94a3b8; }
.mkt-hchip { font-size:10px; padding:2px 8px; border-radius:20px; border:1px solid #94a3b8; color:#4b5563; cursor:pointer; }
.mkt-hchip.on { background:#eff6ff; border-color:#93c5fd; color:#1d4ed8; }
.mkt-hday { font-size:10px; color:#4b5563; padding:6px 2px 2px; }
.mkt-hrow { display:flex; align-items:center; gap:8px; padding:7px 4px; border-bottom:1px solid #f3f4f6; }
.mkt-hico { font-size:20px; flex-shrink:0; width:26px; text-align:center; }
.mkt-hmid { flex:1; min-width:0; }
.mkt-hname { font-size:12px; font-weight:600; color:#111; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mkt-hmeta { font-size:10px; color:#4b5563; margin-top:1px; }
.mkt-hbadge { display:inline-block; font-size:9px; padding:1px 5px; border-radius:20px; font-weight:600; }
.mkt-hb-sell { background:#dbeafe; color:#1d4ed8; }
.mkt-hb-buy { background:#dcfce7; color:#15803d; }
.mkt-hb-cancel { background:#fee2e2; color:#dc2626; }
.mkt-hb-exp { background:#f3f4f6; color:#4b5563; }
.mkt-hright { text-align:right; flex-shrink:0; }
.mkt-hgc { font-size:12px; font-weight:600; }
.mkt-hgc.plus { color:#15803d; }
.mkt-hgc.minus { color:#dc2626; }
.mkt-hgc.neu { color:#4b5563; }
.mkt-hqty { font-size:10px; color:#4b5563; margin-top:1px; }
.mkt-hload { font-size:12px; color:#4b5563; padding:20px; text-align:center; }
.mkt-hsum { display:flex; justify-content:space-between; align-items:center; padding:7px 10px; border-top:1px solid #94a3b8; font-size:10px; color:#4b5563; margin-top:4px; }
.mkt-step-bar { display:flex; align-items:center; gap:0; margin-bottom:10px; }
.gd-root { padding:6px 0; }
.gd-chap { display:flex; align-items:center; gap:8px; padding:10px 14px; cursor:pointer; border-bottom:1px solid #f3f4f6; background:#fff; }
.gd-chap.on { background:#eff6ff; border-left:3px solid #3b82f6; padding-left:11px; }
.gd-chap-ico { font-size:18px; flex-shrink:0; }
.gd-chap-lbl { flex:1; font-size:13px; font-weight:600; color:#111; }
.gd-chap-arr { font-size:12px; color:#4b5563; }
.gd-items { background:#f8fafc; border-bottom:1px solid #94a3b8; }
.gd-item { padding:8px 16px; border-bottom:1px solid #f1f5f9; cursor:pointer; }
.gd-item:last-child { border-bottom:none; }
.gd-item.open { background:#fff; }
.gd-q { font-size:12px; font-weight:600; color:#1d4ed8; display:flex; align-items:center; gap:6px; }
.gd-arrow { font-size:10px; color:#60a5fa; flex-shrink:0; }
.gd-a { font-size:11px; color:#374151; line-height:1.6; margin-top:5px; padding-left:16px; }
.mkt-step-col { display:flex; flex-direction:column; align-items:center; flex:1; }
.mkt-sdot { width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:600; }
.mkt-sdot.done { background:#22c55e; color:#fff; }
.mkt-sdot.active { background:#2563eb; color:#fff; box-shadow:0 0 0 4px #dbeafe; }
.mkt-sdot.idle { background:#f3f4f6; color:#4b5563; border:1px solid #94a3b8; }
.mkt-sline { flex:1; height:1px; background:#94a3b8; margin-bottom:12px; }
.mkt-slabel { font-size:9px; color:#4b5563; margin-top:2px; white-space:nowrap; }

/* ── Market redesign (design A) — header/แท็บ/กริดกลุ่ม/drill-down/sheet วางขาย ── */
.mkt2-head { display:flex; align-items:center; gap:6px; margin-bottom:10px; }
.mkt2-gold { display:flex; align-items:center; gap:3px; font-size:12px; font-weight:700; color:#92400e; background:#fffaf0; border:1px solid #fde9c8; border-radius:16px; padding:6px 10px; white-space:nowrap; flex-shrink:0; }
.mkt2-search { flex:1; min-width:0; font-size:12px; padding:6px 9px; border-radius:8px; border:1px solid #e5e7eb; background:#f9fafb; }
.mkt2-search:focus { outline:none; border-color:#93c5fd; }
.mkt2-sellbtn { font-size:12px; font-weight:700; color:#fff; background:#16a34a; border:1px solid #15803d; border-radius:8px; padding:6px 10px; cursor:pointer; white-space:nowrap; flex-shrink:0; }
.mkt2-tabs { display:flex; gap:5px; margin-bottom:8px; }
.mkt2-tab { flex:1; position:relative; font-size:12px; padding:6px 0; border-radius:18px; border:1px solid #e5e7eb; background:#fff; color:#4b5563; cursor:pointer; transition:background .15s,color .15s,border-color .15s; }
.mkt2-tab.on { background:#0f766e; border-color:#0f766e; color:#fff; font-weight:600; }
.mkt2-badge { display:inline-flex; align-items:center; justify-content:center; min-width:15px; height:15px; margin-left:4px; padding:0 4px; border-radius:9px; background:#ef4444; color:#fff; font-size:9px; font-weight:700; }
.mkt2-chips { display:flex; gap:5px; overflow-x:auto; padding-bottom:4px; margin-bottom:6px; -webkit-overflow-scrolling:touch; }
.mkt2-chip { flex-shrink:0; font-size:11px; padding:4px 10px; border-radius:16px; border:1px solid #e5e7eb; background:#fff; color:#4b5563; cursor:pointer; white-space:nowrap; }
.mkt2-chip.on { background:#0f766e; border-color:#0f766e; color:#fff; font-weight:600; }
.mkt2-chip.lock { opacity:.45; cursor:default; }
.mkt2-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; max-height:300px; overflow-y:auto; }
.mkt2-gcard { background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:8px 5px 7px; text-align:center; cursor:pointer; transition:border-color .15s,box-shadow .12s; }
.mkt2-gcard:hover { border-color:#99f6e4; box-shadow:0 3px 8px rgba(0,0,0,.06); }
.mkt2-gcard.dim { opacity:.5; cursor:default; }
.mkt2-gcard .gi { font-size:20px; }
.mkt2-gcard .gn { font-size:10px; font-weight:600; color:#374151; line-height:1.25; margin-top:2px; min-height:25px; display:flex; align-items:center; justify-content:center; }
.mkt2-gcard .gm { font-size:9px; color:#6b7280; margin-top:1px; }
.mkt2-gcard .gp { font-size:11px; font-weight:700; color:#0f766e; margin-top:1px; }
.mkt2-loading { grid-column:1/-1; font-size:12px; color:#4b5563; padding:20px 8px; text-align:center; }
.mkt2-dethead { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.mkt2-dethead .ti { flex:1; min-width:0; font-size:13px; font-weight:600; color:#111; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mkt2-back { flex-shrink:0; font-size:12px; padding:4px 10px; border-radius:8px; border:1px solid #e5e7eb; background:#fff; color:#374151; cursor:pointer; }
.mkt2-rows { max-height:300px; overflow-y:auto; }
.mkt2-lrow { display:flex; align-items:center; gap:7px; background:#fff; border:1px solid #e5e7eb; border-radius:8px; padding:7px 9px; margin-bottom:5px; font-size:12px; }
.mkt2-lrow .q { font-weight:700; color:#374151; white-space:nowrap; }
.mkt2-lrow .p { font-weight:700; color:#0f766e; white-space:nowrap; }
.mkt2-lrow .p .pu { font-size:9px; color:#6b7280; font-weight:400; }
.mkt2-lrow .s { flex:1; min-width:0; font-size:10px; color:#6b7280; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:right; }
.mkt2-lrow .gi2 { font-size:18px; flex-shrink:0; }
.mkt2-lrow .nm2 { flex:1; min-width:0; font-size:11px; font-weight:600; color:#111; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mkt2-buybtn { flex-shrink:0; font-size:11px; font-weight:700; color:#fff; background:#16a34a; border:1px solid #15803d; border-radius:7px; padding:4px 12px; cursor:pointer; }
.mkt2-buybtn.w { display:block; width:100%; margin-top:4px; padding:4px 0; }
.mkt2-mgrid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; max-height:300px; overflow-y:auto; }
.mkt2-mcard { text-align:left; background:#fff; border:1px solid #e7e5e4; border-radius:0 8px 8px 0; padding:6px 7px; display:flex; flex-direction:column; }
/* margin-top:auto ที่ราคา = ดันบล็อกท้าย (ราคา→ผู้ขาย→ปุ่มซื้อ) ชิดล่างสุด → grid ยืดการ์ดสูงเท่ากัน ปุ่มซื้อทุกใบเลยตรงแถวกัน */
.mkt2-mcard .mprice { font-size:11px; font-weight:700; color:#0f766e; margin-top:auto; padding-top:3px; }
.mkt2-mcard .mseller { font-size:8px; color:#6b7280; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mkt2-sheet { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:10px; }
.mkt2-shead { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.mkt2-stitle { flex:1; font-size:13px; font-weight:700; color:#111; }
.mkt2-x { flex-shrink:0; font-size:12px; border:none; background:#f3f4f6; color:#4b5563; border-radius:50%; width:24px; height:24px; cursor:pointer; }
.mkt2-qbtn { flex-shrink:0; font-size:11px; font-weight:600; padding:5px 9px; border-radius:6px; border:1px solid #e5e7eb; background:#f9fafb; color:#374151; cursor:pointer; }
.mkt2-mhint { font-size:11px; color:#0f766e; background:#f0fdfa; border:1px solid #99f6e4; border-radius:6px; padding:6px 10px; margin-bottom:8px; }
.mkt2-confirm { display:flex; justify-content:center; align-items:center; gap:8px; width:100%; box-sizing:border-box; background:#ecfdf5; border:1px solid #34d399; border-radius:8px; padding:9px 10px; margin-top:6px; cursor:pointer; font-family:inherit; font-size:13px; font-weight:700; color:#065f46; }
.mkt2-confirm.buy { background:#16a34a; border-color:#15803d; color:#fff; }

/* ── Menu bar ────────────────────────────────────────────── */
.menu-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px;
  background: #fff;
  border-top: 1px solid #94a3b8;
  border-bottom: 1px solid #94a3b8;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 50;
}
.menu-bar-row {
  display: flex;
  gap: 4px;
  width: 100%;
}
.menu-icon-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  flex: 1;
  height: 54px;
  background: #f9fafb;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  padding: 4px 2px;
  cursor: pointer;
  font-family: inherit;
  min-width: 0;
  transition: background 0.15s;
}
.menu-icon-btn:hover, .menu-icon-btn.active { background: #eff6ff; border-color: #bfdbfe; }
.menu-icon-btn.menu-locked { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.menu-icon-emoji { font-size: 20px; }
.menu-icon-label { font-size: 10px; color: #374151; font-weight: bold; text-align: center; line-height: 1.05; max-width: 100%; } /* ป้ายยาว (Weapons / Shield) ตัดลง 2 บรรทัดเองเมื่อปุ่มแคบ */

/* ── Logout / Login button ───────────────────────────────── */
.logout-btn {
  width: 100%;
  padding: 10px 0;
  background: #dc2626;
  border: none;
  border-top: 1px solid #b91c1c;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
}
.logout-btn:hover { background: #b91c1c; }
.logout-btn.login-btn { color: #1d4ed8; font-weight: bold; font-size: 14px; background: #eff6ff; border-color: #bfdbfe; }

/* ── Popup overlay ───────────────────────────────────────── */
.panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 90;
}
.panel-overlay.open { display: block; }

/* ── Popup panels ────────────────────────────────────────── */
.panel-popup {
  display: none;
  position: fixed;
  left: 50%; bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 92vw; max-width: 480px;
  max-height: 70vh; max-height: 70dvh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
  z-index: 100;
  padding: 0 14px 20px;
  transition: transform 0.22s ease;
}
.panel-popup.open {
  display: block;
  transform: translateX(-50%) translateY(0);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 10px;
  font-size: 14px;
  font-weight: bold;
  color: #111827;
  border-bottom: 1px solid #94a3b8;
  margin-bottom: 10px;
  position: sticky; top: 0;
  background: #fff;
}
.popup-close {
  background: #f3f4f6;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.popup-close:hover { background: #94a3b8; }
.stat-help-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: #16a34a; color: #fff;
  border: none; font-size: 11px; font-weight: bold;
  cursor: pointer; margin-left: 6px; vertical-align: middle;
}
.stat-help-btn:active { transform: scale(0.9); }
#stat-help-box, #robot-help-box, #gun-help-box, #item-help-box, #house-help-box {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.8;
}
#stat-help-box  { background: #f0fdf4; border: 1px solid #bbf7d0; }
#robot-help-box { background: #eff6ff; border: 1px solid #bfdbfe; }
#gun-help-box   { background: #fff1f2; border: 1px solid #fecdd3; }
#item-help-box  { background: #faf5ff; border: 1px solid #e9d5ff; }
#house-help-box { background: #fff7ed; border: 1px solid #fed7aa; }
.stat-help-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #94a3b8;
}
.stat-help-row:last-child { border-bottom: none; }
.stat-help-icon { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; line-height: 1.6; }
.stat-help-text { flex: 1; }
.stat-help-name { font-size: 12px; font-weight: bold; color: #1f2937; }
.stat-help-desc { color: #4b5563; font-size: 11px; }

/* ── Skill panel ─────────────────────────────────────────── */
#skill-help-box { background: #fefce8; border: 1px solid #fde68a; }
.skill-sp-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--color-background-secondary);
  border: 0.5px solid #94a3b8;
  border-radius: var(--border-radius-md);
  padding: 8px 12px; margin-bottom: 14px;
}
.skill-sp-label { font-size: 12px; color: var(--color-text-secondary); }
.skill-sp-val   { font-size: 15px; font-weight: 500; color: var(--color-text-primary); }
.skill-tree-title {
  font-size: 11px; font-weight: 500; letter-spacing: .05em;
  color: var(--color-text-secondary); text-transform: uppercase;
  margin: 14px 0 6px; padding-left: 2px;
}
/* แต่ละสาย = กล่อง panel แยก (กรอบสีประจำสาย + แถบหัว + จำนวนสกิล) */
.skill-tree-panel {
  border: 0.5px solid #94a3b8;
  border-radius: var(--border-radius-md);
  margin-bottom: 14px; overflow: hidden;
}
.skill-tree-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border-left: 4px solid;
}
.skill-tree-head-label { font-size: 13px; font-weight: 500; }
.skill-tree-head-count { font-size: 12px; flex-shrink: 0; }
.skill-tree-cards { padding: 10px 10px 4px; }
.skill-card {
  display: flex; flex-direction: column; gap: 6px;
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}
.skill-card:last-child { margin-bottom: 2px; }
.skill-card.locked { opacity: .55; border-style: dashed; }
.skill-card.maxed  { border-color: #22c55e; box-shadow: 0 0 0 1px #22c55e33, 0 1px 3px rgba(15,23,42,0.08); }
.skill-top { display: flex; align-items: center; gap: 10px; }
.skill-ico  { font-size: 20px; width: 26px; text-align: center; flex-shrink: 0; }
.skill-mid  { flex: 1; min-width: 0; }
.skill-name { font-size: 13px; font-weight: 500; color: var(--color-text-primary); }
.skill-tag  {
  display: inline-block; font-size: 9px; padding: 1px 6px;
  border-radius: 99px; margin-left: 4px; vertical-align: middle; border: 0.5px solid;
}
.skill-sub  { font-size: 11px; color: var(--color-text-secondary); margin-top: 1px; }
.skill-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.skill-lv   { font-size: 10px; color: var(--color-text-secondary); }
.skill-up-btn {
  font-size: 11px; font-weight: 500; padding: 4px 0;
  width: 52px; min-width: 52px; text-align: center;
  border-radius: var(--border-radius-md); border: 0.5px solid;
  cursor: pointer; background: transparent;
}
.skill-auto-toggle {
  font-size: 10px; font-weight: 600; padding: 3px 0;
  width: 52px; min-width: 52px; text-align: center;
  border-radius: var(--border-radius-md); border: 0.5px solid;
  cursor: pointer;
}
.skill-auto-toggle.on  { background: #dcfce7; color: #166534; border-color: #86efac; }
.skill-auto-toggle.off { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.skill-dots { display: flex; gap: 2px; flex-wrap: wrap; max-width: 180px; }
.skill-dot  { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid; }
.skill-stat { font-size: 10px; padding: 2px 8px; border-radius: 99px; border: 0.5px solid; }
.skill-connector { width: 2px; height: 8px; margin-left: 15px; background: #94a3b8; }
.skill-use-btn {
  font-size: 10px; font-weight: 500; padding: 2px 9px;
  border-radius: 99px; border: 0.5px solid;
  cursor: pointer; background: transparent;
}
.skill-use-btn:active { transform: scale(0.95); }
.skill-req-badge {
  font-size: 10px; padding: 2px 8px; border-radius: var(--border-radius-md);
  background: #fef9c3; color: #854d0e; display: inline-block;
}

/* ── Gun rows (inside popup) ─────────────────────────────── */
.gun-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #94a3b8;
}
.gun-row.active { border-color: #16a34a; background: #f0fdf4; }
.gun-row.melee  { border-color: #dc2626; background: #fff5f5; }
.gun-row.melee.active { border-color: #b91c1c; background: #fee2e2; }
.gun-icon  { font-size: 20px; }
.gun-info  { flex: 1; }
.gun-name  { font-size: 12px; color: #111827; font-weight: bold; }
.gun-sub   { font-size: 10px; color: #4b5563; margin-top: 1px; }
.gun-lv    { font-size: 12px; color: #d97706; font-weight: bold; }
.gun-ammo  { font-size: 12px; color: #2563eb; font-weight: bold; }
.gun-upg {
  font-size: 10px;
  background: #ecfdf5; color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: 4px;
  padding: 5px 0;
  cursor: pointer;
  font-weight: bold;
  width: 54px;
  min-width: 54px;
  text-align: center;
  line-height: 1.5;
  flex-shrink: 0;
}
.gun-upg:hover { background: #d1fae5; }
.gun-upg.disabled-upg { background: #fef9c3; color: #a16207; border-color: #fde68a; cursor: not-allowed; opacity: 0.85; }

/* ── Treasure panel ─────────────────────────────────────── */
.treasure-panel { margin-top: 12px; border-top: 1px solid #94a3b8; padding-top: 10px; width: 100%; box-sizing: border-box; }
.treasure-header { font-size: 13px; font-weight: bold; color: #7c3aed; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.treasure-count { font-size: 11px; color: #4b5563; font-weight: normal; }
.treasure-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; box-sizing: border-box; }
.treasure-card {
  border-radius: 10px;
  padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 3px;
  min-height: 80px;
  justify-content: center;
}
.treasure-card.owned         { border: 1.5px solid #d1d5db; background: #f9fafb; }
.treasure-card.locked        { background: #f3f4f6; border: 1.5px solid #94a3b8; opacity: 0.55; }
/* rarity tiers */
.treasure-card.rarity-white  { background: #f9fafb;  border-color: #d1d5db; }
.treasure-card.rarity-green  { background: #f0fdf4;  border-color: #4ade80; }
.treasure-card.rarity-blue   { background: #eff6ff;  border-color: #60a5fa; }
.treasure-card.rarity-purple { background: #faf5ff;  border-color: #a78bfa; }
.treasure-card.rarity-gold   { background: #fffbeb;  border-color: #fbbf24; }
.treasure-card.rarity-red    { background: #fff1f2;  border-color: #f87171; }
/* qty badge */
.treasure-card { position: relative; }
.tc-qty {
  position: absolute; top: 3px; right: 4px;
  font-size: 9px; font-weight: bold; color: #fff;
  background: #374151; border-radius: 8px;
  padding: 0px 4px; line-height: 14px;
  pointer-events: none;
}
/* rarity label dot */
.tc-rarity { width: 7px; height: 7px; border-radius: 50%; margin-bottom: 1px; }
.rarity-white  .tc-rarity { background: #6b7280; }
.rarity-green  .tc-rarity { background: #22c55e; }
.rarity-blue   .tc-rarity { background: #3b82f6; }
.rarity-purple .tc-rarity { background: #a855f7; }
.rarity-gold   .tc-rarity { background: #f59e0b; }
.rarity-red    .tc-rarity { background: #ef4444; }
.tc-icon  { font-size: 22px; line-height: 1; }
.tc-name  { font-size: 9px; font-weight: bold; color: #4b5563; line-height: 1.25; word-break: break-word; }
.tc-desc  { font-size: 9px; color: #4b5563; font-weight: bold; line-height: 1.2; }
.rarity-green  .tc-desc { color: #15803d; }
.rarity-blue   .tc-desc { color: #1d4ed8; }
.rarity-purple .tc-desc { color: #7c3aed; }
.rarity-gold   .tc-desc { color: #b45309; }
.rarity-red    .tc-desc { color: #dc2626; }
.treasure-card.locked .tc-name { color: #6b7280; font-weight: normal; }
.treasure-card.locked .tc-icon { font-size: 20px; opacity: 0.6; }

/* ── Item panel ──────────────────────────────────────────── */
.item-slots { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.item-slot {
  width: 54px; height: 54px;
  background: #f9fafb;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 22px;
  position: relative;
}
.item-qty {
  position: absolute;
  bottom: 3px; right: 4px;
  font-size: 10px; color: #d97706; font-weight: bold;
}
.action-row { display: flex; gap: 8px; }
.abtn {
  flex: 1; padding: 10px 0;
  font-size: 12px; border: none; border-radius: 8px;
  cursor: pointer; font-family: inherit; font-weight: bold;
}
.abtn.red  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.abtn.blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.abtn:hover { filter: brightness(0.95); }

/* ── Stat panel ──────────────────────────────────────────── */
#stat-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* minmax(0,…) = คอลัมน์หดได้ ไม่ถูกเนื้อหาดันจนล้นจอ (2026-10-06 ปุ่ม ALL ตกขอบบนมือถือ) */
  gap: 6px;
}
.stat-row {
  display: flex; align-items: center; gap: 3px; min-width: 0;
  background: #f9fafb; border: 1px solid #94a3b8;
  border-radius: 6px; padding: 6px 6px;
}
.stat-name { font-size: 11px; color: #4b5563; min-width: 22px; font-weight: bold; flex-shrink: 0; }
.stat-bar-wrap { flex: 1; height: 4px; background: #94a3b8; border-radius: 2px; overflow: hidden; min-width: 0; }
.stat-bar { height: 100%; border-radius: 2px; transition: width .3s; }
.stat-val { font-size: 11px; color: #111827; min-width: 18px; text-align: right; font-weight: bold; flex-shrink: 0; margin-left: auto; }
.stat-up {
  font-size: 11px; background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe; border-radius: 3px;
  width: 20px; height: 20px; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-weight: bold;
}
.stat-up5 {
  font-size: 10px; background: #eef2ff; color: #4338ca;
  border: 1px solid #c7d2fe; border-radius: 3px;
  width: 25px; height: 20px; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-weight: bold;
}
.stat-up:hover  { background: #dbeafe; }
.stat-up5:hover { background: #e0e7ff; }
.stat-up:disabled, .stat-up5:disabled { opacity: .3; cursor: default; }

/* ── Login overlay (demo mode) ───────────────────────────── */
#login-overlay {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 16px 16px 20px;
  background: rgba(15,23,42,0.92);
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 200;
}
.login-overlay-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 40px;
  font-size: 15px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: .04em;
  width: 100%;
  max-width: 360px;
}
.login-overlay-btn:hover { background: #1d4ed8; }
.login-label {
  color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 10px; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.login-btn-row { display: flex; gap: 12px; justify-content: center; }
.login-provider-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 80px; height: 72px;
  background: #fff; color: #333; border: none; border-radius: 14px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.login-provider-btn:hover { background: #f0f0f0; }
.login-provider-btn.google-btn { background: #fff; }

.pts-badge {
  position: absolute; top: -4px; right: -8px;
  background: #2563eb; color: #fff;
  border-radius: 8px; padding: 1px 5px; font-size: 9px;
  font-weight: bold; line-height: 1.4;
  pointer-events: none;
}

/* ── House panel ─────────────────────────────────────────── */
.abtn.green { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.abtn.grey  { background: #f1f5f9; color: #475569; border: 1px solid #94a3b8; cursor:not-allowed; }
.hp-note { font-size: 11px; color: #475569; text-align: center; padding: 20px 0; }
.house-info { background: #f8fafc; border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.house-lv-row  { font-size: 15px; font-weight: bold; color: #fbbf24; margin-bottom: 6px; }
.house-prod-row, .house-stored-row, .house-res-row {
  font-size: 11px; color: #475569; margin-bottom: 4px; line-height: 1.6;
}
.house-upgrade-row {
  display: flex; align-items: center; gap: 8px;
  background: #f1f5f9; border-radius: 8px; padding: 8px 10px;
}
.upgrade-cost { flex: 1; font-size: 11px; color: #334155; line-height: 1.6; }

/* ── Leaderboard panel ───────────────────────────────────── */
.rank-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 0 10px; } /* 🧹 แท็บ 3 × 2 — ป้ายไม่ถูกตัด (docs/rank-mvp-tab-tidy-design.md) */
.rank-tab { /* ไอคอนซ้าย + ข้อความขวา · ทุกปุ่มกว้าง/สูงเท่ากัน · ข้อความยาวขึ้น 2 บรรทัดได้ */
  min-width: 0; height: 34px; padding: 0 5px;
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid #94a3b8; border-radius: 9px;
  cursor: pointer; background: #f8fafc; color: #475569; line-height: 1.1;
}
.rank-tab .rt-ico { flex: 0 0 auto; font-size: 14px; line-height: 1; }
.rank-tab .rt-txt {
  min-width: 0; font-size: 11.5px; font-weight: 600; text-align: left;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.rank-tab.active { background: #1D9E75; border-color: #1D9E75; color: #fff; }
.rank-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 9px 10px; background: #fff;
  border: 1px solid #cbd5e1; border-radius: 12px; margin-bottom: 7px;
}
.rank-row.me { background: #E1F5EE; border-color: #5DCAA5; }
.rank-top { display: flex; align-items: center; gap: 8px; }
.rank-num {
  font-size: 14px; font-weight: 700; color: #475569;
  min-width: 24px; text-align: center; flex: none;
}
.rank-name {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 700; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-row.me .rank-name { color: #085041; }
.rank-score { text-align: right; flex: none; }
.rank-score-val { font-size: 14px; font-weight: 700; color: #1e293b; font-variant-numeric: tabular-nums; }
.rank-row.me .rank-score-val { color: #0F6E56; }
.rank-score-label { font-size: 10px; color: #475569; }

/* ── แถวล่าง: ตัวละคร (ซ้าย ~ครึ่งความกว้าง) + ของวิเศษ 6 อย่าง (ขวา) ── */
.rank-body { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
/* ── ตัวละคร 4 ตัว (กรอบเท่ากันเสมอ · ~50% ของเดิม) ── */
.rank-cast { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 150px; flex: 0 0 150px; } /* ย่อจาก 184px → เปิดที่ให้ chip โชว์ xx/yy เต็ม (2026-07-15) */
.rank-chips { flex: 1 1 150px; min-width: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; align-content: flex-start; } /* grid 3 คอลัมน์เท่ากัน — chip กว้างเท่ากันหมด ไม่เบี้ยว */
.rank-chip { font-size: 8.5px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 999px; padding: 2px 3px; color: #475569; white-space: nowrap; text-align: center; overflow: hidden; } /* ตัด ellipsis — ย่อรูป+ฟอนต์แล้ว xx/yy พอดี ไม่ต้องตัด */
.rank-chip span { color: #1e293b; font-weight: 600; }
.rank-row.me .rank-chip { background: #c6f0e2; border-color: #5DCAA5; }
.rank-row.me .rank-chip span { color: #085041; }
.rank-toon { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.rank-frame {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border-radius: 10px; border: 1.5px solid #d7dee6;
  background: linear-gradient(180deg, #f3f7f4, #ffffff);
  display: flex; align-items: flex-end; justify-content: center; overflow: hidden;
}
.rank-frame img {
  max-width: 86%; max-height: 88%; object-fit: contain;
  image-rendering: pixelated; margin-bottom: 5%;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.2));
}
.rank-emoji { font-size: 17px; margin-bottom: 8%; }
.rank-cap { font-size: 8px; font-weight: 700; color: #64748b; line-height: 1.15; text-align: center; width: 100%; word-break: break-word; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rank-toon.prem .rank-frame, .rank-toon.mvp .rank-frame {
  border: 2px solid transparent;
  background: linear-gradient(#fff,#fff) padding-box,
              linear-gradient(135deg, #f6c945, #e0a400, #b8860b) border-box;
  box-shadow: 0 0 0 1px rgba(224,164,0,.25), 0 2px 8px rgba(224,164,0,.3);
}
.rank-toon.prem .rank-cap, .rank-toon.mvp .rank-cap { color: #c8890a; }
.rank-star { position: absolute; top: -5px; right: 2px; font-size: 11px; z-index: 2; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.rank-toon.empty .rank-frame { border-style: dashed; opacity: .55; }
/* 🏺🦅 สัตว์เทพที่ปลุกแล้ว (2026-09-29) — กรอบม่วงพื้นเข้มเข้ากับไอคอน · ป้ายมุม = ระดับ E→S (S ทอง) */
.rank-toon.dv .rank-frame { border: 2px solid #7c3aed; background: #1e293b; align-items: center; }
.rank-toon.dv .rank-frame img { max-width: 100%; max-height: 100%; margin-bottom: 0; image-rendering: auto; filter: none; }
.rank-toon.dv .rank-cap { color: #6d28d9; }
.rank-grade { top: -6px; right: 0; font-size: 8.5px; font-weight: 800; line-height: 13px; padding: 0 4px; border-radius: 6px; color: #fff; background: #64748b; }
.rank-grade.g1, .rank-grade.g2 { background: #0ea5e9; }
.rank-grade.g3, .rank-grade.g4 { background: #7c3aed; }
.rank-grade.g5 { background: linear-gradient(135deg, #f6c945, #e0a400); }
.rank-toon.empty .rank-dash { color: #94a3b8; font-size: 15px; margin-bottom: 12%; }
/* 🧹 แถวอันดับผู้เล่น / ผู้เล่นใหม่ จัดระเบียบ (2026-10-02 · รูปแบบเดียวกับการ์ดแท็บ MVP): หัวการ์ดเป็นแถบ → ตัวละครแถวเดียว 6 ช่องเท่ากัน → ค่าความชำนาญ/ของสะสม → ปุ่ม
   ใช้คลาส .pl กำกับ — แท็บประเทศ/ประลองที่ใช้ .rank-row ร่วมกันไม่ถูกกระทบ */
.rank-row.pl { padding: 0; gap: 0; overflow: hidden; }
.rank-row.pl .rank-top { padding: 7px 10px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.rank-row.pl.me .rank-top { background: #d3efe5; border-bottom-color: #5DCAA5; }
.rank-row.pl .rank-name { display: flex; align-items: center; gap: 4px; overflow: visible; }
.rank-row.pl .rank-name > b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank-row.pl .rank-name > * { flex: none; }
.rank-row.pl .rank-name > b { flex: 0 1 auto; }
.rank-row.pl .rank-sub { font-size: 9.5px; line-height: 1.3; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row.pl .rank-body { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; padding: 9px 10px 9px; }
.rank-row.pl .rank-cast { width: auto; flex: none; grid-template-columns: repeat(6, minmax(0, 54px)); gap: 6px; }
.rank-row.pl .rank-stats { border-top: 1px solid #eef2f7; padding-top: 8px; }
.rank-frame .rank-art { width: 90%; height: 90%; margin-bottom: 3%; } /* 🎨 ภาพมอนวาดใหม่ (inline SVG) ในกรอบตัวละคร */
.rank-loading { text-align: center; color: #475569; padding: 20px; font-size: 13px; }
.rank-divider { height: 1px; background: #94a3b8; margin: 10px 0; }
.rank-footer { text-align: center; font-size: 11px; color: #475569; padding-top: 4px; }

/* ⏳🔨 ป้ายนับถอยหลังใกล้ปิดประมูล — กะพริบเฉพาะนาทีสุดท้าย (docs/auction-countdown-design.md) */
@keyframes xhAucBlink { 50% { opacity: .25 } }
/* 🎁 เควสรับได้ — กล่องของขวัญเด้งบนแถบบันได (เจ้าของสั่ง 2026-08-31 แทนปุ่ม 'กดรับ' ที่ยาวไป) */
@keyframes xhQGift { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }

/* ── 🎓👉 ทัวร์สอนเล่น (docs/onboarding-guided-tour.md · เจ้าของเคาะ 2026-08-28) ───────────
   🛡️ ทุกกฎที่แตะของเดิมอยู่ใต้ body.onb-tour เท่านั้น — คลาสนี้ถูกถอดทุกทางออกของทัวร์
      ⇒ ผู้เล่นเก่า/การเล่นปกติ ไม่กระทบแม้แต่พิกเซลเดียว */
body.onb-tour .panel-popup {
  bottom: var(--onb-menu-h, 126px);   /* ดันแผงขึ้นเหนือแถบเมนู — ไม่งั้นแผงทับปุ่มที่กำลังชี้อยู่ */
  max-height: 46vh;
  transition: none;                   /* ไม่สไลด์ระหว่างทัวร์ (กรอบ/ป้ายจะตามตำแหน่งไม่ทัน) */
}
/* 🛡️🔧 Equipment เป็นแผงเต็มจอ (ตระกูล B) — ระหว่างทัวร์ดันลงล่าง+ย่อ เพื่อเว้นที่บนให้ป้ายอธิบาย */
body.onb-tour #eq2-panel { align-items: flex-end; padding-bottom: 14px; }
body.onb-tour #eq2-panel > div { max-height: 62vh; }

/* ช่องเจาะ: ตัวกล่องใสวางทับปุ่มพอดี · เงาลามคลุมทั้งจอ = ส่วนที่หรี่ (ปุ่มจึงสว่างอยู่ตัวเดียว)
   z 95 = เหนือแถบเมนู (50) แต่ต่ำกว่าแผง (100) ⇒ แผงไม่โดนหรี่  🚨 ห้ามขยับเลขนี้
   pointer-events:none — การกดทั้งหมดคุมที่ #onb-mask ชั้นเดียว */
#onb-dim {
  position: fixed; z-index: 95; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.72);
  outline: 3px solid #a78bfa; outline-offset: 2px;
  animation: onbPulse 1.15s ease-in-out infinite;
}
@keyframes onbPulse { 0%,100% { outline-color:#a78bfa; } 50% { outline-color:#f9a8d4; } }
/* กันกดทุกอย่าง (มติข้อ 3 ก) — เดินทัวร์ด้วยปุ่มบนป้ายเท่านั้น · สูงกว่าแผงเต็มจอ (9998) */
#onb-mask { position: fixed; inset: 0; z-index: 10004; background: transparent; }
#onb-tip  { position: fixed; z-index: 10005; }

/* 🎓 ผู้เล่นใหม่มีปุ่ม "วิธีเล่น" งอกเหนือ AUTO ON → ดัน D-pad ขึ้นให้พ้น (ไม่งั้นทับกันตอน AUTO OFF)
   คลาสถูกถอดเองเมื่อถึง Lv. ONB_BTN_MAX_LV ⇒ ผู้เล่นเก่าเห็นเลย์เอาต์เดิมทุกพิกเซล */
body.onb-quick .dpad-overlay { bottom: 110px; }
/* ⚠️ ปุ่มนี้เป็นปุ่มเดียวในแถวที่ "ข้อความมาจากคำแปล" (ปุ่มอื่นเป็น AUTO/LOCK/300m ภาษาอังกฤษตายตัว)
   .bot-toggle-btn กว้าง 84px ตายตัวและไม่มี nowrap → ภาษาที่ป้ายยาว (en "How to play" ~69px ·
   es/pt "Cómo jugar"/"Como jogar" ~68px) เหลือที่ว่างแค่ ~15px ถ้าฟอนต์อีโมจิกว้างกว่าปกติจะตัดเป็น 2 บรรทัด
   ⇒ ปุ่มสูงขึ้น ชุดปุ่มยืด แล้ว D-pad ที่ตั้ง bottom ไว้ข้างบนจะทับกันทันที
   กันด้วย nowrap + ย่อฟอนต์นิดเดียว **เฉพาะปุ่มนี้** (ปุ่มพี่น้องในคลาสเดียวกันไม่โดนแตะ) */
#onb-quick-btn { white-space: nowrap; font-size: 9.5px; }

/* ── 🖥️ โหมดจอกว้างบน PC (docs/pc-wide-layout-design.md ระดับ 1 · เจ้าของเคาะ 2026-09-22) ──
   body.wide ตั้งโดย JS (_wideApply ใน resizeCanvas): auto เมื่อจอ ≥900px และไม่ใช่จอสัมผัส · ปุ่ม ⛶ สลับ (จำใน localStorage)
   หลักการ: ปลดคอลัมน์ 480 → status/menu เรียงแถวเดียวเต็มกว้าง · popup ย้ายมากลางจอ · minimap ใหญ่ขึ้น · ไม่มี layout ชุดที่ 2 (DOM เดิมทั้งหมด) */
.wide-only { display: none !important; }
@media (min-width: 900px) { .wide-only { display: flex !important; } }
/* 🖥️ ปุ่มโหมดจอกว้าง ⛶ แสดงตลอดบน PC (เจ้าของ 2026-10-07 "แสดงกรอบไว้ทางด้านเมนูซ้ายตลอดเวลา ไว้เปิดเมื่อไหร่ก็ได้ปิดเมื่อไหร่ก็ได้" + "เฉพาะ PC")
   เดิมถูกซ่อนเมื่อเปิดเมนูตั้งค่า (body.set-menu) และเมื่อพับแผงซ้าย (body.ui-hide-l) · PC = จอ ≥900px + เมาส์ · ลบบล็อกนี้ = กลับไปซ่อนตามเดิม */
@media (min-width: 900px) and (pointer: fine) {
  body.set-menu #wide-btn, body.ui-hide-l .zoom-btns > #wide-btn { display: flex !important; }
}
body.wide #game-screen, body.wide #logout-screen { max-width: none; }
body.wide .status-panel { flex-direction: row; align-items: center; gap: 18px; min-height: 0; max-height: none; padding: 6px 16px; }
body.wide .status-row1 { flex: 0 0 auto; }
body.wide .sp-badge.zone { max-width: 260px; }
body.wide .status-row2 { flex: 1 1 auto; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 3px 14px; }
body.wide .status-row3 { flex: 0 0 auto; gap: 8px; }
body.wide .menu-bar { flex-direction: row; justify-content: center; align-items: center; gap: 6px; padding: 5px 10px; }
body.wide .menu-bar-row { width: auto; gap: 6px; }
body.wide .menu-icon-btn { flex: 0 0 78px; }
body.wide .logout-btn { width: auto; padding: 10px 18px; margin-left: 14px; border-radius: 8px; border-top: none; }
body.wide #minimapCanvas { width: 160px; height: 160px; }
/* 🖥️ ปุ่มใต้มินิแมพเลื่อน/ขยายตามมินิแมพ 160 (เจ้าของ 2026-09-25 "ปุ่มมันทับ mini map") — top = 5 + 160 + 4 แล้วเว้น 27 ทีละปุ่มเหมือนโหมดแคบ
   !important เพราะตำแหน่งเดิมเป็น inline style ใน index.php · ⚠️ ขยายมินิแมพอีกเมื่อไรต้องเลื่อนชุดนี้ + .ui-tab-r ตาม */
body.wide #offline-btn { top: 169px !important; width: 160px !important; }
body.wide #gacha-btn   { top: 196px !important; width: 160px !important; }
body.wide #quest-btn   { top: 223px !important; width: 160px !important; }
/* 🌙 ซ่อนปุ่ม OFFLINE (เจ้าของ 2026-10-07 · js: OFFLINE_BTN_ON) — ปุ่ม G / QUEST เลื่อนขึ้นมาแทนที่ ไม่เหลือช่องว่าง */
body.no-off-btn #offline-btn { display: none !important; }
body.no-off-btn #gacha-btn { top: 93px !important; }
body.no-off-btn #quest-btn { top: 120px !important; }
body.wide.no-off-btn #gacha-btn { top: 169px !important; }
body.wide.no-off-btn #quest-btn { top: 196px !important; }
body.wide .panel-popup { top: 50%; bottom: auto; max-height: 86vh; max-height: 86dvh; border-radius: 14px; transform: translate(-50%, -50%) scale(.97); }
body.wide .panel-popup.open { transform: translate(-50%, -50%) scale(1); }
/* 🖥️📱 iPad แนวนอน (2026-09-22 เจ้าของ: "เมนูด้านล่างเพี้ยน" — Safari วาดปุ่มกว้างกว่า 78px จนแถว 2 ล้นทับ Log out)
   กติกา: แถวห้ามหด (flex-shrink 0) · ปุ่มล็อกกว้างตายตัว ป้ายยาวตัดด้วย … · ไม่พอจริง ๆ ให้ Log out ตกบรรทัดใหม่ แทนการซ้อนทับ */
body.wide .menu-bar { flex-wrap: wrap; row-gap: 4px; }
body.wide .menu-bar-row { flex: 0 0 auto; }
body.wide .menu-icon-btn { flex: 0 0 78px; width: 78px; min-width: 0; max-width: 78px; overflow: hidden; }
body.wide .menu-icon-btn .menu-icon-label { display: block; max-width: 100%; white-space: normal; overflow: hidden; } /* เดิมบรรทัดเดียวตัด … — ป้ายยาวให้ลง 2 บรรทัดแทน */
body.wide .logout-btn { flex: 0 0 auto; }
@media (max-width: 1199px) {
  body.wide .menu-bar-row { gap: 4px; }
  body.wide .menu-icon-btn { flex-basis: 70px; width: 70px; max-width: 70px; }
  body.wide .logout-btn { margin-left: 8px; padding: 8px 12px; }
}

/* ── 🙈 ซ่อน/แสดงกลุ่ม UI 4 ด้าน (docs/ui-hide-groups-design.md · เจ้าของเคาะ 2026-09-23) ──
   class ที่ body: ui-hide-t (บน เหลือ HP+Shield) · ui-hide-l (ซ้าย เหลือ ＋－) · ui-hide-r (มินิแมพ+OFFLINE/G/QUEST) · ui-hide-b (เมนูล่าง+Log out)
   แท็บ .ui-tab อยู่ใน .map-wrap ตำแหน่งคงที่ทั้งเปิด/ปิด — JS สลับ class + ลูกศร + resizeCanvas (js: uiTab/_uiHideApply) */
.ui-tab { position: absolute; width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px; background: rgba(15,23,42,.55); color: #fff; font-size: 11px; line-height: 22px; text-align: center; z-index: 12; cursor: pointer; -webkit-tap-highlight-color: transparent; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.ui-tab:active { background: rgba(15,23,42,.85); }
.ui-tab-t { top: 2px; left: 50%; transform: translateX(-50%); }
.ui-tab-all { top: 2px; left: calc(50% + 16px); font-size: 12px; } /* 👁🙈 เปิด/ซ่อนทุกด้าน — ติดขวาแท็บบน (แท็บบนกว้าง 22 · เว้น 5px) */
.ui-tab-m { top: 2px; left: calc(50% + 43px); font-size: 12px; font-weight: 800; } /* 🅼 ภาพในสนาม ใหม่ ↔ เดิม — ติดขวาปุ่ม 👁 (22 + เว้น 5) */
.ui-tab-m.on, .ui-tab-m.on:active { background: #16a34a; }                            /* เปิดอยู่ = เขียวทึบ (ไม่มีแสงฟุ้ง) */
.ui-tab-l { left: 6px; top: calc(50% + 138px); }              /* ใต้คอลัมน์ .zoom-btns (กลางจอ ±135px) — ด้านบนชนกลุ่ม FB/📖/🧲 */
.ui-tab-r { right: 5px; top: 174px; }                          /* ใต้ปุ่ม QUEST (top 147 + สูง 24 + 3) */
body.wide .ui-tab-r { top: 250px; }                              /* 🖥️ โหมดกว้าง: ใต้ QUEST ที่เลื่อนลง (223 + 24 + 3) */
.ui-tab-b { right: 96px; bottom: 6px; }                        /* ช่องว่างระหว่าง BOSS กับปุ่มสังหาร (AUTO ON กว้าง 84 + right 5) — กลางล่างชน Select destination */
body.wide .ui-tab-b { right: auto; left: 50%; transform: translateX(-50%); } /* โหมดกว้าง กลางล่างว่าง */
.ui-tab.dot::after { content: ''; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; border: 1.5px solid #fff; } /* 🔴 กลุ่มที่ซ่อนมีป้ายค้าง */
body.ui-hide-t .status-row3 { display: none; }
/* 🙈 แผงบนย่อ: แถว 1 เหลือแค่ป้าย Lv (เจ้าของ 2026-09-24 "ตอนปิดให้แสดง LV.xx ด้วย") วางซ้ายของแถบ HP/Shield บรรทัดเดียวกัน */
body.ui-hide-t .status-row1 > :not(#hud-lv) { display: none; }
body.ui-hide-t .status-row1 { flex: 0 0 auto; }
body.ui-hide-t .status-row2 .sp-bar-wrap:nth-child(2), body.ui-hide-t .status-row2 .sp-bar-wrap:nth-child(4) { display: none; } /* MP · EXP — เหลือ HP + Shield */
body.ui-hide-t .status-panel { min-height: 0; padding: 4px 10px; flex-direction: row; align-items: center; gap: 8px; }
body.ui-hide-t .status-row2 { flex: 1 1 auto; min-width: 0; }
body.ui-hide-l .zoom-btns > :not(.zoom-keep) { display: none; }  /* เหลือ ＋ － */
body.ui-hide-r #minimapCanvas, body.ui-hide-r #offline-btn, body.ui-hide-r #gacha-btn, body.ui-hide-r #quest-btn { display: none; }
body.ui-hide-b .menu-bar { display: none; }
/* 🙈 ซ่อนเมนูล่าง = เหลือแค่ ⏱️ สกิล · 🗺️ Select destination · 🏟️ BOSS · ⚔️ DMG/sec (เจ้าของ 2026-09-28) — ปุ่มล่างที่เหลือหายหมด · !important ชนะ display ที่ JS ตั้งตรง ๆ
   🏟️ ปุ่ม BOSS แสดงเสมอข้าง Select destination (เจ้าของ 2026-10-05 "ปุ่ม boss ให้แสดงเสมอข้าง select destination") — ถอดออกจากรายการซ่อน */
body.ui-hide-b .mlog-row, body.ui-hide-b #boss-btns, body.ui-hide-b #pvp-btn,
body.ui-hide-b #onb-quick-btn, body.ui-hide-b #bot-toggle-btn, body.ui-hide-b #lock-btn { display: none !important; }
/* 🚩📢 ชิปขวา (ธง · แจ้งล่วงหน้า) ซ่อนตามแผงขวา (เจ้าของ 2026-09-29 · เดิม 📢 ซ่อนตามแผงบน) · 🎉 ตัวคูณคุมด้วย JS _evPillSync (ปิดแผงขวา = โผล่แวบแล้วจาง) */
body.ui-hide-r #gw-flag-banner, body.ui-hide-r #cw-flag-banner, body.ui-hide-r #evn-chip { display: none !important; }
/* 🙈 ซ่อนแผงบน = ปุ่มลอยมุมซ้ายบนหายหมด เหลือแค่ป้าย Online (เจ้าของ 2026-09-28) — !important ชนะ display ที่ JS ตั้งตรง ๆ (ลิงก์ LINE ฯลฯ) */
body.ui-hide-t .tl-float #fb-link, body.ui-hide-t .tl-float #line-group-link, body.ui-hide-t .tl-float #line-add-link, body.ui-hide-t .tl-float .tl-row2 { display: none !important; }

/* ── ⏱️ แถบคูลดาวน์สกิล (docs/skill-cooldown-bar-design.md · 2026-09-23) — ช่องละสกิล · .cd = กำลังคูลดาวน์ (วงมืดกวาดตามเข็ม --p = สัดส่วนที่ผ่านไป · เลขวินาทีกลางช่อง) · .rdy = แว่บเขียวตอนพร้อม ── */
.skill-cd-bar { display: flex; flex-wrap: wrap-reverse; gap: 3px; max-width: 240px; margin-bottom: 1px; } /* wrap-reverse = แถวแรกอยู่ล่างชิดปุ่ม LOG ล้นแล้วค่อยงอกแถวบน (เจ้าของสั่ง 2026-09-23 "บรรทัดล่างแสดงก่อน") */
.skill-cd-bar:empty { display: none; }
.skcd { position: relative; width: 32px; height: 32px; border-radius: 8px; background: rgba(15,23,42,.72); border: 1px solid rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.skcd-ic { font-size: 17px; line-height: 1; }
.skcd-sw, .skcd-t { position: absolute; inset: 0; display: none; }
.skcd-sw { border-radius: 8px; background: conic-gradient(#fde047 0 calc(var(--p, 0) * 1turn), rgba(255,255,255,.14) calc(var(--p, 0) * 1turn) 1turn); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); } /* 🔁 วงแหวนเหลืองบาง 3px กวาดตามเข็มที่ขอบ — ไม่ทับไอคอน (เจ้าของ 2026-09-23 "เทาดำมองไม่เห็น" → ไอคอนสว่างปกติ) */
.skcd-t { inset: auto 1px 1px auto; align-items: center; justify-content: center; font: 700 9.5px/1.3 Consolas, monospace; color: #fde047; background: rgba(0,0,0,.72); padding: 0 3px; border-radius: 4px; text-shadow: 0 0 2px #000; } /* เลขวินาที ป้ายเล็กมุมขวาล่าง */
.skcd.cd { border-color: #fbbf24aa; }
.skcd.cd .skcd-sw, .skcd.cd .skcd-t { display: flex; }
.skcd.rdy { animation: skcdRdy .28s ease-out; }
@keyframes skcdRdy { 0% { box-shadow: 0 0 0 2px #34d399, 0 0 8px #34d399; transform: scale(1.15); } 100% { box-shadow: 0 1px 3px rgba(0,0,0,.35); transform: scale(1); } }
body.wide .skcd { width: 38px; height: 38px; }
body.wide .skcd-ic { font-size: 20px; }
body.wide .skcd-t { font-size: 12.5px; }
/* ✨ แท็บเมนูล่างกระพริบ (ซ่อนอยู่ + ยังไม่เคยเปิด/มีแต้ม STAT ค้าง · 2026-09-24) */
.ui-tab.blink { animation: uiTabBlink 1.1s ease-in-out infinite; }
@keyframes uiTabBlink { 0%, 100% { background: rgba(15,23,42,.55); transform: scale(1); box-shadow: 0 1px 3px rgba(0,0,0,.3); } 50% { background: #f59e0b; transform: scale(1.18); box-shadow: 0 0 0 3px rgba(245,158,11,.35); } }
body.wide .ui-tab-b.blink { animation-name: uiTabBlinkW; }
@keyframes uiTabBlinkW { 0%, 100% { background: rgba(15,23,42,.55); transform: translateX(-50%) scale(1); } 50% { background: #f59e0b; transform: translateX(-50%) scale(1.18); } }

/* 🗺️ ซ่อนปุ่ม "Map" แถวเดียวกับ Log / Chat (เจ้าของ 2026-10-15 "ปุ่ม Map ซ่อนไปหน่อย") — เปลี่ยนแผนที่ยังทำได้จากปุ่ม 🗺️ เลือกจุดหมาย (ชั้นรายการแผนที่ _dpView maps) · 🔻 เปิดคืน: ลบบรรทัดนี้ */
#open-map-btn { display: none !important; }

/* ══ 🎨 UI v2 kit — ชุดกลางของหน้าจอแบบใหม่ทั้งเกม (docs/ui-v2-design.md · เจ้าของ 2026-10-15 "ดำเนินการทั้งหมด … ระวัง font ด้วย") ══
   ฟอนต์ = var(--gf) (ฟอนต์เกม) เท่านั้น · น้ำหนัก ≤ 700 · ป้ายบนชิปเล็กสุด 8px · ข้อความอ่าน ≥ 10px
   ใช้ class เหล่านี้ใน markup (ไม่เขียน font inline ซ้ำ) · ต้นแบบ: แผงยาน Orion (ORION_V2) · ภาพ docs/ui-v2/*.png */
.u2 { font-family: var(--gf); color: #0f172a; }
.u2 * { font-family: inherit; }
.u2-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #e2e8f0; border-radius: 10px; padding: 3px; margin-bottom: 8px; }
.u2-seg > button, .u2-seg > span { position: relative; height: 30px; border: none; border-radius: 8px; background: transparent; display: flex; align-items: center; justify-content: center; gap: 4px; font: 700 10.5px var(--gf); color: #475569; white-space: nowrap; overflow: hidden; cursor: pointer; padding: 0 4px; min-width: 0; }
.u2-seg > .on { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.u2-seg .dot { position: absolute; top: 3px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; }
.u2-sec { display: flex; align-items: center; gap: 8px; margin: 12px 2px 7px; }
.u2-sec > b { font: 700 11.5px var(--gf); color: #475569; letter-spacing: .3px; white-space: nowrap; }
.u2-sec > i { flex: 1; height: 1px; background: #cbd5e1; }
.u2-sec > .r { flex: none; font: 700 10px var(--gf); color: #64748b; }
.u2-card { position: relative; background: #fff; border: 1.5px solid #e5e7eb; border-radius: 14px; padding: 8px; margin-bottom: 7px; }
.u2-card.act { border-color: #16a34a; background: linear-gradient(#f0fdf4, #fff); }
.u2-card.gold { border-color: #f59e0b; background: linear-gradient(#fffbeb, #fff); }
.u2-card.sel { border-color: #7c3aed; background: linear-gradient(#f5f3ff, #fff); }
.u2-card.lk { border-style: dashed; background: #f8fafc; }
.u2-card.dim { opacity: .6; }
.u2-hd { display: flex; align-items: center; gap: 6px; min-height: 28px; min-width: 0; }
.u2-hd > .ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; overflow: hidden; background: #f1f5f9; }
.u2-hd > b, .u2-hd .nm { font: 700 12px var(--gf); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.u2-hd .sub { display: block; font: 700 9.5px var(--gf); color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u2-hd em, .u2-pill { flex: none; font: 700 9.5px var(--gf); font-style: normal; background: #f1f5f9; color: #64748b; border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.u2-hd .r, .u2-r { margin-left: auto; }
.u2-qm { flex: none; width: 20px; height: 20px; border-radius: 50%; border: none; background: #16a34a; color: #fff; font: 700 11px/20px var(--gf); text-align: center; padding: 0; cursor: pointer; }
.u2-sw { flex: none; width: 38px; height: 21px; border-radius: 999px; border: none; padding: 0; background: #16a34a; position: relative; cursor: pointer; }
.u2-sw::after { content: ''; position: absolute; top: 2px; left: 19px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.u2-sw.off { background: #cbd5e1; } .u2-sw.off::after { left: 2px; }
.u2-c2, .u2-c3, .u2-c4 { display: grid; gap: 4px; margin-top: 6px; }
.u2-c2 { grid-template-columns: 1fr 1fr; } .u2-c3 { grid-template-columns: repeat(3, 1fr); } .u2-c4 { grid-template-columns: repeat(4, 1fr); }
.u2-c2 > div, .u2-c3 > div, .u2-c4 > div { min-height: 31px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; line-height: 1.15; overflow: hidden; background: #f1f5f9; color: #475569; padding: 2px; }
.u2-c2 small, .u2-c3 small, .u2-c4 small { font: 700 8px var(--gf); opacity: .8; white-space: nowrap; letter-spacing: .2px; }
.u2-c2 b, .u2-c3 b, .u2-c4 b { font: 700 11px var(--gf); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.u2-k1 { background: #ede9fe !important; color: #6d28d9 !important; } .u2-k2 { background: #dbeafe !important; color: #1d4ed8 !important; }
.u2-k3 { background: #fef3c7 !important; color: #b45309 !important; } .u2-k4 { background: #f1f5f9 !important; color: #475569 !important; }
.u2-k5 { background: #dcfce7 !important; color: #15803d !important; } .u2-k6 { background: #fee2e2 !important; color: #b91c1c !important; }
.u2-k7 { background: #e0e7ff !important; color: #3730a3 !important; }
.u2-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.u2-rows > div { min-height: 26px; border-radius: 7px; display: flex; align-items: center; gap: 4px; padding: 0 6px; font: 700 9.5px var(--gf); min-width: 0; background: #f8fafc; border: 1px solid #eef2f7; }
.u2-rows > div > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #475569; min-width: 0; }
.u2-rows > div > b { margin-left: auto; font: 700 10.5px var(--gf); white-space: nowrap; }
.u2-btn { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 30px; margin-top: 7px; border: none; border-radius: 9px; font: 700 11px var(--gf); color: #fff; background: #16a34a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; padding: 0 8px; }
.u2-btn.p { background: #7c3aed; } .u2-btn.o { background: #ea580c; } .u2-btn.b { background: #0284c7; } .u2-btn.r { background: #dc2626; }
.u2-btn.y { background: #fde68a; color: #7c2d12; } .u2-btn.g { background: #e2e8f0; color: #334155; }
.u2-btn:disabled, .u2-btn.n { background: #e5e7eb !important; color: #94a3b8 !important; cursor: default; }
.u2-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; margin-top: 7px; } .u2-btns > .u2-btn { margin-top: 0; }
.u2-bar { position: relative; height: 16px; border-radius: 8px; background: #e2e8f0; overflow: hidden; margin-top: 6px; }
.u2-bar > div { height: 100%; background: linear-gradient(90deg, #22c55e, #84cc16); transition: width .5s; }
.u2-bar > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 9.5px var(--gf); color: #14532d; white-space: nowrap; }
.u2-g2, .u2-g3, .u2-g4, .u2-g6 { display: grid; gap: 6px; } .u2-g2 { grid-template-columns: 1fr 1fr; } .u2-g3 { grid-template-columns: repeat(3, 1fr); }
.u2-g4 { grid-template-columns: repeat(4, 1fr); } .u2-g6 { grid-template-columns: repeat(6, 1fr); gap: 4px; }
.u2-t { position: relative; box-sizing: border-box; background: #fff; border: 1.5px solid #e5e7eb; border-radius: 12px; padding: 7px 4px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; cursor: pointer; }
.u2-t > .ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; overflow: hidden; background: #f1f5f9; }
.u2-t > b { font: 700 10.5px var(--gf); margin-top: 4px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.u2-t > i { font: 700 8.5px var(--gf); font-style: normal; color: #64748b; margin-top: 1px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.u2-t > .pp { margin-top: auto; width: 100%; min-height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font: 700 9.5px var(--gf); color: #fff; background: #0f766e; white-space: nowrap; overflow: hidden; padding: 0 2px; }
.u2-t.on { border-color: #16a34a; background: #f0fdf4; } .u2-t.sel { border-color: #7c3aed; background: #f5f3ff; }
.u2-t.lk { opacity: .55; border-style: dashed; cursor: default; } .u2-t.gold { border-color: #f59e0b; }
.u2-t .bdg { position: absolute; top: -1px; right: -1px; font: 700 8.5px var(--gf); color: #fff; background: #16a34a; border-radius: 0 11px 0 8px; padding: 1px 5px; }
.u2-hero { display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 10px 12px; color: #fff; background: linear-gradient(120deg, #0c4a6e, #0369a1 55%, #0ea5e9); margin-bottom: 7px; }
.u2-hero > .ic { flex: none; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-size: 24px; overflow: hidden; }
.u2-hero small { display: block; font: 700 9px var(--gf); letter-spacing: 1px; opacity: .85; }
.u2-hero b.big { font: 700 18px var(--gf); }
.u2-hero .st { margin-left: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.u2-hero .st > span { background: rgba(255,255,255,.16); border-radius: 7px; padding: 3px 6px; font: 700 9px var(--gf); text-align: center; white-space: nowrap; }
.u2-chips { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; padding-bottom: 1px; }
.u2-chips::-webkit-scrollbar { display: none; }
.u2-chips > button, .u2-chips > span { flex: none; height: 26px; border-radius: 999px; padding: 0 10px; display: flex; align-items: center; gap: 3px; font: 700 10px var(--gf); background: #fff; border: 1px solid #e2e8f0; color: #475569; cursor: pointer; white-space: nowrap; }
.u2-chips > .on { background: #0f766e; color: #fff; border-color: #0f766e; }
.u2-lrow { display: flex; align-items: center; gap: 7px; background: #fff; border: 1.5px solid #e5e7eb; border-radius: 11px; padding: 6px 8px; margin-bottom: 5px; font: 700 11px var(--gf); }
.u2-lrow > .n { flex: none; min-width: 24px; height: 24px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; font: 700 10px var(--gf); padding: 0 3px; }
.u2-lrow > .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u2-lrow > .nm small { display: block; font: 700 9.5px var(--gf); color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u2-lrow > .v { flex: none; font: 700 11px var(--gf); color: #0f766e; }
.u2-lrow.me { border-color: #5dcaa5; background: #e1f5ee; }
.u2-note { font: 700 9.5px/1.45 var(--gf); color: #64748b; margin-top: 5px; }
.u2-note.bad { color: #b91c1c; }
.u2-in { flex: 1; min-width: 0; height: 30px; border-radius: 9px; border: 1px solid #cbd5e1; background: #fff; padding: 0 8px; font: 700 11px var(--gf); color: #0f172a; }
.u2-row { display: flex; align-items: center; gap: 6px; }

/* 🔧 แก้ชุดกลาง: ปุ่มในแถว u2-btns ห้ามกว้าง 100% (ในหน้าต่างแบบ flex ดันปุ่มที่ 2 หลุดจอ) · คอลัมน์ minmax(0,1fr) */
.u2-btns { grid-auto-columns: minmax(0, 1fr); } .u2-btns > .u2-btn { width: auto; min-width: 0; }
/* 🔤 ส่วนเก่าที่ฝังอยู่ในหน้าจอใหม่ (ป้าย VIP / GM / เลเวล ฯลฯ) ตัวหนา 800/900 → 700 ตามกติกาฟอนต์ */
.u2 [style*="font-weight:800"], .u2 [style*="font-weight: 800"], .u2 [style*="font-weight:900"], .u2 [style*="font-weight: 900"] { font-weight: 700 !important; }

/* 🧱 กันทะลุกรอบบนมือถือ (เจ้าของ 2026-10-16 "หน้าทะลุกรอบ ลองตรวจหน้าอื่นๆมาด้วย" — ภาพ: แถวสกิน 6 ช่องหน้าสกินสัตว์เลี้ยงล้นออกซ้าย/ขวา)
   ต้นเหตุ: grid-template-columns: repeat(N, 1fr) = ช่องกว้างอย่างน้อยเท่าเนื้อหาข้างใน (รูป 44px + ป้ายตัวเลข) ⇒ จอแคบ 6 ช่องรวมกันกว้างกว่ากรอบ
   แก้: minmax(0, 1fr) ทุกตารางของชุด u2 + รูปในช่องย่อตามช่องได้ */
.u2-c2, .u2-rows, .u2-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.u2-c3, .u2-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.u2-c4, .u2-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.u2-g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.u2-t > .ic { max-width: 100%; }
.u2-t > .ic > canvas, .u2-t > .ic > img { max-width: 100%; height: auto; }
/* 📱 popup ที่ปรับความสูงตามพื้นที่ที่เห็นจริงแล้ว (_ovFitAll) — กล่องข้างในสูงไม่เกินฉากหลัง (ลบ padding ของฉากหลังแล้ว) */
[data-ovfit="1"] > :not(style) { max-height: 100% !important; box-sizing: border-box; }
/* 🏷️ หัวแบบ ORION SHIP ให้ของที่อัปได้ + แถวอัปเกรดในหัว (docs/upgrade-hero-header-list.md · เจ้าของ 2026-10-18 "ทำมาทั้งหมด · ทำแบบย่อขนาด · สีแยกตามหมวด") — สร้างด้วย _hh() ใน js/xhrpg_canvas.js */
.hh { --a: #0c4a6e; --b: #0284c7; border-radius: 14px; padding: 10px 11px; color: #fff; background: linear-gradient(110deg, var(--a), var(--b)); margin: 0 0 7px; font-family: var(--gf); }
.hh-t { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hh-t > .ic { flex: none; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.hh-t > .nm { flex: 1 1 auto; min-width: 0; }
.hh-t > .nm small { display: block; font: 700 9px/1.1 var(--gf); letter-spacing: 1.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-t > .nm b { display: block; font: 700 21px/1.15 var(--gf); white-space: nowrap; }
.hh-t > .nm b > em { font: 700 10px var(--gf); font-style: normal; opacity: .75; margin-left: 2px; }
.hh-t > .st { flex: 0 1 190px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.hh-t > .st > span { background: rgba(255,255,255,.16); border-radius: 7px; padding: 3px 4px; font: 700 9.5px/1.25 var(--gf); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-t > .st > span[onclick] { cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.hh-t > .rt { flex: none; display: flex; align-items: center; gap: 4px; }
.hh-up { margin-top: 8px; padding-top: 7px; border-top: 1px dashed rgba(255,255,255,.35); }
.hh-up > button, .hh-up > div { margin-top: 0 !important; background: rgba(0,0,0,.22) !important; border: 1px solid rgba(255,255,255,.28) !important; color: #f8fafc !important; }
.hh-up > button span { color: #f8fafc !important; }
.hh-up > button:not([disabled]) { background: rgba(34,197,94,.92) !important; border-color: #86efac !important; }
.hh-up > button:not([disabled]) span { color: #052e16 !important; }
.hh-up > button span[style*="dc2626"] { color: #b91c1c !important; background: #fee2e2; border-radius: 5px; padding: 1px 4px; }
.hh-up > div { color: #fde68a !important; background: rgba(250,204,21,.18) !important; }
.hh-x { margin-top: 6px; font: 700 9.5px/1.4 var(--gf); opacity: .9; }
/* แบบย่อ (หน้าที่มีหลายชิ้น) */
.hh.sm { padding: 8px 9px; border-radius: 12px; }
.hh.sm .hh-t > .ic { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }
.hh.sm .hh-t > .nm b { font-size: 17px; }
.hh.sm .hh-t > .st { flex-basis: 176px; gap: 3px; }
.hh.sm .hh-t > .st > span { font-size: 9px; padding: 2px 3px; }
.hh.sm .hh-up { margin-top: 6px; padding-top: 5px; }
.hh-up > .u2-btns { background: none !important; border: none !important; margin: 0 !important; }
.hh-up > .u2-btns > button { margin-top: 0 !important; }
.hh-up > .u2-btn, .hh-up > .u2-btns > .u2-btn { min-height: 30px; }

/* 📱 2026-10-20 iPhone เปิดจากไอคอนหน้าจอโฮม (html.pwa-ios · index.php) — เจ้าของ "ปุ่มล่างมันติดขอบ"
   หน้าเกมยืดถึงขอบล่างจอ ทับแถบโฮม (ขีดดำ) → เว้นขอบล่าง: ใช้ safe-area ถ้าเครื่องบอกค่า ไม่งั้นอย่างน้อย 18px
   แถวปุ่มล่าง (.spot-select-wrap · PREMIUM ฯลฯ) อยู่ใน .map-wrap ที่หดตาม · Safari ปกติ / Android / PC ไม่กระทบ */
html.pwa-ios #game-screen { box-sizing: border-box; padding-bottom: max(env(safe-area-inset-bottom, 0px), 18px); background: #0d1117; }
