/* MobileUILayout - CHI vi tri va kich thuoc (mau o mobile_skin.css). Do theo docs/mobile_reference/hud_layout.json
   (anh S21 760x352), quy ve don vi --q = min(chieu cao, chieu rong x 0,5) / 352 (4:3 khong teo). Chu toi thieu 11px. Vung cham toi thieu 40-48px CSS. Ap khi body.ml. */
body.ml { --sl:env(safe-area-inset-left,0px); --sr:env(safe-area-inset-right,0px); --st:env(safe-area-inset-top,0px); --sb:env(safe-area-inset-bottom,0px); --q: calc(min(100vh, 50vw) / 352); --tap: max(44px, calc(40 * var(--q))); --gap: max(6px, calc(6 * var(--q))); }

/* ---- Trai tren: avatar + thanh */
body.ml #ml-status { position:absolute; left:calc(4px + var(--sl)); top:calc(3px + var(--st)); display:flex; align-items:flex-start; gap:6px; pointer-events:none; }
body.ml #ml-avatar { position:relative; flex:none; width:max(48px, calc(50 * var(--q))); height:max(48px, calc(50 * var(--q))); padding:0; border-radius:50%; pointer-events:auto; }
body.ml #ml-avatar svg { width:56%; height:56%; }
body.ml .ml-avatar-level { position:absolute; left:50%; bottom:-6px; transform:translateX(-50%); min-width:24px; padding:0 5px; border-radius:9px; font:800 12px/18px "Be Vietnam Pro",system-ui,sans-serif; text-align:center; }
body.ml #hud-stats { position:static; display:flex; flex-direction:column; gap:3px; width:max(150px, calc(170 * var(--q))); margin-top:3px; }
body.ml #hud-stats .stat { grid-column:auto !important; grid-row:auto !important; width:100%; }
body.ml #hud-level { display:none; }
body.ml .stat { height:max(13px, calc(12 * var(--q))); }
body.ml .stat-text { font-size:max(11px, calc(9.5 * var(--q))); }
/* the luc: hien so (ban PC an chu tren thanh nay); khong co so lieu thi mobile_hud.js an ca thanh */
body.ml .stamina { height:max(13px, calc(12 * var(--q))); }
body.ml .stamina .stat-text { display:flex; }

/* ---- Giua tren: khung muc tieu */
body.ml #hud-target { left:50%; top:calc(4px + var(--st)); transform:translateX(-50%); width:clamp(140px, 17vw, calc(170 * var(--q))); }
body.ml #hud-fps { top:auto; bottom:calc(4px + var(--sb)); right:auto; left:50%; transform:translateX(-50%); font-size:11px; opacity:.75; }

/* ---- Phai tren: ten ban do + toa do + ban do nho, hang nut nho ben trai */
body.ml #ml-mapbox { position:absolute; right:calc(4px + var(--sr)); top:calc(3px + var(--st)); width:max(118px, calc(122 * var(--q))); pointer-events:none; }
body.ml .ml-mapname { display:flex; flex-direction:column; align-items:flex-end; width:100%; min-height:34px; padding:2px 30px 2px 4px; border:0; text-align:right; pointer-events:auto; }
body.ml .ml-mapname-text { max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font:700 max(12px, calc(11 * var(--q)))/1.25 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-mapcoord { font:600 max(11px, calc(10 * var(--q)))/1.2 ui-monospace,Consolas,monospace; }
body.ml .ml-mapfold { position:absolute; right:0; top:0; width:34px; height:34px; padding:6px; border-radius:50%; pointer-events:auto; }
body.ml .ml-mapfold svg { width:100%; height:100%; }
body.ml #ml-mapbox.folded .ml-mapfold svg { transform:rotate(180deg); }
body.ml .ml-minimap { position:relative; display:block; width:100%; height:max(92px, calc(92 * var(--q))); margin-top:2px; padding:0; overflow:hidden; border-radius:12px; pointer-events:auto; }
body.ml #ml-mapbox.folded .ml-minimap { display:none; }
body.ml .ml-minimap-canvas { position:absolute; inset:0; width:100%; height:100%; }
body.ml .ml-self { position:absolute; left:50%; top:50%; width:10px; height:10px; margin:-5px 0 0 -5px; border-radius:50%; }

/* Hang nut nho: cum 2 hang x 3 sat ben trai ban do nho (S21), nhan chu nam trong nut; nut thu gon la o thu 6 */
body.ml #ml-topmenu { position:absolute; top:calc(4px + var(--st)); right:calc(max(118px, calc(122 * var(--q))) + 10px + var(--sr)); display:grid; grid-template-columns:repeat(3, var(--tbw)); grid-auto-rows:var(--tbh); gap:4px; --tbw:max(52px, calc(46 * var(--q))); --tbh:max(44px, calc(42 * var(--q))); pointer-events:none; }
body.ml .ml-round { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; padding:0; pointer-events:auto; }
body.ml .ml-top-btn { width:var(--tbw); height:var(--tbh); padding:3px 0 2px; border-radius:10px; justify-content:space-between; }
body.ml .ml-round svg { width:52%; height:52%; }
body.ml .ml-top-btn svg { flex:none; width:max(20px, calc(18 * var(--q))); height:max(20px, calc(18 * var(--q))); }
body.ml .ml-btn-label { position:absolute; left:50%; bottom:-15px; transform:translateX(-50%); white-space:nowrap; font:700 max(11px, calc(8.8 * var(--q)))/13px "Be Vietnam Pro",system-ui,sans-serif; pointer-events:none; }
body.ml .ml-top-btn .ml-btn-label { position:static; transform:none; max-width:calc(100% + 4px); overflow:hidden; text-overflow:clip; letter-spacing:-.2px; line-height:1.1; }
body.ml .ml-topmenu-toggle { width:var(--tbw); height:var(--tbh); border-radius:10px; }
body.ml #ml-topmenu.folded { grid-template-columns:var(--tbw); }
body.ml #ml-topmenu.folded .ml-top-btn { display:none; }
body.ml #ml-topmenu.folded .ml-topmenu-toggle svg { transform:rotate(-90deg); }
body.ml #ml-topmenu:not(.folded) .ml-topmenu-toggle svg { transform:rotate(90deg); }

/* ---- Mep trai: tab doc */
body.ml #ml-side { position:absolute; left:calc(0px + var(--sl)); top:calc(max(48px, calc(50 * var(--q))) + 24px + var(--st)); display:flex; flex-direction:column; gap:6px; pointer-events:none; }
body.ml .ml-side-tab { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; width:max(46px, calc(38 * var(--q))); height:max(54px, calc(48 * var(--q))); padding:0 0 14px; border-radius:0 12px 12px 0; pointer-events:auto; }
body.ml .ml-side-tab svg { width:22px; height:22px; }
body.ml .ml-side-tab .ml-btn-label { bottom:2px; font-size:11px; }

/* ---- An thanh nut tren giua cu, vong chuc nang cu (thay bang cum chuc nang) */
body.ml #hud-dock { position:absolute; left:-9999px; top:0; }
body.ml #btn-wheel, body.ml #wheel { display:none !important; }

/* ---- Giua duoi: dai chat + tui */
body.ml #ml-chatstrip { position:absolute; left:calc(50% - 6vw); bottom:calc(4px + var(--sb)); transform:translateX(-50%); display:flex; align-items:flex-end; gap:8px; width:min(46vw, calc(300 * var(--q))); pointer-events:none; }
body.ml #ml-chatstrip #btn-chat { position:static; flex:none; width:var(--tap); height:var(--tap); border-radius:12px; pointer-events:auto; }
body.ml #ml-chatstrip #chat-preview { position:static; flex:1; min-width:0; width:auto; height:calc(2 * 1.35em + 8px); overflow:hidden; padding:4px 8px; border-radius:8px; pointer-events:auto; cursor:pointer; }
body.ml .ml-bag { flex:none; width:max(52px, calc(48 * var(--q))); height:max(52px, calc(48 * var(--q))); border-radius:14px; }
body.ml .ml-bag .ml-btn-label { bottom:2px; position:absolute; }
body.ml .ml-bag svg { margin-top:-10px; }

/* ---- Phai duoi: cum chien dau (S21 M01). Goc toa do = tam nut danh; vi tri tung nut dat bang --tx/--ty trong
   mobile_layout.js: hang o 1..4 sat day, o 5..8 cung deu ban kinh --cR, cot Nhat / cum / Trang ben trai. */
body.ml { --cs:max(44px, calc(34 * var(--q))); --ca:max(62px, calc(54 * var(--q))); --cg:max(6px, calc(6 * var(--q))); --cu:calc(var(--cs) + var(--cg));
  --cR:max(calc(var(--cu) * 1.47), calc(var(--ca) / 2 + var(--cs) / 2 + var(--cg))); --cm:8px; }
body.ml #actions { right:calc(var(--cm) + var(--sr) + var(--cs) / 2 + var(--cu) * 0.75 - var(--ca) / 2); bottom:calc(var(--cm) + var(--sb) + var(--cs) + var(--cg)); width:var(--ca); height:var(--ca); }
body.ml #actions .slot, body.ml #actions .slot.item-slot, body.ml #actions #btn-pick, body.ml #actions #btn-page, body.ml #actions #ml-mode {
  position:absolute; left:50%; top:50%; width:var(--cs); height:var(--cs); margin:calc(var(--cs) / -2) 0 0 calc(var(--cs) / -2); transform:translate(var(--tx, 0px), var(--ty, 0px)); }
body.ml #hud-col { display:contents; }
body.ml #ml-mode { border-radius:10px; }

/* ---- Cum chuc nang (thay cum chien dau khi bat) */
body.ml #ml-func { position:absolute; right:calc(10px + var(--sr)); bottom:calc(10px + var(--sb)); display:grid; grid-template-columns:repeat(3, var(--tap)); gap:max(16px, calc(14 * var(--q))) max(12px, calc(12 * var(--q))); padding-bottom:12px; pointer-events:none; }
body.ml #ml-func[hidden] { display:none; }
body.ml .ml-func-btn { width:var(--tap); height:var(--tap); border-radius:50%; }
body.ml.ml-func-on #actions { visibility:hidden; }
body.ml.ml-func-on #actions #ml-mode { visibility:visible; }

/* ---- Cua so mobile chung */
body.ml .ml-panel { display:flex; flex-direction:column; min-height:0; border-radius:12px; }
body.ml .ml-panel-head { flex:none; display:flex; align-items:center; gap:8px; min-height:44px; padding:0 4px 0 12px; }
body.ml .ml-panel-title { margin:0; font:800 16px/1.2 "Be Vietnam Pro",system-ui,sans-serif; white-space:nowrap; }
body.ml .ml-close { width:44px; height:44px; flex:none; margin-left:auto; padding:10px; border-radius:50%; }
body.ml .ml-close svg { width:100%; height:100%; }
body.ml .ml-tabs { display:flex; gap:6px; }
body.ml .ml-tab { min-width:64px; height:40px; padding:0 12px; border-radius:20px; font:700 13px "Be Vietnam Pro",system-ui,sans-serif; }

/* ---- MobileMap: gan toan man, chua goc trai tren */
body.ml #ml-map { position:fixed; inset:0; z-index:6; }
body.ml #ml-map[hidden] { display:none; }
body.ml .ml-map-box { position:absolute; left:calc(max(48px, calc(50 * var(--q))) + 16px + var(--sl)); right:calc(8px + var(--sr)); top:calc(6px + var(--st)); bottom:calc(6px + var(--sb)); }
body.ml .ml-map-coord { font:600 12px ui-monospace,Consolas,monospace; }
body.ml .ml-map-body { position:relative; flex:1; min-height:0; margin:0 8px; }
body.ml .ml-map-view { position:absolute; inset:0; overflow:hidden; border-radius:8px; touch-action:manipulation; }
body.ml .ml-map-img { position:absolute; user-select:none; -webkit-user-drag:none; pointer-events:none; }
body.ml .ml-map-dots { position:absolute; inset:0; }
body.ml .ml-map-npc { position:absolute; display:flex; align-items:center; gap:3px; min-width:30px; min-height:30px; margin:-15px 0 0 -15px; padding:0 0 0 10px; border:0; background:none; }
body.ml .ml-map-npc-dot { flex:none; width:9px; height:9px; border-radius:50%; }
body.ml .ml-map-npc-name { white-space:nowrap; font:700 11px/1 "Be Vietnam Pro",system-ui,sans-serif; pointer-events:none; }
body.ml .ml-map-self { position:absolute; width:14px; height:14px; margin:-7px 0 0 -7px; border-radius:50%; pointer-events:none; }
body.ml .ml-map-target { position:absolute; width:22px; height:22px; margin:-11px 0 0 -11px; border-radius:50%; pointer-events:none; }
body.ml .ml-npc-list { position:absolute; inset:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows:44px; gap:6px; padding:8px; overflow:auto; align-content:start; border-radius:8px; }
body.ml .ml-npc-list[hidden] { display:none; }
body.ml .ml-npc-item { min-height:44px; padding:0 10px; border-radius:8px; text-align:left; font:600 13px/1.2 "Be Vietnam Pro",system-ui,sans-serif; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.ml .ml-map-note { flex:none; margin:6px 12px 8px; font:500 12px/1.3 "Be Vietnam Pro",system-ui,sans-serif; }

/* ---- MobileInventory: panel bam phai, co theo noi dung: tieu de trai tren, nut dong phai tren, cot trang sat luoi o;
   the chi tiet ben trai co theo noi dung, nut hanh dong o day the. Hang tien: chua co cau du lieu tien cho tui nen chua hien. */
body.ml #bag-panel { display:block; padding:0; }
body.ml #bag-panel[hidden] { display:none; }
body.ml #bag-box { position:absolute; right:calc(6px + var(--sr)); top:calc(6px + var(--st)); bottom:auto; max-height:calc(100% - 12px - var(--st) - var(--sb)); width:auto;
  display:grid; grid-template-columns:auto auto 1fr auto; grid-template-rows:auto minmax(0, 1fr); column-gap:8px; row-gap:6px; padding:6px 8px 8px; }
body.ml #bag-box .panel-head { display:contents; }
body.ml #bag-box .panel-title { grid-row:1; grid-column:1 / 4; align-self:center; padding-left:4px; }
body.ml #bag-box .panel-close { grid-row:1; grid-column:4; justify-self:end; }
body.ml #bag-box .bag-pages { grid-row:2; grid-column:1; position:static; flex:none; display:flex; flex-direction:column; justify-content:flex-start; gap:6px; }
body.ml #bag-box .bag-body { display:contents; }
body.ml #bag-grid { grid-row:2; grid-column:2 / 5; }
body.ml #bag-grid { --bag-cell:clamp(44px, calc((100dvh - 80px - 44px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 6 - 4px), 62px); margin:0; }
body.ml #bag-info { position:absolute; right:calc(100% + 8px); top:0; bottom:auto; width:min(400px, 50vw, calc(100vw - 100% - 24px)); max-height:calc(100vh - 12px - var(--st) - var(--sb)); padding:10px; border-radius:12px; overflow:hidden; }
body.ml #bag-panel:not(.has-item) #bag-info { display:none; }
body.ml #bag-info #bag-desc { flex:0 1 auto; }
body.ml #bag-info .bag-info-icon { width:56px; height:56px; }
body.ml #bag-info .bag-actions { flex-direction:column; margin-top:4px; }
body.ml #bag-info .bag-actions button { min-height:44px; }
body.ml #bag-info .bag-slot-row { grid-template-columns:repeat(4,minmax(44px,1fr)); }
/* hang tien: duoi luoi khi man du cao; man thap (<= 400px) dat tren hang tieu de de luoi giu o >= 44px */
body.ml #bag-money { grid-row:3; grid-column:2 / 5; min-height:30px; }
@media (max-height: 400px) {
  body.ml #bag-grid { --bag-cell:clamp(44px, calc((100dvh - 80px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 6 - 4px), 62px); }
  body.ml #bag-box .panel-title { grid-column:1 / 3; }
  body.ml #bag-money { grid-row:1; grid-column:3 / 4; align-self:center; justify-self:end; flex-direction:column; align-items:flex-end; gap:0; min-height:36px; padding:2px 8px; font-size:12px; line-height:1.25; }
  body.ml #bag-money .bag-money-label { display:none; }
  body.ml #bag-money .bag-money-note { margin-left:0; font-size:11px; }
}

/* ---- MobileSkillBook: panel trai, the thong tin giua, cot o phim tat ben phai */
body.ml #skill-panel { display:block; padding:0; }
body.ml #skill-box { position:absolute; left:calc(6px + var(--sl)); top:calc(6px + var(--st)); bottom:calc(6px + var(--sb)); width:min(48vw, 560px); padding:6px 8px 8px; }
body.ml #skill-box .sk-body { display:block; position:relative; }
body.ml #skill-box .sk-grid { position:absolute; inset:0; grid-template-columns:repeat(auto-fill, minmax(min(150px, 44%), 1fr)); }
body.ml #skill-box .sk-info { position:fixed; left:calc(min(48vw, 560px) + 14px + var(--sl)); right:calc(8px + var(--sr)); top:calc(6px + var(--st)); bottom:calc(6px + var(--sb)); padding:10px; border-radius:12px; }
body.ml #skill-panel:not(.has-item) .sk-info { display:none; }
body.ml #skill-box .sk-info .bag-actions { flex-wrap:wrap; }
body.ml #skill-box .sk-info .bag-actions button { min-height:44px; flex:1 1 30%; }
body.ml #skill-box .sk-info .bag-slot-row { grid-template-columns:repeat(4,minmax(44px,1fr)); }

/* ---- MobileNPCDialog: khung rong nua duoi, chu trai tren, dap an 2 cot */
body.ml #npc-dialog { align-items:flex-end; justify-content:center; padding:0 calc(8px + var(--sr, 0px)) calc(6px + env(safe-area-inset-bottom,0px)) calc(8px + var(--sl, 0px)); }
body.ml #npc-box { width:min(92vw, 860px); max-height:72vh; padding:12px 14px; border-radius:12px; }
/* vung chu >= 40% khung, cuon duoc; dap an toi da ~30% man, cuon rieng */
body.ml #npc-text { flex:1 1 auto; min-height:28vh; max-height:none; overflow:auto; font-size:14px; -webkit-overflow-scrolling:touch; }
body.ml #npc-answers { flex:none; display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px; max-height:30vh; overflow:auto; }
body.ml #npc-answers:has(> .npc-answer:only-child) { grid-template-columns:minmax(0, min(380px, 70%)); justify-content:center; }
body.ml .npc-answer { min-height:46px; font-size:14px; text-align:center; }

/* Nut doi trang o phim tat: ghi ro "Trang" de khong nham voi o so 1 */
body.ml #actions #btn-page { flex-direction:column; border-radius:10px; font:800 15px/1 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml #actions #btn-page::before { content:"Trang"; display:block; margin-bottom:1px; font-size:11px; font-weight:700; opacity:.85; }

/* ---- Vung cham toi thieu 44px (test_mobile_touch) va tranh chong */
body.ml .ml-mapname { min-height:44px; width:calc(100% - 48px); padding-right:4px; }
body.ml .ml-mapfold { width:44px; height:44px; padding:9px; }
body.ml #hud-dock { display:none; }
/* Nut ban phim / toan man hinh (#tools) cua trang: dua xuong duoi ban do nho thay vi de len ten ban do */
body.ml #tools { top:62% !important; bottom:auto !important; left:calc(4px + var(--sl)) !important; right:auto !important; flex-direction:column; }
/* Dai chat + tui: neo theo cum chien dau ben phai de khong chong nut nhat */
body.ml #ml-chatstrip { left:auto; transform:none; right:calc(var(--cm) + var(--sr) + var(--cs) + var(--cu) * 1.75 + var(--cR) + 8px); width:min(40vw, calc(300 * var(--q))); }
body.ml #ml-chatstrip #chat-preview { min-height:44px; }
/* Mo chat: an cac nut HUD nam duoi bang chat */
body.ml:has(#chat-panel:not([hidden])) #ml-side, body.ml:has(#chat-panel:not([hidden])) #ml-chatstrip,
body.ml:has(#chat-panel:not([hidden])) #ml-topmenu, body.ml:has(#chat-panel:not([hidden])) #ml-status { visibility:hidden; }

/* ---- Nut dong cua moi bang o goc phai tren cua chinh bang do */
body.ml .panel-head .panel-close, body.ml .ml-panel-head .ml-close { margin-left:auto; order:99; }
/* Nut X cua cua so PC (trong canvas): goc phai tren cua nua man co cua so, duoi khung muc tieu, khong de len hang nut */
body.ml #panel-exit { width:44px; height:44px; margin-left:0; }
body.ml.panel-left #panel-exit { left:calc(50% - 50px); right:auto; top:calc(56px + var(--st)); }
body.ml.panel-right:not(.panel-left) #panel-exit { left:auto; right:calc(6px + var(--sr)); top:calc(56px + max(92px, calc(92 * var(--q))) + var(--st)); }
/* core gui khung cua so PC: nut X dat sat ben ngoai khung (game_loader.js placePanelExit) */
body.ml.pex-at #panel-exit { left:var(--pex-x) !important; top:var(--pex-y) !important; right:auto !important; }

/* ---- Bang mobile / hoi thoai dang mo: lam mo canvas (ca cua so PC server tu mo) de bang mobile noi len tren */
body.ml.ml-modal #game { filter:brightness(.42) saturate(.7); transition:filter .15s; }
body.ml.ml-modal #hud { opacity:.35; }
body.ml.ml-modal #panel-exit { display:none; }

/* ===== Dot gop y 24/11 (Phuc): HUD gon, sat mep, vung cham >= 40px ===== */
body.ml { --cs:max(40px, calc(28 * var(--q))); --ca:max(56px, calc(48 * var(--q))); --cg:max(5px, calc(5 * var(--q)));
  --mmh:max(72px, calc(72 * var(--q))); --tb:max(40px, calc(30 * var(--q))); }
/* ban do nho thap hon; hang nut menu nam NGAY DUOI ban do nho, sat mep phai, nhan ngan 11px duoi icon */
body.ml .ml-minimap { height:var(--mmh); }
body.ml .ml-mapname { min-height:40px; }
body.ml .ml-mapfold { width:40px; height:40px; padding:8px; }
body.ml #ml-topmenu { display:flex; flex-direction:row; gap:7px; top:calc(3px + 40px + 2px + var(--mmh) + 6px + var(--st)); right:calc(4px + var(--sr)); }
body.ml .ml-top-btn, body.ml .ml-topmenu-toggle { width:var(--tb); height:var(--tb); padding:0; border-radius:10px; justify-content:center; }
body.ml .ml-top-btn svg { width:56%; height:56%; }
body.ml .ml-top-btn .ml-btn-label { position:absolute; left:50%; bottom:-14px; transform:translateX(-50%); max-width:none; font-size:11px; line-height:13px; letter-spacing:0; }
body.ml #ml-topmenu.folded { display:flex; }
/* tab trai nho lai + khung theo doi trong suot */
body.ml #ml-side { gap:5px; }
body.ml .ml-side-tab { width:40px; height:44px; padding:0 0 12px; }
body.ml .ml-side-tab svg { width:18px; height:18px; }
body.ml .ml-side-tab .ml-btn-label { bottom:1px; font-size:11px; }
body.ml .ml-tracker-fold { width:40px; height:40px; border-radius:0 10px 10px 0; padding:9px; }
body.ml .ml-tracker-fold svg { width:100%; height:100%; transform:rotate(-90deg); }
body.ml #ml-tracker { position:absolute; left:calc(46px + var(--sl)); top:calc(max(48px, calc(50 * var(--q))) + 24px + var(--st)); width:min(230px, 30vw); max-height:min(44vh, 220px);
  overflow:auto; padding:4px; border-radius:10px; pointer-events:auto; font:500 12px/1.3 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml #ml-tracker[hidden] { display:none; }
body.ml .ml-tracker-row { display:flex; flex-direction:column; align-items:flex-start; width:100%; min-height:40px; padding:3px 6px; border:0; border-radius:6px; background:none; text-align:left; }
body.ml .ml-tracker-name { font-weight:700; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
body.ml .ml-tracker-sub { font-size:11px; opacity:.85; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
body.ml .ml-tracker-empty { margin:6px; font-size:12px; }
body.ml .ml-side-tab.on { outline:1px solid rgba(255,255,255,.55); }
/* dai chat rong hon (~+30%), khong de len can (trai) va cum chien dau (phai); bo nut Tui do */
body.ml #ml-chatstrip { --chat-r:calc(var(--cm) + var(--sr) + var(--cs) + var(--cu) * 1.75 + var(--cR) + 8px); right:var(--chat-r);
  width:min(calc(100vw - var(--chat-r) - 165px - var(--sl)), calc(400 * var(--q))); }
body.ml #ml-chatstrip #btn-chat { width:40px; height:40px; }
body.ml #ml-chatstrip #chat-preview { min-height:40px; }
/* nut nhat bo khoi bo cuc mobile (thay bang vong chuc nang) */
body.ml #btn-pick { display:none !important; }
body.ml #actions #ml-wheel { position:absolute; left:50%; top:50%; width:var(--cs); height:var(--cs); margin:calc(var(--cs) / -2) 0 0 calc(var(--cs) / -2); transform:translate(var(--tx, 0px), var(--ty, 0px)); border-radius:50%; }
body.ml #ml-wheel.down { outline:2px solid rgba(255,255,255,.7); }
/* vong 4 chuc nang: 4 nut tron 44px tren cung ban kinh 70px quanh nut vong */
body.ml #ml-wheel-ring { position:fixed; left:0; top:0; width:0; height:0; z-index:4; --wr:max(72px, calc(56 * var(--q))); }
body.ml #ml-wheel-ring[hidden] { display:none; }
body.ml .ml-wheel-item { position:absolute; left:0; top:0; width:44px; height:44px; border-radius:50%; transform:translate(calc(var(--wx) * var(--wr) - 22px), calc(var(--wy) * var(--wr) - 22px)); }
body.ml .ml-wheel-item .ml-btn-label { bottom:-14px; }
body.ml .ml-wheel-item.hot { outline:2px solid #ffe37a; transform:translate(calc(var(--wx) * var(--wr) - 22px), calc(var(--wy) * var(--wr) - 22px)) scale(1.15); }
/* vong sang duoi chan muc tieu (vi tri tu core, web_target_screen) */
body.ml #ml-target-ring { position:absolute; left:0; top:0; width:calc(66px * var(--rk, 1)); height:calc(26px * var(--rk, 1)); margin:calc(13px * var(--rk, 1) * -1) 0 0 calc(33px * var(--rk, 1) * -1);
  border:2px solid #49ff7f; border-radius:50%; box-shadow:0 0 8px #49ff7f, inset 0 0 6px rgba(73,255,127,.7); pointer-events:none; will-change:transform; }
body.ml #ml-target-ring[hidden] { display:none; }
/* chon cap ky nang khi gan phim tat */
body.ml .sk-level-box { flex:none; }
body.ml .sk-level-title { margin:2px 0 4px; font:700 12px/1.3 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .sk-level-row { display:grid; grid-template-columns:repeat(auto-fill, minmax(40px, 1fr)); gap:4px; max-height:96px; overflow:auto; }
body.ml .sk-level.on { background:rgba(255,227,122,.3); border-style:solid; }
/* ban do lon: nut +/-, nhan NPC de len nhau thi an chu (cham giu nguyen) */
body.ml .ml-zoom { display:flex; gap:6px; margin-left:8px; }
body.ml .ml-zoom-btn { min-width:44px; padding:0; font-size:20px; }
body.ml .ml-map-npc.nolabel .ml-map-npc-name { display:none; }
body.ml .ml-map-view { touch-action:none; }
/* ban kinh cung du de o cheo (140 do) khong cham khung nut danh khi nut danh lon theo --q */
body.ml { --cR:max(calc(var(--cu) * 1.47), calc((var(--ca) / 2 + var(--cs) / 2) * 1.38 + var(--cg))); }
/* vong 4 chuc nang dang dia tron 4 o (mau Phuc gui 24/11): dia toi ban kinh --wd, 4 nut tren 4 huong */
body.ml #ml-wheel-ring { --wr:58px; --wd:86px; }
body.ml .ml-wheel-disc { position:absolute; left:calc(var(--wd) * -1); top:calc(var(--wd) * -1); width:calc(var(--wd) * 2); height:calc(var(--wd) * 2); border-radius:50%;
  background:radial-gradient(circle, rgba(0,0,0,.25) 0 24px, rgba(20,14,8,.82) 25px 100%); border:1px solid rgba(var(--sk-accent-rgb),.55);
  background-image:linear-gradient(45deg, transparent calc(50% - .5px), rgba(255,255,255,.18) 50%, transparent calc(50% + .5px)),
    linear-gradient(-45deg, transparent calc(50% - .5px), rgba(255,255,255,.18) 50%, transparent calc(50% + .5px)),
    radial-gradient(circle, rgba(0,0,0,.25) 0 26px, rgba(20,14,8,.84) 27px 100%); pointer-events:none; }
body.ml .ml-wheel-item { width:48px; height:48px; border:0; background:none !important; box-shadow:none; transform:translate(calc(var(--wx) * var(--wr) - 24px), calc(var(--wy) * var(--wr) - 24px)); }
body.ml .ml-wheel-item svg { width:24px; height:24px; margin-top:-10px; }
body.ml .ml-wheel-item .ml-btn-label { bottom:2px; font-size:11px; }
body.ml .ml-wheel-item.hot { outline:none; background:rgba(255,227,122,.22) !important; border-radius:12px; transform:translate(calc(var(--wx) * var(--wr) - 24px), calc(var(--wy) * var(--wr) - 24px)) scale(1.1); }
body.ml .sk-level { position:relative; min-height:44px; background:center / 80% no-repeat rgba(0,0,0,.25); }
body.ml .sk-level-num { position:absolute; right:2px; bottom:1px; min-width:16px; padding:0 3px; border-radius:8px; background:rgba(0,0,0,.75); color:#fff; font:700 11px/16px system-ui,sans-serif; }
body.ml .sk-level-row { grid-template-columns:repeat(auto-fill, minmax(44px, 1fr)); max-height:100px; }
body.ml .ml-tracker-time { display:flex; flex-direction:column; gap:1px; margin:0 0 4px; padding:4px 6px; border-radius:6px; background:rgba(255,227,122,.12); }
body.ml .ml-tracker-time-title { font:700 11px/1.3 "Be Vietnam Pro",system-ui,sans-serif; color:#ffe37a; }
body.ml .ml-tracker-time-row { font:600 12px/1.35 "Be Vietnam Pro",system-ui,sans-serif; font-variant-numeric:tabular-nums; }

/* ---- Man tai ban do (mobile 1:1: man canvas trong suot + lop HTML nhe #maploading): an HUD HTML va cac bang trong luc tai */
body.mobile.game-loading > :not(#stage):not(#status):not(#rotate):not(#log):not(#maploading):not(#npc-dialog):not(#game-menu) { visibility:hidden !important; }

/* ---- Man thap (iPhone ngang co thanh Safari ~330px, may 360px): hang nut menu duoi ban do nho de len cum ky nang (o
   "Trang", o 8, nut luoi) -> dua len tren cung, ngay ben trai ban do nho, cung hang voi ten ban do */
@media (max-height: 420px) {
  body.ml #ml-topmenu { top:calc(4px + var(--st)); right:calc(max(118px, calc(122 * var(--q))) + 10px + var(--sr)); }
}

/* ---- Khung muc tieu giua tren (du lieu core web_hud_target): o tron theo loai + ten + thanh mau co so / phan tram */
body.ml #hud-target { display:flex; flex-direction:row; align-items:center; gap:7px; padding:3px 9px 3px 3px; border-radius:24px; width:clamp(170px, 22vw, 230px); }
body.ml .target-avatar { flex:none; display:flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; border:2px solid rgba(255,255,255,.55);
  background:radial-gradient(circle at 35% 30%, #6e7b85, #263038); color:#fff; font:800 15px/1 "Be Vietnam Pro",system-ui,sans-serif; text-shadow:0 1px 2px #000; }
body.ml #hud-target[data-kind="npc"] .target-avatar { background:radial-gradient(circle at 35% 30%, #e7c35a, #6b4f0d); }
body.ml #hud-target[data-kind="mon"] .target-avatar { background:radial-gradient(circle at 35% 30%, #e0584d, #5c1410); }
body.ml #hud-target[data-kind="pc"] .target-avatar { background:radial-gradient(circle at 35% 30%, #5aa9e8, #12385c); }
body.ml #hud-target[data-kind="enemy"] .target-avatar { background:radial-gradient(circle at 35% 30%, #d55be8, #4a1257); }
body.ml .target-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
body.ml #hud-target .target-bar { position:relative; height:12px; border-radius:6px; }
body.ml .target-pct { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#fff; font:700 9px/1 ui-monospace,Consolas,monospace; text-shadow:0 0 2px #000,0 0 2px #000; }

/* ---- Can dieu khien: vien sang khi dang giu (kieu Jx2Cut) */
body.ml #stick-zone .stick-base, body.ml #stick .stick-base { transition:box-shadow .12s; }
body.ml #stick.down, body.ml #stick-zone.down #stick { box-shadow:0 0 0 2px rgba(255,236,170,.85), 0 0 18px 4px rgba(255,214,110,.55); border-radius:50%; }

/* ---- O to doi canh thanh mau (du lieu doi that) */
body.ml .ml-team-slots { display:flex; gap:4px; align-items:center; margin-left:6px; pointer-events:auto; }
body.ml .ml-team-slot { width:40px; height:40px; padding:0; border-radius:50%; border:1px solid rgba(var(--sk-accent-rgb),.7); background:rgba(0,0,0,.5); color:#f3f7f6;
  font:800 15px/1 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-team-slot.lead { border-color:#ffd35a; color:#ffd35a; }
body.ml .ml-team-add { color:rgba(255,255,255,.75); font-size:16px; border-style:dashed; }

/* man thap: hang menu len tren cung -> khung muc tieu xuong ngay duoi hang menu, canh phai theo hang menu */
@media (max-height: 420px) {
  body.ml #hud-target { left:auto; transform:none; top:calc(4px + var(--tb) + 18px + var(--st)); right:calc(max(118px, calc(122 * var(--q))) + 10px + var(--sr)); }
}
/* mobile_hud.js tao ten / thanh mau muc tieu bang id (#target-name, #target-bar, #target-fill) */
body.ml #target-name { display:block; overflow:hidden; color:#eafaf7; font:700 12px/1.25 "Be Vietnam Pro",system-ui,sans-serif; white-space:nowrap; text-overflow:ellipsis; }
body.ml #target-bar { position:relative; display:block; height:12px; overflow:hidden; border-radius:6px; background:rgba(255,255,255,.16); }
body.ml #target-bar[hidden] { display:none; }
body.ml #target-fill { display:block; height:100%; background:linear-gradient(180deg, #f0645a, #b3241c); }

/* ---- Lop ten tren dau (font he thong): duoi HUD, tren canvas game, khong nhan cham */
body.ml #ml-names { position:fixed; left:0; top:0; width:100vw; height:100vh; pointer-events:none; z-index:1; }

/* ---- Bang Tuy chon mobile (thay cua so KUiOptions PC): tab Am thanh / Hien thi / Khac, cong tac to, vung cham >= 40px */
body.ml #ml-opts { position:fixed; inset:0; z-index:6; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.45);
  padding:calc(6px + var(--st, 0px)) calc(8px + var(--sr, 0px)) calc(6px + var(--sb, 0px)) calc(8px + var(--sl, 0px)); }
body.ml #ml-opts[hidden] { display:none; }
body.ml .ml-opts-box { width:min(720px, 100%); max-height:100%; }
body.ml .ml-opts-box .ml-panel-head .ml-tabs { margin-left:6px; }
body.ml .ml-tab.on { box-shadow:inset 0 0 0 2px var(--sk-accent, #ffd35a); }
body.ml .ml-opts-body { flex:1; min-height:0; overflow:auto; padding:4px 12px 6px; }
body.ml .ml-opt-sec { margin:8px 0 4px; font:700 12px/1.2 "Be Vietnam Pro",system-ui,sans-serif; opacity:.8; }
body.ml .ml-opt-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px 10px; }
body.ml .ml-switch { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:44px; padding:0 10px; border-radius:10px;
  font:600 14px/1.2 "Be Vietnam Pro",system-ui,sans-serif; text-align:left; }
body.ml .ml-switch-track { flex:none; position:relative; width:46px; height:26px; border-radius:13px; background:rgba(255,255,255,.22); transition:background .15s; }
body.ml .ml-switch-knob { position:absolute; left:3px; top:3px; width:20px; height:20px; border-radius:50%; background:#fff; transition:left .15s; }
body.ml .ml-switch[aria-checked="true"] .ml-switch-track { background:#3fae6a; }
body.ml .ml-switch[aria-checked="true"] .ml-switch-knob { left:23px; }
body.ml .ml-opt-slider { display:grid; grid-template-columns:110px 1fr 40px; align-items:center; gap:10px; min-height:52px; font:600 14px "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-opt-slider input[type=range] { width:100%; height:40px; accent-color:var(--sk-accent, #ffd35a); }
body.ml .ml-opt-val { text-align:right; font:700 13px ui-monospace,Consolas,monospace; }
body.ml .ml-opt-btn { min-height:44px; padding:0 18px; border-radius:10px; font:700 14px "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-opt-seg { display:flex; flex-wrap:wrap; gap:6px; }
body.ml .ml-opt-hint { margin:6px 0 0; font:500 12px/1.35 "Be Vietnam Pro",system-ui,sans-serif; opacity:.85; }
body.ml .ml-opt-hint[hidden] { display:none; }
body.ml .ml-opts-foot { flex:none; display:flex; justify-content:flex-end; gap:8px; padding:6px 10px 8px; }
body.ml .ml-opt-foot-btn { min-width:96px; min-height:44px; padding:0 14px; border-radius:22px; font:700 14px "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-opt-def { margin-right:auto; }
body.ml .ml-opt-ok { background:linear-gradient(180deg, #e5b64a, #b07d17); color:#1b1306; }
@media (max-height: 420px) {
  body.ml .ml-opts-body { padding-top:2px; }
  body.ml .ml-opt-sec { margin:4px 0 2px; }
  body.ml .ml-opts-foot { padding:4px 10px 6px; }
}

/* o ky nang trong mo di nhu Jx2Cut (van cham duoc de gan) */
body.ml #actions .slot.empty { opacity:.62; background:rgba(0,0,0,.32); border:1px dashed rgba(255,255,255,.55); }
body.ml #actions .slot.empty:active { opacity:.8; }

/* ---- Cum ky nang xep cung quanh nut danh (theo Jx2Cut; ?mskill=grid kieu cu): nut danh sat goc, 2 cung o tron */
body.ml.ml-arc { --r1:max(calc(var(--ca) / 2 + var(--cg) + var(--cs) / 2), calc(var(--cu) * 1.932)); --r2:calc(var(--r1) + var(--cu)); }
body.ml.ml-arc #actions { right:calc(var(--cm) + var(--sr)); bottom:calc(var(--cm) + var(--sb)); }
body.ml.ml-arc #actions .slot { border-radius:50%; }
body.ml.ml-arc #ml-chatstrip { --chat-r:calc(var(--cm) + var(--sr) + var(--ca) / 2 + var(--r2) + var(--cu) * 3 + var(--cs) / 2 + 8px); }

/* chan dung nhan vat (anh PC) trong o avatar */
body.ml #ml-avatar.has-portrait { background-size:cover; background-position:center; background-repeat:no-repeat; }
body.ml #ml-avatar.has-portrait > svg { display:none; }

/* ---- HUD canvas thuong truc cua PC lam lai bang HTML (web_hudx): o sat khi, chong nghien, dong tin chay, tin he thong */
body.ml .ml-pk { align-self:flex-start; margin-left:4px; padding:3px 7px; border-radius:10px; border:1px solid #ff8a7a; background:rgba(120,18,12,.78); color:#ffe1db;
  font:800 12px/1.2 "Be Vietnam Pro",system-ui,sans-serif; pointer-events:auto; }
body.ml .ml-pk[hidden], body.ml .ml-anti[hidden], body.ml #ml-news[hidden], body.ml #ml-sysmsg[hidden] { display:none; }
body.ml .ml-anti { align-self:flex-start; margin:6px 0 0 4px; width:14px; height:14px; border-radius:50%; border:2px solid rgba(255,255,255,.8); background:#3fae6a; pointer-events:auto; }
body.ml .ml-anti[data-state="1"] { background:#e7c23a; }
body.ml .ml-anti[data-state="2"] { background:#e0453b; }
body.ml #ml-news { position:absolute; left:50%; top:calc(2px + var(--st)); transform:translateX(-50%); width:min(46vw, 420px); overflow:hidden; white-space:nowrap;
  padding:2px 0; border-radius:8px; background:rgba(0,0,0,.45); color:#ffe9a8; font:600 12px/1.3 "Be Vietnam Pro",system-ui,sans-serif; pointer-events:none; }
body.ml .ml-news-text { display:inline-block; padding-left:100%; animation:ml-news-run 18s linear infinite; }
@keyframes ml-news-run { from { transform:translateX(0); } to { transform:translateX(-100%); } }
body.ml #ml-sysmsg { position:absolute; left:calc(4px + var(--sl)); bottom:calc(200px + var(--sb)); width:44px; height:44px; padding:10px; border-radius:50%;
  animation:ml-sys-pulse 1.4s ease-in-out infinite; }
body.ml .ml-sysmsg-count { position:absolute; right:-4px; top:-4px; min-width:18px; height:18px; padding:0 4px; border-radius:9px; background:#e0453b; color:#fff;
  font:800 11px/18px system-ui,sans-serif; text-align:center; }
body.ml .ml-sysmsg-count:empty { display:none; }
body.ml .ml-sysmsg-tip { position:absolute; left:50px; top:50%; transform:translateY(-50%); max-width:46vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  padding:3px 8px; border-radius:8px; background:rgba(0,0,0,.6); color:#fff; font:600 12px "Be Vietnam Pro",system-ui,sans-serif; pointer-events:none; }
body.ml .ml-sysmsg-tip:empty { display:none; }
@keyframes ml-sys-pulse { 50% { box-shadow:0 0 0 4px rgba(255,211,90,.55); } }
body.ml #ml-chatstrip #ml-news { left:0; right:0; top:auto; bottom:calc(100% + 4px); transform:none; width:auto; }

/* Hop thoai chung (KUiInformation Co/Khong, KUiGetString nhap chuoi/so, KUiFollowInfo2 / hoi sinh): hop gon, nut >= 46px */
body.ml #npc-dialog:is([data-kind="3"], [data-kind="4"], [data-kind="5"], [data-kind="7"]) #npc-box { width:min(92vw, 520px); }
/* menu He thong (ESC): tieu de giua, nut 1 cot, nut cuoi (Huy / Tro lai) tach nhe */
body.ml #npc-dialog[data-kind="7"] #npc-text { flex:none; min-height:0; text-align:center; font-size:16px; overflow:visible; }
body.ml #npc-dialog[data-kind="7"] #npc-answers { grid-template-columns:repeat(2, minmax(0, 1fr)); max-height:none; }
body.ml #npc-dialog[data-kind="7"] .npc-answer:last-child { grid-column:1 / -1; opacity:.9; }
body.ml #npc-dialog:is([data-kind="3"], [data-kind="4"], [data-kind="5"]) #npc-text { min-height:0; max-height:34vh; text-align:center; }
.npc-input-row { grid-column:1 / -1; display:flex; }
.npc-input { flex:1 1 auto; min-width:0; min-height:46px; padding:6px 12px; border:1px solid rgba(var(--sk-accent-rgb),.55); border-radius:6px; background:rgba(0,0,0,.35); color:var(--sk-ink); font:600 16px/1.3 "Be Vietnam Pro",system-ui,"Segoe UI",sans-serif; text-align:center; }
.npc-input:focus { outline:2px solid var(--sk-accent); outline-offset:1px; }
.npc-answer:disabled { opacity:.45; cursor:default; }

/* Thanh tien do thu hai (KUiGatherProgress) bang HTML: giua man, duoi nhan vat; muc "Thanh tiến độ" cua Sua bo cuc */
body.ml #ml-gather { position:fixed; left:50%; top:62%; transform:translateX(-50%); z-index:2; width:min(280px, 40vw); pointer-events:none; text-align:center; }
body.ml #ml-gather[hidden] { display:none; }
body.ml .ml-gather-text { display:block; margin-bottom:3px; font:700 12px/1.2 "Be Vietnam Pro",system-ui,sans-serif; color:#f3e7c4; text-shadow:0 1px 2px #000; }
body.ml .ml-gather-track { height:8px; border-radius:4px; background:rgba(0,0,0,.55); border:1px solid rgba(var(--sk-accent-rgb),.55); overflow:hidden; }
body.ml .ml-gather-fill { height:100%; width:0; background:linear-gradient(90deg, #b07d17, #e5b64a); }
body.le-editing #ml-gather { display:block !important; }

/* ---- Huong dan hang ngay mobile (thay KUiDailyGuide PC): tab cuon ngang, the hoat dong, lich Bao danh; nut >= 44px */
body.ml #ml-daily { position:fixed; inset:0; z-index:6; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.45);
  padding:calc(6px + var(--st, 0px)) calc(8px + var(--sr, 0px)) calc(6px + var(--sb, 0px)) calc(8px + var(--sl, 0px)); }
body.ml #ml-daily[hidden] { display:none; }
body.ml .ml-daily-box { width:min(820px, 100%); height:100%; max-height:100%; }
body.ml .ml-daily-tabs { flex:none; display:flex; gap:6px; overflow-x:auto; padding:0 10px 6px; scrollbar-width:none; }
body.ml .ml-daily-tabs .ml-tab { flex:none; min-height:40px; padding:0 14px; white-space:nowrap; }
body.ml .ml-daily-body { flex:1; min-height:0; overflow:auto; padding:2px 10px 6px; display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:8px; align-content:start; -webkit-overflow-scrolling:touch; }
body.ml .ml-daily-card { display:flex; flex-direction:column; gap:4px; padding:8px 10px; border:1px solid rgba(var(--sk-accent-rgb),.3); border-radius:10px; background:rgba(var(--sk-panel-rgb),.6); }
body.ml .ml-daily-top { display:flex; align-items:baseline; gap:8px; justify-content:space-between; }
body.ml .ml-daily-name { margin:0; font:800 15px/1.25 "Be Vietnam Pro",system-ui,sans-serif; color:var(--sk-accent-text); }
body.ml .ml-daily-open { font:600 12px/1.3 "Be Vietnam Pro",system-ui,sans-serif; opacity:.85; text-align:right; }
body.ml .ml-daily-meta { display:flex; flex-wrap:wrap; gap:4px 10px; font:600 12px/1.3 "Be Vietnam Pro",system-ui,sans-serif; color:var(--sk-soft-text); }
body.ml .ml-daily-simple, body.ml .ml-daily-details { margin:0; font:500 13px/1.4 "Be Vietnam Pro",system-ui,sans-serif; white-space:pre-line; }
body.ml .ml-daily-details { padding:6px 8px; border-radius:6px; background:rgba(0,0,0,.25); }
body.ml .ml-daily-btns { display:flex; gap:6px; margin-top:2px; }
body.ml .ml-daily-btn { min-height:44px; min-width:88px; padding:0 14px; border-radius:8px; font:700 14px "Be Vietnam Pro",system-ui,sans-serif; display:inline-flex; align-items:center; justify-content:center; text-decoration:none; color:inherit; border:1px solid rgba(var(--sk-accent-rgb),.45); background:linear-gradient(180deg,var(--sk-bg-6),var(--sk-bg-5)); }
body.ml .ml-daily-go { background:linear-gradient(180deg, #e5b64a, #b07d17); color:#1b1306; }
body.ml .ml-daily-empty, body.ml .ml-daily-note, body.ml .ml-daily-calhead { grid-column:1 / -1; margin:6px 0; font:600 13px/1.4 "Be Vietnam Pro",system-ui,sans-serif; opacity:.9; }
body.ml .ml-daily-cal { grid-column:1 / -1; display:grid; grid-template-columns:repeat(7, minmax(40px, 1fr)); gap:4px; max-width:520px; }
body.ml .ml-daily-wd { text-align:center; font:700 12px "Be Vietnam Pro",system-ui,sans-serif; opacity:.8; }
body.ml .ml-daily-day { min-height:40px; border-radius:8px; font:700 14px "Be Vietnam Pro",system-ui,sans-serif; border:1px solid rgba(var(--sk-accent-rgb),.25); background:rgba(var(--sk-panel-2-rgb),.7); color:inherit; }
body.ml .ml-daily-day.empty { border:0; background:none; }
body.ml .ml-daily-day.signed { background:linear-gradient(180deg, #e5b64a, #b07d17); color:#1b1306; }
body.ml .ml-daily-day.missed { opacity:.45; }
body.ml .ml-daily-day.today { box-shadow:inset 0 0 0 2px var(--sk-accent); }
body.ml .ml-daily-foot { flex:none; display:flex; justify-content:flex-end; padding:4px 10px 8px; }
body.ml .ml-daily-auto { min-height:44px; }

/* ---- Xem trang bi nguoi choi khac (thay KUiParadeItem): cot trai thong tin + o vat, cot phai chi tiet; o >= 44px */
body.ml #parade-panel .pd-box { width:min(900px, 96vw); }
body.ml #parade-panel .pd-body { display:grid; grid-template-columns:minmax(0, 1.1fr) minmax(0, 1fr); gap:10px; min-height:0; }
body.ml #parade-panel .pd-left { display:flex; flex-direction:column; gap:8px; min-height:0; overflow:auto; }
body.ml #parade-panel .pd-info { display:grid; grid-template-columns:auto 1fr; gap:2px 10px; margin:0; font:600 13px/1.35 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml #parade-panel .pd-info dt { opacity:.75; }
body.ml #parade-panel .pd-info dd { margin:0; color:var(--sk-accent-text); }
body.ml #parade-panel .pd-views { display:flex; flex-wrap:wrap; gap:6px; }
body.ml #parade-panel .pd-views button { min-height:44px; }
body.ml #parade-panel .pd-grid { grid-template-columns:repeat(auto-fill, minmax(58px, 1fr)); }
body.ml #parade-panel .pd-grid .eq-cell { min-height:58px; min-width:44px; background-size:70% auto; background-position:center 40%; background-repeat:no-repeat; }
body.ml #parade-panel .pd-side { min-height:0; overflow:auto; }
body.ml #parade-panel .pd-plus { position:absolute; top:1px; right:3px; font:800 11px/1 "Be Vietnam Pro",system-ui,sans-serif; color:#ffd35a; text-shadow:0 1px 2px #000; }

/* ---- Tin he thong mobile: the truot vao tren giua (khong che cum ky nang / nut danh), danh sach tin cua nut "!",
   hop xac nhan cua tin (Dong y / Cu tuyet / Phot lo) hien thanh the tren giua thay vi hop giua man */
body.ml #ml-systoast { position:fixed; left:50%; top:calc(8px + var(--st, 0px)); transform:translate(-50%, 0); z-index:7; display:flex; align-items:center; gap:8px;
  width:min(560px, 62vw); padding:6px 6px 6px 12px; border:1px solid rgba(var(--sk-accent-rgb),.6); border-radius:12px; background:rgba(var(--sk-panel-rgb),.94);
  box-shadow:0 8px 22px rgba(0,0,0,.45); color:var(--sk-ink); font:600 13px/1.35 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml #ml-systoast[hidden] { display:none; }
body.ml #ml-systoast.in { animation:ml-toast-in .25s ease-out; }
@keyframes ml-toast-in { from { transform:translate(-50%, -120%); opacity:0; } to { transform:translate(-50%, 0); opacity:1; } }
body.ml .ml-systoast-text { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
body.ml .ml-systoast-btn { flex:none; min-width:64px; min-height:44px; padding:0 12px; border-radius:9px; border:1px solid rgba(var(--sk-accent-rgb),.45);
  background:linear-gradient(180deg,var(--sk-bg-6),var(--sk-bg-5)); color:var(--sk-ink); font:700 14px "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-systoast-open { background:linear-gradient(180deg, #e5b64a, #b07d17); color:#1b1306; }
body.ml .ml-systoast-x { flex:none; width:44px; height:44px; padding:12px; }
body.ml #ml-syslist { position:fixed; left:50%; top:calc(8px + var(--st, 0px)); transform:translateX(-50%); z-index:7; width:min(620px, 70vw); max-height:72vh;
  display:flex; flex-direction:column; border:1px solid rgba(var(--sk-accent-rgb),.6); border-radius:12px; background:rgba(var(--sk-panel-rgb),.96); box-shadow:0 10px 26px rgba(0,0,0,.5); }
body.ml #ml-syslist[hidden] { display:none; }
body.ml .ml-syslist-head { display:flex; align-items:center; justify-content:space-between; padding:4px 4px 4px 12px; }
body.ml .ml-syslist-title { margin:0; font:800 15px "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-syslist-close { width:44px; height:44px; padding:12px; }
body.ml .ml-syslist-body { overflow:auto; padding:0 8px 8px; display:flex; flex-direction:column; gap:6px; }
body.ml .ml-syslist-row { display:flex; align-items:center; gap:6px; padding:4px 4px 4px 8px; border-radius:9px; background:rgba(0,0,0,.22); }
body.ml .ml-syslist-text { flex:1; min-width:0; font:600 13px/1.35 "Be Vietnam Pro",system-ui,sans-serif; }
body.ml .ml-syslist-empty { margin:6px 4px; font:600 13px "Be Vietnam Pro",system-ui,sans-serif; opacity:.85; }
/* hop xac nhan cua tin he thong: the tren giua, khong nen toi, khong chan phan con lai cua man */
body.ml #npc-dialog.npc-card { align-items:flex-start; background:none; pointer-events:none; padding-top:calc(8px + var(--st, 0px)); }
body.ml #npc-dialog.npc-card #npc-box { pointer-events:auto; width:min(560px, 62vw); max-height:60vh; padding:8px 10px; box-shadow:0 8px 22px rgba(0,0,0,.5); animation:ml-card-in .25s ease-out; }
body.ml #npc-dialog.npc-card #npc-text { min-height:0; text-align:left; font-size:14px; }
body.ml #npc-dialog.npc-card #npc-answers { grid-template-columns:repeat(3, minmax(0, 1fr)); }
@keyframes ml-card-in { from { transform:translateY(-40%); opacity:0; } to { transform:none; opacity:1; } }
body.ml #ml-chatstrip #ml-sysmsg { left:auto; right:calc(100% + 6px); bottom:0; pointer-events:auto; }
body.ml #ml-chatstrip #ml-sysmsg .ml-sysmsg-tip { left:auto; right:auto; bottom:calc(100% + 6px); top:auto; transform:none; }
/* the tin tren giua da hien chu tin: bo chu goi y canh nut "!" (de len can di chuyen); nut ghi "!" nhu bieu tuong PC */
body.ml #ml-chatstrip #ml-sysmsg .ml-sysmsg-tip { display:none; }
body.ml #ml-sysmsg svg { display:none; }
body.ml #ml-sysmsg::before { content:"!"; display:block; font:900 22px/24px "Be Vietnam Pro",system-ui,sans-serif; color:#ffd35a; text-align:center; }

/* ---- Khung giao dich mobile gon: khong phu nen, toi da 70% rong / 85% cao, cao vua noi dung; trai = ban dua / doi phuong
   dua / tien / khoa, phai = tui cuon; thu gon con dau + nut */
body.ml #trade-panel { inset:auto; left:50%; top:calc(6px + var(--st, 0px)); transform:translateX(-50%); width:min(70vw, 760px); max-height:85vh; padding:0; background:none; align-items:flex-start; }
body.ml #trade-box { width:100%; max-height:85vh; box-shadow:0 10px 28px rgba(0,0,0,.5); }
body.ml #trade-box .sk-body { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); align-items:start; min-height:0; overflow:hidden; }
body.ml #trade-box .tr-left, body.ml #trade-box .tr-right { max-height:calc(85vh - 120px); }
body.ml #trade-box .tr-bag { grid-template-columns:repeat(auto-fill, minmax(44px, 1fr)); grid-auto-rows:44px; }
body.ml #trade-box .tr-bag .sh-cell, body.ml #trade-box .tr-grid .sh-cell { min-width:44px; min-height:44px; }
body.ml #trade-box .tr-purse { flex:none; font:700 13px/1.3 "Be Vietnam Pro",system-ui,sans-serif; color:#ffd35a; }
body.ml #trade-box .tr-locks { flex:none; display:flex; flex-wrap:wrap; gap:6px; }
body.ml #trade-box .tr-lock { padding:3px 8px; border-radius:999px; background:rgba(0,0,0,.35); font:700 12px "Be Vietnam Pro",system-ui,sans-serif; color:var(--sk-soft-text); }
body.ml #trade-box .tr-lock.on { background:rgba(46,160,90,.35); color:#bff5c9; box-shadow:inset 0 0 0 1px rgba(120,230,150,.6); }
body.ml #trade-box .tr-fold { flex:none; width:auto; min-height:44px; padding:0 12px; margin-left:auto; }
body.ml #trade-panel.tr-folded #trade-box .sk-body { display:none; }
body.ml #trade-panel.tr-folded { width:min(52vw, 520px); }

/* ---- Hop thoai NPC / hop thoai chung luon nam tren cac bang (tui, trang bi...) */
body.ml #npc-dialog { z-index:8; }
body.ml.dlg-open #bag-panel { filter:brightness(.55); }
/* chuyen vat trong tui: o dich nhap nhay, bong vat khi keo */
body.ml #bag-grid.bag-moving .bag-cell { outline:2px dashed rgba(255,211,90,.55); outline-offset:-3px; }
.bag-drag-ghost { position:fixed; z-index:9; width:44px; height:44px; border-radius:6px; background:rgba(0,0,0,.5) center / contain no-repeat; pointer-events:none; box-shadow:0 0 0 2px #ffd35a; }
.bag-drag-ghost[hidden] { display:none; }
